-
Notifications
You must be signed in to change notification settings - Fork 361
223 lines (215 loc) · 8.85 KB
/
integration-tests.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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Integration Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
integration:
name: Integration
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
# Pinning 20.x version as a temporary workaround due to this https://github.com/nodejs/node/issues/52884
node-version: ['18.17.0', '20.12.2', '22']
shard: ['1/4', '2/4', '3/4', '4/4']
exclude:
- os: macOS-latest
node-version: '18.17.0'
- os: windows-latest
node-version: '18.17.0'
- os: windows-latest
node-version: '22'
fail-fast: false
steps:
# Sets an output parameter if this is a release PR
- name: Check for release
id: release-check
# For windows we have to use $env:
run: |-
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT
if: "${{ startsWith(github.head_ref, 'release-') }}"
# This improves Windows network performance, we need this since we open many ports in our tests
- name: Increase Windows port limit and reduce time wait delay
run: |
netsh int ipv4 set dynamicport tcp start=1025 num=64511
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters /v TcpTimedWaitDelay /t REG_DWORD /d 30 /f
if: "${{ matrix.os == 'windows-latest' && !steps.release-check.outputs.IS_RELEASE }}"
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
check-latest: true
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
- name: Install PNPM
run: |
corepack enable
corepack prepare [email protected] --activate
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
- name: Setup Deno
uses: denoland/setup-deno@v1
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
with:
deno-version: v1.44.4
- name: Install core dependencies
run: npm ci --no-audit
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
- name: Generate self-signed certificates
run: npm run certs
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
shell: bash
- name: Prepare tests
run: npm run test:init
if: '${{ !steps.release-check.outputs.IS_RELEASE }}'
- name: Tests
uses: nick-fields/retry@v3
if: '${{ !steps.release-check.outputs.IS_RELEASE }}'
with:
timeout_minutes: 15
max_attempts: 3
retry_on: error
command: npm run test:ci:vitest:integration -- --shard=${{ matrix.shard }}
env:
# GitHub secrets are not available when running on PR from forks
# We set a flag so we can skip tests that access Netlify API
NETLIFY_TEST_DISABLE_LIVE:
${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# NETLIFY_TEST_GITHUB_TOKEN is used to avoid reaching GitHub API limits in exec-fetcher.js
NETLIFY_TEST_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Changes the polling interval used by the file watcher
CHOKIDAR_INTERVAL: 20
CHOKIDAR_USEPOLLING: 1
- name: Get test coverage flags
id: test-coverage-flags
# For windows we have to use $env:
run: |-
os=${{ matrix.os }}
node=$(node --version)
echo "os=${os/-latest/}" >> $GITHUB_OUTPUT
echo "os=${os/-latest/}" >> $env:GITHUB_OUTPUT
echo "node=node_${node/.*.*/}" >> $GITHUB_OUTPUT
echo "node=node_${node/.*.*/}" >> $env:GITHUB_OUTPUT
shell: bash
if: '${{ !steps.release-check.outputs.IS_RELEASE }}'
- name: Sanitize shard for artefact name
id: sanitize-shard-name
run: echo "shard=$(echo '${{ matrix.shard }}' | tr '/' '-')" >> $GITHUB_OUTPUT
- name: Store npm error artefacts
uses: actions/upload-artifact@v4
if: always()
with:
name: npm-logs--${{ matrix.os }}--${{ matrix.node-version }}--${{ steps.sanitize-shard-name.outputs.shard }}
path: |
/home/runner/.npm/_logs/**/*
- uses: codecov/codecov-action@v5
continue-on-error: true
with:
flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }}
token: ${{ secrets.CODECOV_TOKEN }}
if: '${{ !steps.release-check.outputs.IS_RELEASE }}'
# Specific tests for known test that failed on windows using node 23.
# Can be replaced with larger node 23 tests in the future.
integration-win-node-23:
name: Integration test windows latest node23 specific
runs-on: windows-latest
timeout-minutes: 40
steps:
# Sets an output parameter if this is a release PR
- name: Check for release
id: release-check
# For windows we have to use $env:
run: |-
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT
if: "${{ startsWith(github.head_ref, 'release-') }}"
# This improves Windows network performance, we need this since we open many ports in our tests
- name: Increase Windows port limit and reduce time wait delay
run: |
netsh int ipv4 set dynamicport tcp start=1025 num=64511
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters /v TcpTimedWaitDelay /t REG_DWORD /d 30 /f
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '23.x'
cache: npm
check-latest: true
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
- name: Install PNPM
run: |
corepack enable
corepack prepare [email protected] --activate
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
- name: Setup Deno
uses: denoland/setup-deno@v1
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
with:
deno-version: v1.44.4
- name: Install core dependencies
run: npm ci --no-audit
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
- name: Generate self-signed certificates
run: npm run certs
if: '${{!steps.release-check.outputs.IS_RELEASE}}'
shell: bash
- name: Prepare tests
run: npm run test:init
if: '${{ !steps.release-check.outputs.IS_RELEASE }}'
- name: Tests
uses: nick-fields/retry@v3
if: '${{ !steps.release-check.outputs.IS_RELEASE }}'
with:
timeout_minutes: 15
max_attempts: 3
retry_on: error
command: npm exec vitest -- run tests/integration/commands/dev/dev.test.ts
env:
# GitHub secrets are not available when running on PR from forks
# We set a flag so we can skip tests that access Netlify API
NETLIFY_TEST_DISABLE_LIVE:
${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# NETLIFY_TEST_GITHUB_TOKEN is used to avoid reaching GitHub API limits in exec-fetcher.js
NETLIFY_TEST_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Changes the polling interval used by the file watcher
CHOKIDAR_INTERVAL: 20
CHOKIDAR_USEPOLLING: 1
- name: Get test coverage flags
id: test-coverage-flags
# For windows we have to use $env:
run: |-
os=windows-latest
node=$(node --version)
echo "os=${os/-latest/}" >> $GITHUB_OUTPUT
echo "os=${os/-latest/}" >> $env:GITHUB_OUTPUT
echo "node=node_${node/.*.*/}" >> $GITHUB_OUTPUT
echo "node=node_${node/.*.*/}" >> $env:GITHUB_OUTPUT
shell: bash
if: '${{ !steps.release-check.outputs.IS_RELEASE }}'
- name: Store npm error artefacts
uses: actions/upload-artifact@v4
if: always()
with:
name: npm-logs--windows-latest--23x
path: |
/home/runner/.npm/_logs/**/*
- uses: codecov/codecov-action@v5
continue-on-error: true
with:
flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }}
token: ${{ secrets.CODECOV_TOKEN }}
if: '${{ !steps.release-check.outputs.IS_RELEASE }}'