Skip to content

add tsan CI

add tsan CI #4

# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
name: "Python Nightly TSAN Tests"
on:
pull_request:
push:
branches:
- "**/*nightly*"
schedule:
# Run at 2:22am early every morning Eastern time (6/7:22 UTC)
# so that we get tips of CPython development tested.
# https://crontab.guru/#22_7_%2a_%2a_%2a
- cron: "22 7 * * *"
workflow_dispatch:
defaults:
run:
shell: bash
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
COVERAGE_IGOR_VERBOSE: 1
permissions:
contents: read
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
tsan:
name: "${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
# If it doesn't finish in an hour, it's not going to. Don't spin for six
# hours needlessly.
timeout-minutes: 60
env:
TOX_GH_MAJOR_MINOR: "${{ matrix.python-version }}"
CFLAGS: "-fsanitize=thread"
CC: "clang"
strategy:
matrix:
python-version:
- "3.14t"
- "3.15t"
fail-fast: false
steps:
- name: "Check out the repo"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: "Install system dependencies"
run: |
sudo sed -i.bak 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
sudo apt-get update
sudo apt-get build-dep -y python3
- name: "Install pyenv"
run: |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
- name: "Build Python ${{ matrix.python-version }}-dev"
env:
PYVER: "${{ matrix.python-version }}-dev"
run: |
set -xe
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
CONFIGURE_OPTS="--with-address-sanitizer" pyenv install $PYVER -v
pyenv global $PYVER
- name: "Show diagnostic info"
run: |
set -xe
python -VV
python -m site
python -m sysconfig
python -c "import sys; print('GIL:', getattr(sys, '_is_gil_enabled', lambda: True)())"
python -m coverage debug sys
python -m coverage debug pybehave
env | sort
- name: "Check the Python version"
env:
EXPECTED: "${{ matrix.python-version }}"
run: |
python -c "
import sys
print(f'{sys.version = }')
assert sys.version.startswith('$EXPECTED'.strip('t'))
assert getattr(sys, '_is_gil_enabled', lambda: True)() == (not '$EXPECTED'.endswith('t'))
"
- name: "Install dependencies"
run: |
python -m pip install -r requirements/tox.pip
python -m pip install pytest-run-parallel
- name: "Run tox"
run: |
python -m tox -v -- -rfsEX --parallel-threads=4