Skip to content

Commit

Permalink
Additional github runner configurations
Browse files Browse the repository at this point in the history
Adds debug and address-sanitizer build configurations to the test
workflow. At the time of writing these are advisory.

Temporarily drop benchmarks from asan and debug builds for github
runner limits.
  • Loading branch information
ohodson committed Oct 8, 2023
1 parent e08dbfd commit 87e42d5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
20 changes: 20 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ build:sanitizer-common --copt="-fno-omit-frame-pointer" --copt="-mno-omit-leaf-f
build:asan --config=sanitizer-common
build:asan --copt="-fsanitize=address" --linkopt="-fsanitize=address"
build:asan --test_env=ASAN_OPTIONS=abort_on_error=true
# Exclude benchmarks from asan build due to large size (exceed github runner limits)
build:asan -- -//src/workerd/tests:bench-api-headers
build:asan -//src/workerd/tests:bench-global-scope
build:asan -//src/workerd/tests:bench-json
build:asan -//src/workerd/tests:bench-kj-headers
build:asan -//src/workerd/tests:bench-mimetype
build:asan -//src/workerd/tests:bench-regex
build:asan -//src/workerd/tests:bench-tools

#
# Linux and macOS
Expand Down Expand Up @@ -194,3 +202,15 @@ build:windows --per_file_copt='external/v8/src/objects/swiss-name-dictionary\.cc
# enable clang coverage: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
build:clang-coverage --copt="-fprofile-instr-generate" --linkopt="-fprofile-instr-generate"
build:clang-coverage --copt="-fcoverage-mapping" --linkopt="-fcoverage-mapping"

# Debug
build:debug -c dbg
# Exclude benchmarks from debug build build due to large size (exceed github runner limits)
# Each benchmark debug binary is over 900MB.
build:debug -- -//src/workerd/tests:bench-api-headers
build:debug -//src/workerd/tests:bench-global-scope
build:debug -//src/workerd/tests:bench-json
build:debug -//src/workerd/tests:bench-kj-headers
build:debug -//src/workerd/tests:bench-mimetype
build:debug -//src/workerd/tests:bench-regex
build:debug -//src/workerd/tests:bench-tools
48 changes: 30 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,44 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-20.04, macos-latest, windows-2022]
os: [
{ "name" : "linux", image : "ubuntu-20.04" },
{ "name" : "macOS", image : "macos-latest" },
{ "name" : "windows", image : "windows-2022" }
]
config: [
# Default build: no suffix or additional bazel arguments
{"suffix": "", "bazel-args": "" },
# Debug build
{"suffix": "-debug", "bazel-args": "--config=debug" }
]
include:
- os-name: linux
os: ubuntu-20.04
- os-name: macOS
os: macos-latest
- os-name: windows
os: windows-2022
# ASAN on Linux only here
- os: { "name": "linux", "image": "ubuntu-20.04" }
config: { "suffix": "-asan", "bazel-args": "--config=asan" }
# Windows has a custom non-debug bazel config
- os: { "name" : "windows", image : "windows-2022" }
config: { "suffix": "", "bazel-args": "--config=windows_no_dbg" }
exclude:
# Don't build with the matrix generated no-debug bazel config for Windows
- os: { "name" : "windows", image : "windows-2022" }
config: { "suffix": "", "bazel-args": "" }
fail-fast: false
runs-on: ${{ matrix.os }}
name: test (${{ matrix.os-name }})
runs-on: ${{ matrix.os.image }}
name: test (${{ matrix.os.name }}${{ matrix.config.suffix}})
steps:
- uses: actions/checkout@v3
- name: Cache
id: cache
uses: actions/cache@v3
with:
path: ~/bazel-disk-cache
key: bazel-disk-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}
key: bazel-disk-cache-${{ matrix.os.name }}-${{ runner.arch }}${{ matrix.config.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: runner.os == 'Linux'
if: matrix.os.name == 'linux'
# Install dependencies, including clang via through LLVM APT repository. Note that this
# will also install lldb and clangd alongside dependencies, which can be removed with
# `sudo apt-get remove -y lldb-14 clangd-14; sudo apt-get autoremove -y` if space is
Expand All @@ -49,36 +63,35 @@ jobs:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 14
sudo apt-get install -y libunwind-14 libc++abi1-14 libc++1-14 libc++-14-dev
sudo apt-get install -y libunwind-14 libc++abi1-14 libc++1-14 libc++-14-dev libclang-rt-14-dev
echo "build:linux --action_env=CC=/usr/lib/llvm-14/bin/clang --action_env=CXX=/usr/lib/llvm-14/bin/clang++" >> .bazelrc
echo "build:linux --host_action_env=CC=/usr/lib/llvm-14/bin/clang --host_action_env=CXX=/usr/lib/llvm-14/bin/clang++" >> .bazelrc
sed -i -e "s%llvm-symbolizer%/usr/lib/llvm-14/bin/llvm-symbolizer%" .bazelrc
- name: Setup macOS
if: runner.os == 'macOS'
if: matrix.os.name == 'macOS'
# We want to symbolize stacks for crashes on CI. Xcode is currently based on LLVM 15
# and the macos-12 image has llvm@15 installed:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
run: |
export LLVM_SYMBOLIZER=$(brew --prefix llvm@15)/bin/llvm-symbolizer
sed -i -e "s%llvm-symbolizer%${LLVM_SYMBOLIZER}%" .bazelrc
- name: Setup Windows
if: runner.os == 'Windows'
if: matrix.os.name == 'windows'
# Set a custom output dir and disable generating debug information on Windows. By default,
# bazel generates huge amounts of debug information on Windows which slows down the build
# and takes up an excessive amount of cache space.
run: |
[System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=C:/tmp')
[System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'build:windows --config=windows_no_dbg')
# Work around bazel clang 16 include path bug (https://github.com/bazelbuild/bazel/issues/17863)
Move-Item -Path "C:\Program Files\LLVM\lib\clang\16" -Destination "C:\Program Files\LLVM\lib\clang\16.0.6"
- name: Bazel build
# timestamps are no longer being added here, the GitHub logs include timestamps (Use
# 'Show timestamps' on the web interface)
run: |
bazelisk build --disk_cache=~/bazel-disk-cache --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --verbose_failures //...
bazelisk build ${{ matrix.config.bazel-args }} --disk_cache=~/bazel-disk-cache --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --verbose_failures //...
- name: Bazel tests
run: |
bazelisk test --disk_cache=~/bazel-disk-cache --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --verbose_failures --keep_going --test_output=errors //...
bazelisk test ${{ matrix.config.bazel-args }} --disk_cache=~/bazel-disk-cache --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --verbose_failures --keep_going --test_output=errors //...
- name: Report disk usage
if: always()
shell: bash
Expand All @@ -91,4 +104,3 @@ jobs:
du -hs -t 1 $BAZEL_OUTPUT_BASE
echo "Workspace usage statistics"
du -hs -t 1 $GITHUB_WORKSPACE

0 comments on commit 87e42d5

Please sign in to comment.