Skip to content

Commit 8befeae

Browse files
committed
Notify developers upon failures
1 parent 9614d2d commit 8befeae

File tree

1 file changed

+54
-41
lines changed

1 file changed

+54
-41
lines changed

.github/workflows/fireperf-e2e.yml

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: FirePerf E2E Tests
22

33
on:
4+
pull_request:
45
schedule:
56
- cron: 4 */4 * * * # every 4 hours at 04 minutes past the hour
7+
workflow_dispatch: # allow triggering the workflow manually
68

79
concurrency:
810
group: ${{ github.workflow }}
@@ -12,8 +14,11 @@ env:
1214
FTL_RESULTS_BUCKET: fireescape
1315

1416
jobs:
15-
prod:
17+
test:
1618
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
environment: [ prod, autopush ]
1722
steps:
1823
- name: Checkout firebase-android-sdk
1924
uses: actions/checkout@v3
@@ -51,45 +56,53 @@ jobs:
5156
- name: Add google-services.json
5257
run: echo $PERF_E2E_GOOGLE_SERVICES | base64 -d > google-services.json
5358
- 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
7459
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
8966
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

Comments
 (0)