tests #394
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
paths: | |
- src/** | |
- test/** | |
- setup.py | |
- requirements.txt | |
- Makefile | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
run-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python: [ '3.8', '3.9', 'pypy-3.9', '3.10', '3.11', '3.12', '3.13' ] | |
include: | |
- os: macos-13 | |
python: '3.8' | |
- os: macos-13 | |
python: '3.9' | |
- os: macos-13 | |
python: 'pypy-3.9' | |
- os: macos-13 | |
python: '3.10' | |
- os: macos-13 | |
python: '3.11' | |
exclude: | |
- os: macos-latest # Python 3.8 unavailable on macos-14 | |
python: '3.8' | |
- os: macos-latest # Python 3.9 unavailable on macos-14 | |
python: '3.9' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: select Xcode version | |
# MacOS > 14.2 requires Xcode >= 15.3; otherwise loading native extension modules fails with e.g.: | |
# dlopen(/opt/homebrew/lib/python3.11/site-packages/slipcover/probe.abi3.so, 0x0002): bad bind opcode 0x00 | |
if: startsWith(matrix.os, 'macos-') | |
run: | | |
if [ -d /Applications/Xcode_15.3.app/Contents/Developer ]; then sudo xcode-select --switch /Applications/Xcode_15.3.app/Contents/Developer; fi | |
clang++ --version | |
g++ --version | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
allow-prereleases: true | |
- name: install prereqs | |
run: | | |
python3 -m pip install -U pip # to avoid warnings | |
python3 -m pip install pytest | |
- name: install Unix dependencies | |
if: matrix.os != 'windows-latest' | |
run: python3 -m pip install pytest-forked | |
- name: install SlipCover | |
run: | | |
python3 -m pip install . | |
- name: run tests | |
run: python3 -m pytest | |
# Test building from source distribution | |
test-build-from-source: | |
runs-on: ubuntu-latest | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
python_tag: ['cp311', 'pp39'] | |
include: | |
- os: ubuntu-latest | |
container: quay.io/pypa/manylinux_2_28_x86_64 # https://github.com/pypa/manylinux | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
run: | | |
PYT=`echo "${{ matrix.python_tag }}" | tr -d "."`; ls -d -1 /opt/python/$PYT-*/bin | head -n 1 >> $GITHUB_PATH | |
cat $GITHUB_PATH | |
- name: install dependencies | |
run: | | |
python3 -m pip install --upgrade pip # to avoid warnings | |
python3 -m pip install wheel | |
- name: build sdist | |
run: | | |
python3 setup.py sdist | |
- name: try to use it | |
run: | | |
tar xzf dist/slipcover*.tar.gz | |
cd slipcover* | |
python3 setup.py build | |
# Run a manylinux wheel build to verify build configuration | |
test-build-wheel-manylinux: | |
runs-on: ubuntu-latest | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
python_version: ['3.8', '3.9', '3.10', '3.11'] # 3.12+ are "pure Python", no need to build on manylinux | |
include: | |
- os: ubuntu-latest | |
container: quay.io/pypa/manylinux_2_28_x86_64 # https://github.com/pypa/manylinux | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
run: | | |
PYV=`echo "${{ matrix.python_version }}" | tr -d "."`; ls -d -1 /opt/python/cp$PYV*/bin | head -n 1 >> $GITHUB_PATH | |
cat $GITHUB_PATH | |
- name: install dependencies | |
run: | | |
python3 -m pip install --upgrade pip # otherwise building 'cryptography' may fail | |
python3 -m pip install setuptools wheel twine | |
- name: build wheel | |
run: | | |
python3 setup.py bdist_wheel | |
- name: run auditwheel for manylinux | |
run: | | |
auditwheel repair dist/*.whl | |
rm -f dist/*.whl | |
mv wheelhouse/*.whl dist/ |