Repository navigation
125 lines (111 loc) · 4.15 KB
/
Copy pathci.yml
File metadata and controls
125 lines (111 loc) · 4.15 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
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
# A newer push to the same PR makes the older run obsolete. Runs on main always finish.
concurrency:
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# The real spreadsheets never reach CI: tests, e2e and the container smoke test use the
# synthetic workbooks in samples/fixture (scripts/make-fixture.mjs).
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
# Install packageManager directly: Node 26 does not bundle Corepack.
- name: Install pinned pnpm
run: |
npm install --global "$(node -p "require('./package.json').packageManager")"
pnpm --version
- name: Install build deps for better-sqlite3
run: sudo apt-get update && sudo apt-get install -y python3 make g++
- run: pnpm install --frozen-lockfile
- name: Lint (Prettier + ESLint)
run: pnpm lint
- run: pnpm check
- name: Unit tests
run: pnpm test
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
- name: Install pinned pnpm
run: |
npm install --global "$(node -p "require('./package.json').packageManager")"
pnpm --version
- name: Install build deps for better-sqlite3
run: sudo apt-get update && sudo apt-get install -y python3 make g++
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Playwright version
id: playwright
run: echo "version=$(pnpm exec playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-chromium
- name: Install Playwright Chromium
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm exec playwright install --with-deps chromium
- name: Install Playwright system dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: pnpm exec playwright install-deps chromium
- name: E2E tests (Playwright + axe)
run: pnpm test:e2e
- name: Upload Playwright traces
if: failure()
uses: actions/upload-artifact@v7
with:
name: playwright-traces
path: test-results/
retention-days: 7
# Exercise the native SQLite module and startup on both release architectures before publishing.
docker:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v7
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- name: Build image (no push)
uses: docker/build-push-action@v7
with:
context: .
push: false
load: true
tags: data-stats:ci-${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
cache-from: |
type=gha,scope=docker-${{ matrix.arch }}
type=gha
cache-to: type=gha,mode=max,scope=docker-${{ matrix.arch }}
- name: Smoke test (import synthetic workbooks, serve /health and /)
run: |
set -euo pipefail
docker run -d --name smoke --platform linux/${{ matrix.arch }} -p 3000:3000 \
--mount type=bind,src="$PWD/samples/fixture",dst=/data,readonly \
data-stats:ci-${{ matrix.arch }}
for i in $(seq 1 90); do
if curl -fsS http://127.0.0.1:3000/health | tee /tmp/health.json | grep -q '"ok":true'; then break; fi
sleep 2
done
cat /tmp/health.json
grep -q '"captures":[1-9]' /tmp/health.json
curl -fsS -o /dev/null http://127.0.0.1:3000/
curl -fsS -o /dev/null http://127.0.0.1:3000/tides
docker logs smoke
docker rm -f smoke