-
Notifications
You must be signed in to change notification settings - Fork 111
173 lines (159 loc) · 5.33 KB
/
Copy pathci.yml
File metadata and controls
173 lines (159 loc) · 5.33 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
# ── Soroban ABI golden-vector drift guard ────────────────────────────────
golden-vectors:
name: Soroban ABI golden vectors
runs-on: ubuntu-latest
# Run whenever contracts or backend builder code changes
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 ────────────────────────────────────────────────────────
contract:
name: Contract (Rust / Soroban)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Determine package manager
id: pkgmgr
run: |
if [ -f pnpm-lock.yaml ]; then
echo "manager=pnpm" >> "$GITHUB_OUTPUT"
elif [ -f package-lock.json ]; then
echo "manager=npm" >> "$GITHUB_OUTPUT"
elif [ -f yarn.lock ]; then
echo "manager=yarn" >> "$GITHUB_OUTPUT"
else
echo "manager=npm" >> "$GITHUB_OUTPUT"
fi
- name: Setup pnpm when needed
if: steps.pkgmgr.outputs.manager == 'pnpm'
uses: pnpm/action-setup@v2
with:
version: 8
- name: Cache node modules
uses: actions/cache@v4
with:
path: |
node_modules
~/.pnpm-store
key: ${{ runner.os }}-node-${{ steps.pkgmgr.outputs.manager }}-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml', '**/yarn.lock') }}
restore-keys: ${{ runner.os }}-node-${{ steps.pkgmgr.outputs.manager }}-
- name: Cache .next cache
uses: actions/cache@v4
with:
path: .next/cache
key: ${{ runner.os }}-next-cache-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml', '**/yarn.lock') }}
restore-keys: ${{ runner.os }}-next-cache-
- name: Install dependencies
run: |
if [ "${{ steps.pkgmgr.outputs.manager }}" = "pnpm" ]; then
pnpm install --frozen-lockfile
else
npm ci
fi
- name: Lint (fail on warnings)
run: |
if [ "${{ steps.pkgmgr.outputs.manager }}" = "pnpm" ]; then
pnpm eslint --max-warnings=0 .
else
npm run lint -- --max-warnings=0
fi
- name: TypeScript compile
run: |
if [ "${{ steps.pkgmgr.outputs.manager }}" = "pnpm" ]; then
pnpm tsc --noEmit
else
npm run build --if-present -- --noEmit
fi
- name: Build
run: |
if [ "${{ steps.pkgmgr.outputs.manager }}" = "pnpm" ]; then
pnpm build
else
npm run build
fi
unit-tests:
name: 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
# Install Redis directly on the runner — avoids Docker Hub rate limits entirely
- 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
e2e-tests:
name: Playwright E2E tests
runs-on: ubuntu-latest
needs: quality-build
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@v3
with:
name: playwright-failure-${{ github.run_id }}
path: |
test-results
playwright-report
traces
.playwright/traces