Implement in-memory worker file system #14153
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- 'justfile' | |
- '.devcontainer' | |
- '**/*.md' | |
- '.gitignore' | |
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 | |
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, image: ubuntu-22.04 }, | |
{ name: linux-arm, image: ubuntu-22.04-arm }, | |
{ name: macOS, image: macos-15 }, | |
{ name: windows, 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, 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, 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, image: macos-15 } | |
config: { suffix: -debug } | |
- os: { name: linux, image: ubuntu-22.04 } | |
config: { suffix: -debug } | |
# linux release is handled by separate test-linux job | |
- os: { name: linux, image: ubuntu-22.04 } | |
config: { suffix: '' } | |
fail-fast: false | |
uses: ./.github/workflows/_bazel.yml | |
with: | |
image: ${{ matrix.os.image }} | |
os_name: ${{ matrix.os.name }} | |
suffix: ${{ matrix.config.suffix }} | |
extra_bazel_args: '--config=ci-test' | |
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 | |
suffix: '' | |
extra_bazel_args: '--config=ci-test' | |
upload_binary: 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=ci-test' | |
run_tests: false | |
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 Linux | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
wget https://apt.llvm.org/llvm.sh | |
sed -i '/apt-get install/d' llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 18 | |
sudo apt-get install -y --no-install-recommends clang-18 lld-18 libunwind-18 libc++abi1-18 libc++1-18 libc++-18-dev | |
echo "build:linux --action_env=CC=/usr/lib/llvm-18/bin/clang" >> .bazelrc | |
echo "build:linux --host_action_env=CC=/usr/lib/llvm-18/bin/clang" >> .bazelrc | |
- name: build types | |
run: | | |
bazel build --disk_cache=~/bazel-disk-cache --strip=always --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --config=ci --config=release_linux //types:types | |
- name: Check snapshot diff | |
run: | | |
diff -r types/generated-snapshot bazel-bin/types/definitions/ > 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 `bazel build //types && rm -rf types/generated-snapshot && cp -r bazel-bin/types/definitions types/generated-snapshot` 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: 18.20.5 | |
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, Miniflare, Vitest, Vite tests | |
run: pnpm test:ci --concurrency 1 --filter miniflare --filter wrangler --filter @cloudflare/vite-plugin --filter="./fixtures/vitest-pool-workers-examples" | |
env: | |
MINIFLARE_WORKERD_PATH: /tmp/workerd |