Skip to content

Commit cc630e1

Browse files
committed
CI: Cache data separately from tests
1 parent d7e10df commit cc630e1

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

.github/workflows/travis.yml

+30-14
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@ permissions:
1818
contents: read
1919

2020
jobs:
21-
build-linux:
21+
cache-test-data:
2222
if: "!contains(github.event.head_commit.message, '[skip ci]')"
2323
runs-on: ubuntu-latest
2424
env:
2525
TEST_DATA_HOME: /home/runner/testdata/nitransforms-tests
26-
strategy:
27-
max-parallel: 5
28-
matrix:
29-
python-version: ['3.8', '3.9', '3.10', '3.11']
30-
3126
steps:
3227
- name: Git settings (pacify DataLad)
3328
run: |
@@ -48,8 +43,8 @@ jobs:
4843
python-${{ matrix.python-version }}-
4944
- name: Install DataLad
5045
run: |
51-
$CONDA/bin/conda install -c conda-forge git-annex datalad pip pytest
52-
$CONDA/bin/python -m pip install datalad-osf
46+
$CONDA/bin/conda install -c conda-forge git-annex
47+
python -m pip install datalad datalad-next datalad-osf
5348
5449
- uses: actions/cache@v3
5550
with:
@@ -62,19 +57,40 @@ jobs:
6257
run: |
6358
export PATH=$CONDA/bin:$PATH
6459
mkdir -p /home/runner/testdata
65-
cd /home/runner/testdata
6660
67-
$CONDA/bin/datalad install https://gin.g-node.org/oesteban/nitransforms-tests
68-
$CONDA/bin/datalad update --merge -d nitransforms-tests/
69-
$CONDA/bin/datalad get -d nitransforms-tests/
61+
datalad install -s https://gin.g-node.org/oesteban/nitransforms-tests $TEST_DATA_HOME
62+
datalad update --merge -d $TEST_DATA_HOME
63+
datalad get -J 2 -d $TEST_DATA_HOME
64+
65+
build-linux:
66+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
67+
runs-on: ubuntu-latest
68+
needs: [cache-test-data]
69+
env:
70+
TEST_DATA_HOME: /home/runner/testdata/nitransforms-tests
71+
strategy:
72+
max-parallel: 5
73+
matrix:
74+
python-version: ['3.8', '3.9', '3.10', '3.11']
75+
steps:
76+
- name: Set up Python ${{ matrix.python-version }}
77+
uses: actions/setup-python@v4
78+
with:
79+
python-version: ${{ matrix.python-version }}
80+
- uses: actions/cache@v3
81+
with:
82+
path: ${{ env.TEST_DATA_HOME }}
83+
key: data-cache-v2
84+
restore-keys: |
85+
data-cache-v2
7086
7187
- uses: actions/checkout@v3
7288
- name: Install minimal dependencies
7389
run: |
74-
$CONDA/bin/pip install .[tests]
90+
pip install .[tests]
7591
- name: Run pytest
7692
run: |
77-
$CONDA/bin/pytest -v --cov nitransforms --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules nitransforms/
93+
pytest -v --cov nitransforms --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules nitransforms/
7894
7995
- name: Submit code coverage
8096
uses: codecov/codecov-action@v3

0 commit comments

Comments
 (0)