-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[nfc] use _bazel.yml from the release.yml #3079
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,6 @@ on: | |
type: string | ||
required: false | ||
default: "ubuntu-20.04" | ||
os_name: | ||
type: string | ||
required: false | ||
default: "linux" | ||
suffix: | ||
type: string | ||
required: false | ||
|
@@ -22,6 +18,18 @@ on: | |
type: string | ||
required: false | ||
default: "" | ||
cache_prefix: | ||
type: string | ||
required: false | ||
default: "bazel-disk-cache-" | ||
target: | ||
type: string | ||
required: false | ||
default: "//..." | ||
upload_binary: | ||
type: boolean | ||
required: false | ||
default: false | ||
secrets: | ||
BAZEL_CACHE_KEY: | ||
required: true | ||
|
@@ -40,12 +48,12 @@ jobs: | |
uses: actions/cache@v4 | ||
with: | ||
path: ~/bazel-disk-cache | ||
key: bazel-disk-cache-${{ inputs.os_name }}-${{ runner.arch }}${{ inputs.suffix }}-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }} | ||
key: ${{ inputs.cache_prefix }}${{ runner.os }}-${{ runner.arch }}${{ inputs.suffix }}-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }} | ||
# Intentionally not reusing an older cache entry using a key prefix, bazel frequently | ||
# ends up with a larger cache at the end when starting with an available cache entry, | ||
# resulting in a snowballing cache size and cache download/upload times. | ||
- name: Setup Linux | ||
if: inputs.os_name == 'linux' | ||
if: runner.os == 'Linux' | ||
# Install dependencies, including clang through the LLVM APT repository. We drop the | ||
# install step so we can install just the packages we need. | ||
# libunwind, libc++abi1 and libc++1 should be automatically installed as dependencies of | ||
|
@@ -62,12 +70,20 @@ jobs: | |
sudo apt-get install -y --no-install-recommends clang-16 lld-16 libunwind-16 libc++abi1-16 libc++1-16 libc++-16-dev libclang-rt-16-dev llvm-16 | ||
sed -i -e "s%llvm-symbolizer%/usr/lib/llvm-16/bin/llvm-symbolizer%" .bazelrc | ||
- name: Setup Windows | ||
if: inputs.os_name == 'windows' | ||
if: runner.os == 'Windows' | ||
# Set a custom output root directory to avoid long file name issues. | ||
run: | | ||
git config --global core.symlinks true | ||
git config --show-scope --show-origin core.symlinks | ||
[System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=C:/tmp') | ||
- name: Setup macOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
sudo xcode-select -s "/Applications/Xcode_15.1.app" | ||
# Install lld and link it to /usr/local/bin. We overwrite any existing link, which may | ||
# exist from an older pre-installed LLVM version on the runner image. | ||
brew install lld | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep this step release-only? Installing llvm + lld takes some time, which will make builds take longer, especially for builds when the bazel cache is warm. lld provides few advantages to the test build except for slightly faster link speeds which won't make up for this (the macOS system linker has become faster in recent releases). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
hard to do without introducing extra switches. Also arguably we should use the same version of xcode and linker both in release and in test configuration? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using the same Xcode version now that #3078 has been merged. Apple ld and lld on macOS are high-quality linkers that have very good compatibility/interop, so I think we should only spend the 80s - 90s it takes to fetch lld/LLVM for release builds, where we care more about the binary size. |
||
sudo ln -s -f $(brew --prefix lld)/bin/ld64.lld /usr/local/bin/ld64.lld | ||
- name: Configure download mirrors | ||
shell: bash | ||
run: | | ||
|
@@ -82,11 +98,17 @@ jobs: | |
# timestamps are no longer being added here, the GitHub logs include timestamps (Use | ||
# 'Show timestamps' on the web interface) | ||
run: | | ||
bazel build --config=ci --config=ci-${{ inputs.os_name }}${{ inputs.suffix }} --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev ${{ inputs.extra_bazel_args }} //... | ||
bazel build --config=ci --config=ci-${{ runner.os }}${{ inputs.suffix }} ${{ inputs.extra_bazel_args }} --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev ${{ inputs.target }} | ||
- name: Bazel test | ||
if: inputs.run_tests | ||
run: | | ||
bazel test --config=ci --config=ci-${{ inputs.os_name }}${{ inputs.suffix }} --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev ${{ inputs.extra_bazel_args }} //... | ||
bazel test --config=ci --config=ci-${{ runner.os }}${{ inputs.suffix }} ${{ inputs.extra_bazel_args }} --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev ${{ inputs.target }} | ||
- name: Upload binary | ||
if: inputs.upload_binary | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ runner.os }}-${{ runner.arch }}-binary | ||
path: bazel-bin/src/workerd/server/workerd${{ runner.os == 'Windows' && '.exe' || '' }} | ||
- name: Report disk usage (in MB) | ||
if: always() | ||
shell: bash | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,35 +44,49 @@ build:ci-limit-storage --copt="-fno-standalone-debug" | |
|
||
# ci-platform dependent configuration | ||
|
||
build:ci-linux-common --copt='-Werror' | ||
build:ci-linux-common --copt='-Wno-error=#warnings' | ||
build:ci-linux-common --copt='-Wno-error=deprecated-declarations' | ||
build:ci-Linux-common --copt='-Werror' | ||
build:ci-Linux-common --copt='-Wno-error=#warnings' | ||
build:ci-Linux-common --copt='-Wno-error=deprecated-declarations' | ||
# keep in sync with .github/workflows/test.yml | ||
build:ci-linux-common --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++ | ||
build:ci-linux-common --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++ | ||
build:ci-Linux-common --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++ | ||
build:ci-Linux-common --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++ | ||
|
||
build:ci-linux --config=ci-linux-common | ||
build:ci-Linux --config=ci-Linux-common | ||
# Some tests (like Python import tests) take a long time to run and don't benefit much | ||
# from multi-platform testing. For that reason, we only run them in a single configuration | ||
# to minimize effect on CI pipeline runtime. | ||
build:ci-linux --build_tag_filters=-off-by-default | ||
test:ci-linux --test_tag_filters=-off-by-default --test_size_filters=small,medium,large,enormous | ||
build:ci-Linux --build_tag_filters=-off-by-default | ||
test:ci-Linux --test_tag_filters=-off-by-default --test_size_filters=small,medium,large,enormous | ||
|
||
build:ci-linux-debug --config=ci-linux-common --config=ci-limit-storage | ||
build:ci-linux-debug --config=debug --config=rust-debug | ||
build:ci-Linux-debug --config=ci-Linux-common --config=ci-limit-storage | ||
build:ci-Linux-debug --config=debug --config=rust-debug | ||
|
||
build:ci-linux-asan --config=ci-linux-common --config=ci-limit-storage | ||
build:ci-Linux-asan --config=ci-Linux-common --config=ci-limit-storage | ||
# we're really struggling to fit asan build into worker disk size | ||
# having asan without symbols is better than none | ||
build:ci-linux-asan --config=asan --copt="-g0" --strip=always | ||
build:ci-Linux-asan --config=asan --copt="-g0" --strip=always | ||
|
||
# Enable lld identical code folding to significantly reduce binary size. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ICF is primarily useful for release builds – link time slightly more than doubles with this. You could make a case for it based on disk space usage and the time it takes to fetch binaries from cache, but based on the download speed that CI has this would be a net loss for test build time. |
||
build:ci-macOS-common --config=macos_lld_icf | ||
|
||
# Unlike the bazel Unix toolchain the macOS toolchain sets "-O0 -DDEBUG" for fastbuild by | ||
# default. This is unhelpful for compile speeds and test performance, remove the DEBUG | ||
# define. | ||
build:ci-macOS --copt=-UDEBUG | ||
build:ci-macOS --config=ci-macOS-common --copt=-UDEBUG | ||
|
||
build:ci-macOS-debug --config=debug | ||
build:ci-macOS-debug --config=ci-macOS-common --config=debug | ||
|
||
build:ci-windows --config=windows_no_dbg | ||
build:ci-windows-debug --config=debug | ||
build:ci-Windows --config=windows_no_dbg | ||
build:ci-Windows-debug --config=debug | ||
|
||
|
||
## Release configurations | ||
|
||
# Strip debug info here – we don't generate debug info but some is pulled in from external | ||
# static libraries, for example the Rust STL. This is equivalent to the -Wl,-S linker | ||
# option, symbols will not be removed. | ||
build:ci-release --strip=always | ||
|
||
build:ci-Windows-release --config=release_windows | ||
build:ci-Linux-release --config=release_linux | ||
build:ci-macOS-release --config=release_macos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test uses
macos-15
, where only Xcode 16 is available, so this won't work as-is – let's just land #3078 first so that they have the same OS version and the xcode-select command won't be neededThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for approving! I think ci-macOS-release will also need
--config=macos-cross-x86_64
now.