Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/init ci nf test #580

Merged
merged 24 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3b94a03
init-nf-tests-snapshots
sateeshperi May 9, 2023
3a4559b
update-ci-for-nf-tests
sateeshperi May 9, 2023
bcfbd8d
update-ci-for-nf-tests
sateeshperi May 9, 2023
a853e1f
update-dada2-snapshots
sateeshperi May 9, 2023
eb09a40
update-snapshots
sateeshperi May 10, 2023
97e116d
update-pe-pacbio-snapshots
sateeshperi May 10, 2023
7802396
update-snapshots-rm-nxf-ver
sateeshperi May 26, 2023
4d388d4
fix-trailing-whitespaces
sateeshperi May 26, 2023
d16c2da
CI-update-testing-dev-master-nf-tests
sateeshperi May 26, 2023
9f357aa
add-UTILS-groovy-lib-update-snapshots
sateeshperi May 28, 2023
3db027b
CI-add-test-data-caching-nf-test-version
sateeshperi May 28, 2023
0912655
fix-cache-ref
sateeshperi May 28, 2023
092b8cb
fix-samplesheets-remote-paths
sateeshperi May 28, 2023
03c2dff
fix-samplesheets-remote-paths-sed
sateeshperi May 28, 2023
5577bfa
rm docker hardcode for test profiles
sateeshperi Jun 5, 2023
498aa9c
fix tag missing error
sateeshperi Jun 5, 2023
173dc9d
update test UTILS and test multi profile job matrix
sateeshperi Jun 19, 2023
aec9f6e
test multi profile job matrix
sateeshperi Jun 19, 2023
7d4ee50
fix novaseq snap
sateeshperi Jun 20, 2023
3b591cf
ci fail fast to false
sateeshperi Jun 20, 2023
4b093cd
update snapshots after rebase
sateeshperi Jun 20, 2023
49579a9
re-organize tests and use tags in ci job matrix
sateeshperi Jun 20, 2023
179bf77
lint ignore .gitattributes
sateeshperi Jun 20, 2023
91f1b4e
CI - replace test data caching with git clone fetch-depth 1
sateeshperi Jun 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.config linguist-language=nextflow
*.nf.test linguist-language=nextflow
tests/**/*nf.test.snap linguist-generated
modules/nf-core/** linguist-generated
subworkflows/nf-core/** linguist-generated
116 changes: 73 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,106 @@
name: nf-core CI
# This workflow runs the pipeline with the minimal test dataset to check that it completes without any syntax errors
name: nf-core CI
on:
push:
branches:
- dev
- "dev"
pull_request:
branches:
- "dev"
- "master"
release:
types: [published]
types:
- "published"

env:
NXF_ANSI_LOG: false
NFTEST_VER: "0.7.3"

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

jobs:
define_nxf_versions:
name: Choose nextflow versions to test against depending on target branch
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.nxf_versions.outputs.matrix }}
steps:
- 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:
name: Run pipeline with test data
# Only run on push if this is the nf-core dev branch (merged PRs)
if: "${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/ampliseq') }}"
name: nf-test
needs: define_nxf_versions
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
NXF_VER:
- "22.10.1"
- "latest-everything"
NXF_VER: ${{ fromJson(needs.define_nxf_versions.outputs.matrix) }}
tags:
- "test"
- "test_single"
- "test_fasta"
- "test_multi"
- "test_reftaxcustom"
- "test_doubleprimers"
- "test_iontorrent"
- "test_novaseq"
- "test_pacbio_its"
- "test_sintax"
- "test_pplace"
sateeshperi marked this conversation as resolved.
Show resolved Hide resolved
profile:
- "docker"

steps:
- name: Check out pipeline code
uses: actions/checkout@v3

- name: Check out test data
uses: actions/checkout@v3
with:
repository: nf-core/test-datasets
ref: ampliseq
path: test-datasets/
fetch-depth: 1
sateeshperi marked this conversation as resolved.
Show resolved Hide resolved

- name: Replace remote paths in samplesheets
run: |
for f in ${{ github.workspace }}/test-datasets/samplesheets/*.tsv; do
sed -i "s=https://github.com/nf-core/test-datasets/raw/ampliseq/testdata/=${{ github.workspace }}/test-datasets/=g" $f
echo "========== $f ============"
cat $f
echo "========================================"
done;

- name: Install Nextflow
uses: nf-core/setup-nextflow@v1
with:
version: "${{ matrix.NXF_VER }}"

- name: Run pipeline with test data
- name: Install nf-test
run: |
nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results
wget -qO- https://code.askimed.com/install/nf-test | bash -s $NFTEST_VER
sudo mv nf-test /usr/local/bin/

profiles:
name: Run workflow profile
# Only run on push if this is the nf-core dev branch (merged PRs)
if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/ampliseq') }}
runs-on: ubuntu-latest
strategy:
matrix:
# Run remaining test profiles with minimum nextflow version
profile:
[
test_multi,
test_pacbio_its,
test_doubleprimers,
test_iontorrent,
test_single,
test_fasta,
test_reftaxcustom,
test_novaseq,
test_pplace,
test_sintax,
]
steps:
- name: Check out pipeline code
uses: actions/checkout@v2

- name: Install Nextflow
- name: Run nf-test
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
nf-test test --tag ${{ matrix.tags }} --profile ${{ matrix.tags }},${{ matrix.profile }} --junitxml=test.xml

- name: Run pipeline with ${{ matrix.profile }} test profile
- name: Output log on failure
if: failure()
run: |
nextflow run ${GITHUB_WORKSPACE} -profile ${{ matrix.profile }},docker --outdir ./results
sudo apt install bat > /dev/null
batcat --decorations=always --color=always ${{ github.workspace }}/.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: "*.xml"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ testing*
.screenrc
ampliseq.Rproj
results_test/*
.nf-test/
nf-test
4 changes: 3 additions & 1 deletion .nf-core.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
repository_type: pipeline

lint:
files_unchanged:
- .gitattributes
files_exist:
- conf/igenomes.config
actions_ci: False
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Added`

- [#580](https://github.com/nf-core/ampliseq/pull/580) - Add NF-TEST pipeline end-to-end tests for existing CI tests
- [#591](https://github.com/nf-core/ampliseq/pull/591) - New version of the Unite taxonomy databases: 9.0
- [#564](https://github.com/nf-core/ampliseq/pull/564),[#567](https://github.com/nf-core/ampliseq/pull/567),[#582](https://github.com/nf-core/ampliseq/pull/582) - Added phylogenetic placement
- [#577](https://github.com/nf-core/ampliseq/pull/577) - Added SINTAX for taxonomic classification
Expand All @@ -15,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Changed`

- [#580](https://github.com/nf-core/ampliseq/pull/580) - GitHub Actions CI - pull_request to `dev` tests with NXF_VER `latest-everything` & pull_request to `master` tests with NXF_VER `22.10.1` & `latest-everything`
- [#563](https://github.com/nf-core/ampliseq/pull/563) - Renamed DADA2 taxonomic classification files to include the chosen reference taxonomy abbreviation.
- [#567](https://github.com/nf-core/ampliseq/pull/567) - Renamed `--dada_tax_agglom_min` and `--qiime_tax_agglom_min` to `--tax_agglom_min` and `--dada_tax_agglom_max` and `--qiime_tax_agglom_max` to `--tax_agglom_max`
- [#598](https://github.com/nf-core/ampliseq/pull/598) - Updated Workflow figure with SINTAX and phylogenetic placement
Expand Down
16 changes: 16 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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"

// run all test with the defined docker profile from the main nextflow.config
profile ""
}
40 changes: 40 additions & 0 deletions tests/pipeline/doubleprimers.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
nextflow_pipeline {

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

test("Double-Primers") {

when {
params {
outdir = "$outputDir"
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") },
{ assert snapshot(path("$outputDir/overall_summary.tsv")).match("overall_summary_tsv") },
{ assert snapshot(path("$outputDir/barrnap/rrna.arc.gff"),
path("$outputDir/barrnap/rrna.bac.gff"),
path("$outputDir/barrnap/rrna.euk.gff"),
path("$outputDir/barrnap/rrna.mito.gff")).match("barrnap") },
{ assert new File("$outputDir/barrnap/summary.tsv").exists() },
{ assert snapshot(path("$outputDir/cutadapt/cutadapt_summary.tsv")).match("cutadapt") },
{ assert snapshot(path("$outputDir/dada2/ASV_seqs.fasta"),
path("$outputDir/dada2/ASV_table.tsv"),
path("$outputDir/dada2/DADA2_stats.tsv"),
path("$outputDir/dada2/DADA2_table.rds"),
path("$outputDir/dada2/DADA2_table.tsv")).match("dada2") },
{ assert new File("$outputDir/qiime2/input/rep-seqs.qza").exists() },
{ assert new File("$outputDir/qiime2/input/table.qza").exists() },
{ assert snapshot(path("$outputDir/input/Samplesheet_double_primer.tsv")).match("input") },
{ assert snapshot(path("$outputDir/multiqc/multiqc_data/multiqc_general_stats.txt"),
path("$outputDir/multiqc/multiqc_data/multiqc_cutadapt.txt")).match("multiqc") }
)
}
}
}
52 changes: 52 additions & 0 deletions tests/pipeline/doubleprimers.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

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

test("Fasta Input") {

when {
params {
outdir = "$outputDir"
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") },
{ assert snapshot(path("$outputDir/barrnap/rrna.arc.gff"),
path("$outputDir/barrnap/rrna.bac.gff"),
path("$outputDir/barrnap/rrna.euk.gff"),
path("$outputDir/barrnap/rrna.mito.gff")).match("barrnap") },
{ assert new File("$outputDir/barrnap/summary.tsv").exists() },
{ assert snapshot(path("$outputDir/dada2/ref_taxonomy.rdp_18.txt")).match("dada2") },
{ assert new File("$outputDir/dada2/ASV_tax_species.rdp_18.tsv").exists() },
{ assert new File("$outputDir/dada2/ASV_tax.rdp_18.tsv").exists() },
{ assert snapshot(path("$outputDir/input/ASV_seqs.fasta")).match("input") }
)
}
}
}
29 changes: 29 additions & 0 deletions tests/pipeline/fasta.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading