Skip to content

string python versions in readthedocs config #96

string python versions in readthedocs config

string python versions in readthedocs config #96

name: Build and Test (Python 3.9+, macOS, Linux)
env:
UV_VERSION: 0.8.19
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
python3 --version
python3 -m pip install -U pip
python3 -m pip install 'uv==${{ env.UV_VERSION }}'
uv --version
- name: Install package
run: uv sync
- name: Install system dependencies
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do
echo "Waiting for apt lock to be released..."
sleep 5
done
sudo apt update
sudo apt install -y g++ libboost-dev libcdd-dev libcdd-tools libgmp-dev libmpfr-dev libntl-dev make
elif [[ "$RUNNER_OS" == "macOS" ]]; then
brew install gmp boost cddlib mpfr ntl
fi
shell: bash
- name: Run wmpy install
run: |
if [[ "$RUNNER_OS" == "macOS" ]]; then
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
fi
uv run wmpy install --msat --latte --install-path ./wmpy-bin -y
echo "$GITHUB_WORKSPACE/wmpy-bin/latte/bin" >> $GITHUB_PATH
shell: bash
- name: Run mypy
# NOTE: some type stubs are not available for Python < 3.11
run: uv run mypy
- name: Run tests and collect coverage
# NOTE: coverage is only collected for Python 3.12 on Linux
run: |
if [[ "$RUNNER_OS" == "macOS" ]]; then
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
fi
if [[ "${{ matrix.os }}" == "ubuntu-latest" && "${{ matrix.python-version }}" == "3.12" ]]; then
uv run coverage run -m pytest
uv run coverage xml
else
uv run pytest
fi
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}