-
Notifications
You must be signed in to change notification settings - Fork 1
217 lines (209 loc) · 7.87 KB
/
Copy pathcode-checks.yml
File metadata and controls
217 lines (209 loc) · 7.87 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
name: Code tests & eval
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
check:
name: Type check
runs-on: ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: { persist-credentials: false }
- name: Setup environment
uses: ./.github/actions/common-setup
- name: svelte-check
run: pnpm check
test:
name: Unit tests
runs-on: ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: { persist-credentials: false }
- name: Setup environment
uses: ./.github/actions/common-setup
- name: vitest
run: pnpm test
build:
name: Production build
runs-on: ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: { persist-credentials: false }
- name: Setup environment
uses: ./.github/actions/common-setup
- name: Build production bundle
run: pnpm build
- name: Upload dist artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist-${{ github.sha }}
path: dist/
retention-days: 7
smoke:
name: Smoke (real sync-server)
runs-on: ubuntu-22.04
timeout-minutes: 10
# Pin sync-server by digest so this test can never silently shift if `latest`
# is republished. Refresh intentionally when targeting a different release.
services:
sync-server:
image: ghcr.io/d4rken-org/octi-server@sha256:3829efba5ca5a4d407a0d0a048b8d0c20264ad2f9e389aa087c857ea0d0bddaa
ports:
- 18080:8080
env:
OCTI_CORS_ALLOWED_ORIGINS: 'http://127.0.0.1:5173,http://localhost:5173'
sync-server-b:
image: ghcr.io/d4rken-org/octi-server@sha256:3829efba5ca5a4d407a0d0a048b8d0c20264ad2f9e389aa087c857ea0d0bddaa
ports:
- 18081:8080
env:
OCTI_CORS_ALLOWED_ORIGINS: 'http://127.0.0.1:5173,http://localhost:5173'
steps:
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: { persist-credentials: false }
- name: Setup environment
uses: ./.github/actions/common-setup
- name: Wait for sync-servers
run: |
set -euo pipefail
for port in 18080 18081; do
for attempt in $(seq 1 30); do
if curl -sf "http://127.0.0.1:${port}/v1/status" > /dev/null; then
echo "sync-server on ${port} up after ${attempt}s"
continue 2
fi
sleep 1
done
echo "sync-server on ${port} did not respond within 30s" >&2
docker logs ${{ job.services.sync-server.id }} || true
docker logs ${{ job.services['sync-server-b'].id }} || true
exit 1
done
- name: Run smoke suite
env:
SMOKE_SERVER_URL: http://127.0.0.1:18080
SMOKE_SERVER_B_URL: http://127.0.0.1:18081
run: pnpm test:smoke
- name: Dump sync-server logs on failure
if: failure()
run: |
docker logs ${{ job.services.sync-server.id }} || true
docker logs ${{ job.services['sync-server-b'].id }} || true
release-tooling:
name: Release tooling
runs-on: ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: { persist-credentials: false }
- name: Install bats + shellcheck
run: |
sudo apt-get update
sudo apt-get install -y bats shellcheck
- name: Shellcheck bump.sh
run: shellcheck tools/release/bump.sh
- name: Run bump.sh unit tests
run: bats tools/release/bump.bats
- name: Verify package.json + bump.sh are consistent
run: tools/release/bump.sh --mode=check
e2e-smoke:
name: E2E smoke
runs-on: ubuntu-22.04
timeout-minutes: 20
# Mirrors the release-tag.yml e2e job at lower cost: bootstrap a fake phone
# peer, build the SPA, drive it through Playwright with no screenshots.
# Catches selector/bootstrap drift on every PR/main push so a release tag
# never surfaces these surprises for the first time. A second sync-server
# backs the multi-connector spec (link the SPA to two servers via the UI).
services:
sync-server:
image: ghcr.io/d4rken-org/octi-server@sha256:3829efba5ca5a4d407a0d0a048b8d0c20264ad2f9e389aa087c857ea0d0bddaa
ports:
- 18080:8080
env:
OCTI_CORS_ALLOWED_ORIGINS: 'http://127.0.0.1:4173,http://localhost:4173'
sync-server-b:
image: ghcr.io/d4rken-org/octi-server@sha256:3829efba5ca5a4d407a0d0a048b8d0c20264ad2f9e389aa087c857ea0d0bddaa
ports:
- 18081:8080
env:
OCTI_CORS_ALLOWED_ORIGINS: 'http://127.0.0.1:4173,http://localhost:4173'
steps:
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: { persist-credentials: false }
- name: Setup environment
uses: ./.github/actions/common-setup
- name: Wait for sync-servers
run: |
set -euo pipefail
for port in 18080 18081; do
for attempt in $(seq 1 30); do
if curl -sf "http://127.0.0.1:${port}/v1/status" > /dev/null; then
echo "sync-server on ${port} up after ${attempt}s"
continue 2
fi
sleep 1
done
echo "sync-server on ${port} did not respond within 30s" >&2
docker logs ${{ job.services.sync-server.id }} || true
docker logs ${{ job.services['sync-server-b'].id }} || true
exit 1
done
# Three bootstrap files with independent one-time-use share codes:
# bootstrap-peer.json (server A) — the single-connector smoke spec
# peer-a.json (server A), peer-b.json (server B) — the multi-connector spec
# Separate files so the two specs never redeem the same code.
- name: Bootstrap fake phone peer (smoke, server A)
env:
SYNC_SERVER_URL: http://127.0.0.1:18080
OUTPUT_PATH: bootstrap-peer.json
run: pnpm bootstrap-peer
- name: Bootstrap fake phone peer (multi, server A)
env:
SYNC_SERVER_URL: http://127.0.0.1:18080
OUTPUT_PATH: peer-a.json
run: pnpm bootstrap-peer
- name: Bootstrap fake phone peer (multi, server B)
env:
SYNC_SERVER_URL: http://127.0.0.1:18081
OUTPUT_PATH: peer-b.json
run: pnpm bootstrap-peer
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps chromium
- name: Build SPA (stable channel for smoke)
env:
VITE_CHANNEL: stable
VITE_COMMIT_SHA: ${{ github.sha }}
run: pnpm build
- name: Run E2E smoke
env:
BOOTSTRAP_PEER_FILE: bootstrap-peer.json
run: pnpm e2e:smoke
- name: Run E2E multi-connector
env:
BOOTSTRAP_PEER_A_FILE: peer-a.json
BOOTSTRAP_PEER_B_FILE: peer-b.json
run: pnpm e2e:multi
- name: Dump sync-server logs on failure
if: failure()
run: |
docker logs ${{ job.services.sync-server.id }} || true
docker logs ${{ job.services['sync-server-b'].id }} || true
- name: Upload Playwright trace on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-trace-${{ github.run_id }}
path: |
test-results/
playwright-report/
if-no-files-found: ignore