Skip to content

Commit 544e51e

Browse files
committed
Switch to headless mode for Karma, use variable for Node version
1 parent 639310b commit 544e51e

File tree

2 files changed

+25
-48
lines changed

2 files changed

+25
-48
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ concurrency:
99
group: ci-${{ github.ref }}
1010
cancel-in-progress: true
1111

12+
env:
13+
NODE_VERSION: '18.20.4'
14+
1215
jobs:
1316
# ============================================================
1417
# Root build job - all dependent jobs fan out from here
@@ -21,7 +24,7 @@ jobs:
2124
- uses: actions/setup-node@v6
2225
with:
2326
# TODO: Update this version to match library
24-
node-version: '18.20.4'
27+
node-version: ${{ env.NODE_VERSION }}
2528
cache: 'npm'
2629

2730
- name: Install dependencies
@@ -56,32 +59,24 @@ jobs:
5659
- uses: ./.github/actions/setup-chrome
5760

5861
- name: Run hover_label test in UTC timezone
59-
uses: coactions/setup-xvfb@v1
62+
run: date && npm run test-jasmine hover_label
6063
env:
6164
TZ: 'UTC'
62-
with:
63-
run: date && npm run test-jasmine hover_label
6465

6566
- name: Run hover_label test in Europe/Berlin timezone
66-
uses: coactions/setup-xvfb@v1
67+
run: date && npm run test-jasmine hover_label
6768
env:
6869
TZ: 'Europe/Berlin'
69-
with:
70-
run: date && npm run test-jasmine hover_label
7170

7271
- name: Run hover_label test in Asia/Tokyo timezone
73-
uses: coactions/setup-xvfb@v1
72+
run: date && npm run test-jasmine hover_label
7473
env:
7574
TZ: 'Asia/Tokyo'
76-
with:
77-
run: date && npm run test-jasmine hover_label
7875

7976
- name: Run hover_label test in America/Toronto timezone
80-
uses: coactions/setup-xvfb@v1
77+
run: date && npm run test-jasmine hover_label
8178
env:
8279
TZ: 'America/Toronto'
83-
with:
84-
run: date && npm run test-jasmine hover_label
8580

8681
no-gl-jasmine:
8782
needs: install-and-cibuild
@@ -100,9 +95,7 @@ jobs:
10095
- uses: ./.github/actions/setup-chrome
10196

10297
- name: Run jasmine tests (no-gl, shard ${{ matrix.shard }})
103-
uses: coactions/setup-xvfb@v1
104-
with:
105-
run: .github/scripts/test.sh no-gl-jasmine
98+
run: .github/scripts/test.sh no-gl-jasmine
10699

107100
webgl-jasmine:
108101
needs: install-and-cibuild
@@ -121,9 +114,7 @@ jobs:
121114
- uses: ./.github/actions/setup-chrome
122115

123116
- name: Run jasmine tests (webgl, shard ${{ matrix.shard }})
124-
uses: coactions/setup-xvfb@v1
125-
with:
126-
run: .github/scripts/test.sh webgl-jasmine
117+
run: .github/scripts/test.sh webgl-jasmine
127118

128119
virtual-webgl-jasmine:
129120
needs: install-and-cibuild
@@ -142,9 +133,7 @@ jobs:
142133
- uses: ./.github/actions/setup-chrome
143134

144135
- name: Run jasmine tests (virtual-webgl, shard ${{ matrix.shard }})
145-
uses: coactions/setup-xvfb@v1
146-
with:
147-
run: .github/scripts/test.sh virtual-webgl-jasmine
136+
run: .github/scripts/test.sh virtual-webgl-jasmine
148137

149138
webgl-jasmine-chromeLatest:
150139
needs: install-and-cibuild
@@ -165,9 +154,7 @@ jobs:
165154
chrome-version: '143.0.7499.192'
166155

167156
- name: Run jasmine tests (webgl chromeLatest, shard ${{ matrix.shard }})
168-
uses: coactions/setup-xvfb@v1
169-
with:
170-
run: .github/scripts/test.sh webgl-jasmine
157+
run: .github/scripts/test.sh webgl-jasmine
171158

172159
flaky-no-gl-jasmine:
173160
needs: install-and-cibuild
@@ -182,9 +169,7 @@ jobs:
182169
- uses: ./.github/actions/setup-chrome
183170

