Skip to content

Commit f8f9fd5

Browse files
authored
chore: fix the ci (#5020)
* chore: drop node 19, add node 20 and 21 to workflows * update karma deps * use 'moz:debuggerAdress' * . * debug * . * patch webdriverio * fix lint * improve ci
1 parent 37deed2 commit f8f9fd5

File tree

7 files changed

+1157
-809
lines changed

7 files changed

+1157
-809
lines changed

.github/workflows/browser-test.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@ jobs:
1212
runs-on: ubuntu-latest
1313
if: contains(github.event.pull_request.labels.*.name, 'run-browser-test')
1414
steps:
15-
- uses: actions/setup-node@v3
15+
- uses: actions/setup-node@v4
1616
with:
17-
node-version: 16
18-
- uses: actions/checkout@v3
17+
node-version: lts/*
18+
- uses: actions/checkout@v4
1919
with:
2020
ref: ${{ github.event.pull_request.head.sha }}
21+
persist-credentials: false
2122
- name: 'Cache node_modules'
2223
uses: actions/cache@v3
2324
with:
2425
path: '~/.npm'
25-
key: "ubuntu-latest-node-full-v16-${{ hashFiles('**/package-lock.json') }}"
26-
restore-keys: |
27-
ubuntu-latest-node-full-v16-
26+
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
2827
- name: Install Dependencies
2928
run: npm ci
3029
- name: Run Browser Tests

.github/workflows/delete-runs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
inputs:
55
days:
66
description: 'Number of days'
7+
type: number
78
required: true
89
default: 180
910

.github/workflows/mocha.yml

Lines changed: 65 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ jobs:
2222
- name: Check event pull_request
2323
if: github.event_name == 'pull_request'
2424
run: 'echo pull_request: run workflow'
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626
if: github.event_name == 'push'
27+
with:
28+
persist-credentials: false
2729
- name: Check event push
2830
id: findPr
2931
if: github.event_name == 'push'
@@ -45,10 +47,12 @@ jobs:
4547
- 14
4648
- 16
4749
- 18
48-
- 19
50+
- 20
4951
steps:
50-
- uses: actions/checkout@v3
51-
- uses: actions/setup-node@v3
52+
- uses: actions/checkout@v4
53+
with:
54+
persist-credentials: false
55+
- uses: actions/setup-node@v4
5256
with:
5357
node-version: '${{ matrix.node }}'
5458
- run: npm install --production
@@ -59,17 +63,17 @@ jobs:
5963
runs-on: ubuntu-latest
6064
needs: smoke
6165
steps:
62-
- uses: actions/setup-node@v3
66+
- uses: actions/setup-node@v4
6367
with:
64-
node-version: 16
65-
- uses: actions/checkout@v3
68+
node-version: lts/*
69+
- uses: actions/checkout@v4
70+
with:
71+
persist-credentials: false
6672
- name: 'Cache node_modules'
6773
uses: actions/cache@v3
6874
with:
6975
path: '~/.npm'
70-
key: "ubuntu-latest-node-v16-${{ hashFiles('**/package-lock.json') }}"
71-
restore-keys: |
72-
ubuntu-latest-node-v16-
76+
key: "ubuntu-latest-node-lts-${{ hashFiles('**/package-lock.json') }}"
7377
- name: Install Dependencies
7478
run: npm ci --ignore-scripts
7579
- name: 'Check lint'
@@ -90,17 +94,19 @@ jobs:
9094
- 14
9195
- 16
9296
- 18
93-
- 19
97+
- 20
9498
include:
9599
- os: ubuntu-latest
96100
node: 16
97101
env:
98102
COVERAGE: 1
99103
steps:
100-
- uses: actions/setup-node@v3
104+
- uses: actions/setup-node@v4
101105
with:
102106
node-version: '${{ matrix.node }}'
103-
- uses: actions/checkout@v3
107+
- uses: actions/checkout@v4
108+
with:
109+
persist-credentials: false
104110
- name: Get npm cache directory in Windows
105111
id: npm-cache
106112
if: ${{ matrix.os == 'windows-2019' }}
@@ -111,8 +117,6 @@ jobs:
111117
with:
112118
path: ${{ matrix.os == 'ubuntu-latest' && '~/.npm' || steps.npm-cache.outputs.dir }}
113119
key: "${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}"
114-
restore-keys: |
115-
${{ matrix.os }}-node-v${{ matrix.node }}-
116120
- name: Install Dependencies
117121
run: npm ci --ignore-scripts
118122
- name: Install Annotation Support
@@ -133,31 +137,69 @@ jobs:
133137
with:
134138
github-token: '${{ secrets.GITHUB_TOKEN }}'
135139

136-
test-browser:
137-
name: 'Browser Tests'
140+
test-browser-local:
141+
name: Browser Test [ChromeHeadless]
138142
needs: smoke
139143
runs-on: ubuntu-latest
140144
timeout-minutes: 20
141145
# Don't run forked 'pull_request' without saucelabs token
142146
if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
143147
steps:
144-
- uses: actions/setup-node@v3
148+
- uses: actions/setup-node@v4
149+
with:
150+
node-version: lts/*
151+
- uses: actions/checkout@v4
152+
with:
153+
persist-credentials: false
154+
- name: 'Cache node_modules'
155+
uses: actions/cache@v3
156+
with:
157+
path: '~/.npm'
158+
# this key is different than above, since we are running scripts
159+
# (builds, postinstall lifecycle hooks, etc.)
160+
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
161+
- name: Install Dependencies
162+
run: npm ci
163+
- name: Run Browser Tests
164+
run: npm start test.browser
165+
env:
166+
BROWSER: ChromeHeadless
167+
168+
test-browser-saucelabs:
169+
name: Browser Tests on SauceLabs [${{ matrix.browser }}]
170+
needs:
171+
- smoke
172+
- test-browser-local
173+
runs-on: ubuntu-latest
174+
timeout-minutes: 20
175+
strategy:
176+
matrix:
177+
browser:
178+
- firefox@latest
179+
- chrome@latest
180+
- MicrosoftEdge@latest
181+
- safari@latest
182+
# Don't run forked 'pull_request' without saucelabs token
183+
if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
184+
steps:
185+
- uses: actions/setup-node@v4
186+
with:
187+
node-version: lts/*
188+
- uses: actions/checkout@v4
145189
with:
146-
node-version: 16
147-
- uses: actions/checkout@v3
190+
persist-credentials: false
148191
- name: 'Cache node_modules'
149192
uses: actions/cache@v3
150193
with:
151194
path: '~/.npm'
152195
# this key is different than above, since we are running scripts
153196
# (builds, postinstall lifecycle hooks, etc.)
154-
key: "ubuntu-latest-node-full-v16-${{ hashFiles('**/package-lock.json') }}"
155-
restore-keys: |
156-
ubuntu-latest-node-full-v16-
197+
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
157198
- name: Install Dependencies
158199
run: npm ci
159200
- name: Run Browser Tests
160201
run: npm start test.browser
161202
env:
162203
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
163204
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
205+
BROWSER: ${{ matrix.browser }}

.github/workflows/nightly-site-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Webhook Action
13-
uses: joelwmale/webhook-action@1.0.0
13+
uses: joelwmale/webhook-action@2.3.2
1414
env:
1515
data: ''
1616
WEBHOOK_URL: ${{ secrets.NETLIFY_NIGHTLY_DEPLOY_URL }}

karma.conf.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const rollupPlugin = require('./scripts/karma-rollup-plugin');
2828
const BASE_BUNDLE_DIR_PATH = path.join(__dirname, '.karma');
2929
const env = process.env;
3030
const hostname = os.hostname();
31+
const BROWSER = env.BROWSER;
3132

3233
const SAUCE_BROWSER_PLATFORM_MAP = {
3334
'chrome@latest': 'Windows 10',
@@ -90,8 +91,7 @@ module.exports = config => {
9091
const buildId = `github-${env.GITHUB_RUN_ID}_${env.GITHUB_RUN_NUMBER}`;
9192
bundleDirPath = path.join(BASE_BUNDLE_DIR_PATH, buildId);
9293
sauceConfig = {
93-
build: buildId,
94-
geckodriverVersion: '0.30.0' // temporary workaround for firefox
94+
build: buildId
9595
};
9696
} else {
9797
console.error(`Local environment (${hostname}) detected`);
@@ -121,6 +121,13 @@ module.exports = config => {
121121
files: [...cfg.files, {pattern: './mocha.js.map', included: false}]
122122
};
123123

124+
if (BROWSER) {
125+
cfg = {
126+
...cfg,
127+
browsers: [BROWSER]
128+
};
129+
}
130+
124131
config.set(cfg);
125132
};
126133

@@ -172,7 +179,7 @@ const addSauceTests = (cfg, sauceLabs) => {
172179
const customLaunchers = sauceBrowsers.reduce((acc, sauceBrowser) => {
173180
const platformName = SAUCE_BROWSER_PLATFORM_MAP[sauceBrowser];
174181
const [browserName, browserVersion] = sauceBrowser.split('@');
175-
return {
182+
const result = {
176183
...acc,
177184
[sauceBrowser]: {
178185
base: 'SauceLabs',
@@ -182,9 +189,13 @@ const addSauceTests = (cfg, sauceLabs) => {
182189
'sauce:options': sauceLabs
183190
}
184191
};
192+
if (browserName === 'firefox') {
193+
result[sauceBrowser]['sauce:options']['moz:debuggerAddress'] = true;
194+
}
195+
return result;
185196
}, {});
186197

187-
return {
198+
const result = {
188199
...cfg,
189200
reporters: [...cfg.reporters, 'saucelabs'],
190201
browsers: [...cfg.browsers, ...sauceBrowsers],
@@ -198,6 +209,7 @@ const addSauceTests = (cfg, sauceLabs) => {
198209
captureTimeout: 120000,
199210
browserNoActivityTimeout: 20000
200211
};
212+
return result;
201213
}
202214
return {...cfg};
203215
};

0 commit comments

Comments
 (0)