Skip to content

tests

tests #87

Workflow file for this run

name: tests
on:
push:
branches:
- master
pull_request:
schedule:
- cron: '0 0 * * 1' # run every Monday
workflow_call:
workflow_dispatch:
env:
PYTEST_ADDOPTS: "--color=yes"
jobs:
tests:
runs-on: GPU
defaults:
run:
shell: bash -i {0}
strategy:
matrix:
python-version: ["3.9", "3.13"]
steps:
- name: Initialisation
uses: actions/checkout@v2
- name: Debug
run: |
pwd
echo $PATH
which conda
- name: Prepare env file
run: sed -i "s/PYTHON_VERSION/${{ matrix.python-version }}/g" .github/environment.yml
- name: Create conda env
run: conda env create -f ".github/environment.yml"
- name: Install packages
run: |
eval "$(conda shell.bash hook)"
conda activate conda-environment
python --version
python -m pip install .[dev]
- name: Unit tests with coverage
run: |
eval "$(conda shell.bash hook)"
conda activate conda-environment
invoke test.coverage
- name: Doc tests
run: |
eval "$(conda shell.bash hook)"
conda activate conda-environment
invoke test.docs
- name: Notebook tests
run: |
eval "$(conda shell.bash hook)"
conda activate conda-environment
invoke test.ipynb
- name: Remove conda env
run: conda env remove -n conda-environment
if: always()
- name: Upload coverage to Codecov.io
uses: codecov/codecov-action@v1
build:
needs: tests
name: Build wheel and sdist
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install pypa/build
run: python -m pip install --user build
- name: Build wheel and source tarball
run: python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/