Skip to content

Commit a1fe150

Browse files
committed
Run browser tests to collect code coverage data
Obviously it's not yet possible to just migrate `gulp browsertest` to GitHub Actions, however it's already possible to at least run the browser tests there which allows collection of more code coverage data. This should thus give us more realistic coverage numbers, since currently there's many `src/` files that have very low code coverage. By taking advantage of the fact that the GitHub Actions runners provide multiple cores, these tests are also fairly fast: - The ubuntu-latest/firefox job complete in ~9 minutes.
1 parent 19046a6 commit a1fe150

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Coverage (Browser tests)
2+
on:
3+
push:
4+
paths:
5+
- 'gulpfile.mjs'
6+
- 'external/builder/**'
7+
- 'src/**'
8+
- 'test/images/**'
9+
- 'test/pdfs/**'
10+
- 'test/resources/**'
11+
- 'test/*.css'
12+
- 'test/driver.js'
13+
- 'test/test.mjs'
14+
- 'test/test_manifest.json'
15+
- 'test/test_slave.html'
16+
- 'web/**'
17+
- '.github/workflows/coverage_browser_tests.yml'
18+
branches:
19+
- master
20+
pull_request:
21+
paths:
22+
- 'gulpfile.mjs'
23+
- 'external/builder/**'
24+
- 'src/**'
25+
- 'test/images/**'
26+
- 'test/pdfs/**'
27+
- 'test/resources/**'
28+
- 'test/*.css'
29+
- 'test/driver.js'
30+
- 'test/test.mjs'
31+
- 'test/test_manifest.json'
32+
- 'test/test_slave.html'
33+
- 'web/**'
34+
- '.github/workflows/coverage_browser_tests.yml'
35+
branches:
36+
- master
37+
workflow_dispatch:
38+
permissions:
39+
contents: read
40+
41+
jobs:
42+
test:
43+
name: ${{ matrix.os }} / firefox
44+
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
node-version: [lts/*]
49+
os: [ubuntu-latest]
50+
51+
runs-on: ${{ matrix.os }}
52+
environment: code-coverage
53+
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
57+
with:
58+
fetch-depth: 0
59+
persist-credentials: false
60+
61+
- name: Use Node.js ${{ matrix.node-version }}
62+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
63+
with:
64+
node-version: ${{ matrix.node-version }}
65+
cache: 'npm'
66+
67+
- name: Install dependencies
68+
run: npm ci
69+
70+
- name: Restore cached PDF files
71+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
72+
with:
73+
path: test/pdfs/*.pdf
74+
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
75+
restore-keys: |
76+
cached-pdf-files-
77+
enableCrossOsArchive: true
78+
79+
- name: Run browser tests with code coverage
80+
run: npx gulp botbrowsertest --headless -j4 --coverage --coverage-output build/coverage/browser --noChrome
81+
82+
- name: Save cached PDF files
83+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
84+
with:
85+
path: test/pdfs/*.pdf
86+
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
87+
enableCrossOsArchive: true
88+
89+
- name: Upload results to Codecov
90+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
91+
with:
92+
token: ${{ secrets.CODECOV_TOKEN }}
93+
fail_ci_if_error: true
94+
files: ./build/coverage/browser/lcov.info
95+
flags: browsertest
96+
name: codecov-umbrella
97+
disable_search: true
98+
disable_telem: true
99+
verbose: true

0 commit comments

Comments
 (0)