Skip to content

Commit

Permalink
Merge pull request #129 from nf-core/fix/ci-nf-tests
Browse files Browse the repository at this point in the history
Fix/ci nf tests & Remove un-necessary registry declarations
  • Loading branch information
maxulysse authored Jun 15, 2023
2 parents bb9557b + a0391a8 commit 26abd17
Show file tree
Hide file tree
Showing 26 changed files with 565 additions and 475 deletions.
94 changes: 37 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,93 +4,73 @@ on:
pull_request:
branches:
- dev
- master
release:
types: [published]

env:
NXF_ANSI_LOG: false
CAPSULE_LOG: none
NFTEST_VER: "0.7.3"

concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true

jobs:
changes:
name: Check for changes
define_nxf_versions:
name: Choose nextflow versions to test against depending on target branch
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'modules' output variable
tags: ${{ steps.filter.outputs.changes }}
matrix: ${{ steps.nxf_versions.outputs.matrix }}
steps:
- uses: actions/checkout@v2

- uses: dorny/paths-filter@v2
id: filter
with:
filters: "tests/config/tags.yml"
- id: nxf_versions
run: |
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "dev" && "${{ matrix.NXF_VER }}" != "latest-everything" ]]; then
echo matrix='["latest-everything"]' | tee -a $GITHUB_OUTPUT
else
echo matrix='["latest-everything", "22.10.1"]' | tee -a $GITHUB_OUTPUT
fi
test_changes:
name: ${{ matrix.tags }} ${{ matrix.component }} ${{ matrix.profile }} ${{ matrix.NXF_VER }}
runs-on: ubuntu-20.04
needs: changes
if: needs.changes.outputs.tags != '[]'
test:
name: Run pipeline with test data
needs: define_nxf_versions
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
NXF_VER:
- "23.04.0"
- "latest-everything"
tags: ["${{ fromJson(needs.changes.outputs.tags) }}"]
profile: ["docker"] # TODO Add singularity/conda
component: ["pipeline"] # TODO There aren't any subworkflows or modules tests YET
exclude:
- NXF_VER: "latest-everything"
profile: "conda"
NXF_VER: ${{ fromJson(needs.define_nxf_versions.outputs.matrix) }}
profile:
- docker
steps:
- name: Check out pipeline code
uses: actions/checkout@v3

- uses: actions/cache@v2
with:
path: /usr/local/bin/
key: ${{ runner.os }}
restore-keys: |
${{ runner.os }}-nextflow-
# Install Nextflow
- name: Install Nextflow
env:
CAPSULE_LOG: none
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
uses: nf-core/setup-nextflow@v1
with:
version: "${{ matrix.NXF_VER }}"

# Install nf-test
- name: Install nf-test
run: |
wget -qO- https://code.askimed.com/install/nf-test | bash
wget -qO- https://code.askimed.com/install/nf-test | bash -s $NFTEST_VER
sudo mv nf-test /usr/local/bin/
- name: Set up Singularity
if: matrix.profile == 'singularity'
uses: eWaterCycle/setup-singularity@v5
with:
singularity-version: 3.7.1

- name: Set up miniconda
if: matrix.profile == 'conda'
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
channels: conda-forge,bioconda,defaults
python-version: ${{ matrix.python-version }}

- name: Conda clean
if: matrix.profile == 'conda'
run: conda clean -a

# Run nf-test
- name: Run nf-test
run: nf-test test --profile=test,${{ matrix.profile }} tests/${{ matrix.component }}/${{ matrix.tags }}/*.nf.test --junitxml=${{ matrix.tags }}.xml
run: nf-test test tests/pipeline/ --profile=test,${{ matrix.profile }} --junitxml=test.xml

# If the test fails, output the software_versions.yml using the 'batcat' utility
- name: Output log on failure
if: failure()
run: |
sudo apt install bat > /dev/null
batcat --decorations=always --color=always .nf-test/tests/*/output/pipeline_info/software_versions.yml
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: "${{ matrix.tags }}.xml"
report_paths: test.xml
5 changes: 3 additions & 2 deletions conf/public_aws_ecr.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
----------------------------------------------------------------------------------------
*/

docker.registry = 'public.ecr.aws'
podman.registry = 'public.ecr.aws'
docker.registry = 'public.ecr.aws'
podman.registry = 'public.ecr.aws'
singularity.registry = 'public.ecr.aws'

