diff --git a/.github/workflows/fireperf-e2e.yml b/.github/workflows/fireperf-e2e.yml new file mode 100644 index 00000000000..c754b7c718d --- /dev/null +++ b/.github/workflows/fireperf-e2e.yml @@ -0,0 +1,107 @@ +name: FirePerf E2E Tests + +on: + schedule: + - cron: 4 */4 * * * # every 4 hours at 04 minutes past the hour + workflow_dispatch: # allow triggering the workflow manually + +concurrency: + group: ${{ github.workflow }} + +env: + PERF_E2E_GOOGLE_SERVICES: ${{ secrets.PERF_E2E_GOOGLE_SERVICES }} + FTL_RESULTS_BUCKET: fireescape + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + environment: [ prod, autopush ] + steps: + - name: Checkout firebase-android-sdk + uses: actions/checkout@v3 + - name: Checkout firebase-android-buildtools + uses: actions/checkout@v3 + with: + repository: FirebasePrivate/firebase-android-buildtools + token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} + path: firebase-android-buildtools + - 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 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Set up fireci + run: pip3 install -e ci/fireci + - uses: google-github-actions/auth@v0 + with: + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - uses: google-github-actions/setup-gcloud@v0 + - name: Add google-services.json + run: echo $PERF_E2E_GOOGLE_SERVICES | base64 -d > google-services.json + - name: Run fireperf end-to-end tests + run: | + fireci fireperf_e2e_test \ + --plugin_repo_dir=firebase-android-buildtools \ + --target_environment=${{ matrix.environment }} + - name: Notify developers upon failures + if: ${{ failure() }} + uses: actions/github-script@v6 + with: + script: | + const owner = context.repo.owner; + const repo = context.repo.repo; + const commit = context.sha; + const run = context.runId; + const url = `https://github.com/${owner}/${repo}/actions/runs/${run}`; + + const datetime = (new Date()).toLocaleString('en-US', { + timeZone: 'America/Los_Angeles', + dateStyle: 'medium', + timeStyle: 'long', + }); + + const text = + `Failed on commit ${commit} at ${datetime}. + + ${url}`; + + const { data: issues } = await github.rest.issues.listForRepo({ + owner: owner, + repo: repo, + state: 'open', + labels: 'fireperf-e2e-tests' + }); + + if (issues.length) { + github.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: issues[0].number, + body: text, + }); + } else { + github.rest.issues.create({ + owner: owner, + repo: repo, + title: 'FirePerf E2E Test Failures', + body: text, + labels: ['fireperf-e2e-tests'], + assignees: ['jeremyjiang-dev', 'leotianlizhan', 'raymondlam', 'visumickey'] + }); + } diff --git a/ci/fireci/fireciplugins/fireperf.py b/ci/fireci/fireciplugins/fireperf.py index a073c922efa..8e336e5390f 100644 --- a/ci/fireci/fireciplugins/fireperf.py +++ b/ci/fireci/fireciplugins/fireperf.py @@ -13,7 +13,6 @@ # limitations under the License. import click -import contextlib import logging import os import pathlib @@ -38,7 +37,7 @@ ) @ci_command() def fireperf_e2e_test(target_environment, plugin_repo_dir): - """Run Firebase Performance end to end test.""" + """Run Firebase Performance end-to-end test.""" _logger.info('Building fireperf plugin ...') with chdir(plugin_repo_dir):