Skip to content

Commit 16a7eee

Browse files
committed
CI: move ASAN job to MacOS, drop UBSAN
1 parent cc5851e commit 16a7eee

2 files changed

Lines changed: 76 additions & 59 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Test with compiler sanitizers
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
- maintenance/**
11+
12+
defaults:
13+
run:
14+
shell: bash
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
permissions:
21+
contents: read # to fetch code (actions/checkout)
22+
23+
jobs:
24+
clang_ASAN:
25+
# To enable this workflow on a fork, comment out:
26+
# if: github.repository == 'numpy/numpy'
27+
runs-on: macos-latest
28+
steps:
29+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+
with:
31+
submodules: recursive
32+
fetch-tags: true
33+
persist-credentials: false
34+
- name: Set up pyenv
35+
run: |
36+
git clone https://github.com/pyenv/pyenv.git "$HOME/.pyenv"
37+
# main as of Feb 3 2025
38+
pushd "$HOME/.pyenv"
39+
git checkout 823dd3cef9d53621a5bdbf68f83713e1b15bfc80
40+
popd
41+
PYENV_ROOT="$HOME/.pyenv"
42+
PYENV_BIN="$PYENV_ROOT/bin"
43+
PYENV_SHIMS="$PYENV_ROOT/shims"
44+
echo "$PYENV_BIN" >> $GITHUB_PATH
45+
echo "$PYENV_SHIMS" >> $GITHUB_PATH
46+
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
47+
- name: Check pyenv is working
48+
run:
49+
pyenv --version
50+
- name: Set up LLVM
51+
run: |
52+
brew install llvm@19
53+
LLVM_PREFIX=$(brew --prefix llvm@19)
54+
echo CC="$LLVM_PREFIX/bin/clang" >> $GITHUB_ENV
55+
echo CXX="$LLVM_PREFIX/bin/clang++" >> $GITHUB_ENV
56+
echo LDFLAGS="-L$LLVM_PREFIX/lib" >> $GITHUB_ENV
57+
echo CPPFLAGS="-I$LLVM_PREFIX/include" >> $GITHUB_ENV
58+
- name: Build Python with address sanitizer support and install dependencies
59+
run: |
60+
CONFIGURE_OPTS="--with-address-sanitizer" pyenv install 3.13-dev
61+
pyenv global 3.13-dev
62+
echo $PATH
63+
pip install -r requirements/build_requirements.txt
64+
pip install -r requirements/ci_requirements.txt
65+
pip install -r requirements/test_requirements.txt
66+
- name: Build
67+
run:
68+
python -m spin build -- -Db_sanitize=address
69+
- name: Test
70+
run: |
71+
ASAN_OPTIONS=detect_leaks=0:symbolize=1:strict_init_order=true:allocator_may_return_null=1:halt_on_error=1 \
72+
# pass -s to see ASAN errors and warnings, otherwise pytest captures them
73+
python -m spin test -- -v -s --timeout=600 --durations=10
74+
- name: Setup tmate session
75+
if: ${{ failure() }}
76+
uses: mxschmitt/action-tmate@v3

.github/workflows/linux_compiler_sanitizers.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)