|
1 | 1 | name: Deps & CI
|
2 | 2 |
|
3 |
| -on: [push] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ '*' ] |
| 6 | + pull_request: |
| 7 | + branches: [ master, 'maint/*' ] |
| 8 | + schedule: |
| 9 | + - cron: '0 0 * * 1' |
| 10 | + # Allow job to be triggered manually from GitHub interface |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
4 | 19 |
|
5 | 20 | jobs:
|
6 |
| - build-linux: |
7 |
| - if: "!contains(github.event.head_commit.message, '[skip ci]' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'nipy/nitransforms'))" |
| 21 | + cache-test-data: |
| 22 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
8 | 23 | runs-on: ubuntu-latest
|
9 | 24 | env:
|
10 | 25 | TEST_DATA_HOME: /home/runner/testdata/nitransforms-tests
|
11 |
| - strategy: |
12 |
| - max-parallel: 5 |
13 |
| - matrix: |
14 |
| - python-version: ['3.8', '3.9', '3.10', '3.11'] |
15 |
| - |
| 26 | + outputs: |
| 27 | + SHA: ${{ steps.test-head.outputs.SHA }} |
16 | 28 | steps:
|
17 | 29 | - name: Git settings (pacify DataLad)
|
18 | 30 | run: |
|
19 | 31 | git config --global user.name 'NiPreps Bot'
|
20 | 32 | git config --global user.email '[email protected]'
|
21 |
| - - name: Set up Python ${{ matrix.python-version }} |
22 |
| - uses: actions/setup-python@v4 |
23 |
| - with: |
24 |
| - python-version: ${{ matrix.python-version }} |
25 |
| - - uses: actions/cache@v3 |
26 |
| - id: conda |
27 |
| - with: |
28 |
| - path: | |
29 |
| - /usr/share/miniconda/pkgs |
30 |
| - /home/runner/.cache/pip |
31 |
| - key: python-${{ matrix.python-version }}-v1 |
32 |
| - restore-keys: | |
33 |
| - python-${{ matrix.python-version }}- |
34 | 33 | - name: Install DataLad
|
35 | 34 | run: |
|
36 |
| - $CONDA/bin/conda install -c conda-forge git-annex datalad pip pytest |
37 |
| - $CONDA/bin/python -m pip install datalad-osf |
| 35 | + $CONDA/bin/conda install -c conda-forge git-annex |
| 36 | + python -m pip install datalad datalad-next datalad-osf |
| 37 | + - name: Check remote HEAD |
| 38 | + id: test-head |
| 39 | + run: | |
| 40 | + git ls-remote https://gin.g-node.org/oesteban/nitransforms-tests \ |
| 41 | + | awk '/HEAD/{ print "SHA=" $1 }' >> $GITHUB_OUTPUT |
38 | 42 |
|
39 | 43 | - uses: actions/cache@v3
|
40 | 44 | with:
|
41 | 45 | path: ${{ env.TEST_DATA_HOME }}
|
42 |
| - key: data-cache-v2 |
| 46 | + key: data-cache-v2-${{ steps.test-head.outputs.SHA }} |
43 | 47 | restore-keys: |
|
| 48 | + data-cache-v2-${{ steps.test-head.outputs.SHA }} |
44 | 49 | data-cache-v2
|
45 | 50 |
|
46 | 51 | - name: Install test data
|
47 | 52 | run: |
|
48 | 53 | export PATH=$CONDA/bin:$PATH
|
49 | 54 | mkdir -p /home/runner/testdata
|
50 |
| - cd /home/runner/testdata |
51 | 55 |
|
52 |
| - $CONDA/bin/datalad install https://gin.g-node.org/oesteban/nitransforms-tests |
53 |
| - $CONDA/bin/datalad update --merge -d nitransforms-tests/ |
54 |
| - $CONDA/bin/datalad get -d nitransforms-tests/ |
| 56 | + datalad install -s https://gin.g-node.org/oesteban/nitransforms-tests $TEST_DATA_HOME |
| 57 | + datalad update --merge -d $TEST_DATA_HOME |
| 58 | + datalad get -J 2 -d $TEST_DATA_HOME |
| 59 | +
|
| 60 | + build-linux: |
| 61 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 62 | + runs-on: ubuntu-latest |
| 63 | + needs: [cache-test-data] |
| 64 | + env: |
| 65 | + TEST_DATA_HOME: /home/runner/testdata/nitransforms-tests |
| 66 | + strategy: |
| 67 | + max-parallel: 5 |
| 68 | + matrix: |
| 69 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 70 | + steps: |
| 71 | + - name: Set up Python ${{ matrix.python-version }} |
| 72 | + uses: actions/setup-python@v4 |
| 73 | + with: |
| 74 | + python-version: ${{ matrix.python-version }} |
| 75 | + - uses: actions/cache/restore@v3 |
| 76 | + with: |
| 77 | + path: ${{ env.TEST_DATA_HOME }} |
| 78 | + key: data-cache-v2-${{ needs.cache-test-data.outputs.SHA }} |
55 | 79 |
|
56 | 80 | - uses: actions/checkout@v3
|
57 | 81 | - name: Install minimal dependencies
|
58 | 82 | run: |
|
59 |
| - $CONDA/bin/pip install .[tests] |
| 83 | + pip install .[tests] |
60 | 84 | - name: Run pytest
|
61 | 85 | run: |
|
62 |
| - $CONDA/bin/pytest -v --cov nitransforms --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules nitransforms/ |
| 86 | + pytest -v --cov nitransforms --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules nitransforms/ |
63 | 87 |
|
64 | 88 | - name: Submit code coverage
|
65 | 89 | uses: codecov/codecov-action@v3
|
|
0 commit comments