Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,15 @@ build:windows --enable_runfiles
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:windows --extra_execution_platforms=//:x64_windows-clang-cl

# Windows ARM64 overrides: use the ARM64 platform instead of x64. The toolchain name is
# auto-generated by local_config_cc – if this doesn't match what Bazel detects on the ARM64
# runner, query @local_config_cc//:all to find the correct name.
build:windows_arm64 --extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows-clang-cl
build:windows_arm64 --extra_execution_platforms=//:arm64_windows-clang-cl
# clang-cl on ARM64 Windows doesn't auto-link compiler-rt builtins, causing undefined symbols
# like __udivti3 (128-bit integer division). Link the builtins library explicitly.
build:windows_arm64 --linkopt=clang_rt.builtins-aarch64.lib

# The Windows fastbuild bazel configuration is broken in that it necessarily generates PDB debug
# information while the Linux and macOS toolchains only compile with debug information in the dbg
# configuration or when requested with the -g flag. This causes huge increases in compile time and
Expand Down Expand Up @@ -435,6 +444,9 @@ build:release_windows --per_file_copt="src/workerd/server/container-client"@/cla
# Work around Windows test failures in rpc-related tests
build:release_windows --per_file_copt=src/workerd/io/worker-interface@/clang:-fno-inline

build:release_windows_arm64 --config=release_windows
build:release_windows_arm64 --config=windows_arm64

