Skip to content

Commit 9a2e154

Browse files
committed
adding github workflow to run nf-test tests
1 parent b1ff8b0 commit 9a2e154

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed

.github/workflows/nf-test.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: nf-test CI
2+
# This workflow runs the pipeline with the minimal test dataset to check that it completes without any syntax errors
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
release:
9+
types: [published]
10+
workflow_dispatch:
11+
12+
env:
13+
NFT_DIFF: "pdiff"
14+
NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2"
15+
NFT_VER: "0.9.2"
16+
NFT_WORKDIR: "~"
17+
NXF_ANSI_LOG: false
18+
NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity
19+
NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity
20+
21+
concurrency:
22+
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
23+
cancel-in-progress: true
24+
25+
jobs:
26+
test:
27+
runs-on: ubuntu-latest
28+
name: "Test ${{ matrix.filter }} | ${{ matrix.profile }} | ${{ matrix.NXF_VER }} | ${{ matrix.shard }}/5"
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
NXF_VER:
33+
- "24.10.2"
34+
- "latest-everything"
35+
filter: ["workflow", "pipeline"]
36+
# filter: ["process", "workflow", "function", "pipeline"]
37+
profile: ["conda", "docker", "singularity"]
38+
shard: [1, 2, 3, 4, 5]
39+
#isMaster:
40+
# - ${{ github.base_ref == 'main' }}
41+
#exclude:
42+
# - isMaster: false
43+
# profile: "conda"
44+
# - isMaster: false
45+
# profile: "singularity"
46+
47+
steps:
48+
- name: Check out pipeline code
49+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
50+
with:
51+
fetch-depth: 0
52+
53+
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
54+
with:
55+
python-version: "3.11"
56+
57+
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
58+
with:
59+
distribution: "temurin"
60+
java-version: "17"
61+
62+
- name: Set up Nextflow
63+
uses: nf-core/setup-nextflow@v2
64+
with:
65+
version: "${{ matrix.NXF_VER }}"
66+
67+
- name: Set up nf-test
68+
uses: nf-core/setup-nf-test@v1
69+
with:
70+
version: ${{ env.NFT_VER }}
71+
72+
- name: Set up apptainer
73+
if: matrix.profile == 'singularity'
74+
uses: eWaterCycle/setup-apptainer@main
75+
76+
- name: Set up Singularity
77+
if: matrix.profile == 'singularity'
78+
run: |
79+
mkdir -p $NXF_SINGULARITY_CACHEDIR
80+
mkdir -p $NXF_SINGULARITY_LIBRARYDIR
81+
82+
- name: Cache pdiff
83+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
84+
id: cache-pip-pdiff
85+
with:
86+
path: ~/.cache/pip
87+
key: ${{ runner.os }}-pip-pdiff
88+
89+
- name: Install pdiff
90+
run: python -m pip install --upgrade pip pdiff cryptography
91+
92+
- name: Set up miniconda
93+
if: matrix.profile == 'conda'
94+
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3
95+
with:
96+
miniconda-version: "latest"
97+
auto-update-conda: true
98+
conda-solver: libmamba
99+
channels: conda-forge,bioconda
100+
101+
- name: Set up Conda
102+
if: matrix.profile == 'conda'
103+
run: |
104+
echo $(realpath $CONDA)/condabin >> $GITHUB_PATH
105+
echo $(realpath python) >> $GITHUB_PATH
106+
107+
- name: Disk space cleanup
108+
uses: jlumbroso/free-disk-space@v1.3.1
109+
110+
- name: Start summary
111+
id: print-test
112+
run: |
113+
echo "## nf-test tests summary :rocket:" >> $GITHUB_STEP_SUMMARY
114+
echo "" >> $GITHUB_STEP_SUMMARY
115+
echo "This \`${{ matrix.filter }}\` ${{ matrix.shard }}/5 shard was run on \`${{ matrix.profile }}\` | \`NXF_VER=${{ matrix.NXF_VER }}\`, and contains the following test(s):" >> $GITHUB_STEP_SUMMARY
116+
echo "" >> $GITHUB_STEP_SUMMARY
117+
nf-test test \
118+
--ci \
119+
--dryRun \
120+
--junitxml="TEST-${{ matrix.filter }}_${{ matrix.profile }}_${{ matrix.shard }}.xml" \
121+
--shard ${{ matrix.shard }}/5 \
122+
--changed-since HEAD^ \
123+
--follow-dependencies \
124+
--profile "+${{ matrix.profile }}" \
125+
--filter ${{ matrix.filter }} \
126+
| grep PASSED | cut -d "'" -f 2 | sed 's/^/- /' | sort -u >> $GITHUB_STEP_SUMMARY
127+
128+
- name: "Run tests | ${{ matrix.filter }}_${{ matrix.profile }} | ${{ matrix.shard }}/5"
129+
run: |
130+
nf-test test \
131+
--ci \
132+
--debug \
133+
--verbose \
134+
--junitxml="TEST-${{ matrix.filter }}_${{ matrix.profile }}_${{ matrix.shard }}.xml" \
135+
--shard ${{ matrix.shard }}/5 \
136+
--changed-since HEAD^ \
137+
--follow-dependencies \
138+
--profile "+${{ matrix.profile }}" \
139+
--filter ${{ matrix.filter }}
140+
141+
- name: Print success in summary
142+
if: success()
143+
run: |
144+
echo "" >> $GITHUB_STEP_SUMMARY
145+
echo "All test(s) successfull :tada:" >> $GITHUB_STEP_SUMMARY
146+
147+
- name: Print failure in summary
148+
if: failure()
149+
run: |
150+
echo "" >> $GITHUB_STEP_SUMMARY
151+
echo "Some test(s) failed :cold_sweat:" >> $GITHUB_STEP_SUMMARY
152+
153+
- name: Publish Test Report
154+
uses: mikepenz/action-junit-report@v4
155+
if: success() || failure() # always run even if the previous step fails
156+
with:
157+
report_paths: "TEST-*.xml"
158+
159+
- name: Clean up
160+
if: success() || failure()
161+
run: |
162+
sudo rm -rf /home/ubuntu/tests/

0 commit comments

Comments
 (0)