forked from nf-core/scdownstream
-
Notifications
You must be signed in to change notification settings - Fork 0
263 lines (239 loc) · 8.17 KB
/
nf-test.yml
File metadata and controls
263 lines (239 loc) · 8.17 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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
name: Run nf-test
on:
push:
branches:
- dev
- master
- main
paths-ignore:
- "docs/**"
- "**/meta.yml"
- "**/*.md"
- "**/*.png"
- "**/*.svg"
pull_request:
paths-ignore:
- "docs/**"
- "**/meta.yml"
- "**/*.md"
- "**/*.png"
- "**/*.svg"
release:
types: [published]
workflow_dispatch:
# Cancel if a newer run is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NFT_VER: "0.9.2"
NFT_WORKDIR: "~"
NXF_ANSI_LOG: false
NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity
NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity
jobs:
nf-test-changes:
name: nf-test-changes
runs-on: # use self-hosted runners
- runs-on=$-nf-test-changes
- runner=4cpu-linux-x64
outputs:
shard: ${{ steps.set-shards.outputs.shard }}
total_shards: ${{ steps.set-shards.outputs.total_shards }}
steps:
- name: Clean Workspace # Purge the workspace in case it's running on a self-hosted runner
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: get number of shards
id: set-shards
uses: ./.github/actions/get-shards
env:
NFT_VER: ${{ env.NFT_VER }}
with:
max_shards: 15
tags: modules_local,subworkflows_local
- name: debug
run: |
echo ${{ steps.set-shards.outputs.shard }}
echo ${{ steps.set-shards.outputs.total_shards }}
nf-test:
name: "${{ matrix.profile }} | ${{ matrix.NXF_VER }} | ${{ matrix.shard }}/${{ needs.nf-test-changes.outputs.total_shards }}"
needs: [nf-test-changes]
if: ${{ needs.nf-test-changes.outputs.total_shards != '0' }}
runs-on: # use self-hosted runners
- runs-on=$-nf-test
- runner=4cpu-linux-x64
- disk=large
strategy:
fail-fast: false
matrix:
shard: ${{ fromJson(needs.nf-test-changes.outputs.shard) }}
profile: [conda, docker, singularity]
isMain:
- ${{ github.base_ref == 'master' || github.base_ref == 'main' }}
# Exclude conda and singularity on dev
exclude:
- isMain: false
profile: "conda"
- isMain: false
profile: "singularity"
NXF_VER:
- "24.04.2"
- "latest-everything"
env:
NXF_ANSI_LOG: false
TOTAL_SHARDS: ${{ needs.nf-test-changes.outputs.total_shards }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Run nf-test
uses: ./.github/actions/nf-test
env:
NFT_WORKDIR: ${{ env.NFT_WORKDIR }}
with:
profile: ${{ matrix.profile }}
shard: ${{ matrix.shard }}
total_shards: ${{ env.TOTAL_SHARDS }}
tags: modules_local,subworkflows_local
pipeline-tests:
name: "Pipeline Test | ${{ matrix.test_name }} | ${{ matrix.NXF_VER }} | ${{ matrix.profile }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test_name:
- "default"
- "main_pipeline_build"
- "main_pipeline_extend"
- "main_pipeline_sub"
- "main_pipeline_qc"
- "main_pipeline_reference_mapping"
profile: [conda, docker, singularity]
isMain:
- ${{ github.base_ref == 'master' || github.base_ref == 'main' }}
# Exclude conda and singularity on dev
exclude:
- isMain: false
profile: "conda"
- isMain: false
profile: "singularity"
NXF_VER:
- "24.04.2"
- "latest-everything"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Disk space cleanup
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
- name: Setup Nextflow
uses: nf-core/setup-nextflow@v2
with:
version: "${{ matrix.NXF_VER }}"
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.13"
- name: Install nf-test
uses: nf-core/setup-nf-test@v1
with:
version: ${{ env.NFT_VER }}
install-pdiff: true
- name: Setup apptainer
if: contains(matrix.profile, 'singularity')
uses: eWaterCycle/setup-apptainer@main
- name: Set up Singularity
if: contains(matrix.profile, 'singularity')
shell: bash
run: |
mkdir -p $NXF_SINGULARITY_CACHEDIR
mkdir -p $NXF_SINGULARITY_LIBRARYDIR
- name: Conda setup
if: contains(matrix.profile, 'conda')
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3
with:
auto-update-conda: true
conda-solver: libmamba
conda-remove-defaults: true
- name: Run nf-test
shell: bash
env:
NFT_DIFF: ${{ env.NFT_DIFF }}
NFT_DIFF_ARGS: ${{ env.NFT_DIFF_ARGS }}
NFT_WORKDIR: ${{ env.NFT_WORKDIR }}
run: |
# Make it clear that we're ONLY running tests from the tests directory
# and not including any module or subworkflow tests
nf-test test \
--profile=+${{ matrix.profile }} \
--ci \
--verbose \
--tap=test.tap \
tests/${{ matrix.test_name }}.nf.test
- name: Generate test summary
if: always()
shell: bash
run: |
# Add header if it doesn't exist (using a token file to track this)
if [ ! -f ".summary_header" ]; then
echo "# 🚀 nf-test results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Status | Test Name | Profile | Nextflow Version |" >> $GITHUB_STEP_SUMMARY
echo "|:------:|-----------|---------|-----------------|" >> $GITHUB_STEP_SUMMARY
touch .summary_header
fi
if [ -f test.tap ]; then
while IFS= read -r line; do
if [[ $line =~ ^ok ]]; then
test_name="${line#ok }"
# Remove the test number from the beginning
test_name="${test_name#* }"
echo "| ✅ | ${test_name} | ${{ matrix.profile }} | ${{ matrix.NXF_VER }} |" >> $GITHUB_STEP_SUMMARY
elif [[ $line =~ ^not\ ok ]]; then
test_name="${line#not ok }"
# Remove the test number from the beginning
test_name="${test_name#* }"
echo "| ❌ | ${test_name} | ${{ matrix.profile }} | ${{ matrix.NXF_VER }} |" >> $GITHUB_STEP_SUMMARY
fi
done < test.tap
else
echo "| ⚠️ | No test results found | ${{ matrix.profile }} | ${{ matrix.NXF_VER }} |" >> $GITHUB_STEP_SUMMARY
fi
confirm-pass:
needs: [nf-test, pipeline-tests]
if: always()
runs-on: # use self-hosted runners
- runs-on=$-confirm-pass
- runner=2cpu-linux-x64
steps:
- name: One or more tests failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
- name: One or more tests cancelled
if: ${{ contains(needs.*.result, 'cancelled') }}
run: exit 1
- name: All tests ok
if: ${{ contains(needs.*.result, 'success') }}
run: exit 0
- name: debug-print
if: always()
run: |
echo "::group::DEBUG: `needs` Contents"
echo "DEBUG: toJSON(needs) = ${{ toJSON(needs) }}"
echo "DEBUG: toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}"
echo "::endgroup::"
- name: Clean Workspace # Purge the workspace in case it's running on a self-hosted runner
if: always()
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./