build:windows --cxxopt='/std:c++23preview' --host_cxxopt='/std:c++23preview'
build:windows --copt='/D_CRT_USE_BUILTIN_OFFSETOF' --host_copt='/D_CRT_USE_BUILTIN_OFFSETOF'
build:windows --copt='/DWIN32_LEAN_AND_MEAN' --host_copt='/DWIN32_LEAN_AND_MEAN'
Expand Down
8 changes: 8 additions & 0 deletions .github/actions/setup-runner/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ runs:
git config --show-scope --show-origin core.symlinks
git config --system core.longpaths true
[System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=\\\\?\\C:\\tmp')
- name: Use Bazel 9.0.2rc1 on ARM64 Windows
shell: pwsh
if: runner.os == 'Windows' && runner.arch == 'ARM64'
# Bazel 9.0.1 has a broken ARM64 Windows build (bazelbuild/bazel#28941).
# Use 9.0.2rc1 which fixes the JNI DLL architecture mismatch.
# TODO(cleanup): Remove this once .bazelversion is bumped to 9.0.2+.
run: |
echo "USE_BAZEL_VERSION=9.0.2rc1" >> $env:GITHUB_ENV
- name: Setup macOS
if: runner.os == 'macOS'
shell: bash
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ jobs:
image: windows-2025-16core
bazel-config: release_windows
target-arch: X64
- title: windows-arm64
os-name: Windows
image: windows-11-arm
bazel-config: release_windows_arm64
target-arch: ARM64
name: build (${{ matrix.title }})
uses: './.github/workflows/_bazel.yml'
with:
Expand All @@ -130,8 +135,6 @@ jobs:
strategy:
matrix:
arch: [linux-64, darwin-64, windows-64]
# This variable itself is unused, but allows us to set up two macOS builds. arm64 builds for
# other platforms will be supported later, then we'll list both architectures here.
cpu: [X64]
include:
- arch: linux-64
Expand All @@ -146,6 +149,9 @@ jobs:
cpu: ARM64
- arch: windows-64
name: Windows-X64
- arch: windows-arm64
name: Windows-ARM64
cpu: ARM64
steps:
- name: Checkout Repo
uses: actions/checkout@v6
Expand All @@ -158,15 +164,15 @@ jobs:
name: ${{ matrix.name }}-binary
path: /tmp
# Set execute permissions before compressing the binary
- if: matrix.arch != 'windows-64'
- if: ${{ !contains(matrix.arch, 'windows') }}
run: chmod +x /tmp/workerd
- name: Compress release binary
run: |
# As of release v1.20230404.0 the Linux x64 binary after debug_strip is 65.8 MB,
# 21.0 MB with gzip and 17.3 MB with brotli -9. Use gzip as a widely supported format
# which still produces an acceptable compressed size.
gzip -9N -k /tmp/workerd${{ matrix.arch == 'windows-64' && '.exe' || '' }}
- run: mv /tmp/workerd${{ matrix.arch == 'windows-64' && '.exe' || '' }}.gz /tmp/workerd-${{ matrix.arch }}.gz
gzip -9N -k /tmp/workerd${{ contains(matrix.arch, 'windows') && '.exe' || '' }}
- run: mv /tmp/workerd${{ contains(matrix.arch, 'windows') && '.exe' || '' }}.gz /tmp/workerd-${{ matrix.arch }}.gz
# Upload compressed release binaries – one set of artifacts is sufficient with gzip being
# widely supported
- name: Upload Release Assets
Expand All @@ -191,7 +197,7 @@ jobs:
WORKERD_VERSION: ${{ needs.version.outputs.version }}
LATEST_COMPATIBILITY_DATE: ${{ needs.version.outputs.date }}
- run: mkdir npm/workerd-${{ matrix.arch }}/bin
- run: cp /tmp/workerd${{ matrix.arch == 'windows-64' && '.exe' || '' }} npm/workerd-${{ matrix.arch }}/bin/workerd${{ matrix.arch == 'windows-64' && '.exe' || '' }}
- run: cp /tmp/workerd${{ contains(matrix.arch, 'windows') && '.exe' || '' }} npm/workerd-${{ matrix.arch }}/bin/workerd${{ contains(matrix.arch, 'windows') && '.exe' || '' }}
- run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > npm/workerd-${{ matrix.arch }}/.npmrc
- run: cd npm/workerd-${{ matrix.arch }} && npm publish --access public --tag ${{ startsWith(needs.version.outputs.version, '0') && 'beta' || 'latest'}}
env:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
{ name: linux-arm, arch: ARM64, image: ubuntu-22.04-arm-16core },
{ name: macOS, arch: ARM64, image: macos-15-xlarge, use_lld: true },
{ name: windows, arch: X64, image: windows-2025-16core },
{ name: windows-arm64, arch: ARM64, image: windows-11-arm },
]
config: [
# Default build: no suffix or additional bazel arguments
Expand All @@ -57,6 +58,8 @@ jobs:
exclude:
- os: { name: windows, arch: X64, image: windows-2025-16core }
config: { suffix: -debug }
- os: { name: windows-arm64, arch: ARM64, image: windows-11-arm }
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.
Expand Down
9 changes: 9 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ platform(
],
)

