forked from darkreader/darkreader
-
Notifications
You must be signed in to change notification settings - Fork 2
123 lines (105 loc) · 3.37 KB
/
test-browser.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Run browser tests
on:
# Runs for pushes, pull requests, and manual triggers.
# (Dooes not run when only some config is changed.)
push:
branches:
- main
paths-ignore:
- 'src/config/*'
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- ready_for_review
paths-ignore:
- 'src/config/**'
workflow_dispatch:
inputs:
test_results_retention_days:
description: 'Test results retention (in days)'
required: true
default: '7'
node_version:
description: 'NodeJS version'
required: true
default: '18.x'
jobs:
test-browser:
name: Run browser tests
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
# Extended support releases
- channel: esr
firefox: latest-esr
# Stable releases
- channel: stable
chrome: stable
firefox: latest
coverage: true
# Beta releases
- channel: beta
chrome: beta
firefox: latest-beta
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Chrome
if: ${{ matrix.chrome }}
uses: browser-actions/setup-chrome@latest
with:
chrome-version: ${{ matrix.chrome }}
- name: Configure Karma with path to Chrome executable
if: ${{ matrix.chrome }}
run: |
chrome --version
{ echo CHROME_BIN="$(which chrome)"; echo CHROME_TEST=1; } | tee -a "$GITHUB_ENV"
- name: Install Firefox
if: ${{ matrix.firefox }}
uses: browser-actions/setup-firefox@latest
with:
firefox-version: ${{ matrix.firefox }}
- name: Configure Karma with path to Firefox executable
if: ${{ matrix.firefox }}
run: |
firefox --version
{ echo FIREFOX_BIN="$(which firefox)"; echo FIREFOX_TEST=1; } | tee -a "$GITHUB_ENV"
- name: Node setup
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version || '18.x' }}
cache: npm
- name: Install NPM dependencies
run: npm ci
- name: Deps
run: cat package-lock.json
- name: Run injection tests
run: npm run test:inject -- --ci --json --outputFile=test-results-inject.json
- name: Run browser tests on Chromium MV2 build
if: ${{ matrix.chrome }}
uses: coactions/setup-xvfb@v1
with:
run: npm run test:chrome -- --json --outputFile=test-results-chrome.json
- name: Run browser tests on Chromium MV3 build
if: ${{ matrix.chrome }}
uses: coactions/setup-xvfb@v1
with:
run: npm run test:chrome-mv3 -- --json --outputFile=test-results-chrome-mv3.json
- name: Run browser tests on Firefox MV2 build
if: ${{ matrix.firefox }}
uses: coactions/setup-xvfb@v1
with:
run: npm run test:firefox -- --json --outputFile=test-results-firefox-mv2.json
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results-chrome-${{ matrix.chrome }}-firefox-${{ matrix.firefox }}-coverage-${{ matrix.coverage }}
path: test-results-*
retention-days: ${{ inputs.test_results_retention_days }}