Skip to content

Commit

Permalink
added nf-tests
Browse files Browse the repository at this point in the history
- dry (stub) runs for each input type
  - input are empty files
- dry run ci test with nf-test
  • Loading branch information
MarieLataretu committed Dec 15, 2023
1 parent 29a7c8b commit 237782d
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/dryrun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: dry run CI

env:
NXF_ANSI_LOG: false

jobs:
test:
name: Dry run ${{ matrix.inputtype }}-${{ matrix.profile }} pipeline test
runs-on: ubuntu-latest
strategy:
matrix:
NXF_VER:
- "23.04.1"
- "latest"
inputtype:
- fasta
- illumina
- nanopore
profile: ["docker"] # TODO , "singularity", "conda"]
steps:
- name: Check out pipeline code
uses: actions/checkout@v3

- uses: actions/cache@v2
with:
path: /usr/local/bin/nextflow
key: ${{ runner.os }}
restore-keys: |
${{ runner.os }}-nextflow-
- name: Install Nextflow
uses: nf-core/setup-nextflow@v1
with:
version: "${{ matrix.NXF_VER }}"

- name: Install nf-test
run: |
wget -qO- https://code.askimed.com/install/nf-test | bash
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

- name: Run nf-test
run: nf-test test --profile=${{ matrix.profile }} tests/${{ matrix.inputtype }}/*.nf.test --tap=test.tap

- uses: pcolby/tap-summary@v1
with:
path: >-
test.tap
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ centrifuge-cloud/
conda/
singularity/
.vscode/
.nf-test/
Empty file added assets/EMPTY_FILE
Empty file.
Empty file added assets/EMPTY_FILE_R1.fastq
Empty file.
Empty file added assets/EMPTY_FILE_R2.fastq
Empty file.
12 changes: 12 additions & 0 deletions configs/test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
========================================================================================
Nextflow config file for running tests
========================================================================================
*/
params {
// Limit resources so that this can run on GitHub Actions
max_cores = 2
cores = 1
max_memory = 6.GB
memory = 6.GB
}
7 changes: 7 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config {

testsDir "tests"
workDir ".nf-test"
configFile "tests/nextflow.config"

}
24 changes: 24 additions & 0 deletions tests/fasta/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
nextflow_pipeline {

name "FASTA input"
script "../../clean.nf"

test("Stub") {
options "-stub-run"

when {
params {
input_type = "fasta"
input = "$projectDir/assets/EMPTY_FILE"
own = "$projectDir/assets/EMPTY_FILE"
}
}

then {
assertAll(
{ assert workflow.success }
)
}
}

}
80 changes: 80 additions & 0 deletions tests/illumina/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
nextflow_pipeline {

name "Illumina input"
script "../../clean.nf"

test("Stub paired-end") {
options "-stub-run"

when {
params {
input_type = "illumina"
input = "$projectDir/assets/EMPTY_FILE_{R1,R2}.fastq"
own = "$projectDir/assets/EMPTY_FILE"
}
}

then {
assertAll(
{ assert workflow.success }
)
}
}

test("Stub single-end") {
options "-stub-run"

when {
params {
input_type = "illumina_single_end"
input = "$projectDir/assets/EMPTY_FILE"
own = "$projectDir/assets/EMPTY_FILE"
}
}

then {
assertAll(
{ assert workflow.success }
)
}
}

test("Stub paired-end bbduk") {
options "-stub-run"

when {
params {
input_type = "illumina"
input = "$projectDir/assets/EMPTY_FILE_{R1,R2}.fastq"
own = "$projectDir/assets/EMPTY_FILE"
bbduk = true
}
}

then {
assertAll(
{ assert workflow.success }
)
}
}

test("Stub single-end bbduk") {
options "-stub-run"

when {
params {
input_type = "illumina_single_end"
input = "$projectDir/assets/EMPTY_FILE"
own = "$projectDir/assets/EMPTY_FILE"
bbduk = true
}
}

then {
assertAll(
{ assert workflow.success }
)
}
}

}
24 changes: 24 additions & 0 deletions tests/nanopore/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
nextflow_pipeline {

name "Nanopore input"
script "../../clean.nf"

test("Stub") {
options "-stub-run"

when {
params {
input_type = "nano"
input = "$projectDir/assets/EMPTY_FILE"
own = "$projectDir/assets/EMPTY_FILE"
}
}

then {
assertAll(
{ assert workflow.success }
)
}
}

}

0 comments on commit 237782d

Please sign in to comment.