-
-
Notifications
You must be signed in to change notification settings - Fork 420
204 lines (167 loc) · 6.44 KB
/
Copy pathbuild-and-test.yml
File metadata and controls
204 lines (167 loc) · 6.44 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
name: Build Affected Packages
permissions:
contents: read
actions: read
on:
pull_request:
branches: [main, '**']
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
checkout-install:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
e2e_suites: ${{ steps.e2e-affected.outputs.e2e_suites }}
steps:
- name: Checkout Repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
- name: Setup Node.js 24
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '24'
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Evaluate E2E affected suites
id: e2e-affected
run: node tools/scripts/ci-is-affected.mjs --githubOutputAll=e2e_suites
- name: Restore Turborepo cache
id: turbo-cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: .turbo/cache
key: ${{ runner.os }}-turbo-${{ github.ref_name }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-turbo-${{ github.ref_name }}-
${{ runner.os }}-turbo-
- name: Install Cypress
run: npx cypress install
- name: Check code format
run: node tools/scripts/check-format-changed.mjs
- name: Test CI affected policy
run: node --test tools/scripts/ci-is-affected.test.mjs
- name: Verify Rslib Template Publint Wiring
run: node packages/create-module-federation/scripts/verify-rslib-templates.mjs
- name: Verify Package Rslib Publint Wiring
run: node tools/scripts/verify-rslib-publint-coverage.mjs
- name: Verify Publint Workflow Coverage
run: node tools/scripts/verify-publint-workflow-coverage.mjs
- name: Verify Turbo Conventions
run: pnpm run verify:turbo
- name: Build packages
run: pnpm run build:packages
- name: Check Package Publishing Compatibility
run: |
for pkg in packages/*; do
if [ -f "$pkg/package.json" ] && \
[ "$pkg" != "packages/assemble-release-plan" ] && \
[ "$pkg" != "packages/chrome-devtools" ] && \
[ "$pkg" != "packages/core" ] && \
[ "$pkg" != "packages/modernjs" ] && \
[ "$pkg" != "packages/utilities" ]; then
echo "Checking $pkg..."
npx publint "$pkg"
fi
done
- name: Run affected package tests
run: node tools/scripts/run-affected-package-tests.mjs
- name: Pack Node.js 20 compatibility artifacts
if: ${{ !startsWith(github.head_ref, 'release-v') }}
run: node tools/scripts/prepare-node20-compat-packages.mjs
- name: Upload Node.js 20 compatibility artifacts
if: ${{ !startsWith(github.head_ref, 'release-v') }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: node20-compat-packages
path: artifacts/node20-compat/*.tgz
if-no-files-found: error
retention-days: 1
- name: Save Turborepo cache
if: ${{ success() && steps.turbo-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: .turbo/cache
key: ${{ steps.turbo-cache.outputs.cache-primary-key }}
e2e-modern:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).modern }}
uses: ./.github/workflows/e2e-modern.yml
secrets: inherit
node20-compat:
if: ${{ !startsWith(github.head_ref, 'release-v') }}
needs: checkout-install
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout Repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Setup Node.js 20.19.5
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '20.19.5'
- name: Download Node.js 20 compatibility artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: node20-compat-packages
path: artifacts/node20-compat
- name: Verify published packages on Node.js 20.19.5
run: node tools/scripts/verify-node20-compat.mjs
e2e-runtime:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).runtime }}
uses: ./.github/workflows/e2e-runtime.yml
secrets: inherit
e2e-manifest:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).manifest }}
uses: ./.github/workflows/e2e-manifest.yml
secrets: inherit
e2e-node:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).node }}
uses: ./.github/workflows/e2e-node.yml
secrets: inherit
e2e-next-dev:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).next }}
uses: ./.github/workflows/e2e-next-dev.yml
secrets: inherit
e2e-next-prod:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).next }}
uses: ./.github/workflows/e2e-next-prod.yml
secrets: inherit
e2e-treeshake:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).treeshake }}
uses: ./.github/workflows/e2e-treeshake.yml
secrets: inherit
e2e-modern-ssr:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).modernSsr }}
uses: ./.github/workflows/e2e-modern-ssr.yml
secrets: inherit
e2e-router:
needs: checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).router }}
uses: ./.github/workflows/e2e-router.yml
secrets: inherit
e2e-metro:
needs:
- checkout-install
if: ${{ fromJSON(needs.checkout-install.outputs.e2e_suites).metro }}
uses: ./.github/workflows/e2e-metro.yml
secrets: inherit
devtools:
needs: checkout-install
uses: ./.github/workflows/devtools.yml
secrets: inherit