Skip to content

Commit 8c6788e

Browse files
authored
Add workflow definition for fireperf end-to-end tests (#3969)
1 parent 089c828 commit 8c6788e

File tree

2 files changed

+108
-2
lines changed

2 files changed

+108
-2
lines changed

.github/workflows/fireperf-e2e.yml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: FirePerf E2E Tests
2+
3+
on:
4+
schedule:
5+
- cron: 4 */4 * * * # every 4 hours at 04 minutes past the hour
6+
workflow_dispatch: # allow triggering the workflow manually
7+
8+
concurrency:
9+
group: ${{ github.workflow }}
10+
11+
env:
12+
PERF_E2E_GOOGLE_SERVICES: ${{ secrets.PERF_E2E_GOOGLE_SERVICES }}
13+
FTL_RESULTS_BUCKET: fireescape
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
environment: [ prod, autopush ]
21+
steps:
22+
- name: Checkout firebase-android-sdk
23+
uses: actions/checkout@v3
24+
- name: Checkout firebase-android-buildtools
25+
uses: actions/checkout@v3
26+
with:
27+
repository: FirebasePrivate/firebase-android-buildtools
28+
token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }}
29+
path: firebase-android-buildtools
30+
- name: Set up JDK 11
31+
uses: actions/setup-java@v2
32+
with:
33+
java-version: 11
34+
distribution: temurin
35+
cache: gradle
36+
- name: Set up NDK 21.4.7075529
37+
run: |
38+
ANDROID_ROOT=/usr/local/lib/android
39+
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
40+
ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle
41+
SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
42+
echo "y" | $SDKMANAGER "ndk;21.4.7075529"
43+
ln -sfn ${ANDROID_SDK_ROOT}/ndk/21.4.7075529 ${ANDROID_NDK_ROOT}
44+
echo "ANDROID_NDK_HOME=${ANDROID_NDK_ROOT}" >> $GITHUB_ENV
45+
- name: Set up Python 3.10
46+
uses: actions/setup-python@v4
47+
with:
48+
python-version: '3.10'
49+
- name: Set up fireci
50+
run: pip3 install -e ci/fireci
51+
- uses: google-github-actions/auth@v0
52+
with:
53+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}
54+
- uses: google-github-actions/setup-gcloud@v0
55+
- name: Add google-services.json
56+
run: echo $PERF_E2E_GOOGLE_SERVICES | base64 -d > google-services.json
57+
- name: Run fireperf end-to-end tests
58+
run: |
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
65+
with:
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', 'raymondlam', 'visumickey']
106+
});
107+
}

ci/fireci/fireciplugins/fireperf.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import click
16-
import contextlib
1716
import logging
1817
import os
1918
import pathlib
@@ -38,7 +37,7 @@
3837
)
3938
@ci_command()
4039
def fireperf_e2e_test(target_environment, plugin_repo_dir):
41-
"""Run Firebase Performance end to end test."""
40+
"""Run Firebase Performance end-to-end test."""
4241

4342
_logger.info('Building fireperf plugin ...')
4443
with chdir(plugin_repo_dir):

0 commit comments

Comments
 (0)