Skip to content

Commit 6ee8674

Browse files
authored
Merge pull request #116 from kbestak/test_updates
Use nf-test in CI
2 parents 9a3b10f + 381fd15 commit 6ee8674

18 files changed

Lines changed: 268 additions & 53 deletions

File tree

.github/workflows/ci.yml

Lines changed: 87 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
workflow_dispatch:
1111

1212
env:
13+
NFT_VER: "0.9.0"
1314
NXF_ANSI_LOG: false
1415
NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity
1516
NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity
@@ -19,18 +20,41 @@ concurrency:
1920
cancel-in-progress: true
2021

2122
jobs:
23+
nf-test-changes:
24+
name: Check for changes
25+
runs-on: ubuntu-latest
26+
outputs:
27+
nf_test_files: ${{ steps.list.outputs.components }}
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: List nf-test files
35+
id: list
36+
uses: adamrtalbot/detect-nf-test-changes@v0.0.4
37+
with:
38+
head: ${{ github.sha }}
39+
base: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}
40+
41+
- name: print list of nf-test files
42+
run: |
43+
echo ${{ steps.list.outputs.components }}
44+
2245
test:
23-
name: "Run pipeline with test data (${{ matrix.NXF_VER }} | ${{ matrix.test_name }} | ${{ matrix.profile }})"
46+
name: "Run tests (${{ matrix.nf_test_files }} ${{ matrix.profile }} NF-${{ matrix.NXF_VER }})"
2447
# Only run on push if this is the nf-core dev branch (merged PRs)
25-
if: "${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/molkart') }}"
48+
needs: [nf-test-changes]
49+
if: "${{ (github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/molkart')) && needs.nf-test-changes.outputs.nf_test_files != '[]' }}"
2650
runs-on: ubuntu-latest
2751
strategy:
2852
matrix:
2953
NXF_VER:
3054
- "24.04.2"
3155
- "latest-everything"
56+
nf_test_files: ["${{ fromJson(needs.nf-test-changes.outputs.nf_test_files) }}"]
3257
profile:
33-
- "conda"
3458
- "docker"
3559
- "singularity"
3660
test_name:
@@ -41,12 +65,15 @@ jobs:
4165
- profile: "conda"
4266

4367
steps:
68+
- name: install curl
69+
run: sudo apt update && sudo apt install -y curl
70+
4471
- name: Check out pipeline code
4572
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
4673
with:
4774
fetch-depth: 0
4875

49-
- name: Set up Nextflow
76+
- name: Install Nextflow
5077
uses: nf-core/setup-nextflow@v2
5178
with:
5279
version: "${{ matrix.NXF_VER }}"
@@ -61,9 +88,63 @@ jobs:
6188
mkdir -p $NXF_SINGULARITY_CACHEDIR
6289
mkdir -p $NXF_SINGULARITY_LIBRARYDIR
6390
91+
- name: Install nf-test
92+
uses: nf-core/setup-nf-test@v1
93+
with:
94+
version: ${{ env.NFT_VER }}
95+
96+
- uses: actions/setup-python@v4
97+
with:
98+
python-version: "3.11"
99+
architecture: "x64"
100+
101+
- name: Install pdiff to see diff between nf-test snapshots
102+
run: |
103+
python -m pip install --upgrade pip
104+
pip install pdiff
105+
64106
- name: Clean up Disk space
65107
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
66108

67-
- name: "Run pipeline with test data ${{ matrix.NXF_VER }} | ${{ matrix.test_name }} | ${{ matrix.profile }}"
109+
- name: Run nf-test
110+
run: |
111+
nf-test test \
112+
--verbose ${{ matrix.nf_test_files }} \
113+
--profile "+${{ matrix.profile }},test" \
114+
--junitxml=test.xml \
115+
--tap=test.tap
116+
117+
- uses: pcolby/tap-summary@v1
118+
with:
119+
path: >-
120+
test.tap
121+
122+
- name: Output log on failure
123+
if: failure()
124+
run: |
125+
sudo apt install bat > /dev/null
126+
batcat --decorations=always --color=always ${{ github.workspace }}/.nf-test/tests/*/meta/nextflow.log
127+
128+
- name: Publish Test Report
129+
uses: mikepenz/action-junit-report@v3
130+
if: always()
131+
with:
132+
report_paths: test.xml
133+
134+
confirm-pass:
135+
runs-on: ubuntu-latest
136+
needs: [test]
137+
if: always()
138+
steps:
139+
- name: All tests ok
140+
if: ${{ !contains(needs.*.result, 'failure') }}
141+
run: exit 0
142+
- name: One or more tests failed
143+
if: ${{ contains(needs.*.result, 'failure') }}
144+
run: exit 1
145+
146+
- name: debug-print
147+
if: always()
68148
run: |
69-
nextflow run ${GITHUB_WORKSPACE} -profile ${{ matrix.test_name }},${{ matrix.profile }} --outdir ./results
149+
echo "toJSON(needs) = ${{ toJSON(needs) }}"
150+
echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
### Changed
1313

1414
- [PR #111](https://github.com/nf-core/molkart/pull/111) - Updated json schemas (@kbestak)
15+
- [PR #116](https://github.com/nf-core/molkart/pull/116) - Update CI to use nf-test on changed files (@kbestak)
1516

1617
### Fixed
1718

modules.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
},
2828
"mindagap/duplicatefinder": {
2929
"branch": "master",
30-
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
30+
"git_sha": "a84e5d699986fac96d7d7f01044a339a343af827",
3131
"installed_by": ["modules"]
3232
},
3333
"mindagap/mindagap": {
3434
"branch": "master",
35-
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
35+
"git_sha": "a84e5d699986fac96d7d7f01044a339a343af827",
3636
"installed_by": ["modules"]
3737
},
3838
"multiqc": {
3939
"branch": "master",
40-
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
40+
"git_sha": "7b50cb7be890e4b28cffb82e438cc6a8d7805d3f",
4141
"installed_by": ["modules"]
4242
},
4343
"stardist": {

modules/nf-core/mindagap/duplicatefinder/environment.yml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/mindagap/duplicatefinder/main.nf

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/mindagap/duplicatefinder/tests/main.nf.test

Lines changed: 35 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/mindagap/duplicatefinder/tests/main.nf.test.snap

Lines changed: 40 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/mindagap/duplicatefinder/tests/tags.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

modules/nf-core/mindagap/mindagap/main.nf

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/mindagap/mindagap/tests/main.nf.test

Lines changed: 25 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)