-
Notifications
You must be signed in to change notification settings - Fork 1
174 lines (166 loc) · 5.84 KB
/
Copy pathcode-checks.yml
File metadata and controls
174 lines (166 loc) · 5.84 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
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'
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-server
run: |
set -euo pipefail
for attempt in $(seq 1 30); do
if curl -sf http://127.0.0.1:18080/v1/status > /dev/null; then
echo "sync-server up after ${attempt}s"
exit 0
fi
sleep 1
done
echo "sync-server did not respond within 30s" >&2
docker logs ${{ job.services.sync-server.id }} || true
exit 1
- name: Run smoke suite
env:
SMOKE_SERVER_URL: http://127.0.0.1:18080
run: pnpm test:smoke
- name: Dump sync-server logs on failure
if: failure()
run: docker logs ${{ job.services.sync-server.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: 15
# 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.
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'
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-server
run: |
set -euo pipefail
for attempt in $(seq 1 30); do
if curl -sf http://127.0.0.1:18080/v1/status > /dev/null; then
echo "sync-server up after ${attempt}s"
exit 0
fi
sleep 1
done
echo "sync-server did not respond within 30s" >&2
docker logs ${{ job.services.sync-server.id }} || true
exit 1
- name: Bootstrap fake phone peer
env:
SYNC_SERVER_URL: http://127.0.0.1:18080
OUTPUT_PATH: bootstrap-peer.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: Dump sync-server logs on failure
if: failure()
run: docker logs ${{ job.services.sync-server.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