-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (214 loc) · 6.32 KB
/
ci.yaml
File metadata and controls
225 lines (214 loc) · 6.32 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
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
224
225
# This is a Github Workflow that runs tests on any push or pull request.
# If the tests pass and this is a push to the master branch it also runs Semantic Release.
name: CI
on: [push, pull_request]
env:
npm_config_audit: false
npm_config_fund: false
npm_config_save: false
npm_config_package_lock: false
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Use Node.js 24
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: build
path: |
target
package.json
package-main.json
jsr.json
retention-days: 1
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- name: Fetch deps
run: npm ci
- name: Run tests
run: npm run test
- uses: actions/upload-artifact@v4
with:
name: coverage
path: |
target/coverage
package.json
retention-days: 1
release:
name: Release ${{ github.ref }}
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
# if: github.event_name == 'turned-off-temporary'
runs-on: ubuntu-latest
permissions:
checks: read
statuses: write
contents: write
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
merge-multiple: true
- name: Run release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_PROVENANCE: true
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_USER: 'x-access-token'
GIT_BRANCH: 'main'
GIT_AUTHOR_NAME: ${{ vars.GIT_AUTHOR_NAME }}
GIT_AUTHOR_EMAIL: ${{ vars.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
run: npx zx-semrel
# run: |
# mv -f package-main.json package.json
# npx zx-semrel
- name: Push docs and coverage
env:
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
DEBUG: true
run: |
npx ggcp target/coverage/lcov.info target/coverage/${{ github.sha }}.lcov.info
npx ggcp "target/coverage>*.info" https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git/coverage --message='chore: add coverage for ${{ github.sha }}'
npx ggcp target/docs https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git/gh-pages --message='chore: update docs'
smoke-node:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: build
name: smoke-node${{ matrix.node-version }}
strategy:
matrix:
node-version: [10, 12, 18, 24]
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- name: Run smoke:esm tests
if: matrix.node-version >= 12
run: npm run smoke:esm
- name: Run smoke:cjs tests
run: npm run smoke:cjs
smoke-node-win32:
if: github.event_name == 'pull_request'
runs-on: windows-latest
needs: build
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js 24
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- name: Run smoke:esm tests
run: npm run smoke:esm
- name: Run smoke:cjs tests
run: npm run smoke:cjs
smoke-browser:
if: github.event_name == 'pull_request'
timeout-minutes: 5
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js 24
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- run: |
npm ci
npx playwright install --with-deps chromium
npm run smoke:browser
smoke-bun:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Bun
uses: antongolub/action-setup-bun@f0b9f339a7ce9ba1174a58484e4dc9bbd6f7b133 # v1.13.2
- uses: actions/download-artifact@v5
with:
name: build
- run: |
bun ./src/test/smoke/node.test.cjs
bun ./src/test/smoke/node.test.mjs
smoke-deno:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: smoke-deno${{ matrix.deno-version }}
needs: build
strategy:
matrix:
deno-version: [ 1, 2 ]
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Deno
uses: denoland/setup-deno@909cc5acb0fdd60627fb858598759246509fa755 # v2.0.2
with:
deno-version: ${{ matrix.deno-version }}
- run: deno install npm:types/node
- uses: actions/download-artifact@v5
with:
name: build
- run: deno test ./src/test/smoke/deno.test.js