Skip to content

Commit 8b389a2

Browse files
authored
[Auth CI] Log warning if chrome version has changed (#7872)
Add CI annotations if the chrome browser is out of date with auth's latest tested version.
1 parent 2e32eeb commit 8b389a2

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

.github/workflows/test-all.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ env:
2525
# the beahvior to use the new URLs.
2626
CHROMEDRIVER_CDNURL: https://googlechromelabs.github.io/
2727
CHROMEDRIVER_CDNBINARIESURL: https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/
28+
CHROME_VALIDATED_VERSION: linux-120.0.6099.71
29+
CHROME_VERSION_MISMATCH_MESSAGE: "The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass."
2830
artifactRetentionDays: 14
2931
# Bump Node memory limit
3032
NODE_OPTIONS: "--max_old_space_size=4096"
@@ -115,6 +117,15 @@ jobs:
115117
- name: install Chrome stable
116118
run: |
117119
npx @puppeteer/browsers install chrome@stable
120+
chromeVersionString=$(ls chrome)
121+
if [ "$CHROME_VALIDATED_VERSION" != "$chromeVersionString" ]; then
122+
echo "::warning ::The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass."
123+
echo "::warning ::Previously validated version: ${CHROME_VALIDATED_VERSION} vs. Installed version: $chromeVersionString"
124+
echo "CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE" >> "$GITHUB_ENV"
125+
fi
126+
- name: Test Evn TEMP
127+
run: |
128+
echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE
118129
- name: Download build archive
119130
uses: actions/download-artifact@v3
120131
with:

.github/workflows/test-changed-auth.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
name: Test Auth
1616

17-
on: pull_request
17+
on: [push, pull_request]
1818

1919
env:
2020
# make chromedriver detect installed Chrome version and download the corresponding driver
@@ -23,20 +23,34 @@ env:
2323
# the beahvior to use the new URLs.
2424
CHROMEDRIVER_CDNURL: https://googlechromelabs.github.io/
2525
CHROMEDRIVER_CDNBINARIESURL: https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/
26+
CHROME_VALIDATED_VERSION: linux-120.0.6099.71
2627
# Bump Node memory limit
2728
NODE_OPTIONS: "--max_old_space_size=4096"
2829

2930
jobs:
3031
test-chrome:
3132
name: Test Auth on Chrome and Node If Changed
3233
runs-on: ubuntu-latest
33-
3434
steps:
3535
# install Chrome first, so the correct version of webdriver can be installed by chromedriver
3636
# when setting up the repo
37+
#
38+
# Note: we only need to check the chrome version change in one job as the warning annotation
39+
# is appended to the entire workflow results, not just this job's results.
3740
- name: install Chrome stable
41+
env:
42+
CHROME_VERSION_MISMATCH_MESSAGE: "The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass."
3843
run: |
3944
npx @puppeteer/browsers install chrome@stable
45+
chromeVersionString=$(ls chrome)
46+
if [ "$CHROME_VALIDATED_VERSION" != "$chromeVersionString" ]; then
47+
echo "::warning ::The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass."
48+
echo "::warning ::Previously validated version: ${CHROME_VALIDATED_VERSION} vs. Installed version: $chromeVersionString"
49+
echo "CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE" >> "$GITHUB_ENV"
50+
fi
51+
- name: Test Evn TEMP
52+
run: |
53+
echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE
4054
- name: Checkout Repo
4155
uses: actions/checkout@master
4256
with:

scripts/ci-test/test_changed.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ async function runTests(config: TestConfig) {
8080
process.exit(0);
8181
} catch (e) {
8282
console.error(chalk`{red ${e}}`);
83+
84+
const chrome_notes = process.env.CHROME_VERSION_NOTES;
85+
if (chrome_notes) {
86+
console.error();
87+
console.error(chalk`{red ${chrome_notes}}`);
88+
console.error();
89+
}
90+
8391
process.exit(1);
8492
}
8593
}

scripts/run_tests_in_ci.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ const argv = yargs.options({
8787
console.error('Failure: ' + name);
8888
console.log(stdout);
8989
console.error(stderr);
90+
91+
if (process.env.CHROME_VERSION_NOTES) {
92+
console.error();
93+
console.error(process.env.CHROME_VERSION_NOTES);
94+
console.error();
95+
}
96+
9097
writeLogs('Failure', name, stdout + '\n' + stderr);
98+
9199
process.exit(1);
92100
}
93101
})();

0 commit comments

Comments
 (0)