Skip to content

Extra tests for recode_ancestral #1607

Extra tests for recode_ancestral

Extra tests for recode_ancestral #1607

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: install clang-format
if: steps.clang_format.outputs.cache-hit != 'true'
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/[email protected]
test:
name: Python
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: [ 3.9, "3.12" ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Cache conda and dependancies
id: cache
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.python}}-conda-v5-${{ hashFiles('requirements/CI-tests-conda/requirements.txt')}}
- name: Install Miniconda with Mamba
uses: conda-incubator/setup-miniconda@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
activate-environment: anaconda-client-env
python-version: ${{ matrix.python }}
channels: conda-forge
# channel-priority: strict
auto-update-conda: true
# mamba-version: "*"
# use-mamba: true
- name: Fix windows .profile
if: steps.cache.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
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
if: steps.cache.outputs.cache-hit != 'true'
shell: bash -l {0} #We need a login shell to get conda
run: conda install --yes c-compiler
- name: Install conda deps
if: steps.cache.outputs.cache-hit != 'true'
shell: bash -l {0} #We need a login shell to get conda
run: conda install --yes --file=requirements/CI-tests-conda/requirements.txt
- name: Install cyvcf2 #Fails if done via conda due to no windows support.
if: steps.cache.outputs.cache-hit != 'true' && matrix.os != 'windows-latest'
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
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
if: steps.cache.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
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
pip install sgkit==0.9.0
- 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