Skip to content

Commit

Permalink
Merge pull request #253 from adamrtalbot/nftest_new_tags_strategy
Browse files Browse the repository at this point in the history
Replace tags strategy with implicit 'tags in test' strategy
  • Loading branch information
drpatelh authored Jan 29, 2024
2 parents 02f932b + cb4f0e6 commit 8d3a0c5
Show file tree
Hide file tree
Showing 44 changed files with 215 additions and 176 deletions.
128 changes: 102 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,101 @@ jobs:
name: Check for changes
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'tags' output variable
tags: ${{ steps.filter.outputs.changes }}
changes: ${{ steps.changed_files.outputs.any_modified }}
tags: ${{ steps.list.outputs.tags }}
steps:
- name: Install Nextflow
uses: nf-core/setup-nextflow@v1

- name: Cache nf-test installation
id: cache-software
uses: actions/cache@v3
with:
path: |
/usr/local/bin/nf-test
/home/runner/.nf-test/nf-test.jar
key: ${{ runner.os }}-${{ env.NFT_VER }}-nftest

- name: Install nf-test
if: steps.cache-software.outputs.cache-hit != 'true'
run: |
wget -qO- https://code.askimed.com/install/nf-test | bash
sudo mv nf-test /usr/local/bin/
- uses: actions/checkout@v3
- name: Combine all tags.yml files
id: get_username
run: find . -name "tags.yml" -not -path "./.github/*" -exec cat {} + > .github/tags.yml
- name: debug
run: cat .github/tags.yml
- uses: dorny/paths-filter@v2
id: filter
with:
filters: ".github/tags.yml"
fetch-depth: 0

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
- uses: tj-actions/changed-files@v42
id: changed_files
with:
dir_names: "true"
output_renamed_files_as_deleted_and_added: "true"
# Define list of additional rules for testing paths
# Mostly, we define additional 'pipeline' or 'all' tests here
files_yaml: |
".":
- .github/workflows/**
- nf-test.config
- nextflow.config
tests:
- assets/*
- bin/*
- conf/*
- main.nf
- nextflow_schema.json
files_ignore: |
.git*
.gitpod.yml
.prettierignore
.prettierrc.yml
**.md
**.png
modules.json
pyproject.toml
tower.yml
- name: debug
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", "23.04.0"]' | tee -a $GITHUB_OUTPUT
fi
echo ${{ steps.changed_files.outputs.any_modified }}
echo ${{ steps.changed_files.outputs.all_changed_files }}
echo ${{ steps.changed_files.outputs.changed_keys }}
- name: nf-test list tags
id: list
if: ${{ steps.changed_files.outputs.any_modified }}
run: echo tags=$(nf-test list --silent --tags --format json ${{ steps.changed_files.outputs.all_changed_files }} ${{ steps.changed_files.outputs.changed_keys }}) >> $GITHUB_OUTPUT

- name: debug2
run: |
echo ${{ steps.list.outputs.tags }}
# 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", "23.04.0"]' | tee -a $GITHUB_OUTPUT
# fi

test:
name: ${{ matrix.tags }} ${{ matrix.profile }} NF ${{ matrix.NXF_VER }}
needs: [changes, define_nxf_versions]
if: needs.changes.outputs.tags != '[]'
name: ${{ matrix.tags }} ${{ matrix.profile }} NF-${{ matrix.NXF_VER }}
needs: [changes]
if: needs.changes.outputs.changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
NXF_VER: ${{ fromJson(needs.define_nxf_versions.outputs.matrix) }}
NXF_VER:
- "latest-everything"
- "23.04"
tags: ["${{ fromJson(needs.changes.outputs.tags) }}"]
profile:
- "docker"
Expand Down Expand Up @@ -122,3 +180,21 @@ jobs:
if: always() # always run even if the previous step fails
with:
report_paths: test.xml

confirm-pass:
runs-on: ubuntu-latest
needs: [test]
if: always()
steps:
- name: All tests ok
if: ${{ success() || !contains(needs.*.result, 'failure') }}
run: exit 0
- name: One or more tests failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1

- name: debug-print
if: always()
run: |
echo "toJSON(needs) = ${{ toJSON(needs) }}"
echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}"
5 changes: 2 additions & 3 deletions modules/local/multiqc_mappings_config/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ nextflow_process {
name "Test process: MULTIQC_MAPPINGS_CONFIG"
script "../main.nf"
process "MULTIQC_MAPPINGS_CONFIG"
tag "modules"
tag "modules_local"
tag "multiqc_mappings_config"

tag "MULTIQC_MAPPINGS_CONFIG"

test("Should run without failures") {

Expand Down
2 changes: 0 additions & 2 deletions modules/local/multiqc_mappings_config/tests/tags.yml

This file was deleted.

5 changes: 2 additions & 3 deletions modules/local/sra_fastq_ftp/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ nextflow_process {
name "Test process: SRA_FASTQ_FTP"
script "../main.nf"
process "SRA_FASTQ_FTP"
tag "modules"
tag "modules_local"
tag "sra_fastq_ftp"

tag "SRA_FASTQ_FTP"

test("Should run without failures") {

Expand Down
2 changes: 0 additions & 2 deletions modules/local/sra_fastq_ftp/tests/tags.yml

This file was deleted.

5 changes: 2 additions & 3 deletions modules/local/sra_ids_to_runinfo/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ nextflow_process {
name "Test process: SRA_IDS_TO_RUNINFO"
script "../main.nf"
process "SRA_IDS_TO_RUNINFO"
tag "modules"
tag "modules_local"
tag "sra_ids_to_runinfo"

tag "SRA_IDS_TO_RUNINFO"

test("Should run without failures") {

Expand Down
2 changes: 0 additions & 2 deletions modules/local/sra_ids_to_runinfo/tests/tags.yml

This file was deleted.

5 changes: 2 additions & 3 deletions modules/local/sra_runinfo_to_ftp/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ nextflow_process {
name "Test process: SRA_RUNINFO_TO_FTP"
script "../main.nf"
process "SRA_RUNINFO_TO_FTP"
tag "modules"
tag "modules_local"
tag "sra_runinfo_to_ftp"

tag "SRA_RUNINFO_TO_FTP"

test("Should run without failures") {

Expand Down
2 changes: 0 additions & 2 deletions modules/local/sra_runinfo_to_ftp/tests/tags.yml

This file was deleted.

5 changes: 2 additions & 3 deletions modules/local/sra_to_samplesheet/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ nextflow_process {
name "Test process: SRA_TO_SAMPLESHEET"
script "../main.nf"
process "SRA_TO_SAMPLESHEET"
tag "modules"
tag "modules_local"
tag "sra_to_samplesheet"

tag "SRA_TO_SAMPLESHEET"

test("Should run without failures") {

Expand Down
2 changes: 0 additions & 2 deletions modules/local/sra_to_samplesheet/tests/tags.yml

This file was deleted.

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

2 changes: 0 additions & 2 deletions modules/nf-core/custom/sratoolsncbisettings/tests/tags.yml

This file was deleted.

8 changes: 3 additions & 5 deletions modules/nf-core/sratools/fasterqdump/tests/main.nf.test

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

2 changes: 0 additions & 2 deletions modules/nf-core/sratools/fasterqdump/tests/tags.yml

This file was deleted.

5 changes: 1 addition & 4 deletions modules/nf-core/sratools/prefetch/tests/main.nf.test

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

2 changes: 0 additions & 2 deletions modules/nf-core/sratools/prefetch/tests/tags.yml

This file was deleted.

5 changes: 1 addition & 4 deletions modules/nf-core/untar/tests/main.nf.test

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

2 changes: 0 additions & 2 deletions modules/nf-core/untar/tests/tags.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ nextflow_function {

name "Test Functions"
script "subworkflows/local/utils_nfcore_fetchngs_pipeline/main.nf"
tag 'subworkflows'
tag 'utils_nfcore_fetchngs_pipeline'
tag 'subworkflows/utils_nfcore_fetchngs_pipeline'
tag "UTILS_NFCORE_FETCHNGS_PIPELINE"

test("Function isSraId") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ nextflow_workflow {
name "Test Workflow PIPELINE_COMPLETION"
script "subworkflows/local/utils_nfcore_fetchngs_pipeline/main.nf"
workflow "PIPELINE_COMPLETION"
tag 'subworkflows'
tag 'utils_nfcore_fetchngs_pipeline'
tag 'subworkflows/utils_nfcore_fetchngs_pipeline'
tag "PIPELINE_COMPLETION"

test("Should run") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ nextflow_workflow {
name "Test Workflow PIPELINE_INITIALISATION"
script "subworkflows/local/utils_nfcore_fetchngs_pipeline/main.nf"
workflow "PIPELINE_INITIALISATION"
tag 'subworkflows'
tag 'utils_nfcore_fetchngs_pipeline'
tag 'subworkflows/utils_nfcore_fetchngs_pipeline'
tag 'PIPELINE_INITIALISATION'

test("Should run") {

Expand Down

This file was deleted.

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

This file was deleted.

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

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

2 changes: 0 additions & 2 deletions subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml

This file was deleted.

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

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

Loading

0 comments on commit 8d3a0c5

Please sign in to comment.