-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (86 loc) · 3.52 KB
/
Copy pathci.yml
File metadata and controls
90 lines (86 loc) · 3.52 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
name: ci
on:
push:
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
# npm install (not ci): esbuild ships platform-specific optional binaries;
# install resolves the runner's platform and skips the others, where a
# cross-platform-pinned lockfile would make `npm ci` fail EBADPLATFORM.
- run: npm install --no-audit --no-fund
- name: Test (vitest + coverage gate)
run: npm test
- name: Build single-file SPA
run: npm run build
- uses: actions/upload-artifact@v4
with:
name: sql-browser-dist
path: dist/sql.html
retention-days: 14
# Release-bundle smoke test: assemble the curl|sh artifact, extract it, and boot
# the zero-dep Python runner exactly as an end user would — proving the bundle
# layout, the SPA-path discovery, and config.json generation all work before a
# tag ever cuts a real release.
bundle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: npm install --no-audit --no-fund
- name: Build release bundle
run: build/bundle.sh
- name: Extract + boot the runner (as a user would)
run: |
set -euo pipefail
tmp=$(mktemp -d)
tar -C "$tmp" -xzf dist/altinity-sql-browser.tar.gz --strip-components=1
for f in sql.html local.py sql-browser.xml run.sh VERSION; do
test -f "$tmp/$f" || { echo "missing $f in bundle" >&2; exit 1; }
done
python3 -c "import ast,sys; ast.parse(open(sys.argv[1]).read())" "$tmp/local.py"
# No LOCAL_CH_CONFIG: the runner discovers the bundled sql-browser.xml
# next to local.py, proving the merge/discovery path end to end.
# SQL_BROWSER_PROBE=0: don't depend on reaching external demo hosts from CI.
SQL_BROWSER_PROBE=0 PORT=8901 "$tmp/run.sh" &
pid=$!
for i in $(seq 1 20); do curl -fsS "http://localhost:8901/sql" >/dev/null 2>&1 && break; sleep 0.5; done
curl -fsS "http://localhost:8901/sql" >/dev/null
curl -fsS "http://localhost:8901/config.json" \
| python3 -c "import sys,json; assert json.load(sys.stdin)['hosts'], 'no hosts parsed'"
kill "$pid"
- name: Lint the installer (shellcheck)
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq shellcheck
shellcheck install.sh build/bundle.sh
# Real-browser regression tests (Playwright). Runs on Linux runners where the
# Gecko/Chromium binaries launch normally — separate from the unit suite so a
# missing browser binary can't mask a unit failure, and vice versa. The
# harness imports /src directly over a python http.server (started by the
# Playwright config's webServer), so no build step is needed.
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: npm install --no-audit --no-fund
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium firefox
- name: E2E (Playwright — Chromium + Firefox)
run: npm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: playwright-results
path: test-results/
retention-days: 14