Skip to content

Commit 5b0aceb

Browse files
committed
Notify developers upon failures
1 parent 9614d2d commit 5b0aceb

File tree

1 file changed

+53
-41
lines changed

1 file changed

+53
-41
lines changed

.github/workflows/fireperf-e2e.yml

Lines changed: 53 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: FirePerf E2E Tests
33
on:
44
schedule:
55
- cron: 4 */4 * * * # every 4 hours at 04 minutes past the hour
6+
workflow_dispatch: # allow triggering the workflow manually
67

78
concurrency:
89
group: ${{ github.workflow }}
@@ -12,8 +13,11 @@ env:
1213
FTL_RESULTS_BUCKET: fireescape
1314

1415
jobs:
15-
prod:
16+
test:
1617
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
enviroment: [ prod, autopush ]
1721
steps:
1822
- name: Checkout firebase-android-sdk
1923
uses: actions/checkout@v3
@@ -51,45 +55,53 @@ jobs:
5155
- name: Add google-services.json
5256
run: echo $PERF_E2E_GOOGLE_SERVICES | base64 -d > google-services.json
5357
- 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
7458
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
59+
fireci fireperf_e2e_test \
60+
--plugin_repo_dir=firebase-android-buildtools \
61+
--target_environment=${{ matrix.environment }}
62+
- name: Notify developers upon failures
63+
if: ${{ failure() }}
64+
uses: actions/github-script@v6
8965
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
66+
script: |
67+
const owner = context.repo.owner;
68+
const repo = context.repo.repo;
69+
const commit = context.sha;
70+
const run = context.runId;
71+
const url = `https://github.com/${owner}/${repo}/actions/runs/${run}`;
72+
73+
const datetime = (new Date()).toLocaleString('en-US', {
74+
timeZone: 'America/Los_Angeles',
75+
dateStyle: 'medium',
76+
timeStyle: 'long',
77+
});
78+
79+
const text =
80+
`Failed on commit ${commit} at ${datetime}.
81+
82+
${url}`;
83+
84+
const { data: issues } = await github.rest.issues.listForRepo({
85+
owner: owner,
86+
repo: repo,
87+
state: 'open',
88+
labels: 'fireperf-e2e-tests'
89+
});
90+
91+
if (issues.length) {
92+
github.rest.issues.createComment({
93+
owner: owner,
94+
repo: repo,
95+
issue_number: issues[0].number,
96+
body: text,
97+
});
98+
} else {
99+
github.rest.issues.create({
100+
owner: owner,
101+
repo: repo,
102+
title: 'FirePerf E2E Test Failures',
103+
body: text,
104+
labels: ['fireperf-e2e-tests'],
105+
assignees: ['jeremyjiang-dev', 'leotianlizhan', 'visumickey']
106+
});
107+
}

0 commit comments

Comments
 (0)