Skip to content

Commit ef2ee03

Browse files
HReed1SPPearce
andauthored
Migrate shasum to topic channel versions and add stub block (#11400)
* Migrate shasum to topic channel versions and add stub block - Converted versions.yml output to topic channel (versions_sha256sum) - Removed END_VERSIONS heredoc from script block - Added stub block with touch for .sha256 output - Updated existing test to use sanitizeOutput(process.out) - Added stub test case Note: Tests pass on amd64 CI but fail locally on arm64 due to container being amd64-only (Wave container). Contributes to #4570 * fix(shasum): fix bash quoting in eval() version command; update meta.yml via lint --fix; regenerate snap * fix(shasum): switch from eval() to versions.yml+topic pattern eval() with awk '{print $NF}' required double-escaped quotes that caused process failures ('assert process.success' = false) in all CI runners. Switch to versions.yml written in script and stub blocks. * fix(maltextract): switch from eval() to versions.yml+topic pattern eval() with sed 's/MaltExtract version//' required double-escaped single quotes that caused 'Different Snapshot' failures in conda and singularity CI. Switch to versions.yml written in script and stub blocks. * fix(shasum): correct meta.yml to use type:file for path-based versions.yml topic emit * chore(shasum): remove accidental maltextract change from this branch (scope isolation) * fix(shasum): correct meta.yml versions_sha256sum to single-dash format (path not tuple) * fix(shasum): replace versions.yml with topic channel eval output * fix(shasum): correct meta.yml eval string and regenerate snapshot via docker profile * fix(shasum): extract only version number in eval string * fix(shasum): sync meta.yml eval string with main.nf --------- Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
1 parent 66dcaf1 commit ef2ee03

4 files changed

Lines changed: 85 additions & 27 deletions

File tree

modules/nf-core/shasum/main.nf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ process SHASUM {
1212

1313
output:
1414
tuple val(meta), path("*.sha256"), emit: checksum
15-
path "versions.yml", emit: versions
15+
tuple val("${task.process}"), val('sha256sum'), eval("sha256sum --version 2>&1 | head -n 1 | sed 's/.* //'"), emit: versions_sha256sum, topic: versions
1616

1717
when:
1818
task.ext.when == null || task.ext.when
@@ -24,10 +24,10 @@ process SHASUM {
2424
${args} \\
2525
${file} \\
2626
> ${file}.sha256
27+
"""
2728

28-
cat <<-END_VERSIONS > versions.yml
29-
"${task.process}":
30-
sha256sum: \$(echo \$(sha256sum --version 2>&1 | head -n 1| sed 's/^.*) //;' ))
31-
END_VERSIONS
29+
stub:
30+
"""
31+
touch ${file}.sha256
3232
"""
3333
}

modules/nf-core/shasum/meta.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ tools:
99
description: Create an SHA256 (256-bit) checksum.
1010
homepage: "https://www.gnu.org"
1111
documentation: "https://linux.die.net/man/1/shasum"
12-
licence: ["GPLv3+"]
12+
licence:
13+
- "GPLv3+"
1314
identifier: ""
1415
input:
1516
- - meta:
@@ -34,13 +35,27 @@ output:
3435
description: File containing checksum
3536
pattern: "*.sha256"
3637
ontologies: []
38+
versions_sha256sum:
39+
- - ${task.process}:
40+
type: string
41+
description: Process name
42+
- sha256sum:
43+
type: string
44+
description: Tool name
45+
- "sha256sum --version 2>&1 | head -n 1 | sed 's/.* //'":
46+
type: eval
47+
description: Software version
48+
topics:
3749
versions:
38-
- versions.yml:
39-
type: file
40-
description: File containing software versions
41-
pattern: "versions.yml"
42-
ontologies:
43-
- edam: http://edamontology.org/format_3750 # YAML
50+
- - ${task.process}:
51+
type: string
52+
description: Process name
53+
- sha256sum:
54+
type: string
55+
description: Tool name
56+
- "sha256sum --version 2>&1 | head -n 1 | sed 's/.* //'":
57+
type: eval
58+
description: Software version
4459
authors:
4560
- "@matthdsm"
4661
maintainers:

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

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ nextflow_process {
1515
process {
1616
"""
1717
input[0] = [
18-
[ id:'test', single_end:false ], // meta map
19-
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
20-
]
18+
[ id:'test', single_end:false ], // meta map
19+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
20+
]
2121

2222
"""
2323
}
@@ -26,7 +26,31 @@ nextflow_process {
2626
then {
2727
assertAll(
2828
{ assert process.success },
29-
{ assert snapshot(process.out).match() }
29+
{ assert snapshot(sanitizeOutput(process.out)).match() }
30+
)
31+
}
32+
}
33+
34+
test("test-shasum - stub") {
35+
36+
options "-stub"
37+
38+
when {
39+
process {
40+
"""
41+
input[0] = [
42+
[ id:'test', single_end:false ], // meta map
43+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
44+
]
45+
46+
"""
47+
}
48+
}
49+
50+
then {
51+
assertAll(
52+
{ assert process.success },
53+
{ assert snapshot(sanitizeOutput(process.out)).match() }
3054
)
3155
}
3256
}

modules/nf-core/shasum/tests/main.nf.test.snap

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"test-shasum": {
33
"content": [
44
{
5-
"0": [
5+
"checksum": [
66
[
77
{
88
"id": "test",
@@ -11,27 +11,46 @@
1111
"test.paired_end.bam.sha256:md5,138a19e100f09fc975ea1b717da9b6dd"
1212
]
1313
],
14-
"1": [
15-
"versions.yml:md5,9d5d3f7101eb83416b87a2d6d61a0fa5"
16-
],
14+
"versions_sha256sum": [
15+
[
16+
"SHASUM",
17+
"sha256sum",
18+
"9.5"
19+
]
20+
]
21+
}
22+
],
23+
"timestamp": "2026-05-03T20:43:40.688253838",
24+
"meta": {
25+
"nf-test": "0.9.5",
26+
"nextflow": "24.10.4"
27+
}
28+
},
29+
"test-shasum - stub": {
30+
"content": [
31+
{
1732
"checksum": [
1833
[
1934
{
2035
"id": "test",
2136
"single_end": false
2237
},
23-
"test.paired_end.bam.sha256:md5,138a19e100f09fc975ea1b717da9b6dd"
38+
"test.paired_end.bam.sha256:md5,d41d8cd98f00b204e9800998ecf8427e"
2439
]
2540
],
26-
"versions": [
27-
"versions.yml:md5,9d5d3f7101eb83416b87a2d6d61a0fa5"
41+
"versions_sha256sum": [
42+
[
43+
"SHASUM",
44+
"sha256sum",
45+
"9.5"
46+
]
2847
]
2948
}
3049
],
50+
"timestamp": "2026-05-03T20:43:46.125782074",
3151
"meta": {
32-
"nf-test": "0.9.2",
33-
"nextflow": "24.10.2"
34-
},
35-
"timestamp": "2024-12-13T11:49:42.210020546"
52+
"nf-test": "0.9.5",
53+
"nextflow": "24.10.4"
54+
}
3655
}
3756
}

0 commit comments

Comments
 (0)