Skip to content

Pyproject reqs

Pyproject reqs #1760

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches: [main]
merge_group:
jobs:
pre-commit:
name: Lint
runs-on: ubuntu-24.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.4.0
with:
python-version: '3.10'
- name: install clang-format
run: |
sudo pip install clang-format==6.0.1
sudo ln -s /usr/local/bin/clang-format /usr/local/bin/clang-format-6.0
- uses: pre-commit/action@v3.0.1
test:
name: Python
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: [ 3.9, "3.12" ]
os: [ macos-latest, ubuntu-24.04, windows-latest ]
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4.2.2
with:
submodules: true
- name: Install Miniconda with Mamba
uses: conda-incubator/setup-miniconda@v3.1.1
with:
activate-environment: anaconda-client-env
python-version: ${{ matrix.python }}
channels: conda-forge
auto-update-conda: true
- name: Fix windows .profile
run: |
cp ~/.bash_profile ~/.profile
# Work around weird issues on OSX possibly caused by mixed compilers
# https://github.com/tskit-dev/tsinfer/issues/376
- name: Install compiler from conda
shell: bash -l {0} #We need a login shell to get conda
run: conda install --yes c-compiler
- name: Install conda deps
shell: bash -l {0} #We need a login shell to get conda
run: conda install msprime
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.15"
- name: Install cyvcf2 #Fails if done via conda due to no windows support.
run: |
source ~/.profile
conda activate anaconda-client-env
#Install these by pip so we don't pull in cbgen with conda as it isn't available on 3.12
uv pip install sgkit==0.9.0 cyvcf2==0.31.1 yarl==1.9.4 aiohttp==3.9.5 requests==2.32.3
- name: Install sgkit only on windows
run: |
source ~/.profile
conda activate anaconda-client-env
#Install these by pip so we don't pull in cbgen with conda as it isn't available on 3.12
uv pip install sgkit==0.9.0
- name: Install pip deps
run:
uv pip install -r pyproject.toml --extra test
- name: Build module
run: |
source ~/.profile
conda activate anaconda-client-env
# Use numpy2 to build the module
pip install "numpy>=2"
python setup.py build_ext --inplace
- name: Run tests
run: |
source ~/.profile
conda activate anaconda-client-env
# Test with numpy<2 for numba
pip install "numpy<2"
python -m pytest -xv