Skip to content

Commit 6620ec5

Browse files
authored
Merge 55d996b into c6cc8c5
2 parents c6cc8c5 + 55d996b commit 6620ec5

File tree

2 files changed

+109
-2
lines changed

2 files changed

+109
-2
lines changed

.github/workflows/fireperf-e2e.yml

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

ci/fireci/fireciplugins/fireperf.py

Lines changed: 1 addition & 2 deletions
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)