Update template components #3144
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create a pipeline from a template and test it | |
on: | |
push: | |
branches: | |
- dev | |
paths: | |
- nf_core/pipeline-template/** | |
pull_request: | |
paths-ignore: | |
- "docs/**" | |
- "CHANGELOG.md" | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
runners: | |
description: "Runners to test on" | |
type: choice | |
options: | |
- "ubuntu-latest" | |
- "self-hosted" | |
default: "self-hosted" | |
# Cancel if a newer run is started | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
NXF_ANSI_LOG: false | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
prepare-matrix: | |
name: Retrieve all template features | |
runs-on: ubuntu-latest | |
outputs: | |
all_features: ${{ steps.create_matrix.outputs.matrix }} | |
steps: | |
- name: 🏗 Set up yq | |
uses: frenck/action-setup-yq@v1 | |
- name: checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Create Matrix | |
id: create_matrix | |
run: | | |
echo "matrix=$(yq 'keys | filter(. != "github") | filter(. != "is_nfcore") | filter(. != "test_config") | tojson(0)' nf_core/pipelines/create/template_features.yml)" >> $GITHUB_OUTPUT | |
RunTestWorkflow: | |
runs-on: ${{ matrix.runner }} | |
needs: prepare-matrix | |
env: | |
NXF_ANSI_LOG: false | |
strategy: | |
matrix: | |
TEMPLATE: ${{ fromJson(needs.prepare-matrix.outputs.all_features) }} | |
runner: | |
# use the runner given by the input if it is dispatched manually, run on github if it is a rerun or on self-hosted by default | |
- ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }} | |
profile: ["self_hosted_runner"] | |
include: | |
- TEMPLATE: all | |
runner: ubuntu-latest | |
profile: "docker" | |
- TEMPLATE: nf_core_configs | |
runner: ubuntu-latest | |
profile: "docker" | |
exclude: | |
- TEMPLATE: nf_core_configs | |
profile: "self_hosted_runner" | |
fail-fast: false | |
steps: | |
- name: go to working directory | |
run: | | |
mkdir -p create-lint-wf-template | |
cd create-lint-wf-template | |
export NXF_WORK=$(pwd) | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
name: Check out source-code repository | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 | |
with: | |
python-version: "3.12" | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
- name: Install Nextflow | |
uses: nf-core/setup-nextflow@v2 | |
with: | |
version: latest-everything | |
# Create template files | |
- name: Create template skip ${{ matrix.TEMPLATE }} | |
run: | | |
mkdir create-test-lint-wf | |
export NXF_WORK=$(pwd) | |
if [ ${{ matrix.TEMPLATE }} == "all" ] | |
then | |
printf "org: my-prefix\nskip_features: ${{ needs.prepare-matrix.outputs.all_features }}" > create-test-lint-wf/template_skip_all.yml | |
else | |
printf "org: my-prefix\nskip_features: [${{ matrix.TEMPLATE }}]" > create-test-lint-wf/template_skip_${{ matrix.TEMPLATE }}.yml | |
fi | |
# Create a pipeline from the template | |
- name: create a pipeline from the template ${{ matrix.TEMPLATE }} | |
run: | | |
cd create-test-lint-wf | |
nf-core --log-file log.txt pipelines create -n testpipeline -d "This pipeline is for testing" -a "Testing McTestface" --template-yaml template_skip_${{ matrix.TEMPLATE }}.yml | |
- name: run the pipeline | |
run: | | |
cd create-test-lint-wf | |
nextflow run my-prefix-testpipeline -profile test,${{matrix.profile}} --outdir ./results | |
# Remove results folder before linting | |
- name: remove results folder | |
run: | | |
rm -rf create-test-lint-wf/results | |
# Try syncing it before we change anything | |
- name: nf-core pipelines sync | |
run: nf-core --log-file log.txt pipelines sync --dir create-test-lint-wf/my-prefix-testpipeline/ | |
# Run code style linting | |
- name: Run pre-commit | |
run: pre-commit run --all-files | |
working-directory: create-test-lint-wf | |
# Remove TODO statements | |
- name: remove TODO | |
run: find my-prefix-testpipeline -type f -exec sed -i '/TODO nf-core:/d' {} \; | |
working-directory: create-test-lint-wf | |
# Uncomment includeConfig statement | |
- name: uncomment include config | |
run: find my-prefix-testpipeline -type f -exec sed -i 's/\/\/ includeConfig/includeConfig/' {} \; | |
working-directory: create-test-lint-wf | |
# Replace zenodo.XXXXXX to pass readme linting | |
- name: replace zenodo.XXXXXX | |
run: find my-prefix-testpipeline -type f -exec sed -i 's/zenodo.XXXXXX/zenodo.123456/g' {} \; | |
working-directory: create-test-lint-wf | |
# Add empty ro-crate file | |
- name: add empty ro-crate file | |
run: touch my-prefix-testpipeline/ro-crate-metadata.json | |
working-directory: create-test-lint-wf | |
# Run nf-core linting | |
- name: nf-core pipelines lint | |
run: nf-core --log-file log.txt --hide-progress pipelines lint --dir my-prefix-testpipeline --fail-warned | |
working-directory: create-test-lint-wf | |
# Run code style linting | |
- name: run pre-commit | |
shell: bash | |
run: pre-commit run --all-files | |
working-directory: create-test-lint-wf | |
# Run bump-version | |
- name: nf-core pipelines bump-version | |
run: nf-core --log-file log.txt pipelines bump-version --dir my-prefix-testpipeline/ 1.1 | |
working-directory: create-test-lint-wf | |
# Run nf-core linting in release mode | |
- name: nf-core pipelines lint in release mode | |
run: nf-core --log-file log.txt --hide-progress pipelines lint --dir my-prefix-testpipeline --fail-warned --release | |
working-directory: create-test-lint-wf | |
- name: Tar files | |
run: tar -cvf artifact_files.tar log.txt template_skip*.yml | |
working-directory: create-test-lint-wf | |
- name: Upload log file artifact | |
if: ${{ always() }} | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 | |
with: | |
name: nf-core-log-file-${{ matrix.TEMPLATE }} | |
path: create-test-lint-wf/artifact_files.tar | |
- name: Cleanup work directory | |
run: sudo rm -rf create-test-lint-wf | |
if: always() |