Repository navigation
177 lines (143 loc) · 5.51 KB
/
Copy pathtests.yml
File metadata and controls
177 lines (143 loc) · 5.51 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# A newer push to a pull request supersedes its run; a push to main always finishes, so the
# badges never show a cancelled run as failing.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
test-node:
name: Test on Node.js (${{ matrix.node-version }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
node-version: [20, 22, 24, 26]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
- name: Print the Node.js version in use
run: node --version
- name: Run tests
if: matrix.node-version != 24
run: vp test
- name: Run tests with coverage
if: matrix.node-version == 24
run: vp test run --coverage
- name: Upload coverage to Codecov
if: matrix.node-version == 24
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: true
flags: node
test-bun:
name: Test on Bun
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- name: Run tests
run: bun test src
test-deno:
name: Test on Deno
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
- name: Setup Deno
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5
with:
deno-version: v2.x
- name: Run tests
run: deno test --unstable-sloppy-imports --allow-net --allow-env src
# What JSR would reject at release time fails here instead: slow types in the public API,
# an export of jsr.json that does not resolve, a file outside the publish list.
- name: Dry-run the JSR publication
run: deno publish --dry-run
test-browsers:
name: Test on Browsers (${{ matrix.browser }})
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
# A flake in one browser must not cancel the others, or its cause is lost.
fail-fast: false
matrix:
browser: [edge, chrome, firefox]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
# Chromium under the webdriverio provider loses a test iframe when many test files load at
# once: the run either fails at once with "Cannot connect to the iframe" / "Failed to fetch
# dynamically imported module", or prints nothing more until it is killed. With test files in
# parallel that happened on most Chrome and Edge runs, which then sat silent until the timeout
# before retrying; one file at a time they finish in about a minute, faster than Firefox in
# parallel. So Chrome and Edge run one file at a time from the start. An attempt that still
# times out, or fails with one of those two errors, is run again one file at a time, up to
# three attempts. Any other failure, including a failing assertion, fails the step at once.
- name: Run tests in ${{ matrix.browser }}
env:
BROWSER: ${{ matrix.browser }}
run: |
attempt() {
timeout "$1" vp test --browser.enabled --browser.name="$BROWSER" "${@:2}" 2>&1 | tee browser-tests.log
return "${PIPESTATUS[0]}"
}
lost_iframe() {
[ "$1" -eq 124 ] || grep -qE "Cannot connect to the iframe|Failed to fetch dynamically imported module" browser-tests.log
}
first_attempt=()
case "$BROWSER" in
chrome | edge) first_attempt=(--no-file-parallelism) ;;
esac
attempt 240 "${first_attempt[@]}" && exit 0
status=$?
for retry in 1 2; do
lost_iframe "$status" || exit "$status"
echo "::warning::The $BROWSER test run lost a test iframe (exit $status); retry $retry of 2, one file at a time."
attempt 300 --no-file-parallelism && exit 0
status=$?
done
exit "$status"
test-safari:
name: Test on Browsers (safari)
runs-on: macos-latest
timeout-minutes: 25
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
- name: Run tests in Safari
run: vp test --browser.enabled --browser.name=safari --browser.headless=false