aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan José <soyjuanarbol@gmail.com>2025-05-15 02:30:00 -0500
committerGitHub <noreply@github.com>2025-05-15 09:30:00 +0200
commit29edf310890634af02555c96e8f2fb4dab509fe8 (patch)
tree29751d1e458d6ab63b45a17476adec2b8e353c24
parent2b76a4fafa91dd531e35084ab544d9cd8a3e2d79 (diff)
downloadlibuv-29edf310890634af02555c96e8f2fb4dab509fe8.tar.gz
libuv-29edf310890634af02555c96e8f2fb4dab509fe8.zip
build: dedup sanitizer jobs using matrix strategy (#4776)
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
-rw-r--r--.github/workflows/CI-unix.yml14
-rw-r--r--.github/workflows/CI-win.yml2
-rw-r--r--.github/workflows/sanitizer.yml96
3 files changed, 41 insertions, 71 deletions
diff --git a/.github/workflows/CI-unix.yml b/.github/workflows/CI-unix.yml
index 298dca21..c539d40f 100644
--- a/.github/workflows/CI-unix.yml
+++ b/.github/workflows/CI-unix.yml
@@ -51,7 +51,7 @@ jobs:
disable-animations: true
script: |
echo "::group::Configure"
- cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-30
+ cmake -B build -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-30
echo "::endgroup::"
echo "::group::Build"
@@ -95,9 +95,7 @@ jobs:
brew install ninja automake libtool
- name: Configure
run: |
- mkdir build
- cd build
- cmake .. -DBUILD_TESTING=ON -G Ninja
+ cmake -B build -DBUILD_TESTING=ON -G Ninja
- name: Build
run: |
cmake --build build
@@ -129,9 +127,7 @@ jobs:
- uses: actions/checkout@v4
- name: Configure
run: |
- mkdir build-ios
- cd build-ios
- cmake .. -GXcode -DCMAKE_SYSTEM_NAME:STRING=iOS -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL=NO -DCMAKE_CONFIGURATION_TYPES:STRING=Release
+ cmake -B build-ios -GXcode -DCMAKE_SYSTEM_NAME:STRING=iOS -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL=NO -DCMAKE_CONFIGURATION_TYPES:STRING=Release
- name: Build
run: |
cmake --build build-ios
@@ -170,9 +166,7 @@ jobs:
sudo apt install qemu-user qemu-user-binfmt ${{ matrix.config.toolchain }} -y
- name: Configure with ${{ matrix.config.cc }}
run: |
- mkdir build
- cd build
- cmake .. -DBUILD_TESTING=ON -DQEMU=ON -DCMAKE_C_COMPILER=${{ matrix.config.cc }}
+ cmake -B build -DBUILD_TESTING=ON -DQEMU=ON -DCMAKE_C_COMPILER=${{ matrix.config.cc }}
- name: Build
run: |
cmake --build build
diff --git a/.github/workflows/CI-win.yml b/.github/workflows/CI-win.yml
index d1d68547..0e0a75f4 100644
--- a/.github/workflows/CI-win.yml
+++ b/.github/workflows/CI-win.yml
@@ -86,7 +86,7 @@ jobs:
sudo apt install mingw-w64 ninja-build -y
- name: Build
run: |
- cmake -S . -B build -G Ninja -DHOST_ARCH=${{ matrix.config.arch }} -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=cmake-toolchains/cross-mingw32.cmake
+ cmake -B build -G Ninja -DHOST_ARCH=${{ matrix.config.arch }} -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=cmake-toolchains/cross-mingw32.cmake
cmake --build build
cmake --install build --prefix "`pwd`/build/usr"
mkdir -p build/usr/test build/usr/bin
diff --git a/.github/workflows/sanitizer.yml b/.github/workflows/sanitizer.yml
index 58254327..77725a8f 100644
--- a/.github/workflows/sanitizer.yml
+++ b/.github/workflows/sanitizer.yml
@@ -15,6 +15,17 @@ on:
jobs:
sanitizers-linux:
runs-on: ubuntu-22.04
+ strategy:
+ matrix:
+ config:
+ - name: ASAN
+ flags: -DASAN=ON -DCMAKE_BUILD_TYPE=Debug
+ - name: MSAN
+ flags: -DMSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang
+ - name: TSAN
+ flags: -DTSAN=ON -DCMAKE_BUILD_TYPE=Release
+ - name: UBSAN
+ flags: -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang
steps:
- uses: actions/checkout@v4
- name: Setup
@@ -28,78 +39,44 @@ jobs:
run: |
sudo sysctl -w kernel.randomize_va_space=0
- - name: ASAN Build
+ - name: Build ${{ matrix.config.name }}
run: |
- mkdir build-asan
- (cd build-asan && cmake .. -G Ninja -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug)
- cmake --build build-asan
- - name: ASAN Test
- run: |
- ./build-asan/uv_run_tests_a
-
- - name: MSAN Build
- run: |
- mkdir build-msan
- (cd build-msan && cmake .. -G Ninja -DBUILD_TESTING=ON -DMSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang)
- cmake --build build-msan
- - name: MSAN Test
- run: |
- ./build-msan/uv_run_tests_a
-
- - name: TSAN Build
- run: |
- mkdir build-tsan
- (cd build-tsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release)
- cmake --build build-tsan
- - name: TSAN Test
- # Note: path must be absolute because some tests chdir.
- # TSan exits with an error when it can't find the file.
- run: |
- env TSAN_OPTIONS="suppressions=$PWD/tsansupp.txt" ./build-tsan/uv_run_tests_a
+ cmake -B build -G Ninja -DBUILD_TESTING=ON ${{ matrix.config.flags }}
+ cmake --build build
- - name: UBSAN Build
- run: |
- mkdir build-ubsan
- (cd build-ubsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang)
- cmake --build build-ubsan
- - name: UBSAN Test
+ - name: Test ${{ matrix.config.name }}
run: |
- ./build-ubsan/uv_run_tests_a
+ # Note: path must be absolute because some tests chdir.
+ # TSan exits with an error when it can't find the file.
+ if [ "${{ matrix.config.name }}" = "TSAN" ]; then
+ env TSAN_OPTIONS="suppressions=$PWD/tsansupp.txt" ./build/uv_run_tests_a
+ else
+ ./build/uv_run_tests_a
+ fi
sanitizers-macos:
runs-on: macos-13
+ strategy:
+ matrix:
+ config:
+ - name: ASAN
+ flags: -DASAN=ON -DCMAKE_BUILD_TYPE=Debug
+ - name: TSAN
+ flags: -DTSAN=ON -DCMAKE_BUILD_TYPE=Release
+ - name: UBSAN
+ flags: -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug
steps:
- uses: actions/checkout@v4
- name: Envinfo
run: npx envinfo
- - name: ASAN Build
+ - name: Build ${{ matrix.config.name }}
run: |
- mkdir build-asan
- (cd build-asan && cmake .. -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug)
- cmake --build build-asan
- - name: ASAN Test
- run: |
- ./build-asan/uv_run_tests_a
-
- - name: TSAN Build
- run: |
- mkdir build-tsan
- (cd build-tsan && cmake .. -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release)
- cmake --build build-tsan
- - name: TSAN Test
- run: |
- ./build-tsan/uv_run_tests_a
-
- - name: UBSAN Build
- run: |
- mkdir build-ubsan
- (cd build-ubsan && cmake .. -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug)
- cmake --build build-ubsan
- - name: UBSAN Test
- run: |
- ./build-ubsan/uv_run_tests_a
+ cmake -B build -DBUILD_TESTING=ON ${{ matrix.config.flags }}
+ cmake --build build
+ - name: Test ${{ matrix.config.name }}
+ run: ./build/uv_run_tests_a
sanitizers-windows:
runs-on: windows-2022
@@ -120,7 +97,6 @@ jobs:
- name: UBSAN Build
run: |
- mkdir build-ubsan
cmake -B build-ubsan -G Ninja -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang
cmake --build build-ubsan
- name: UBSAN Test