process {
withName: 'BASES2FASTQ' {
Expand Down
7 changes: 3 additions & 4 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ profiles {
}
docker {
docker.enabled = true
docker.registry = 'quay.io'
docker.userEmulation = true
conda.enabled = false
singularity.enabled = false
Expand All @@ -130,7 +129,6 @@ profiles {
}
podman {
podman.enabled = true
podman.registry = 'quay.io'
conda.enabled = false
docker.enabled = false
singularity.enabled = false
Expand Down Expand Up @@ -197,11 +195,12 @@ env {
process.shell = ['/bin/bash', '-euo', 'pipefail']

// Set default registry for Docker and Podman independent of -profile
// Will not be used unless Docker / Podman are enabled
// Will not be used unless Docker, Podman or Singularity is enabled
// Set to your registry if you have a mirror of containers
singularity.registry = 'quay.io'

docker.registry = 'quay.io'
podman.registry = 'quay.io'
singularity.registry = 'quay.io'

def trace_timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss')
timeline {
Expand Down
13 changes: 11 additions & 2 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
config {

// location for all nf-tests
testsDir "tests"

// nf-test directory including temporary files for each test
workDir ".nf-test"

// location of library folder that is added automatically to the classpath
libDir "tests/pipeline/lib/"

// location of an optional nextflow.config file specific for executing tests
configFile "nextflow.config"
profile "test"

// run all test with the defined docker profile from the main nextflow.config
profile ""
}

41 changes: 41 additions & 0 deletions tests/pipeline/bases2fastq.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
nextflow_pipeline {

name "Test Workflow main.nf"
script "main.nf"
tag "bases2fastq"
tag "pipeline"

test("Bases2Fastq") {

when {
params {
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/samplesheet/1.3.0/b2fq-samplesheet.csv'
demultiplexer = 'bases2fastq'
outdir = "$outputDir"
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") },
{ assert workflow.trace.succeeded().size() == 8 },
{ assert snapshot(
// FIXME
// path("$outputDir/sim-data/DefaultSample_R1.fastq.gz.md5"),
// path("$outputDir/sim-data/DefaultSample_R2.fastq.gz.md5"),
path("$outputDir/sim-data/Metrics.csv"),
path("$outputDir/sim-data/RunManifest.json"),
path("$outputDir/sim-data/UnassignedSequences.csv"),
path("$outputDir/sim-data/Samples/DefaultSample/DefaultSample_R1.fastq.gz"),
path("$outputDir/sim-data/Samples/DefaultSample/DefaultSample_R2.fastq.gz"),
).match("bases2fastq") },
{ assert new File("$outputDir/sim-data/Bases2Fastq-Sim_QC.html").exists() },
{ assert new File("$outputDir/sim-data/RunStats.json").exists() },
{ assert new File("$outputDir/sim-data/Samples/DefaultSample/DefaultSample_stats.json").exists() }
)
}

}

}
18 changes: 18 additions & 0 deletions tests/pipeline/bases2fastq.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"software_versions": {
"content": [
"{BASES2FASTQ={bases2fastq=1.1.0.593880262, use subject to license available at elementbiosciences.com}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, FALCO={falco=1.2.1}, FASTP={fastp=0.23.4}, UNTAR={untar=1.30}, Workflow={nf-core/demultiplex=1.4.0dev}}"
],
"timestamp": "2023-06-15T00:10:15+0000"
},
"bases2fastq": {
"content": [
"Metrics.csv:md5,3213ad7bdf66f33476cb589b4d608948",
"RunManifest.json:md5,d4ecdb19e5fbcffab3e6e770c34023fb",
"UnassignedSequences.csv:md5,11c1693830ce941b8cfb8d2431a59097",
"DefaultSample_R1.fastq.gz:md5,77b68ec94323741d1bddc03a7a428fa9",
"DefaultSample_R2.fastq.gz:md5,ecd4ed53e10207582bbbc29383080b57"
],
"timestamp": "2023-06-15T00:10:15+0000"
}
}
35 changes: 35 additions & 0 deletions tests/pipeline/bcl2fastq.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
nextflow_pipeline {

name "Test Workflow main.nf"
script "main.nf"
tag "bcl2fastq"
tag "pipeline"

test("Bcl2Fastq") {

when {
params {
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/samplesheet/1.3.0/flowcell_input.csv'
demultiplexer = 'bcl2fastq'
outdir = "$outputDir"
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") },
{ assert workflow.trace.succeeded().size() == 6 },
{ assert snapshot(
// FIXME
// path("$outputDir/220422_M11111_0222_000000000-K9H97/Sample1_S1_L001_R1_001.fastq.gz.md5"),

path("$outputDir/bcl2fastq/Sample1_S1_L001_R1_001.fastq.gz"),
path("$outputDir/bcl2fastq/Stats").list(),
).match("bcl2fastq") }
)
}

}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"Should run without failures": {
"software_versions": {
"content": [
"{BCL2FASTQ={bcl2fastq=2.20.0.422}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, FALCO={falco=1.2.1}, FASTP={fastp=0.23.4}, Workflow={nf-core/demultiplex=1.4.0dev}}"
],
"timestamp": "2023-06-14T23:57:41+0000"
},
"bcl2fastq": {
"content": [
"Sample1_S1_L001_R1_001.fastq.gz:md5,e92fce7b86c6447b053d72c5cb4be89c",
[
Expand All @@ -11,6 +17,6 @@
"Stats.json:md5,8e5f038b8aa9e465599d3575f930e604"
]
],
"timestamp": "2023-01-18T23:52:50+0000"
"timestamp": "2023-06-14T23:57:41+0000"
}
}
37 changes: 37 additions & 0 deletions tests/pipeline/bclconvert.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
nextflow_pipeline {

name "Test Workflow main.nf"
script "main.nf"
tag "bclconvert"
tag "pipeline"

test("BCL-CONVERT") {

when {
params {
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/samplesheet/1.3.0/flowcell_input.csv'
demultiplexer = 'bclconvert'
outdir = "$outputDir"
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") },
{ assert workflow.trace.succeeded().size() == 6 },
{ assert snapshot(path("$outputDir/multiqc/multiqc_data/multiqc_bclconvert_bylane.txt"),
path("$outputDir/multiqc/multiqc_data/multiqc_fastp.txt"),
path("$outputDir/multiqc/multiqc_data/multiqc_bclconvert_bysample.txt")).match("multiqc") },
{ assert snapshot(path("$outputDir/220422_M11111_0222_000000000-K9H97/Sample1_S1_L001.fastp.fastq.gz"),
path("$outputDir/220422_M11111_0222_000000000-K9H97/Sample1_S1_L001_R1_001.fastq.gz"),
path("$outputDir/220422_M11111_0222_000000000-K9H97/Sample1_S1_L001_summary.txt"),
path("$outputDir/220422_M11111_0222_000000000-K9H97/Undetermined_S0_L001_R1_001.fastq.gz"),
path("$outputDir/220422_M11111_0222_000000000-K9H97/L001/Reports/").list(),
).match("bclconvert") }
)
}

}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"Should run without failures": {
"bclconvert": {
"content": [
"Sample1_S1_L001.fastp.fastq.gz:md5,8a723787b4a0c0fbf5b81d3a0b989c69",
"Sample1_S1_L001_R1_001.fastq.gz:md5,0a0341e2990b4fa1d9ad4b4c603144c1",
"Sample1_S1_L001_summary.txt:md5,510c6b8a26ff8d530950c05b3ca5a1c6",
"Undetermined_S0_L001_R1_001.fastq.gz:md5,febef808ae5397ea4ee7ee40e5fd39e0",
[
"Adapter_Cycle_Metrics.csv:md5,5a0c88793b4a0885fe3dda16609b576e",
Expand All @@ -18,6 +20,20 @@
"fastq_list.csv:md5,05bc84f51840f5754cfb8381b36f2cb0"
]
],
"timestamp": "2023-06-07T17:53:57+0000"
"timestamp": "2023-06-15T00:38:31+0000"
},
"software_versions": {
"content": [
"{BCLCONVERT={bclconvert=00.000.000.4.0.3}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, FALCO={falco=1.2.1}, FASTP={fastp=0.23.4}, Workflow={nf-core/demultiplex=1.4.0dev}}"
],
"timestamp": "2023-06-15T00:38:31+0000"
},
"multiqc": {
"content": [
"multiqc_bclconvert_bylane.txt:md5,8ef9efabf1d2f9de8221e651d0b10e2f",
"multiqc_fastp.txt:md5,76b067a76f4f58759526ca2aa4d6679d",
"multiqc_bclconvert_bysample.txt:md5,b68dcbf3fdb26e6eb483995eb114cdd8"
],
"timestamp": "2023-06-15T00:38:31+0000"
}
}
Loading

0 comments on commit 26abd17

Please sign in to comment.