-
Notifications
You must be signed in to change notification settings - Fork 1
190 lines (155 loc) · 4.99 KB
/
Copy pathdevelop-ci.yml
File metadata and controls
190 lines (155 loc) · 4.99 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
name: Develop CI
on:
pull_request:
branches:
- develop
push:
branches:
- develop
workflow_dispatch:
concurrency:
group: develop-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
backend-test:
name: Backend lint and tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Public repository hygiene
run: ./scripts/check_public_hygiene.sh
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Python dependencies
run: uv sync --extra dev
- name: Lint backend
run: uv run --extra dev ruff check .
- name: Run backend tests
run: uv run --extra dev python -m pytest --junitxml=reports/pytest.xml
- name: Upload backend test report
if: always()
uses: actions/upload-artifact@v4
with:
name: develop-backend-test-report
path: reports/pytest.xml
if-no-files-found: ignore
retention-days: 7
frontend-build:
name: Frontend build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dashboard dependencies
working-directory: frontend
run: npm ci
- name: Build dashboard
working-directory: frontend
run: npm run build
- name: Upload dashboard build
uses: actions/upload-artifact@v4
with:
name: develop-dashboard-dist
path: frontend/dist/
if-no-files-found: error
retention-days: 7
macos-package-smoke:
name: macOS app and DMG smoke
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Python dependencies
run: uv sync --extra dev
- name: Install dashboard dependencies
working-directory: frontend
run: npm ci
- name: Build app bundle and DMG
run: ./scripts/package_macos.sh
- name: Verify app signature
run: codesign --verify --deep --strict --verbose=2 build/macos/KOQUANT.app
- name: Smoke test packaged backend
run: |
set -euo pipefail
log_file="$(mktemp)"
server_pid=""
cleanup() {
if [[ -n "$server_pid" ]]; then
kill "$server_pid" >/dev/null 2>&1 || true
wait "$server_pid" >/dev/null 2>&1 || true
fi
cat "$log_file"
}
trap cleanup EXIT
KOQUANT_FRONTEND_DIST="$PWD/build/macos/KOQUANT.app/Contents/Resources/frontend/dist" \
build/macos/KOQUANT.app/Contents/Resources/Backend/koquant-server \
--no-browser \
--host 127.0.0.1 \
--port 18000 \
--mode paper \
--config-dir "$PWD/build/macos/KOQUANT.app/Contents/Resources/config" \
> "$log_file" 2>&1 &
server_pid="$!"
health=""
for _ in {1..30}; do
health="$(curl -fsS http://127.0.0.1:18000/health 2>/dev/null || true)"
if [[ "$health" == *'"mode":"paper"'* ]]; then
break
fi
sleep 1
done
grep -q "KOQUANT dashboard: http://127.0.0.1:18000/" "$log_file"
[[ "$health" == *'"mode":"paper"'* ]]
curl -fsS http://127.0.0.1:18000/api/broker/status
curl -fsS -X POST "http://127.0.0.1:18000/api/ops/halt?reason=ci-smoke"
curl -fsS -X POST "http://127.0.0.1:18000/api/ops/resume?reason=ci-smoke"
- name: Verify DMG checksum
run: hdiutil verify build/macos/KOQUANT.dmg
- name: Verify DMG contents
run: |
set -euo pipefail
mount_dir="$(mktemp -d)"
cleanup() {
hdiutil detach "$mount_dir" >/dev/null 2>&1 || true
rm -rf "$mount_dir"
}
trap cleanup EXIT
hdiutil attach build/macos/KOQUANT.dmg \
-nobrowse \
-readonly \
-owners off \
-mountpoint "$mount_dir"
test -d "$mount_dir/KOQUANT.app"
test -L "$mount_dir/Applications"
- name: Upload develop DMG
uses: actions/upload-artifact@v4
with:
name: develop-koquant-macos-dmg
path: build/macos/KOQUANT.dmg
if-no-files-found: error
retention-days: 7