Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
wip: run test once, download data
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Sep 30, 2024
1 parent 3501207 commit 7fb2086
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 40 deletions.
64 changes: 39 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Unit and integration tests

on:
push:
Expand All @@ -19,6 +19,7 @@ defaults:
# Force tox and pytest to use color
env:
FORCE_COLOR: true
TEST_DATA_HOME: /home/runner/eddymotion-tests/

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -28,41 +29,54 @@ permissions:
contents: read

jobs:
stable:
# Check each OS, all supported Python, minimum versions and latest releases
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest']
python-version: ['3.10', '3.11', '3.12']
dependencies: ['full', 'pre']
include:
- os: ubuntu-latest
python-version: '3.10'
dependencies: 'min'

env:
DEPENDS: ${{ matrix.dependencies }}
test:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5

- uses: mamba-org/[email protected]
with:
environment-file: env.yml
init-shell: bash
cache-environment: true
cache-environment-key: environment-v1
cache-downloads: false
post-cleanup: 'none'
generate-run-shell: true
# https://github.com/mamba-org/setup-micromamba/issues/225
micromamba-version: 1.5.10-0
micromamba-binary-path: /home/runner/micromamba-bin-versioned/micromamba

- uses: actions/cache/restore@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install tox
path: /home/runner/eddymotion-tests/
key: data-v0

- name: Get test data with DataLad
shell: micromamba-shell {0}
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
if [[ ! -d "${TEST_DATA_HOME}" ]]; then
datalad install -rg --source=https://gin.g-node.org/nipreps-data/tests-eddymotion.git ${TEST_DATA_HOME}
else
cd ${TEST_DATA_HOME}
datalad update --merge -r .
datalad get -r -J4 *
fi
- uses: actions/cache/save@v4
with:
path: /home/runner/eddymotion-tests/
key: data-v0

- name: Show tox config
shell: micromamba-shell {0}
run: tox c
- name: Run tox
shell: micromamba-shell {0}
run: tox -v --exit-and-dump-after 1200
- uses: codecov/codecov-action@v4
if: ${{ always() }}
Expand Down
28 changes: 28 additions & 0 deletions env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: eddymotion
channels:
- conda-forge
# Update this ~yearly; last updated Jan 2024
dependencies:
- python=3.12
# Intel Math Kernel Library for numpy
- mkl=2023.2.0
- mkl-service=2.4.0
# git-annex for templateflow users with DataLad superdatasets
- git-annex=*=alldep*
# Workflow dependencies: ANTs
- ants=2.5
- pip
- pip:
- datalad
- dipy>=1.3.0
- h5py
- joblib
- tox
- tox-gh-actions
- coverage
- pytest
- pytest-cov
- pytest-env
- pytest-xdist
variables:
FSLOUTPUTTYPE: NIFTI_GZ
16 changes: 1 addition & 15 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,17 @@
requires =
tox>=4
envlist =
py3{10,11,12}-{full,pre}
py310-min
py312
skip_missing_interpreters = true

# Configuration that allows us to split tests across GitHub runners effectively
[gh-actions]
python =
3.10: py310
3.11: py311
3.12: py312

[gh-actions:env]
DEPENDS =
min: min
full: full
pre: pre

[testenv]
description = Pytest with coverage
labels = test
pip_pre =
pre: true
pass_env =
# getpass.getuser() sources for Windows:
LOGNAME
Expand All @@ -37,9 +26,6 @@ pass_env =
CLICOLOR
CLICOLOR_FORCE
extras = test
deps =
min: nipype ==1.8.5
min: pybids ==0.15.6
commands =
pytest --doctest-modules --cov eddymotion --cov-report xml \
--junitxml=test-results.xml -v src test {posargs}
Expand Down

0 comments on commit 7fb2086

Please sign in to comment.