-
Notifications
You must be signed in to change notification settings - Fork 11
133 lines (113 loc) · 3.62 KB
/
tests.yml
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
name: CI-Tests
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- master
pull_request:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
env:
FSLOUTPUTTYPE: NIFTI_GZ
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- 'macos-12'
- 'macos-13'
- 'ubuntu-22.04'
- 'ubuntu-20.04'
python-version:
- '3.9'
steps:
- name: Get home directory
run: |
echo ~
echo $HOME
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Package installation
run: |
echo "shimming-toolbox installation"
make install
- name: Set path for Shimming Toolbox
run: |
echo "$HOME/shimming-toolbox/bin" >> $GITHUB_PATH
- name: Spinal Cord Toolbox clone
run: |
cd ~/work
git clone --depth 1 https://github.com/neuropoly/spinalcordtoolbox
cd spinalcordtoolbox
# Use HEAD commit hash as key for cache
git rev-parse HEAD > $GITHUB_WORKSPACE/.sct_HEAD_hash
cat $GITHUB_WORKSPACE/.sct_HEAD_hash
- name: Cache SCT
id: cache-sct
uses: actions/cache@v2
with:
path: ~/work/spinalcordtoolbox
# Use commit hash file from previous step as key
key: ${{ matrix.os }}-${{ hashFiles('**/.sct_HEAD_hash') }}
- name: Spinal Cord Toolbox installation
if: steps.cache-sct.outputs.cache-hit != 'true'
run: |
cd ../../spinalcordtoolbox
./install_sct -y
- name: Set path for SCT
run: echo "$HOME/work/spinalcordtoolbox/bin" >> $GITHUB_PATH
- name: prelude macOS
if: contains(matrix.os, 'macos')
run: |
echo "Download prelude for macOS"
mkdir prelude
curl -o prelude/prelude -JL https://github.com/shimming-toolbox/binaries/raw/master/prelude_macos
sudo install prelude/prelude /usr/local/bin
- name: prelude Ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
echo "Download prelude"
st_download_data prelude
sudo install prelude/prelude /usr/local/bin
- name: Check dependencies
run: st_check_dependencies
- name: Run unit tests
run: |
source ~/shimming-toolbox/python/bin/activate # to be able to call conda
py.test . -v --cov shimmingtoolbox/ --cov-report term-missing
- name: macOS Shellcheck
if: contains(matrix.os, 'macos')
run: brew install shellcheck
- name: Shellcheck
run: |
echo "Check Bash scripts"
if [[ -n "$(ls examples/*.sh)" ]]; then shellcheck examples/*.sh; fi
- name: Upload Coverage
run: |
pip3 install coveralls
coveralls --service=github --rcfile=.coveragerc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.os }}-Python-${{ matrix.python-version }}
COVERALLS_PARALLEL: true
coveralls:
name: Finish Coveralls
needs: test
runs-on: 'ubuntu-22.04'
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish --rcfile=.coveragerc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}