206 lines (175 loc) · 6.83 KB
/
main.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: CI
on:
push:
branches:
- main
pull_request:
branches_ignore: []
jobs:
cancel-previous:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- uses: khan/pull-request-workflow-cancel@1.0.0
with:
workflows: "main.yml"
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup black environment
run: |
conda create -c conda-forge -y -q --name black black
- name: Check formatting
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate black
black --check --diff snakemake tests/tests.py tests/test_tes.py tests/test_io.py tests/common.py tests/test_google_lifesciences.py
- name: Comment PR
if: github.event_name == 'pull_request' && failure()
uses: marocchino/sticky-pull-request-comment@v1.1.0
with:
message: 'Please format your code with [black](https://black.readthedocs.io): `black snakemake tests/*.py`.'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
testing:
runs-on: ubuntu-latest
needs: formatting
env:
AWS_AVAILABLE: ${{ secrets.AWS_ACCESS_KEY_ID }}
GCP_AVAILABLE: ${{ secrets.GCP_SA_KEY }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # we need tags for versioneer to work
- name: Setup Snakemake environment
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
conda install -c conda-forge -q mamba
mamba env create -q --name snakemake --file test-environment.yml
# additionally add singularity
# TODO remove version constraint: needed because 3.8.7 fails with missing libz:
# bin/unsquashfs: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
mamba install -c conda-forge -n snakemake "singularity<=3.8.6"
- name: Setup apt dependencies
run: |
sudo apt install -y stress git wget
- name: Setup iRODS
run: |
docker build -t irods-server tests/test_remote_irods
docker run -d -p 1247:1247 --name provider irods-server -i run_irods
sleep 10
docker exec -u irods provider iput /incoming/infile
cp -r tests/test_remote_irods/setup-data ~/.irods
- name: Setup Gcloud
uses: GoogleCloudPlatform/github-actions/setup-gcloud@v0.2.1
if: env.GCP_AVAILABLE
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Setup AWS
uses: aws-actions/configure-aws-credentials@v1
if: env.AWS_AVAILABLE
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Run tests
env:
CI: true
ZENODO_SANDBOX_PAT: ${{ secrets.ZENODO_SANDBOX_PAT }}
run: |
# activate conda env
export PATH="/usr/share/miniconda/bin:$PATH"
source activate snakemake
pytest -v -x tests/test_expand.py tests/test_io.py tests/test_schema.py tests/test_linting.py tests/tests.py
- name: Build and publish docker image
if: "contains(github.event.pull_request.labels.*.name, 'update-container-image')"
uses: elgohr/Publish-Docker-Github-Action@2.16
with:
name: snakemake/snakemake
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
tags: ${{ env.GITHUB_SHA }}
- name: Set container image
if: "contains(github.event.pull_request.labels.*.name, 'update-container-image')"
run: |
echo CONTAINER_IMAGE=snakemake/snakemake:$GITHUB_SHA >> $GITHUB_ENV
# TODO reactivate in April (we have no free resources left this month)
- name: Test Google Life Sciences Executor
if: env.GCP_AVAILABLE
run: |
# activate conda env
export PATH="/usr/share/miniconda/bin:$PATH"
source activate snakemake
pytest -s -v -x tests/test_google_lifesciences.py
# TODO reactivate in April (we have no free resources left this month)
- name: Test Kubernetes execution
if: env.GCP_AVAILABLE
env:
CI: true
run: |
# activate conda env
export PATH="/usr/share/miniconda/bin:$PATH"
source activate snakemake
pytest -s -v -x tests/test_kubernetes.py
# TODO temporarily deactivate and fix in separate PR.
- name: Test Tibanna (AWS) execution
if: env.AWS_AVAILABLE
env:
CI: true
run: |
# activate conda env
export PATH="/usr/share/miniconda/bin:$PATH"
source activate snakemake
# pytest -v -x -s tests/test_tibanna.py
- name: Test GA4GH TES executor
run: |
# activate conda env
export PATH="/usr/share/miniconda/bin:$PATH"
source activate snakemake
pytest -s -v -x tests/test_tes.py
- name: Delete container image
if: "contains(github.event.pull_request.labels.*.name, 'update-container-image') && always()"
run: |
docker run --rm lumir/remove-dockerhub-tag \
--user ${{ secrets.DOCKER_USERNAME }} \
--password ${{ secrets.DOCKER_TOKEN }} \
snakemake/snakemake:${{ env.GITHUB_SHA }}
- name: Build container image
if: "!contains(github.event.pull_request.labels.*.name, 'update-container-image')"
run: docker build .
testing-windows:
runs-on: windows-latest
needs: formatting
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Remove unix-only dependencies
shell: python
run: |
import fileinput
excluded_on_win = ["environment-modules", "cwltool"]
for line in fileinput.input("test-environment.yml", inplace=True):
if all(pkg not in line for pkg in excluded_on_win):
print(line)
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: snakemake
python-version: 3.9
channels: conda-forge, bioconda
- name: Setup Snakemake environment
run: |
conda install -q --name base mamba
mamba env update -q --file test-environment.yml
- name: Run tests
env:
CI: true
ZENODO_SANDBOX_PAT: ${{ secrets.ZENODO_SANDBOX_PAT }}
run: |
python -m pytest -v -x tests/tests.py