forked from datalad/datalad
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (101 loc) · 3.75 KB
/
test_extensions.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
name: Extensions
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
extension: [
datalad-neuroimaging,
datalad-container,
datalad-metalad,
datalad-crawler,
datalad-deprecated,
datalad-next,
]
steps:
- name: Set up system
shell: bash
run: |
bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
# enable in case -devel version is needed
# sudo sed -i-devel.list -e 's,/debian ,/debian-devel ,g' /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-get update -qq
sudo apt-get install eatmydata
sudo eatmydata apt-get install git-annex-standalone
- name: Set up environment
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Almighty"
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install DataLad and dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-devel.txt
- name: Setup ${{ matrix.extension }} extension specific variables
run: |
DL_PIP_INSTALLS=mock
DL_APT_INSTALLS=dcm2niix
DL_REPO=datalad/${{ matrix.extension }}
DL_TESTER=pytest
DL_NEED_SINGULARITY=
# TODO: just reuse information from datalad-extensions!!
case ${{ matrix.extension }} in
datalad-container)
DL_NEED_SINGULARITY=1;;
esac
{
echo "DL_PIP_INSTALLS=$DL_PIP_INSTALLS"
echo "DL_APT_INSTALLS=$DL_APT_INSTALLS"
echo "DL_REPO=$DL_REPO"
echo "DL_TESTER=$DL_TESTER"
echo "DL_NEED_SINGULARITY=$DL_NEED_SINGULARITY"
echo "DL_PACKAGE=$(echo ${{ matrix.extension }} | tr '-' '_')"
} >> "$GITHUB_ENV"
- name: Clone and install ${{ matrix.extension }} extension
run: |
git clone https://github.com/$DL_REPO __extension__
pip install ./__extension__[devel]
- name: Install Singularity
run: |
release="$(curl -fsSL https://api.github.com/repos/sylabs/singularity/releases/latest | jq -r .tag_name)"
codename="$(lsb_release -cs)"
arch="$(dpkg --print-architecture)"
cd /tmp
wget -O singularity-ce.deb https://github.com/sylabs/singularity/releases/download/$release/singularity-ce_${release#v}-${codename}_$arch.deb
sudo dpkg -i singularity-ce.deb
sudo apt-get install -f
if: env.DL_NEED_SINGULARITY == '1'
- name: Install additional dependencies and prepare for testing
run: |
pip install $DL_PIP_INSTALLS
[ -z "$DL_APT_INSTALLS" ] || sudo apt-get install $DL_APT_INSTALLS
mkdir -p __testhome__
- name: WTF!?
run: |
datalad wtf
- name: ${{ matrix.extension }} tests using pytest
run: |
cd __testhome__
# -crawler's tox.ini points to itself (but without full path) for coverage
# configuration. So far attempts to "fix" by somehow providing full path did not work.
# That is why just symlink it here. If no tox.ini -- create an empty one
[ -e ../__extension__/tox.ini ] && ln -s ../__extension__/tox.ini . || touch tox.ini
python -m pytest -c ./tox.ini -s -v --cov=datalad --pyargs ${DL_PACKAGE}
if: env.DL_TESTER == 'pytest'
- name: Prepare coverage
run: |
cd __testhome__
python -m coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: __testhome__
fail_ci_if_error: false