-
Notifications
You must be signed in to change notification settings - Fork 563
174 lines (148 loc) · 5.26 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
name: CI
on:
push:
branches:
- main
pull_request:
concurrency:
# Cancel concurrent flows on PRs
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
formatting:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
environment-name: black
create-args: black
cache-environment: false
- name: Check formatting
shell: bash -el {0}
run: black --check --diff .
- name: Comment PR
if: github.event_name == 'pull_request' && failure()
uses: marocchino/[email protected]
with:
message: "Please format your code with [black](https://black.readthedocs.io): `black snakemake tests/*.py`."
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
testing:
strategy:
matrix:
test_group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
py_ver: ["3.11", "3.12"]
runs-on: ubuntu-latest
needs: formatting
env:
AWS_AVAILABLE: "${{ secrets.AWS_ACCESS_KEY_ID }}"
GCP_AVAILABLE: "${{ secrets.GCP_SA_KEY }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Modify python version in test env
shell: bash -el {0}
run: |
cp test-environment.yml test-environment-${{ matrix.py_ver }}.yml
sed -E -i 's/- python.+/- python =${{ matrix.py_ver }}/' test-environment-${{ matrix.py_ver }}.yml
- name: Setup snakemake environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
environment-file: test-environment-${{ matrix.py_ver }}.yml
environment-name: snakemake
auto-update-conda: true
- name: Install snakemake from source
shell: bash -el {0}
run: |
conda config --set channel_priority strict
pip install -e .
# - name: Configure fast APT mirror
# uses: vegardit/[email protected]
- name: Setup apt dependencies
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt-get update
sudo apt install -y stress git wget openmpi-bin libopenmpi-dev apptainer
# See https://github.com/apptainer/apptainer/pull/2262
- name: Disable apparmor namespace restrictions for apptainer
run: |
sudo sh -c 'echo kernel.apparmor_restrict_unprivileged_userns=0 \
>/etc/sysctl.d/90-disable-userns-restrictions.conf'
sudo sysctl -p /etc/sysctl.d/90-disable-userns-restrictions.conf
- name: Test local
env:
CI: true
ZENODO_SANDBOX_PAT: "${{ secrets.ZENODO_SANDBOX_PAT }}"
#PYTHONTRACEMALLOC: 10
shell: bash -el {0}
run: |
pytest -v -x --show-capture=stderr \
--splits 10 --group ${{ matrix.test_group }} --splitting-algorithm=least_duration \
tests/tests.py \
tests/test_expand.py \
tests/test_io.py \
tests/test_schema.py \
tests/test_linting.py \
tests/test_executor_test_suite.py \
tests/test_api.py \
tests/test_internals.py
- name: Run tests/test_report/Snakefile to generate report
shell: bash -el {0}
run: |
cd tests/test_report
snakemake --use-conda --cores 1 --report report.zip
- name: List directory structure
run: |
ls -R
- name: Upload report
if: ${{ matrix.test_group == 1 }}
uses: actions/upload-artifact@v4
with:
name: report-${{ matrix.py_ver }}.zip
path: tests/test_report/report.zip
build-container-image:
runs-on: ubuntu-latest
needs: testing
steps:
- uses: actions/checkout@v4
- name: Build container image
run: docker build .
testing-windows:
strategy:
matrix:
test_group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
runs-on: windows-latest
needs: formatting
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Remove unix-only dependencies
shell: python
run: |
import fileinput
excluded_on_win = ["environment-modules", "cwltool", "cwl-utils", "apptainer", "squashfuse"]
for line in fileinput.input("test-environment.yml", inplace=True):
if all(pkg not in line for pkg in excluded_on_win):
print(line, end="")
- name: Setup snakemake environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
environment-file: test-environment.yml
environment-name: snakemake
auto-update-conda: true
- name: Install snakemake from source
run: |
pip install .
- name: Run tests
env:
CI: true
ZENODO_SANDBOX_PAT: "${{ secrets.ZENODO_SANDBOX_PAT }}"
run: |
python -m pytest --show-capture=stderr -v -x --splits 10 --group ${{ matrix.test_group }} --splitting-algorithm=least_duration tests/tests.py