Skip to content

Commit

Permalink
Merge pull request #3133 from mirpedrol/template-customisation-testing
Browse files Browse the repository at this point in the history
Template: add option to exclude test configs from pipeline template
  • Loading branch information
mirpedrol authored Aug 26, 2024
2 parents 769c6fc + 25030e3 commit 40a8bcb
Show file tree
Hide file tree
Showing 11 changed files with 303 additions and 264 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/create-test-lint-wf-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Create Matrix
id: create_matrix
run: |
echo "matrix=$(yq 'keys | tojson(0)' nf_core/pipelines/create/templatefeatures.yml)" >> $GITHUB_OUTPUT
echo "matrix=$(yq 'keys | filter(. != "github") | filter(. != "is_nfcore") | filter(. != "test_config") | tojson(0)' nf_core/pipelines/create/templatefeatures.yml)" >> $GITHUB_OUTPUT
RunTestWorkflow:
runs-on: ${{ matrix.runner }}
Expand All @@ -66,8 +66,6 @@ jobs:
runner: ubuntu-latest
profile: "docker"
exclude:
- TEMPLATE: github
- TEMPLATE: is_nfcore
- TEMPLATE: nf_core_configs
profile: "self_hosted_runner"
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- add option to exclude email from pipeline template ([#3126](https://github.com/nf-core/tools/pull/3126))
- add option to exclude fastqc from pipeline template ([#3129](https://github.com/nf-core/tools/pull/3129))
- add option to exclude documentation from pipeline template ([#3130](https://github.com/nf-core/tools/pull/3130))
- add option to exclude test configs from pipeline template ([#3133](https://github.com/nf-core/tools/pull/3133))

### Linting

Expand Down
7 changes: 6 additions & 1 deletion nf_core/pipeline-template/.github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ If you're not used to this workflow with git, you can start with some [docs from

## Tests

{%- if test_config %}
You have the option to test your changes locally by running the pipeline. For receiving warnings about process selectors and other `debug` information, it is recommended to use the debug profile. Execute all the tests with the following command:

```bash
nf-test test --profile debug,test,docker --verbose
```

{% endif %}
When you create a pull request with changes, [GitHub Actions](https://github.com/features/actions) will run automatic tests.
Typically, pull-requests are only fully reviewed when these tests are passing, though of course we can help out before then.

There are typically two types of tests that run:
{% if test_config %}There are typically two types of tests that run:{% endif %}

### Lint tests

Expand All @@ -48,12 +50,15 @@ To enforce these and ensure that all pipelines stay in sync, we have developed a

If any failures or warnings are encountered, please follow the listed URL for more documentation.

{%- if test_config %}

### Pipeline tests

Each `nf-core` pipeline should be set up with a minimal set of test-data.
`GitHub Actions` then runs the pipeline on this data to ensure that it exits successfully.
If there are any failures then the automated tests fail.
These tests are run both with the latest available version of `Nextflow` and also the minimum required version that is stated in the pipeline code.
{%- endif %}

## Patch

Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/.github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ Learn more about contributing: [CONTRIBUTING.md](https://github.com/{{ name }}/t
- [ ] If necessary, also make a PR on the {{ name }} _branch_ on the [nf-core/test-datasets](https://github.com/nf-core/test-datasets) repository.
{%- endif %}
- [ ] Make sure your code lints (`nf-core pipelines lint`).
{%- if test_config %}
- [ ] Ensure the test suite passes (`nextflow run . -profile test,docker --outdir <OUTDIR>`).
- [ ] Check for unexpected warnings in debug mode (`nextflow run . -profile debug,test,docker --outdir <OUTDIR>`).
{%- endif %}
- [ ] Usage Documentation in `docs/usage.md` is updated.
- [ ] Output Documentation in `docs/output.md` is updated.
- [ ] `CHANGELOG.md` is updated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
--download-configuration
- name: Inspect download
run: tree ./${{ env.REPOTITLE_LOWERCASE }}
run: tree ./${{ env.REPOTITLE_LOWERCASE }}{% endraw %}{% if test_config %}{% raw %}

- name: Run the downloaded pipeline (stub)
id: stub_run_pipeline
Expand All @@ -83,4 +83,4 @@ jobs:
env:
NXF_SINGULARITY_CACHEDIR: ./
NXF_SINGULARITY_HOME_MOUNT: true
run: nextflow run ./${{ env.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ env.REPO_BRANCH }}) -profile test,singularity --outdir ./results{% endraw %}
run: nextflow run ./${{ env.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ env.REPO_BRANCH }}) -profile test,singularity --outdir ./results{% endraw %}{% endif %}
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
## Usage

> [!NOTE]
> If you are new to Nextflow and nf-core, please refer to [this page](https://nf-co.re/docs/usage/installation) on how to set-up Nextflow. Make sure to [test your setup](https://nf-co.re/docs/usage/introduction#how-to-run-a-pipeline) with `-profile test` before running the workflow on actual data.
> If you are new to Nextflow and nf-core, please refer to [this page](https://nf-co.re/docs/usage/installation) on how to set-up Nextflow. {% if test_config %}Make sure to [test your setup](https://nf-co.re/docs/usage/introduction#how-to-run-a-pipeline) with `-profile test` before running the workflow on actual data.{% endif %}
<!-- TODO nf-core: Describe the minimum required steps to execute the pipeline, e.g. how to prepare samplesheets.
Explain what rows and columns represent. For instance (please edit as appropriate):
Expand Down
3 changes: 3 additions & 0 deletions nf_core/pipeline-template/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ They are loaded in sequence, so later profiles can overwrite earlier profiles.

If `-profile` is not specified, the pipeline will run locally and expect all software to be installed and available on the `PATH`. This is _not_ recommended, since it can lead to different results on different machines dependent on the computer enviroment.

{%- if test_config %}

- `test`
- A profile with a complete configuration for automated testing
- Includes links to test data so needs no other parameters
{%- endif %}
- `docker`
- A generic configuration profile to be used with [Docker](https://docker.com/)
- `singularity`
Expand Down
4 changes: 3 additions & 1 deletion nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ params {
hook_url = null
help = false
version = false
pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/'
{% if test_config %}pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/'{% endif %}

{%- if nf_core_configs %}
// Config options
Expand Down Expand Up @@ -189,8 +189,10 @@ profiles {
executor.memory = 8.GB
}
{%- endif %}
{%- if test_config %}
test { includeConfig 'conf/test.config' }
test_full { includeConfig 'conf/test_full.config' }
{%- endif %}
}

// Set default registry for Apptainer, Docker, Podman, Charliecloud and Singularity independent of -profile
Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@
"description": "Validation of parameters in lenient more.",
"hidden": true,
"help_text": "Allows string values that are parseable as numbers or booleans. For further information see [JSONSchema docs](https://github.com/everit-org/json-schema#lenient-mode)."
},
}{% if test_config %},
"pipelines_testdata_base_path": {
"type": "string",
"fa_icon": "far fa-check-circle",
"description": "Base URL or local path to location of pipeline test dataset files",
"default": "https://raw.githubusercontent.com/nf-core/test-datasets/",
"hidden": true
}
}{% endif %}
}
}
},
Expand Down
28 changes: 28 additions & 0 deletions nf_core/pipelines/create/templatefeatures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,31 @@ documentation:
- "docs/usage.md"
nfcore_pipelines: False
custom_pipelines: True
test_config:
skippable_paths:
- "conf/test.config"
- "conf/test_full.config"
- ".github/workflows/awsfulltest.yml"
- ".github/workflows/awstest.yml"
- ".github/workflows/ci.yml"
short_description: "Add testing profiles"
description: "Add two default testing profiles"
help_text: |
This will add two default testing profiles to run the pipeline with different inputs.
You can customise them and add other test profiles.
These profiles can be used to run the pipeline with a minimal testing dataset with `nextflow run <your_pipeline> -profile test`.
The pipeline will include two profiles: `test` and `test_full`.
In nf-core, we typically use the `test` profile to run the pipeline with a minimal dataset and the `test_full` to run the pipeline with a larger dataset that simulates a real-world scenario.
linting:
files_exist:
- "conf/test.config"
- "conf/test_full.config"
- ".github/workflows/ci.yml"
nextflow_config: False
files_unchanged:
- ".github/CONTRIBUTING.md"
- ".github/PULL_REQUEST_TEMPLATE.md"
nfcore_pipelines: False
custom_pipelines: True
Loading

0 comments on commit 40a8bcb

Please sign in to comment.