Repository navigation
209 lines (199 loc) · 7.59 KB
/
Copy pathci.yml
File metadata and controls
209 lines (199 loc) · 7.59 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
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Node 26 (LTS since 2026-10) is tested but not a required check yet.
node: [22, 24, 26]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node }}
cache: npm
- run: npm ci
- name: Python tools for the golden-file tests (openpyxl)
run: |
python3 -m venv "$RUNNER_TEMP/py"
"$RUNNER_TEMP/py/bin/pip" install --quiet openpyxl==3.1.5
echo "JSE_PYTHON=$RUNNER_TEMP/py/bin/python" >> "$GITHUB_ENV"
- run: npm run typecheck
- run: npm test
- run: npm run build
- run: npm run lint
# OPS-11: javascript-excel has no runtime dependencies, and only dist/ +
# README + LICENSE + package.json are published. A new runtime
# dependency means changing this allowlist in the same pull request.
- name: Dependency guard (runtime allowlist, tarball contents)
run: node scripts/check-deps.mjs --package packages/javascript-excel --allow '' --pack
- name: Packed-tarball smoke test
run: npm run smoke
# Opens the golden workbooks in LibreOffice headless (test/write/libreoffice.test.ts), and
# reads files LibreOffice wrote (test/read/libreoffice.test.ts).
# Not a required check. It fails, not skips, when LibreOffice or openpyxl is missing.
libreoffice:
name: LibreOffice
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
cache: npm
- run: npm ci
- name: Install LibreOffice Calc (headless)
run: |
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends libreoffice-calc-nogui
soffice --version
- name: Python tools (openpyxl)
run: |
python3 -m venv "$RUNNER_TEMP/py"
"$RUNNER_TEMP/py/bin/pip" install --quiet openpyxl==3.1.5
echo "JSE_PYTHON=$RUNNER_TEMP/py/bin/python" >> "$GITHUB_ENV"
- name: LibreOffice headless check
env:
JSE_REQUIRE_LIBREOFFICE: "1"
# One file at a time: headless LibreOffice instances sharing a profile block each other.
run: npm -w packages/javascript-excel exec -- vitest run --no-file-parallelism test/write/libreoffice.test.ts test/read/libreoffice.test.ts test/conformance/libreoffice.test.ts test/format/libreoffice.test.ts
# The conformance corpus (docs/conformance.md) as a downloadable artifact,
# for the manual check in Excel and Numbers.
- name: Build the conformance corpus
run: npm -w packages/javascript-excel run conformance:artifact
- uses: actions/upload-artifact@v7
with:
name: conformance-corpus
path: packages/javascript-excel/conformance-corpus/
if-no-files-found: error
retention-days: 90
# javascript-excel/dom in a real browser (test/browser, Vitest browser mode +
# Playwright Chromium). Not a required check.
browser:
name: Browser
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
cache: npm
- run: npm ci
- name: Playwright version
id: pw
run: echo "version=$(npm -w packages/javascript-excel exec -- playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-chromium-headless-shell
- name: Install Chromium (headless shell) and its system libraries
run: npm -w packages/javascript-excel exec -- playwright install --with-deps --only-shell chromium
- name: Browser tests
run: npm -w packages/javascript-excel run test:browser
# Write/read/CSV benchmarks at 10k, 100k and 1M cells (packages/javascript-excel/bench/run.mjs).
# Not a required check: it reports numbers (job summary + artifact) and fails only if a run crashes.
bench:
name: Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
cache: npm
- run: npm ci
- run: npm run build -w packages/javascript-excel
- name: Benchmarks (Node 26)
run: npm run bench -- --json "$RUNNER_TEMP/bench.json"
- name: Render model benchmarks (Node 26)
run: npm -w packages/javascript-excel run bench:render -- --json "$RUNNER_TEMP/bench-render.json"
- uses: actions/upload-artifact@v7
with:
name: benchmarks
path: |
${{ runner.temp }}/bench.json
${{ runner.temp }}/bench-render.json
# The guides' examples (examples/), the README snippets and the API reference.
# Not a required check.
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
cache: npm
- run: npm ci
- name: Code in the READMEs and guides matches examples/
run: npm run docs:check
- name: Build the package; check, build and run the examples
run: npm run examples
- name: API reference (TypeDoc, from the .d.ts)
run: npm run build -w tools/api-docs
- uses: actions/upload-artifact@v7
with:
name: api-reference
path: tools/api-docs/out
consumer-ts:
name: Consumer TS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
cache: npm
- run: npm ci
- run: npm run build -w packages/javascript-excel
- name: Type-check the packed tarball with TypeScript 5.0–7.0
run: npm run consumer-ts
release-dry-run:
name: Release dry run
runs-on: ubuntu-latest
env:
PACKAGE_DIR: packages/javascript-excel
steps:
# On a pull_request, HEAD is the test merge commit and HEAD~1 is the
# base branch tip, so the release check below previews what merging
# this PR would do.
- uses: actions/checkout@v7
with:
fetch-depth: 2
- uses: actions/setup-node@v7
with:
node-version: 26
cache: npm
- run: npm ci
- name: Release script unit tests
run: node --test "scripts/*.test.mjs"
- name: Release preview (what merging this would publish)
id: check
run: node scripts/release-check.mjs --package "$PACKAGE_DIR"
- run: npm run build --if-present
- name: npm pack --dry-run
run: npm pack "./$PACKAGE_DIR" --dry-run
- name: npm publish --dry-run
env:
PUBLISHED: ${{ steps.check.outputs.published }}
DIST_TAG: ${{ steps.check.outputs.dist-tag }}
run: |
if [ "$PUBLISHED" = "true" ]; then
# npm refuses even a dry run over a version that is already on
# npm, so dry-run a throwaway prerelease of it instead (this
# checkout is discarded after the job).
(cd "$PACKAGE_DIR" && npm version prerelease --preid dryrun --no-git-tag-version --ignore-scripts --workspaces-update=false)
DIST_TAG=next
fi
npm publish "./$PACKAGE_DIR" --dry-run --tag "$DIST_TAG"