-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (116 loc) · 3.63 KB
/
ci.yml
File metadata and controls
121 lines (116 loc) · 3.63 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
name: CI
on:
push:
branches: [main, "claude/**", "fix/**", "feat/**", "perf/**"]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
backend:
name: Backend — Test (shard ${{ matrix.shard }})
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
defaults:
run:
working-directory: backend
env:
# Split the CQL-heavy suite across parallel runners; keep this in sync with the
# length of matrix.shard above. See build.gradle.kts for the hash-based selection.
TEST_SHARD_TOTAL: "8"
TEST_SHARD_INDEX: ${{ matrix.shard }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v4
with:
# Only one shard writes the shared Gradle cache to avoid concurrent-write
# contention; the rest read it.
cache-read-only: ${{ matrix.shard != 0 }}
- name: Run backend tests (shard ${{ matrix.shard }}/8)
run: ./gradlew test --build-cache --no-daemon
- name: Per-class timings (shard balancing data)
if: always()
run: |
shopt -s nullglob
for f in build/test-results/test/*.xml; do
cls=$(basename "$f" .xml); cls=${cls#TEST-}
t=$(sed -n 's/.*<testsuite[^>]*[[:space:]]time="\([0-9.]*\)".*/\1/p' "$f" | head -1)
echo "TIMING ${t:-0} ${cls}"
done | sort -t' ' -k2 -gr
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Backend Tests (shard ${{ matrix.shard }})
path: backend/build/test-results/test/*.xml
reporter: java-junit
frontend:
name: Frontend — Lint, Test, Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.17.1
run_install: false
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml
- name: Install deps
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Unit tests
run: pnpm test
- name: Build
env:
NEXT_PUBLIC_API_BASE_URL: https://workwell-measure-studio-api.fly.dev
NEXT_PUBLIC_APP_NAME: WorkWell Measure Studio
NEXT_PUBLIC_DEMO_MODE: "false"
run: pnpm build
e2e:
name: Playwright E2E (manual)
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.17.1
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install e2e dependencies
working-directory: e2e
run: pnpm install
- name: Install Playwright browsers
working-directory: e2e
run: npx playwright install chromium --with-deps
- name: Run E2E tests
working-directory: e2e
env:
PLAYWRIGHT_BASE_URL: https://workwell-measure-studio.vercel.app
run: npx playwright test
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: e2e/playwright-report/