Skip to content

Commit

Permalink
Merge pull request #8 from petrelharp/CI
Browse files Browse the repository at this point in the history
github CI
  • Loading branch information
benjeffery authored Dec 16, 2024
2 parents db7d7cd + 68542dc commit ad2d1d7
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build Docs

on:
pull_request:
push:
branches: [main]
tags:
- '*'

env:
COMMIT_EMAIL: [email protected]
MAKE_TARGET: -C python
OWNER: tskit-dev
REPO: tskit
REQUIREMENTS: python/requirements/CI-docs/requirements.txt

jobs:
build-deploy-docs:
name: Docs
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v4

- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: tskit-docs-env

- name: Cache Conda env
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ hashFiles(env.REQUIREMENTS) }}-${{ env.CACHE_NUMBER }}
env:
CACHE_NUMBER: 0
id: cache

- name: Update environment
run: |
mamba install -y python=3.12 doxygen pip
pip install -r ${{ env.REQUIREMENTS }}
if: steps.cache.outputs.cache-hit != 'true'

- name: Build Docs
run: make -C docs
83 changes: 83 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Tests

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
name: Lint
runs-on: ubuntu-24.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/[email protected]
- uses: actions/[email protected]
- name: install clang-format
run: |
pip install clang-format==6.0.1
- uses: pre-commit/[email protected]

test:
name: Python
runs-on: ${{ matrix.os }}
strategy:
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/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/[email protected]
with:
submodules: true

- name: Cache conda and dependencies
id: cache
uses: actions/[email protected]
with:
path: ${{ env.CONDA }}/envs
key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.python}}-conda-${{ hashFiles('requirements/CI-tests-conda/requirements.txt') }}-${{ hashFiles('requirements/CI-tests-pip/requirements.txt') }}

- name: Install Conda
uses: conda-incubator/[email protected]
if: steps.cache.outputs.cache-hit != 'true'
with:
activate-environment: anaconda-client-env
python-version: ${{ matrix.python }}
channels: conda-forge, anaconda
channel-priority: strict
auto-update-conda: true

- name: Fix windows .profile
if: steps.cache.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
run: |
cp ~/.bash_profile ~/.profile
- 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 pip deps
if: steps.cache.outputs.cache-hit != 'true'
shell: bash -l {0}
run: |
pip install -r requirements/CI-tests-pip/requirements.txt
pip install .
- name: Run tests
run: |
source ~/.profile
conda activate anaconda-client-env
pytest -xvs -n0
11 changes: 11 additions & 0 deletions requirements/CI-docs-pip/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
jupyter-book==1.0.0
breathe==4.35.0
sphinx-autodoc-typehints==2.2.2
sphinx-issues==4.1.0
sphinx-argparse==0.4.0
svgwrite==1.4.3
tskit==0.6.0
scipy==1.14.1
msprime==1.3.2
sphinx-book-theme

2 changes: 2 additions & 0 deletions requirements/CI-tests-conda/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scipy==1.14.1
msprime==1.3.2
5 changes: 5 additions & 0 deletions requirements/CI-tests-pip/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tskit==0.6.0
numpy==2.2.0
pytest==8.2.2
pytest-cov==5.0.0
pytest-xdist==3.6.1
7 changes: 7 additions & 0 deletions requirements/development.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tskit
numpy
scipy
pytest
pytest-cov
pytest-xdist
msprime>=1.0.0

0 comments on commit ad2d1d7

Please sign in to comment.