-
Notifications
You must be signed in to change notification settings - Fork 29
122 lines (118 loc) · 4.7 KB
/
Copy pathtest-spras.yml
File metadata and controls
122 lines (118 loc) · 4.7 KB
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
name: Test SPRAS
on: [push, pull_request]
jobs:
# Installs the conda environment but does not run tests because the tests require Linux Docker images
conda-only:
name: Test conda environment
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install conda environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: spras
environment-file: environment.yml
auto-activate-base: false
miniconda-version: 'latest'
- name: Log conda environment
# Log conda environment contents
shell: bash --login {0}
run: conda list
# Runs the test code and Snakemake workflow in the conda environment
test:
name: Run tests
# The Docker images will be pulled in both the docker job and this test job
runs-on: ${{ matrix.os }}
strategy:
matrix:
# We later use this with `pytest-split` to split our test CI into two
# (with the max specified by `--splits 2`), to save CI time by parallelization
test_group: [1, 2]
os: [ubuntu-latest]
# we want all tests to run, even if some fail.
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: "node-cleanup"
# Frees up space for https://github.com/Reed-CompBio/spras/issues/448
# removing dotnet, android, and leftover docker images as per https://carlosbecker.com/posts/github-actions-disk-space/.
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android
sudo docker image prune --all --force
sudo docker builder prune -a
- name: Install conda environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: spras
environment-file: environment.yml
auto-activate-base: false
miniconda-version: 'latest'
- name: Install spras in conda env
# Install spras in the environment using pip
shell: bash --login {0}
run: pip install .
- name: Log conda environment
# Log conda environment contents
shell: bash --login {0}
run: conda list
- name: Install Apptainer
# Formerly used Singularity instead of Apptainer (see https://github.com/eWaterCycle/setup-singularity/issues/6)
uses: eWaterCycle/setup-apptainer@v2
with:
# Choose version from https://github.com/apptainer/apptainer/releases
apptainer-version: 1.3.6
- name: Run tests
shell: bash --login {0}
# Verbose output and disable stdout and stderr capturing
# [this pytest-split workflow was borrowed from Snakemake CI]
run: pytest -vs --splits 2 --group ${{ matrix.test_group }}
workflow:
name: Run workflow
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
# TODO: is it worth it to make this setup into a composite action?
- name: Checkout repository
uses: actions/checkout@v4
- name: Install conda environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: spras
environment-file: environment.yml
auto-activate-base: false
miniconda-version: 'latest'
# Install spras in the environment using pip
- name: Install spras in conda env
shell: bash --login {0}
run: pip install .
- name: Run Snakemake workflow
shell: bash --login {0}
# We enable high parallelization (cores 4) to test our way out of the experienced
# race conditions from #268 and #279
# We also enforce strict DAG evaluation to catch DAG problems before they appear as user errors. (#359)
run: snakemake --cores 4 --configfile config/config.yaml --show-failed-logs --strict-dag-evaluation cyclic-graph --strict-dag-evaluation functions --strict-dag-evaluation periodic-wildcards
# Run pre-commit checks on source files
pre-commit:
name: Run pre-commit checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install conda environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: spras
environment-file: environment.yml
auto-activate-base: false
miniconda-version: 'latest'
- name: Run pre-commit
shell: bash --login {0}
# https://github.com/pre-commit/action/blob/576ff52938d158a24ac7e009dfa94b1455e7df99/action.yml#L19
run: pre-commit run --all-files --show-diff-on-failure --color=always