-
-
Notifications
You must be signed in to change notification settings - Fork 3
138 lines (132 loc) · 4.84 KB
/
test_cpac.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
134
135
136
137
138
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Test cpac
on:
push:
paths-ignore:
- README.rst
pull_request:
jobs:
test_cpac:
runs-on: ubuntu-latest
env:
SINGULARITY_CACHEDIR: $GITHUB_WORKSPACE/.singularity/cache
SINGULARITY_TMPDIR: $GITHUB_WORKSPACE/.singularity/tmp
strategy:
max-parallel: 1 # This'll slow it down but increase stability
matrix:
platform: [docker]
tag: [nightly] # latest
go: [1.14]
python: [3.7, 3.8, 3.9, "3.10", 3.11]
singularity: [3.6.4]
steps:
- name: Maximize space
uses: easimon/maximize-build-space@v8
with:
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-docker-images: 'false'
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install --upgrade pip setuptools wheel
run: python -m pip install --upgrade pip setuptools wheel
- name: Set up Singularity
if: ${{ matrix.platform == 'singularity' }}
uses: eWaterCycle/setup-singularity@v7
with:
singularity-version: ${{ matrix.singularity }}
- name: Prepare Singularity cache and tmp directories
if: ${{ matrix.platform == 'singularity' }}
run: mkdir -p ${SINGULARITY_CACHEDIR} && mkdir -p ${SINGULARITY_TMPDIR}
- name: Install dependencies
run: |
sudo apt-get install libffi-dev \
flawfinder \
libgpgme11-dev \
libseccomp-dev \
squashfs-tools \
libssl1.1 libssl-dev \
libuuid1 uuid-dev
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install coverage coveralls nipype
- name: Install cpac
run: cd $GITHUB_WORKSPACE && pip install -e .
- name: Test cpac, platform and tag specified
run: |
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --platform ${{ matrix.platform }} --tag ${{ matrix.tag }} .
coverage report -m
- name: Test cpac, platform specified, tag unspecified
if: ${{ matrix.tag == 'latest' }}
run: |
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --platform ${{ matrix.platform }} .
coverage report -m
- name: Test cpac, platform unspecified, tag specified
if: ${{ matrix.platform == 'docker' }}
run: |
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --tag ${{ matrix.tag }} .
coverage report -m
- name: Test cpac, platform and tag unspecified
if: ${{ matrix.platform == 'docker' }} && ${{ matrix.tag }} == 'latest'
run: |
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules .
coverage report -m
- name: Report coverage
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel: True
flag-name: Test cpac ${{ matrix.platform }} with Python ${{ matrix.python }}
continue-on-error: true
finalize_coverage-report:
needs:
- test_cpac
runs-on: ubuntu-latest
steps:
- name: Finalize coverage report
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel-finished: true
continue-on-error: true
update_README:
# Only update README if tests succeed
needs:
- test_cpac
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install cpac
run: |
export DEB_PYTHON_INSTALL_LAYOUT=deb_system
cd $GITHUB_WORKSPACE
pip install .
- name: Configure Git credentials
uses: oleksiyrudenko/[email protected]
with:
global: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update README
run: |
(head -n $(read -d : <<< $(less README.rst | grep ".. BEGIN USAGE" -n); expr $REPLY + 1) README.rst; \
printf ".. code-block:: shell\n\n cpac --help\n"; \
cpac --help | sed 's/^/ /'; \
tail --lines=+$(read -d : <<< $(less README.rst | grep ".. END USAGE" -n); expr $REPLY - 1) README.rst\
) > tempREADME &&
mv tempREADME README.rst &
wait %1
if [[ $(git diff --numstat README.rst) ]]; then
git add README.rst
git commit -m ":memo: Update usage from helpstring"
git push origin HEAD:${GITHUB_REF}
fi
shell: bash