-
Notifications
You must be signed in to change notification settings - Fork 741
249 lines (228 loc) · 8.99 KB
/
Copy pathtest.yml
File metadata and controls
249 lines (228 loc) · 8.99 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: Tests
on:
pull_request:
merge_group:
push:
branches:
- main
concurrency:
# Cancel existing builds for the same PR.
# Otherwise, all other builds will be allowed to run through.
group: test.yml-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
permissions:
# Read repo
contents: read
# Read/write artifacts
actions: write
# Required for adding comments to PR.
# Specifically for sticky-pull-request-comment workflow action.
pull-requests: write
jobs:
fixup:
if: github.event_name == 'pull_request'
uses: ./.github/workflows/fixup.yml
labels:
if: github.event_name == 'pull_request'
uses: ./.github/workflows/labels.yml
test:
strategy:
matrix:
os:
[
{ name: linux, arch: X64, image: ubuntu-22.04 },
{ name: linux-arm, arch: ARM64, image: ubuntu-22.04-arm },
{ name: macOS, arch: ARM64, image: macos-15 },
{ name: windows, arch: X64, image: windows-2025 },
]
config: [
# Default build: no suffix or additional bazel arguments
{ suffix: '' },
# Debug build
{ suffix: -debug },
]
include:
# Add an Address Sanitizer (ASAN) build on Linux for additional checking.
- os: { name: linux, arch: X64, image: ubuntu-22.04 }
config: { suffix: -asan }
# TODO (later): The custom Windows-debug configuration consistently runs out of disk
# space on CI, disable it for now. Once https://github.com/bazelbuild/bazel/issues/21615
# has been resolved we can likely re-enable it and possibly fold up the custom
# configurations, as we can more easily disable PDB file generation.
# - os: { name : windows, image : windows-2025 }
# config: { suffix: -debug, bazel-args: --config=windows_dbg }
exclude:
- os: { name: windows, arch: X64, image: windows-2025 }
config: { suffix: -debug }
# due to resource constraints, exclude the macOS and x64 Linux debug runners for now.
# linux-asan and arm64 linux-debug should provide sufficient coverage for building in the
# debug configuration.
- os: { name: macOS, arch: ARM64 ,image: macos-15 }
config: { suffix: -debug }
- os: { name: linux, arch: X64, image: ubuntu-22.04 }
config: { suffix: -debug }
# linux release is handled by separate test-linux job
- os: { name: linux, arch: X64, image: ubuntu-22.04 }
config: { suffix: '' }
fail-fast: false
name: test (${{ matrix.os.name }}, ${{ matrix.os.image}}${{matrix.config.suffix != '' && format(', {0}', matrix.config.suffix) || ''}})
uses: ./.github/workflows/_bazel.yml
with:
image: ${{ matrix.os.image }}
os_name: ${{ matrix.os.name }}
arch_name: ${{ matrix.os.arch }}
suffix: ${{ matrix.config.suffix }}
extra_bazel_args: '--config=ci-test --config=ci-${{matrix.os.name}}${{matrix.config.suffix}}'
secrets:
BAZEL_CACHE_KEY: ${{ secrets.BAZEL_CACHE_KEY }}
WORKERS_MIRROR_URL: ${{ secrets.WORKERS_MIRROR_URL }}
# Handled separately from `test` to speed up execution of workers-sdk-test which depends on it.
test-linux:
uses: ./.github/workflows/_bazel.yml
with:
image: ubuntu-22.04
os_name: linux
arch_name: 'X64'
suffix: ''
extra_bazel_args: '--config=ci-test --config=ci-linux'
upload_test_logs: true
upload_binary: true
build_container_images: true
secrets:
BAZEL_CACHE_KEY: ${{ secrets.BAZEL_CACHE_KEY }}
WORKERS_MIRROR_URL: ${{ secrets.WORKERS_MIRROR_URL }}
lint:
uses: ./.github/workflows/_bazel.yml
with:
extra_bazel_args: '--config=lint --config=clang-tidy --config=ci-test --config=ci-linux'
run_tests: false
parse_headers: true
secrets:
BAZEL_CACHE_KEY: ${{ secrets.BAZEL_CACHE_KEY }}
WORKERS_MIRROR_URL: ${{ secrets.WORKERS_MIRROR_URL }}
check-snapshot:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Cache
id: cache
uses: actions/cache@v4
# Use same cache and build configuration as release build, this allows us to keep download
# sizes small and generate types with optimization enabled, should be slightly faster.
with:
path: ~/bazel-disk-cache
key: bazel-disk-cache-release-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}
- name: Setup Runner
uses: ./.github/actions/setup-runner
- name: build types
run: |
bazel build --strip=always --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --config=ci --config=release_linux //types
- name: Check snapshot diff
run: |
diff -r types/generated-snapshot/latest bazel-bin/types/definitions/latest > types.diff
diff -r types/generated-snapshot/experimental bazel-bin/types/definitions/experimental >> types.diff
- name: 'Put diff on the environment'
if: failure()
id: types_diff
run: |
{
echo 'TYPES_DIFF<<EOF'
cat types.diff
echo EOF
} >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: generated-snapshot
path: bazel-bin/types/definitions/
- name: 'Comment on PR with error details'
if: failure()
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728
with:
message: |
The generated output of `@cloudflare/workers-types` has been changed by this PR. If this is intentional, run `just generate-types` to update the snapshot. Alternatively, you can download the full generated types: ${{ steps.artifact-upload-step.outputs.artifact-url }}
<details>
<summary>Full Type Diff</summary>
```diff
${{ env.TYPES_DIFF }}
```
</details>
- name: 'Comment on PR with error details'
if: success()
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728
with:
only_update: true
message: |
The generated output of `@cloudflare/workers-types` matches the snapshot in `types/generated-snapshot` :tada:
workers-sdk-test:
needs: [test-linux, check-snapshot]
name: Run workers-sdk tests
runs-on: ubuntu-22.04
steps:
- name: Checkout workers-sdk
uses: actions/checkout@v4
with:
repository: cloudflare/workers-sdk
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
# Match workers-sdk node version
node-version: 20.19.1
cache: 'pnpm'
- name: Install workers-sdk dependencies
run: pnpm install
- name: Download workerd binary
uses: actions/download-artifact@v4
with:
name: linux-X64-binary
path: /tmp
- name: Make workerd binary executable
run: chmod +x /tmp/workerd
- name: Download generated types
uses: actions/download-artifact@v4
with:
name: generated-snapshot
path: /tmp/test-types
- name: Create and install workers-types package
run: |
cp /tmp/test-types/oldest/* /tmp/test-types
cat > /tmp/test-types/package.json << EOF
{
"name": "@cloudflare/workers-types"
}
EOF
pnpm add /tmp/test-types -w
- name: Run Wrangler unit tests
# Run all the wrangler unit tests besides the ConfigController ones since those
# are currently very flaky (the ANT team will look into stabilizing them and
# re-enabling them here as soon as possible, ref: https://jira.cfdata.org/browse/DEVX-2309)
run: pnpm test:ci --filter wrangler -- -t '^((?!(ConfigController)).)*$'
env:
MINIFLARE_WORKERD_PATH: /tmp/workerd
- name: Run Miniflare unit tests
run: pnpm test:ci --filter miniflare
env:
MINIFLARE_WORKERD_PATH: /tmp/workerd
- name: Run Vite unit tests
run: pnpm test:ci --filter @cloudflare/vite-plugin
env:
MINIFLARE_WORKERD_PATH: /tmp/workerd
- name: Run Vitest unit tests
run: pnpm test:ci --filter="./fixtures/vitest-pool-workers-examples"
env:
MINIFLARE_WORKERD_PATH: /tmp/workerd
- name: Run Wrangler Node.js e2e tests
run: pnpm test:e2e --filter wrangler -- unenv-preset
env:
MINIFLARE_WORKERD_PATH: /tmp/workerd
wpt-report:
needs: [test-linux]
uses: ./.github/workflows/_wpt.yml
with:
image: 'ubuntu-22.04'
logs_artifact: 'test-logs-linux-X64.zip'
report_artifact: 'wpt-report-linux-X64.json'