-
Notifications
You must be signed in to change notification settings - Fork 111
206 lines (168 loc) · 5.9 KB
/
Copy pathci.yml
File metadata and controls
206 lines (168 loc) · 5.9 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
# ── Frontend quality gate ─────────────────────────────────────────────────
frontend:
name: Frontend (lint → typecheck → build → test)
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint (fail on warnings)
run: npm run lint -- --max-warnings=0
- name: Typecheck
run: npm run typecheck
- name: Build
run: npm run build
- name: Test
run: npm test
# ── Soroban ABI golden-vector drift guard ────────────────────────────────
golden-vectors:
name: Soroban ABI golden vectors
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
contains(toJson(github.event.pull_request.changed_files), 'contracts/') ||
contains(toJson(github.event.pull_request.changed_files), 'backend/src/soroban/') ||
contains(toJson(github.event.pull_request.changed_files), 'backend/src/tx/')
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm install
- name: Run golden-vector encoding tests
run: npx jest --testPathPattern="golden-vectors" --no-coverage
- name: Verify vectors are up-to-date (no uncommitted drift)
run: |
npx ts-node ../scripts/refresh-vectors.ts
if ! git diff --exit-code backend/src/soroban/golden-vectors.json; then
echo "::error::golden-vectors.json is stale. Run 'npm run refresh-vectors' locally, review the diff, and commit the updated file."
exit 1
fi
# ── Smart contract (Rust / Soroban) ──────────────────────────────────────
contract:
name: Contract (Rust / Soroban)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Run contract tests
run: cargo test --workspace --features testutils
- name: Build WASM (release)
run: cargo build --release --target wasm32-unknown-unknown --workspace
# ── Backend unit tests ────────────────────────────────────────────────────
unit-tests:
name: Backend unit tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
env:
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
NODE_ENV: test
steps:
- uses: actions/checkout@v4
- name: Start Redis
run: |
sudo apt-get update -qq
sudo apt-get install -y redis-server
sudo systemctl start redis-server
redis-cli ping
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm test
# ── Playwright E2E tests ──────────────────────────────────────────────────
e2e-tests:
name: Playwright E2E tests
runs-on: ubuntu-latest
needs: frontend
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test --reporter=html
continue-on-error: true
- name: Upload Playwright artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-failure-${{ github.run_id }}
path: |
test-results/
playwright-report/
retention-days: 14
# ── Accessibility (axe) ───────────────────────────────────────────────────
accessibility:
name: Accessibility (axe / Playwright)
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: frontend/package-lock.json
- run: npm ci
- run: npm run build
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run axe accessibility checks
run: npx playwright test tests/accessibility.spec.ts --reporter=list
env:
BASE_URL: http://localhost:3000
- uses: actions/upload-artifact@v4
if: failure()
with:
name: axe-report-${{ github.sha }}
path: frontend/playwright-report/
retention-days: 14