|
1 | 1 | name: FirePerf E2E Tests
|
2 | 2 |
|
3 | 3 | on:
|
| 4 | + pull_request: |
4 | 5 | schedule:
|
5 | 6 | - cron: 4 */4 * * * # every 4 hours at 04 minutes past the hour
|
| 7 | + workflow_dispatch: # allow triggering the workflow manually |
6 | 8 |
|
7 | 9 | concurrency:
|
8 | 10 | group: ${{ github.workflow }}
|
|
12 | 14 | FTL_RESULTS_BUCKET: fireescape
|
13 | 15 |
|
14 | 16 | jobs:
|
15 |
| - prod: |
| 17 | + test: |
16 | 18 | runs-on: ubuntu-latest
|
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + environment: [ prod, autopush ] |
17 | 22 | steps:
|
18 | 23 | - name: Checkout firebase-android-sdk
|
19 | 24 | uses: actions/checkout@v3
|
@@ -51,45 +56,53 @@ jobs:
|
51 | 56 | - name: Add google-services.json
|
52 | 57 | run: echo $PERF_E2E_GOOGLE_SERVICES | base64 -d > google-services.json
|
53 | 58 | - name: Run fireperf end-to-end tests
|
54 |
| - run: fireci fireperf_e2e_test --plugin_repo_dir=firebase-android-buildtools --target_environment=prod |
55 |
| - |
56 |
| - autopush: |
57 |
| - runs-on: ubuntu-latest |
58 |
| - steps: |
59 |
| - - name: Checkout firebase-android-sdk |
60 |
| - uses: actions/checkout@v3 |
61 |
| - - name: Checkout firebase-android-buildtools |
62 |
| - uses: actions/checkout@v3 |
63 |
| - with: |
64 |
| - repository: FirebasePrivate/firebase-android-buildtools |
65 |
| - token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} |
66 |
| - path: firebase-android-buildtools |
67 |
| - - name: Set up JDK 11 |
68 |
| - uses: actions/setup-java@v2 |
69 |
| - with: |
70 |
| - java-version: 11 |
71 |
| - distribution: temurin |
72 |
| - cache: gradle |
73 |
| - - name: Set up NDK 21.4.7075529 |
74 | 59 | run: |
|
75 |
| - ANDROID_ROOT=/usr/local/lib/android |
76 |
| - ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk |
77 |
| - ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle |
78 |
| - SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager |
79 |
| - echo "y" | $SDKMANAGER "ndk;21.4.7075529" |
80 |
| - ln -sfn ${ANDROID_SDK_ROOT}/ndk/21.4.7075529 ${ANDROID_NDK_ROOT} |
81 |
| - echo "ANDROID_NDK_HOME=${ANDROID_NDK_ROOT}" >> $GITHUB_ENV |
82 |
| - - name: Set up Python 3.10 |
83 |
| - uses: actions/setup-python@v4 |
84 |
| - with: |
85 |
| - python-version: '3.10' |
86 |
| - - name: Set up fireci |
87 |
| - run: pip3 install -e ci/fireci |
88 |
| - - uses: google-github-actions/auth@v0 |
| 60 | + fireci fireperf_e2e_test \ |
| 61 | + --plugin_repo_dir=firebase-android-buildtools \ |
| 62 | + --target_environment=${{ matrix.environment }} |
| 63 | + - name: Notify developers upon failures |
| 64 | + if: ${{ failure() }} |
| 65 | + uses: actions/github-script@v6 |
89 | 66 | with:
|
90 |
| - credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} |
91 |
| - - uses: google-github-actions/setup-gcloud@v0 |
92 |
| - - name: Add google-services.json |
93 |
| - run: echo $PERF_E2E_GOOGLE_SERVICES | base64 -d > google-services.json |
94 |
| - - name: Run fireperf end-to-end tests |
95 |
| - run: fireci fireperf_e2e_test --plugin_repo_dir=firebase-android-buildtools --target_environment=autopush |
| 67 | + script: | |
| 68 | + const owner = context.repo.owner; |
| 69 | + const repo = context.repo.repo; |
| 70 | + const commit = context.sha; |
| 71 | + const run = context.runId; |
| 72 | + const url = `https://github.com/${owner}/${repo}/actions/runs/${run}`; |
| 73 | +
|
| 74 | + const datetime = (new Date()).toLocaleString('en-US', { |
| 75 | + timeZone: 'America/Los_Angeles', |
| 76 | + dateStyle: 'medium', |
| 77 | + timeStyle: 'long', |
| 78 | + }); |
| 79 | +
|
| 80 | + const text = |
| 81 | + `Failed on commit ${commit} at ${datetime}. |
| 82 | +
|
| 83 | + ${url}`; |
| 84 | +
|
| 85 | + const { data: issues } = await github.rest.issues.listForRepo({ |
| 86 | + owner: owner, |
| 87 | + repo: repo, |
| 88 | + state: 'open', |
| 89 | + labels: 'fireperf-e2e-tests' |
| 90 | + }); |
| 91 | +
|
| 92 | + if (issues.length) { |
| 93 | + github.rest.issues.createComment({ |
| 94 | + owner: owner, |
| 95 | + repo: repo, |
| 96 | + issue_number: issues[0].number, |
| 97 | + body: text, |
| 98 | + }); |
| 99 | + } else { |
| 100 | + github.rest.issues.create({ |
| 101 | + owner: owner, |
| 102 | + repo: repo, |
| 103 | + title: 'FirePerf E2E Test Failures', |
| 104 | + body: text, |
| 105 | + labels: ['fireperf-e2e-tests'], |
| 106 | + assignees: ['jeremyjiang-dev', 'leotianlizhan', 'visumickey'] |
| 107 | + }); |
| 108 | + } |
0 commit comments