diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc8966d6..fdb4bf07 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Tests +name: Unit and integration tests on: push: @@ -28,38 +28,49 @@ 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/setup-micromamba@v1.9.0 + with: + environment-file: env.yml + init-shell: bash + cache-environment: true + cache-environment-key: environment-v1 + ache-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/test-data/ + key: data-v0 + + - name: Datalad install + 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/test-data/ + key: data-v0 + - name: Show tox config run: tox c - name: Run tox diff --git a/env.yml b/env.yml new file mode 100644 index 00000000..21acb742 --- /dev/null +++ b/env.yml @@ -0,0 +1,29 @@ +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 + TEST_DATA_HOME: /home/runner/test-data diff --git a/tox.ini b/tox.ini index e3bdd827..f512cbcd 100644 --- a/tox.ini +++ b/tox.ini @@ -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 @@ -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}