platform(
name = "arm64_windows-clang-cl",
constraint_values = [
"@platforms//cpu:aarch64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)

# Used for cross-compilation
platform(
name = "macOS_x86",
Expand Down
36 changes: 36 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,42 @@ archive_override(
bazel_dep(name = "rules_go", version = "0.60.0", repo_name = None)
bazel_dep(name = "rules_android", version = "0.7.1", repo_name = None)

# Override yq.bzl to 0.3.5 for Windows ARM64 yq toolchain support. The transitive version (0.3.2)
# pulled in by aspect_rules_js lacks windows_arm64 in its platform list.
bazel_dep(name = "yq.bzl", version = "0.3.5")
archive_override(
module_name = "yq.bzl",
integrity = "sha256-zma0n7LjdqDY0rxYe8GqIju96A6GwKghRXCYp56lgDg=",
strip_prefix = "yq.bzl-0.3.5",
url = "https://github.com/bazel-contrib/yq.bzl/releases/download/v0.3.5/yq.bzl-v0.3.5.tar.gz",
)

# Patch aspect_rules_js to add yq_windows_arm64 to its use_repo list. Without this, the
# @yq_windows_arm64 repo created by yq.bzl is not visible from aspect_rules_js's module scope.
archive_override(
module_name = "aspect_rules_js",
integrity = "sha256-eBgxR7xQutVxi+c7M4Dn9G4hR/PJl6KQ4sXpWZQQUuE=",
patch_args = ["-p1"],
patches = [
"//:patches/aspect_rules_js/0001-add-yq-windows-arm64-to-use-repo.patch",
],
strip_prefix = "rules_js-3.0.3",
url = "https://github.com/aspect-build/rules_js/releases/download/v3.0.3/rules_js-v3.0.3.tar.gz",
)

# Patch aspect_rules_esbuild to add win32-arm64 platform + integrity hash. The upstream rules
# don't include ARM64 Windows despite esbuild shipping native binaries for it.
archive_override(
module_name = "aspect_rules_esbuild",
integrity = "sha256-tz1ly+0pGMOC93pUihBpgrQPhSAPAlVl1c+hsuCQEec=",
patch_args = ["-p1"],
patches = [
"//:patches/aspect_rules_esbuild/0001-add-win32-arm64-platform.patch",
],
strip_prefix = "rules_esbuild-0.25.1",
url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.25.1/rules_esbuild-v0.25.1.tar.gz",
)

# Automatically managed dependencies
include("//build/deps:gen/deps.MODULE.bazel")
include("//build/deps:gen/build_deps.MODULE.bazel")
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ The primary distribution channel for `workerd` right now is through `npm`. We us

## Cutting Releases

This is pretty simple, and completely automatic—every time the date in [release-version.txt](src/workerd/io/release-version.txt) changes, a new release is generated, along with the built binaries for `linux-64`, `linux-arm64`, `darwin-64`, `darwin-arm64` and `windows-64`. The types will also be generated and published automatically. This is governed by the [release.yml](.github/workflows/release.yml) GitHub Action.
This is pretty simple, and completely automatic—every time the date in [release-version.txt](src/workerd/io/release-version.txt) changes, a new release is generated, along with the built binaries for `linux-64`, `linux-arm64`, `darwin-64`, `darwin-arm64`, `windows-64` and `windows-arm64`. The types will also be generated and published automatically. This is governed by the [release.yml](.github/workflows/release.yml) GitHub Action.
5 changes: 5 additions & 0 deletions build/ci.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@ test:ci-macOS --spawn_strategy=local
build:ci-windows --config=release_windows
build:ci-windows-debug --config=debug

build:ci-windows-arm64 --config=release_windows_arm64

# Some tests (like Python import tests) take a long time to run, especially when debug is enabled
# For that reason, we only run them in the default configuration for each platform to minimize
# effect on CI pipeline runtime.
test:ci-linux --test_size_filters=
test:ci-macOS --test_size_filters=
test:ci-windows --test_size_filters=
test:ci-windows-arm64 --test_size_filters=
# The windows-11-arm runner has only 4 vCPUs (vs 16 for x64 Windows), so tests need more time.
test:ci-windows-arm64 --test_timeout=15,60,240,240

# Run container tests on Linux CI
test:ci-linux --test_tag_filters=-off-by-default,-requires-fuzzilli
Expand Down
3 changes: 3 additions & 0 deletions build/deps/rust.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RUST_TARGET_TRIPLES = [
"x86_64-apple-darwin",
# Add support for macOS rosetta
"aarch64-unknown-linux-gnu",
# Add support for Windows ARM64
"aarch64-pc-windows-msvc",
]

# rules_rust
Expand Down Expand Up @@ -36,6 +38,7 @@ rust.toolchain(
"x86_64-pc-windows-msvc": ["-Ctarget-feature=+sse4.2"],
"aarch64-unknown-linux-gnu": ["-Ctarget-feature=+crc"],
# No options needed for aarch64-apple-darwin: CRC feature is enabled by default.
# No options needed for aarch64-pc-windows-msvc: CRC feature is enabled by default on ARM64.
},
extra_target_triples = RUST_TARGET_TRIPLES,
rustfmt_version = RUST_NIGHTLY_VERSION,
Expand Down
11 changes: 11 additions & 0 deletions deps/rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,22 @@ selects.config_setting_group(
],
)

selects.config_setting_group(
name = "win_arm64",
match_all = [
"@platforms//os:windows",
"@platforms//cpu:aarch64",
],
)

CARGO_BAZEL = select({
":linux_x64": "@cargo_bazel_linux_x64//file:downloaded",
":linux_arm64": "@cargo_bazel_linux_arm64//file:downloaded",
":macos_x64": "@cargo_bazel_macos_x64//file:downloaded",
":macos_arm64": "@cargo_bazel_macos_arm64//file:downloaded",
":win_x64": "@cargo_bazel_win_x64//file:downloaded.exe",
# x64 cargo-bazel runs under emulation on Windows ARM64
":win_arm64": "@cargo_bazel_win_x64//file:downloaded.exe",
})

# Generates a repository containing all the crates we reference from our
Expand Down Expand Up @@ -82,6 +92,7 @@ crates_vendor(
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
"aarch64-pc-windows-msvc",
],
)

Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.ahash-0.8.12.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ rust_library(
"@rules_rust//rust/platform:x86_64-apple-darwin": [
"@crates_vendor__once_cell-1.21.4//:once_cell", # cfg(not(all(target_arch = "arm", target_os = "none")))
],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__once_cell-1.21.4//:once_cell", # cfg(not(all(target_arch = "arm", target_os = "none")))
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@crates_vendor__once_cell-1.21.4//:once_cell", # cfg(not(all(target_arch = "arm", target_os = "none")))
],
Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.jobserver-0.1.34.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ rust_library(
"@rules_rust//rust/platform:x86_64-apple-darwin": [
"@crates_vendor__libc-0.2.183//:libc", # cfg(unix)
],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__getrandom-0.3.4//:getrandom", # cfg(windows)
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@crates_vendor__getrandom-0.3.4//:getrandom", # cfg(windows)
],
Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.mio-1.2.0.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ rust_library(
"@rules_rust//rust/platform:x86_64-apple-darwin": [
"@crates_vendor__libc-0.2.183//:libc", # cfg(any(unix, target_os = "hermit", target_os = "wasi"))
],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows)
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows)
],
Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.sha1-0.10.6.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ rust_library(
"@rules_rust//rust/platform:x86_64-apple-darwin": [
"@crates_vendor__cpufeatures-0.2.17//:cpufeatures", # cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))
],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__cpufeatures-0.2.17//:cpufeatures", # cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@crates_vendor__cpufeatures-0.2.17//:cpufeatures", # cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))
],
Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.socket2-0.6.3.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ rust_library(
"@rules_rust//rust/platform:x86_64-apple-darwin": [
"@crates_vendor__libc-0.2.183//:libc", # cfg(any(unix, target_os = "wasi"))
],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows)
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows)
],
Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.termcolor-1.4.1.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ rust_library(
],
version = "1.4.1",
deps = select({
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__winapi-util-0.1.11//:winapi_util", # cfg(windows)
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@crates_vendor__winapi-util-0.1.11//:winapi_util", # cfg(windows)
],
Expand Down
6 changes: 6 additions & 0 deletions deps/rust/crates/BUILD.tokio-1.50.0.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ rust_library(
"socket2",
"time",
] + select({
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"windows-sys", # aarch64-pc-windows-msvc
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"windows-sys", # x86_64-pc-windows-msvc
],
Expand Down Expand Up @@ -69,6 +72,9 @@ rust_library(
"@rules_rust//rust/platform:x86_64-apple-darwin": [
"@crates_vendor__libc-0.2.183//:libc", # x86_64-apple-darwin
],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.61.2//:windows_sys", # aarch64-pc-windows-msvc
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.61.2//:windows_sys", # x86_64-pc-windows-msvc
],
Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.winapi-util-0.1.11.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ rust_library(
],
version = "0.1.11",
deps = select({
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows)
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows)
],
Expand Down
Loading
Loading