Skip to content

Commit 0188d05

Browse files
authored
[CI] setup Chrome and utilize binary path (opensearch-project#3997)
Within the CI, the virtual runner that we are utilizing has Chrome installed already. The version of Chrome is installed periodically. The most recent version of Chrome requires updates to dependencies that drop support for Node 14. This downloads chrome in the CI and then checks the chromedriver from the environment variable `TEST_BROWSER_BINARY_PATH`. Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
1 parent 6e352ff commit 0188d05

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

.github/workflows/build_and_test_workflow.yml

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ env:
2525
TEST_OPENSEARCH_TRANSPORT_PORT: 9403
2626
TEST_OPENSEARCH_PORT: 9400
2727
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true
28+
# Version 112.0.5615.0
29+
CHROME_VERSION: 1109208
2830

2931
jobs:
3032
build-lint-test:
@@ -122,6 +124,7 @@ jobs:
122124
functional-tests:
123125
name: Run functional tests on ${{ matrix.name }} (ciGroup${{ matrix.group }})
124126
strategy:
127+
fail-fast: false
125128
matrix:
126129
os: [ubuntu-latest, windows-latest]
127130
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
@@ -134,6 +137,22 @@ jobs:
134137
steps:
135138
- run: echo Running functional tests for ciGroup${{ matrix.group }}
136139

140+
- name: Setup Chrome
141+
id: setup-chrome
142+
uses: browser-actions/setup-chrome@v1
143+
with:
144+
chrome-version: ${{ env.CHROME_VERSION }}
145+
146+
- name: Set Chrome Path
147+
if: matrix.os != 'windows-latest'
148+
run: |
149+
echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
150+
151+
- name: Set Chrome Path (Windows)
152+
if: matrix.os == 'windows-latest'
153+
run: |
154+
echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
155+
137156
- name: Configure git's autocrlf (Windows only)
138157
if: matrix.os == 'windows-latest'
139158
run: |

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
148148
- Upgrade yarn version to be compatible with @openearch-project/opensearch ([#3443](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3443))
149149
- [CI] Reduce redundancy by using matrix strategy on Windows and Linux workflows ([#3514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3514))
150150
- Add an achievement badger to the PR ([#3721](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3721))
151+
- Install chrome driver for functional tests from path set by environment variable `TEST_BROWSER_BINARY_PATH`([#3997](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3997))
151152

152153
### 📝 Documentation
153154

scripts/upgrade_chromedriver.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,34 @@ const versionCheckCommands = [];
2525
switch (process.platform) {
2626
case 'win32':
2727
versionCheckCommands.push(
28-
'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"'
28+
...[
29+
...(process.env.TEST_BROWSER_BINARY_PATH
30+
? [
31+
`powershell "(Get-Item \\"${process.env.TEST_BROWSER_BINARY_PATH}\\").VersionInfo.FileVersion"`,
32+
]
33+
: []),
34+
'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"',
35+
]
2936
);
3037
break;
3138

3239
case 'darwin':
3340
versionCheckCommands.push(
34-
'/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version'
41+
...[
42+
...(process.env.TEST_BROWSER_BINARY_PATH
43+
? [`${process.env.TEST_BROWSER_BINARY_PATH} --version`]
44+
: []),
45+
'/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version',
46+
]
3547
);
3648
break;
3749

3850
default:
51+
versionCheckCommands.push(
52+
...(process.env.TEST_BROWSER_BINARY_PATH
53+
? [`${process.env.TEST_BROWSER_BINARY_PATH} --version`]
54+
: [])
55+
);
3956
versionCheckCommands.push(
4057
...[
4158
'/usr/bin',

0 commit comments

Comments
 (0)