-
Notifications
You must be signed in to change notification settings - Fork 9
175 lines (167 loc) · 5.79 KB
/
test.yml
File metadata and controls
175 lines (167 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Unit and integration tests
on:
push:
branches: ['main', 'maint/*']
pull_request:
branches: ['main', 'maint/*']
# Allow job to be triggered manually from GitHub interface
workflow_dispatch:
schedule:
- cron: '0 22 * * 0' # At 22:00 UTC every Sunday
defaults:
run:
shell: bash
# Force tox and pytest to use color
env:
FORCE_COLOR: true
TEST_DATA_HOME: /home/runner/nifreeze-tests/
TEST_OUTPUT_DIR: /home/runner/nifreeze-tests/test-output
DIPY_HOME: /home/runner/nifreeze-tests/dipy
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 4
ANTSPATH: /usr/share/miniconda/bin/
NIFREEZE_WERRORS: 1
TEST_DATA_REPO: https://gin.g-node.org/nipreps-data/tests-nifreeze
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
cache-test-data:
runs-on: 'ubuntu-latest'
outputs:
SHA: ${{ steps.test-head.outputs.SHA }}
steps:
- name: Check remote HEAD
id: test-head
run: |
SHA=$( git ls-remote $TEST_DATA_REPO HEAD | cut -f 1 )
echo SHA=$SHA >> $GITHUB_OUTPUT
echo SHA7=${SHA:0:7} >> $GITHUB_OUTPUT
- name: Check for data-v2-${{ steps.test-head.outputs.SHA }}
uses: actions/cache@v5
id: test-data
with:
path: ${{ env.TEST_DATA_HOME }}
key: data-v2-${{ steps.test-head.outputs.SHA }}
lookup-only: true
- name: Create data-v2-${{ steps.test-head.outputs.SHA }}
uses: actions/cache@v5
if: steps.test-data.outputs.cache-hit != 'true'
with:
path: ${{ env.TEST_DATA_HOME }}
key: data-v2-${{ steps.test-head.outputs.SHA }}
restore-keys: |
data-v2
data-v1
data-v0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
if: steps.test-data.outputs.cache-hit != 'true'
- name: Install datalad
if: steps.test-data.outputs.cache-hit != 'true'
run: |
uvx datalad-installer --sudo ok git-annex
uv tool install --with=datalad-osf --with=datalad-next datalad
uv tool install --with=datalad-next datalad-osf
datalad wtf
- name: Checkout commit ${{ steps.test-head.outputs.SHA7 }}
if: steps.test-data.outputs.cache-hit != 'true'
run: |
if [[ ! -d "${TEST_DATA_HOME}" ]]; then
datalad install -rg --source=${TEST_DATA_REPO} ${TEST_DATA_HOME}
else
cd ${TEST_DATA_HOME}
datalad update --merge -r .
datalad get -r -J4 *
fi
- name: Install DIPY and fetch stanford_hardi dataset
if: steps.test-data.outputs.cache-hit != 'true'
run: |
echo "from dipy.data import fetch_stanford_hardi; fetch_stanford_hardi()" > fetch.py
uv tool install dipy
uv add --script fetch.py dipy
uv run fetch.py
stable:
# Unit tests only on Linux/Python 3.12
runs-on: 'ubuntu-latest'
needs: ['cache-test-data']
strategy:
matrix:
python-version: ${{ github.event_name == 'schedule' && fromJson('["3.10", "3.11", "3.12", "3.13"]') || fromJson('["3.12"]') }}
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
- name: Install ANTs
run: |
# Override libiconv pre-installed from anaconda channel
# See https://github.com/conda-forge/libitk-feedstock/issues/98
# Since we're not creating a new environment, we must be explicit
conda install -c conda-forge ants=2.4 libitk=5.3 libiconv
- name: Verify antsRegistration path
run: |
export PATH=$ANTSPATH:$PATH
which antsRegistration
antsRegistration --version
- uses: actions/cache/restore@v5
with:
path: ${{ env.TEST_DATA_HOME }}
key: data-v2-${{ needs.cache-test-data.outputs.SHA }}
- name: Install TeX Live
run: |
sudo apt-get update
sudo apt install texlive texlive-latex-extra texlive-fonts-recommended cm-super dvipng
- name: Install tox
run: |
uv tool install --with=tox-uv --with=tox-gh-actions tox
- name: Show tox config
run: tox c
- name: Prepare test output directory
run: mkdir -p "${TEST_OUTPUT_DIR}"
- name: Run tox
run: |
export PATH=$ANTSPATH:$PATH
tox -v --exit-and-dump-after 1200
- name: Upload test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: test-output-py${{ matrix.python-version }}
path: ${{ env.TEST_OUTPUT_DIR }}
if-no-files-found: warn
- uses: codecov/codecov-action@v5
if: ${{ always() }}
with:
files: cov.xml
token: ${{ secrets.CODECOV_TOKEN }}
checks:
runs-on: 'ubuntu-latest'
continue-on-error: true
strategy:
matrix:
check: ['spellcheck', 'typecheck']
steps:
- uses: actions/checkout@v5
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
# Can remove this once there is a traits release that supports 3.13
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Install tox
run: uv tool install tox --with=tox-uv
- name: Show tox config
run: tox c
- name: Show tox config (this call)
run: tox c -e ${{ matrix.check }}
- name: Run check
run: tox -e ${{ matrix.check }}