diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 8ca00aa..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Pipeline CI - -on: - push: - branches: - - master - - dev - pull_request: - branches: - - master - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - profile: - - gemflux - - starrsem - - starflux - - markdup - - rmdup - - ihec - - steps: - - uses: actions/checkout@v3 - - name: Set up Java - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 16 - java-package: jre - - - name: Run pipeline - run: . .circ && ci test - env: - CI_PROFILE: ${{ matrix.profile }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0f06e8e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,82 @@ +name: Test + +on: + push: + branches: + - master + - dev + - test-refactor + pull_request: + branches: + - master + +jobs: + pipeline-test: + name: Pipeline tests + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + profile: + - gemflux + - starrsem + - starflux + - markdup + - rmdup + - ihec + + steps: + - uses: actions/checkout@v4 + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 16 + java-package: jre + - name: Setup Nextflow + uses: nf-core/setup-nextflow@v2 + - name: Install nf-test + uses: nf-core/setup-nf-test@v1 + - name: Run tests + run: nf-test test --tag pipeline --profile +${CI_PROFILE} + env: + CI_PROFILE: ${{ matrix.profile }} + + workflow-test: + name: Workflow tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Java + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 16 + java-package: jre + - name: Setup Nextflow + uses: nf-core/setup-nextflow@v2 + - name: Install nf-test + uses: nf-core/setup-nf-test@v1 + - name: Run tests + run: nf-test test --tag workflow + + module-test: + name: Module tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Java + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 16 + java-package: jre + - name: Setup Nextflow + uses: nf-core/setup-nextflow@v2 + - name: Install nf-test + uses: nf-core/setup-nf-test@v1 + - name: Run tests + run: nf-test test --tag module diff --git a/data/annotation.gtf.gz b/data/annotation.gtf.gz new file mode 100644 index 0000000..c14a6a0 Binary files /dev/null and b/data/annotation.gtf.gz differ diff --git a/data/genome.fa.gz b/data/genome.fa.gz new file mode 100644 index 0000000..925b843 Binary files /dev/null and b/data/genome.fa.gz differ diff --git a/tests/grape-pipeline-markdup.nf.test b/tests/grape-pipeline-markdup.nf.test deleted file mode 100644 index 6d4c0f9..0000000 --- a/tests/grape-pipeline-markdup.nf.test +++ /dev/null @@ -1,29 +0,0 @@ -nextflow_pipeline { - - name "Test Workflow grape-pipeline.nf" - script "grape-pipeline.nf" - - profile "+markdup" - - test("Should run markdup pipeline") { - - - when { - params { - // define parameters here. Example: - // outdir = "tests/results" - steps = 'mapping' - } - } - - then { - assert workflow.success - assert workflow.trace.failed().size() == 0 - assert workflow.trace.succeeded().size() == 20 - def lines = file("${launchDir}/pipeline.db").readLines() - assert lines.size() == 9 - } - - } - -} diff --git a/tests/grape-pipeline-starrsem.nf.test b/tests/grape-pipeline-starrsem.nf.test deleted file mode 100644 index 5c27ca1..0000000 --- a/tests/grape-pipeline-starrsem.nf.test +++ /dev/null @@ -1,29 +0,0 @@ -nextflow_pipeline { - - name "Test Workflow grape-pipeline.nf" - script "grape-pipeline.nf" - - profile "+starrsem" - - test("Should run starrsem pipeline") { - - - when { - params { - // define parameters here. Example: - // outdir = "tests/results" - steps = 'mapping' - } - } - - then { - assert workflow.success - assert workflow.trace.failed().size() == 0 - assert workflow.trace.succeeded().size() == 17 - def lines = file("${launchDir}/pipeline.db").readLines() - assert lines.size() == 9 - } - - } - -} diff --git a/tests/grape-pipeline.nf.test b/tests/grape-pipeline.nf.test new file mode 100644 index 0000000..5099532 --- /dev/null +++ b/tests/grape-pipeline.nf.test @@ -0,0 +1,37 @@ +import com.askimed.nf.test.util.AnsiColors; +import com.askimed.nf.test.util.AnsiText; + +nextflow_pipeline { + + name "Test Workflow grape-pipeline.nf" + script "grape-pipeline.nf" + + tag "pipeline" + + test("Should run pipeline") { + + setup { + def profile = parent.profiles.last().minus('+') + print "(${AnsiColors.yellow(profile)}) " + } + + then { + def profile = parent.profiles.last().minus('+') + def expected = [ + "starrsem": [ traceSize: 28, dbSize: 30 ], + "starflux": [ traceSize: 24, dbSize: 28 ], + "markdup": [ traceSize: 31, dbSize: 30 ], + "gemflux": [ traceSize: 24, dbSize: 22 ], + "rmdup": [ traceSize: 31, dbSize: 30 ], + "ihec": [ traceSize: 31, dbSize: 30 ], + ][profile] + assert workflow.success + assert workflow.trace.failed().size() == 0 + assert workflow.trace.succeeded().size() == expected?.traceSize + def lines = file("${launchDir}/pipeline.db").readLines() + assert lines.size() == expected?.dbSize + } + + } + +} diff --git a/tests/modules/fastaIndex/samtools/main.nf.test b/tests/modules/fastaIndex/samtools/main.nf.test index 44ac97a..3d87f0b 100644 --- a/tests/modules/fastaIndex/samtools/main.nf.test +++ b/tests/modules/fastaIndex/samtools/main.nf.test @@ -4,6 +4,8 @@ nextflow_process { script "modules/fastaIndex/samtools/main.nf" process "fastaIndex" + tag "module" + test("Should produce the fasta index") { when { diff --git a/tests/modules/mapping/star/main.index.nf.test b/tests/modules/mapping/star/main.index.nf.test index f09a2f7..466c4f8 100644 --- a/tests/modules/mapping/star/main.index.nf.test +++ b/tests/modules/mapping/star/main.index.nf.test @@ -3,7 +3,9 @@ nextflow_process { name "Test Process index" script "modules/mapping/star/main.nf" process "index" - + + tag "module" + test("Should index compressed references") { when { diff --git a/tests/workflows/mapping.nf.test b/tests/workflows/mapping.nf.test index 84e7a07..288638d 100644 --- a/tests/workflows/mapping.nf.test +++ b/tests/workflows/mapping.nf.test @@ -4,6 +4,8 @@ nextflow_workflow { script "workflows/mapping.nf" workflow "mapping" + tag "workflow" + test("Should run STAR mapping sorting with sambamba") { when { @@ -13,7 +15,7 @@ nextflow_workflow { sortBamTool = "sambamba" sjOverHang = 100 maxMismatches = 4 - maxMultimaps = 10 + maxMultimaps = 10 } workflow { """ @@ -49,7 +51,7 @@ nextflow_workflow { sortBamTool = "samtools" sjOverHang = 100 maxMismatches = 4 - maxMultimaps = 10 + maxMultimaps = 10 } workflow { """