Repository navigation
201 lines (191 loc) · 5.67 KB
/
Copy pathci.yaml
File metadata and controls
201 lines (191 loc) · 5.67 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
# 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: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Use Node.js 26
uses: actions/setup-node@v7
with:
node-version: 26
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v7
with:
name: build
path: |
target
package.json
jsr.json
retention-days: 1
test:
needs: build
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 26
cache: 'npm'
- uses: actions/download-artifact@v8
with:
name: build
- name: Fetch deps
run: npm ci
- name: Run tests
run: npm run test
- uses: actions/upload-artifact@v7
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@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 26
cache: 'npm'
- uses: actions/download-artifact@v8
with:
merge-multiple: true
- name: Run release
env:
NPM_OIDC: 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
- name: Push docs and coverage
env:
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx ggcp target/docs https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git/gh-pages --message='chore: update docs'
npx ggcp target/coverage/lcov.info https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git/coverage/${{ github.sha }}.lcov.info --message='chore: add coverage for ${{ github.sha }}'
test-node:
needs: build
if: github.event_name == 'pull_request'
name: test-node-${{ matrix.node-version }}
strategy:
matrix:
node-version: [ 22, 24, 26 ]
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- uses: actions/download-artifact@v8
with:
name: build
- run: npm ci
- run: npm run test
smoke-node-14:
needs: build
if: github.event_name == 'pull_request'
name: smoke-node-14
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: 14
- uses: actions/download-artifact@v8
with:
name: build
- run: npm install --no-package-lock
# mocha@12 is ESM with import attributes, mocha@10 is the last line that supports Node 14
- run: npm install --no-package-lock --no-save mocha@10
- run: npm run test:legacy
smoke-os:
needs: build
if: github.event_name == 'pull_request'
name: smoke-${{ matrix.os }}
strategy:
matrix:
os: [ macos-26, windows-2022, windows-2025 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: 26
cache: 'npm'
- uses: actions/download-artifact@v8
with:
name: build
- run: npm ci
- name: Run smoke tests
if: "!contains(matrix.os, 'windows')"
run: npm run test:unit
- name: Run smoke tests (windows)
if: contains(matrix.os, 'windows')
timeout-minutes: 2
run: npm run test:legacy
smoke-alpine:
needs: build
if: github.event_name == 'pull_request'
name: smoke-alpine-busybox
runs-on: ubuntu-26.04
container: node:26-alpine@sha256:c6ad9e9c1d80f6eb607c26b4b0a132ff7a2344fad1c78ea3baa2a7d4c8de6d94 # 26.13
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/download-artifact@v8
with:
name: build
- name: Verify BusyBox ps
run: |
which busybox && busybox --list | grep -w ps
ps -eo pid,ppid,args | head -5
- run: npm ci
- run: npm run test:unit