184171
- name: Run flaky jasmine tests
185-
uses: coactions/setup-xvfb@v1
186-
with:
187-
run: .github/scripts/test.sh flaky-no-gl-jasmine
172+
run: .github/scripts/test.sh flaky-no-gl-jasmine
188173

189174
bundle-jasmine:
190175
needs: install-and-cibuild
@@ -197,9 +182,7 @@ jobs:
197182
- uses: ./.github/actions/setup-chrome
198183

199184
- name: Run bundle jasmine tests
200-
uses: coactions/setup-xvfb@v1
201-
with:
202-
run: .github/scripts/test.sh bundle-jasmine
185+
run: .github/scripts/test.sh bundle-jasmine
203186

204187
mathjax-firefoxLatest:
205188
needs: install-and-cibuild
@@ -213,9 +196,7 @@ jobs:
213196
- uses: browser-actions/setup-firefox@v1
214197

215198
- name: Test MathJax on firefox-latest
216-
uses: coactions/setup-xvfb@v1
217-
with:
218-
run: .github/scripts/test.sh mathjax-firefox
199+
run: .github/scripts/test.sh mathjax-firefox
219200

220201
# ============================================================
221202
# noCI tests (merged from test.yml)
@@ -229,9 +210,7 @@ jobs:
229210
- uses: ./.github/actions/setup-chrome
230211

231212
- name: Run noCI tests
232-
uses: coactions/setup-xvfb@v1
233-
with:
234-
run: ./tasks/noci_test.sh jasmine
213+
run: ./tasks/noci_test.sh jasmine
235214

236215
# ============================================================
237216
# Image baseline generation and comparison
@@ -560,7 +539,7 @@ jobs:
560539

561540
- uses: actions/setup-node@v6
562541
with:
563-
node-version: '18.20.4'
542+
node-version: ${{ env.NODE_VERSION }}
564543
cache: 'npm'
565544

566545
- name: Set up build environment
@@ -673,7 +652,7 @@ jobs:
673652

674653
- uses: actions/setup-node@v6
675654
with:
676-
node-version: '18.20.4'
655+
node-version: ${{ env.NODE_VERSION }}
677656
cache: 'npm'
678657

679658
- name: Set up build environment
@@ -693,14 +672,14 @@ jobs:
693672
path: stackgl_modules/index.js
694673

695674
test-topojson-build:
696-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
675+
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
697676
runs-on: ubuntu-latest
698677
steps:
699678
- uses: actions/checkout@v6
700679

701680
- uses: actions/setup-node@v6
702681
with:
703-
node-version: '18.20.4'
682+
node-version: ${{ env.NODE_VERSION }}
704683
cache: 'npm'
705684

706685
- name: Set up build environment

test/jasmine/karma.conf.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,21 +260,19 @@ func.defaultConfig = {
260260
flags: [
261261
'--touch-events',
262262
'--window-size=' + argv.width + ',' + argv.height,
263+
isCI ? '--headless' : '',
263264
isCI ? '--ignore-gpu-blocklist' : '',
264-
// The following two flags are needed only for the "NoCI" tests which run in GitHub Actions.
265-
// The first is needed because the GPU is not available to those runners,
266-
// and therefore we need to use SwiftShader instead (which is disabled by default as of Jan 2026,
267-
// hence the need for a flag to manually enable it).
268-
// The second flag is needed because the Chrome browser installed by the CI job runner
269-
// fails without it.
270265
isCI && process.env.GITHUB_ACTIONS ? '--enable-unsafe-swiftshader' : '',
271266
isCI && process.env.GITHUB_ACTIONS ? '--no-sandbox' : '',
272267
isBundleTest && basename(testFileGlob) === 'no_webgl' ? '--disable-webgl' : ''
273268
]
274269
},
275270
_Firefox: {
276271
base: 'Firefox',
277-
flags: ['--width=' + argv.width, '--height=' + argv.height],
272+
flags: [
273+
'--width=' + argv.width, '--height=' + argv.height,
274+
isCI ? '--headless' : ''
275+
],
278276
prefs: {
279277
'devtools.toolbox.zoomValue': '1.5',
280278
'devtools.toolbox.host': 'window',

0 commit comments

Comments
 (0)