-
Notifications
You must be signed in to change notification settings - Fork 296
180 lines (159 loc) · 5.1 KB
/
ci.yml
File metadata and controls
180 lines (159 loc) · 5.1 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call: # allow other workflows to run CI as a gate
permissions:
contents: read
concurrency:
group: ci-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- name: Build plugin (needed for benchmark workspace type resolution)
run: vp run build
- run: vp run check
test-unit:
name: Vitest (unit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- run: vp test run --project unit
test-integration:
name: Vitest (integration ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3]
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- name: Build plugin (needed by ecosystem and nextjs-compat fixtures)
run: vp run build
- run: vp test run --project integration --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
env:
CI: true
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: blob-report-${{ matrix.shardIndex }}
path: .vitest-reports/*
include-hidden-files: true
retention-days: 1
test-integration-merge:
name: Vitest (integration report)
if: ${{ !cancelled() }}
needs: [test-integration]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- uses: actions/download-artifact@v7
with:
path: .vitest-reports
pattern: blob-report-*
merge-multiple: true
- run: vp test run --merge-reports
env:
CI: true
create-next-app:
name: create-next-app (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- name: Build plugin
run: vp run build
- name: Pack vinext for local install
run: vp pm pack --pack-destination "${{ runner.temp }}"
working-directory: packages/vinext
- name: Scaffold a fresh create-next-app project
run: vp dlx create-next-app@latest "${{ runner.temp }}/cna-test" --yes
- name: Install vinext from local tarball
working-directory: ${{ runner.temp }}/cna-test
shell: bash
run: vp add "${{ runner.temp }}"/vinext-*.tgz
- name: Run vinext init
working-directory: ${{ runner.temp }}/cna-test
run: vp exec vinext init --skip-check
- name: Start dev server and verify HTTP 200
working-directory: ${{ runner.temp }}/cna-test
shell: bash
run: |
vp exec vite dev --port 3099 &
SERVER_PID=$!
for i in $(seq 1 30); do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3099/ || true)
if [ "$STATUS" = "200" ]; then
echo "Server responded with HTTP 200 (attempt $i)"
kill "$SERVER_PID" 2>/dev/null || true
exit 0
fi
sleep 1
done
echo "Server did not respond with HTTP 200 within 30 seconds"
kill "$SERVER_PID" 2>/dev/null || true
exit 1
e2e:
name: E2E (${{ matrix.project }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- pages-router
- app-router
- cloudflare-pages-router
- pages-router-prod
- cloudflare-workers
- cloudflare-dev
- cloudflare-pages-router-dev
- static-export
- app-with-src
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- name: Build plugin
run: vp run build
- name: Cache Playwright browsers
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: playwright-chromium-${{ runner.os }}-${{ hashFiles('**/package.json') }}
- run: vp exec playwright install chromium
- run: vp run test:e2e
env:
CI: true
PLAYWRIGHT_PROJECT: ${{ matrix.project }}
- uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-report-${{ matrix.project }}
path: playwright-report/
retention-days: 7
ci:
name: CI
if: ${{ always() }}
needs: [check, test-unit, test-integration-merge, create-next-app, e2e]
runs-on: ubuntu-latest
steps:
- name: All checks passed
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
run: echo "All checks passed"
- name: Some checks failed
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1