Skip to content

Commit

Permalink
CI: simplify sanitizers launch (#573)
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <[email protected]>
  • Loading branch information
678098 authored Jan 22, 2025
1 parent 005a33d commit 4f27024
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
- cron: "10 0 * * *"

concurrency:
group: deps-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
group: global
cancel-in-progress: false

jobs:
build_dependencies:
Expand Down
84 changes: 19 additions & 65 deletions .github/workflows/sanitize.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sanitize with AddressSanitizer, MemorySanitizer, ThreadSanitizer and UndefinedBehaviorSanitizer.
name: Sanitize

on:
pull_request_review:
Expand All @@ -9,72 +9,26 @@ concurrency:
cancel-in-progress: true

jobs:
build_dependencies:
name: Build deps [ubuntu]
runs-on: ubuntu-latest
get_dependencies:
name: "Dependencies"
if: github.event.review.state == 'APPROVED'
uses: ./.github/workflows/dependencies.yaml

build_and_run_sanitizer:
name: ${{ matrix.mode }}
needs: get_dependencies
strategy:
matrix:
mode: ["asan", "msan", "tsan", "ubsan"]
fail-fast: false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Get dependencies hash
id: get-hash
run: echo "deps_hash=`cat docker/build_deps.sh | shasum`" >> $GITHUB_OUTPUT
- name: Cache lookup
uses: actions/cache/restore@v4
id: cache-lookup
with:
path: deps
key: deps-${{ steps.get-hash.outputs.deps_hash }}
lookup-only: true
- name: Set up dependencies
if: steps.cache-lookup.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -qy build-essential \
gdb \
curl \
python3.10 \
python3-pip \
cmake \
ninja-build \
pkg-config \
bison \
libfl-dev \
libbenchmark-dev \
libgmock-dev \
libz-dev
- name: Fetch & Build non packaged dependencies
if: steps.cache-lookup.outputs.cache-hit != 'true'
run: |
mkdir -p deps
cd deps
../docker/build_deps.sh
- name: Cache save
if: steps.cache-lookup.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
- uses: actions/cache/restore@v4
with:
path: deps
key: deps-${{ steps.get-hash.outputs.deps_hash }}

run_asan:
needs: build_dependencies
uses: ./.github/workflows/sanitizer-check.yaml
with:
sanitizer-name: 'asan'

run_msan:
needs: build_dependencies
uses: ./.github/workflows/sanitizer-check.yaml
with:
sanitizer-name: 'msan'

run_tsan:
needs: build_dependencies
uses: ./.github/workflows/sanitizer-check.yaml
with:
sanitizer-name: 'tsan'

run_ubsan:
needs: build_dependencies
uses: ./.github/workflows/sanitizer-check.yaml
with:
sanitizer-name: 'ubsan'
key: ${{ needs.get_dependencies.outputs.cache_key }}
- name: Build [${{ matrix.mode }}]
run: ${{ github.workspace }}/.github/workflows/sanitizers/build_sanitizer.sh ${{ matrix.mode }}
- name: UT [c++,${{ matrix.mode }}]
run: ${{ github.workspace }}/cmake.bld/Linux/run-unittests.sh
27 changes: 0 additions & 27 deletions .github/workflows/sanitizer-check.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/sanitizers/clang-libcxx-sanitizer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ string(CONCAT TOOLCHAIN_CXX_FLAGS
"-Wno-old-style-cast "
"-Wno-undef "
"-Wno-zero-as-null-pointer-constant "
"-Wno-unsafe-buffer-usage "
)

# Define linker flags (used for both shared-objects and executables).
Expand Down
4 changes: 2 additions & 2 deletions bin/build-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ mkdir -p "${DIR_INSTALL}"

# :: Clone dependencies :::::::::::::::::::::::::::::::::::::::::::::::::::::::
if [ ! -d "${DIR_THIRDPARTY}/bde-tools" ]; then
git clone --depth 1 --branch 4.8.0.0 https://github.com/bloomberg/bde-tools "${DIR_THIRDPARTY}/bde-tools"
git clone --depth 1 --branch 4.13.0.0 https://github.com/bloomberg/bde-tools "${DIR_THIRDPARTY}/bde-tools"
fi
if [ ! -d "${DIR_THIRDPARTY}/bde" ]; then
git clone --depth 1 --branch 4.8.0.0 https://github.com/bloomberg/bde.git "${DIR_THIRDPARTY}/bde"
git clone --depth 1 --branch 4.18.0.0 https://github.com/bloomberg/bde.git "${DIR_THIRDPARTY}/bde"
fi
if [ ! -d "${DIR_THIRDPARTY}/ntf-core" ]; then
git clone --depth 1 --branch 2.4.2 https://github.com/bloomberg/ntf-core.git "${DIR_THIRDPARTY}/ntf-core"
Expand Down
4 changes: 2 additions & 2 deletions bin/build-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ mkdir -p "${DIR_INSTALL}"
# :: Clone dependencies :::::::::::::::::::::::::::::::::::::::::::::::::::::::

if [ ! -d "${DIR_THIRDPARTY}/bde-tools" ]; then
git clone --depth 1 --branch 4.8.0.0 https://github.com/bloomberg/bde-tools "${DIR_THIRDPARTY}/bde-tools"
git clone --depth 1 --branch 4.13.0.0 https://github.com/bloomberg/bde-tools "${DIR_THIRDPARTY}/bde-tools"
fi
if [ ! -d "${DIR_THIRDPARTY}/bde" ]; then
git clone --depth 1 --branch 4.8.0.0 https://github.com/bloomberg/bde.git "${DIR_THIRDPARTY}/bde"
git clone --depth 1 --branch 4.18.0.0 https://github.com/bloomberg/bde.git "${DIR_THIRDPARTY}/bde"
fi
if [ ! -d "${DIR_THIRDPARTY}/ntf-core" ]; then
git clone --depth 1 --branch 2.4.2 https://github.com/bloomberg/ntf-core.git "${DIR_THIRDPARTY}/ntf-core"
Expand Down
4 changes: 2 additions & 2 deletions docker/build_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ fetch_git() {
}

fetch_deps() {
fetch_git bloomberg bde-tools 4.8.0.0
fetch_git bloomberg bde 4.8.0.0
fetch_git bloomberg bde-tools 4.13.0.0
fetch_git bloomberg bde 4.18.0.0
fetch_git bloomberg ntf-core 2.4.2
}

Expand Down

0 comments on commit 4f27024

Please sign in to comment.