From ace430139561c3bb1b168d21f43e953e1b9422bd Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 6 Feb 2024 12:20:05 +0100 Subject: [PATCH 1/3] Add test for initialize breaking the template Can include any other files that might break the template as well --- .github/workflows/tools.yml | 154 ++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 .github/workflows/tools.yml diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml new file mode 100644 index 00000000000..5d4306f55d2 --- /dev/null +++ b/.github/workflows/tools.yml @@ -0,0 +1,154 @@ +name: Run Template Tests +on: + push: + branches: [master] + paths: + - "**/initialise**" + pull_request: + branches: [master] + paths: + - "**/initialise**" + merge_group: + types: [checks_requested] + branches: [master] + paths: + - "**/initialise**" + +# Cancel if a newer run is started +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + RunTestWorkflow: + runs-on: ${{ matrix.runner }} + env: + NXF_ANSI_LOG: false + strategy: + matrix: + TEMPLATE: + - "template_skip_github_badges.yml" + - "template_skip_igenomes.yml" + - "template_skip_ci.yml" + runner: ["self-hosted"] + profile: ["self_hosted_runner"] + include: + - TEMPLATE: "template_skip_all.yml" + runner: ubuntu-latest + profile: "docker" + - TEMPLATE: "template_skip_nf_core_configs.yml" + runner: ubuntu-latest + profile: "docker" + + 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@v4 + name: Check out source-code repository + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + pip install . + + - name: Install Nextflow + uses: nf-core/setup-nextflow@v1 + with: + version: latest-everything + + # Create template files + - name: Create template skip all (except github) + run: | + mkdir create-test-lint-wf + export NXF_WORK=$(pwd) + printf "prefix: my-prefix\nskip: ['ci', 'github_badges', 'igenomes', 'nf_core_configs']" > create-test-lint-wf/template_skip_all.yml + + - name: Create template skip github_badges + run: | + printf "prefix: my-prefix\nskip: github_badges" > create-test-lint-wf/template_skip_github_badges.yml + + - name: Create template skip igenomes + run: | + printf "prefix: my-prefix\nskip: igenomes" > create-test-lint-wf/template_skip_igenomes.yml + + - name: Create template skip ci + run: | + printf "prefix: my-prefix\nskip: ci" > create-test-lint-wf/template_skip_ci.yml + + - name: Create template skip nf_core_configs + run: | + printf "prefix: my-prefix\nskip: nf_core_configs" > create-test-lint-wf/template_skip_nf_core_configs.yml + + # 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 create -n testpipeline -d "This pipeline is for testing" -a "Testing McTestface" --template-yaml ${{ matrix.TEMPLATE }} + + - 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 sync + run: nf-core --log-file log.txt 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 + + # 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 + + # Run nf-core linting + - name: nf-core lint + run: nf-core --log-file log.txt --hide-progress lint --dir my-prefix-testpipeline --fail-warned + working-directory: create-test-lint-wf + + # Run bump-version + - name: nf-core bump-version + run: nf-core --log-file log.txt bump-version --dir my-prefix-testpipeline/ 1.1 + working-directory: create-test-lint-wf + + # Run nf-core linting in release mode + - name: nf-core lint in release mode + run: nf-core --log-file log.txt --hide-progress 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@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() From 1ceb5d945fd2e4e4730b63416af012ed402a4b39 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 6 Feb 2024 12:26:10 +0100 Subject: [PATCH 2/3] fix: initialise path Need to migrate to nf-test --- .github/workflows/tools.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 5d4306f55d2..351bc3a73df 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -3,16 +3,16 @@ on: push: branches: [master] paths: - - "**/initialise**" + - "subworkflows/nf-core/initialise/**" pull_request: branches: [master] paths: - - "**/initialise**" + - "subworkflows/nf-core/initialise/**" merge_group: types: [checks_requested] branches: [master] paths: - - "**/initialise**" + - "subworkflows/nf-core/initialise/**" # Cancel if a newer run is started concurrency: From 0392574b86f2be9ad881d2ac7caaf98275410c09 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 6 Feb 2024 12:27:32 +0100 Subject: [PATCH 3/3] dummy: Add line for CI --- subworkflows/nf-core/initialise/main.nf | 1 + 1 file changed, 1 insertion(+) diff --git a/subworkflows/nf-core/initialise/main.nf b/subworkflows/nf-core/initialise/main.nf index c5a5350d755..2402f9cb741 100644 --- a/subworkflows/nf-core/initialise/main.nf +++ b/subworkflows/nf-core/initialise/main.nf @@ -158,6 +158,7 @@ def dashedLine(monochrome_logs) { return "-${colors.dim}----------------------------------------------------${colors.reset}-" } + // // nf-core logo //