Skip to content

Add workflow definition for smoke tests #3960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Aug 4, 2022
Merged
59 changes: 59 additions & 0 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Smoke Tests

on: [ pull_request ]

jobs:
smoke-tests:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth adding a check to see if secrets are going to be available, similar to:

# only run on post submit or PRs not originating from forks.
if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The smoke tests were enabled only for presubmit on Prow, therefore it is set to trigger only on pull_request here, hence only github.event.pull_request.head.repo.full_name == github.repository.

if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: true
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
cache: gradle
- name: Set up NDK 21.4.7075529
run: |
ANDROID_ROOT=/usr/local/lib/android
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle
SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
echo "y" | $SDKMANAGER "ndk;21.4.7075529"
ln -sfn ${ANDROID_SDK_ROOT}/ndk/21.4.7075529 ${ANDROID_NDK_ROOT}
echo "ANDROID_NDK_HOME=${ANDROID_NDK_ROOT}" >> $GITHUB_ENV
- uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v0

# TODO(yifany): make it a fireci plugin and remove the separately distributed jar file
- name: Download smoke tests runner
run: |
SMOKE_TESTS_RUNNER_URL="https://storage.googleapis.com/android-ci/smoke-tests-runner.jar"
curl ${SMOKE_TESTS_RUNNER_URL} --output runner.jar

# TODO(yifany): remove hardcoded reference to /smoke-tests-google-services from the runner
- name: Add google-services.json
env:
SMOKE_TESTS_GOOGLE_SERVICES: ${{ secrets.SMOKE_TESTS_GOOGLE_SERVICES }}
run: |
echo $SMOKE_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json
sudo mkdir /smoke-tests-google-services
sudo mv google-services.json /smoke-tests-google-services

# TODO(yifany): remove hardcoded reference to Prow environment variables from the runner
- name: Run smoke tests
env:
FIREBASE_CI: 1
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: firebase-android-sdk
PULL_NUMBER: ${{ github.event.pull_request.number }}
JOB_NAME: smoke-tests
BUILD_ID: ${{ github.run_id }}
ARTIFACTS: ${{ runner.temp }}
run: java -jar runner.jar smoke-tests/runner.config