From d4ae72fd7753ca868cbba1be960da49406738c4f Mon Sep 17 00:00:00 2001 From: Jorisvansteenbrugge <7196110+Jorisvansteenbrugge@users.noreply.github.com> Date: Fri, 3 Apr 2026 16:46:03 +0200 Subject: [PATCH 1/4] nf-core style linting --- .github/workflows/lint.yml | 207 +++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..d7cc771 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,207 @@ +name: Run Linting +on: + pull_request: + 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_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity + NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # renovate: datasource=github-releases depName=nextflow/nextflow versioning=semver + NXF_VER: "25.10.2" + NXF_SYNTAX_PARSER: "v2" + +jobs: + pre-commit: + runs-on: ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - uses: nf-core/setup-nextflow@v2 + - name: Run prek + uses: j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1 + with: + extra_args: "" + + ################### + # nf-core linting # + ################### + # TODO Move these to pre-commit + # https://github.com/nf-core/tools/pull/3141 + nf-core-changes: + name: nf-core-changes + runs-on: + - runs-on=${{ github.run_id }}-nf-core-changes + - runner=4cpu-linux-x64 + - image=ubuntu22-full-x64 + outputs: + # https://github.com/dorny/paths-filter?tab=readme-ov-file#custom-processing-of-changed-files + modules: ${{ steps.filter.outputs.modules }} + modules_files: ${{ steps.module_names.outputs.result }} + subworkflows: ${{ steps.filter.outputs.subworkflows }} + subworkflows_files: ${{ steps.subworkflow_names.outputs.result }} + steps: + - name: Clean workspace + run: | + sudo rm -rf ./* || true + sudo rm -rf ./.* || true + + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + fetch-depth: 2 # To retrieve the preceding commit. + + - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4 + id: filter + with: + filters: | + modules: + - added|modified: 'modules/nf-core/**' + subworkflows: + - added|modified: 'subworkflows/nf-core/**' + token: "" + list-files: "json" + + - name: Get module name + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + id: module_names + with: + script: | + return [...new Set(${{ steps.filter.outputs.modules_files }} + .filter(x => x.endsWith('main.nf') || x.endsWith('.nf.test.snap')) + .map(path => path + .replace('modules/nf-core/', '') + .replace(/\/(main\.nf|tests\/.*)$/, '') + ) + )]; + - name: Get subworkflow name + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + id: subworkflow_names + with: + script: | + return [...new Set(${{ steps.filter.outputs.subworkflows_files }} + .filter(x => x.endsWith('main.nf') || x.endsWith('.nf.test.snap')) + .map(path => path + .replace('subworkflows/nf-core/', '') + .replace(/\/(main\.nf|tests\/.*)$/, '') + ) + )]; + + - name: debug + run: | + echo ${{ steps.filter.outputs.modules_files }} + echo ${{ steps.module_names.outputs.result }} + echo ${{ steps.filter.outputs.subworkflows_files }} + echo ${{ steps.subworkflow_names.outputs.result }} + + nf-core-lint-modules: + runs-on: + - runs-on=${{ github.run_id }}-nf-core-lint-modules + - runner=4cpu-linux-x64 + - image=ubuntu22-full-x64 + name: nf-core lint modules + needs: nf-core-changes + if: ${{ needs.nf-core-changes.outputs.modules_files != '[]' }} + strategy: + fail-fast: false + matrix: + module: ${{ fromJson(needs.nf-core-changes.outputs.modules_files || '[]') }} + steps: + - name: Clean workspace + run: | + sudo rm -rf ./* || true + sudo rm -rf ./.* || true + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - name: Set up Python + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + with: + python-version: "3.14" + + - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + id: cache-pip + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + restore-keys: | + ${{ runner.os }}-pip + + - name: Install pip + run: python -m pip install --upgrade pip + + - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + with: + distribution: "temurin" + java-version: "17" + + - name: Set up Nextflow + uses: nf-core/setup-nextflow@v2 + + - name: Install nf-core tools development version + run: python -m pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev + + - name: Lint module ${{ matrix.module }} + run: nf-core modules lint ${{ matrix.module }} + + nf-core-lint-subworkflows: + runs-on: + - runs-on=${{ github.run_id }}-nf-core-lint-subworkflows + - runner=4cpu-linux-x64 + - image=ubuntu22-full-x64 + name: nf-core lint subworkflows + needs: nf-core-changes + if: ${{ needs.nf-core-changes.outputs.subworkflows_files != '[]' }} + strategy: + fail-fast: false + matrix: + subworkflow: ${{ fromJson(needs.nf-core-changes.outputs.subworkflows_files || '[]') }} + steps: + - name: Clean workspace + run: | + sudo rm -rf ./* || true + sudo rm -rf ./.* || true + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - name: Set up Python + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + with: + python-version: "3.14" + + - name: Set up Nextflow + uses: nf-core/setup-nextflow@v2 + + - name: Install nf-core tools development version + run: python -m pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev + + - name: Lint subworkflow ${{ matrix.subworkflow }} + run: nf-core subworkflows lint ${{ matrix.subworkflow }} + + confirm-pass-lint: + runs-on: + - runs-on=${{ github.run_id }}-confirm-pass-lint + - runner=2cpu-linux-x64 + - image=ubuntu22-full-x64 + needs: [nf-core-lint-modules, nf-core-lint-subworkflows] + 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) }}" From ab0f6f9e26e95e72ad412321a83dc71462314d93 Mon Sep 17 00:00:00 2001 From: Jorisvansteenbrugge <7196110+Jorisvansteenbrugge@users.noreply.github.com> Date: Fri, 3 Apr 2026 16:47:57 +0200 Subject: [PATCH 2/4] run on pull requests --- .github/workflows/lint.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d7cc771..391c8f8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,15 +1,16 @@ name: Run Linting on: pull_request: - workflow_dispatch: - inputs: - runners: - description: "Runners to test on" - type: choice - options: - - "ubuntu-latest" - - "self-hosted" - default: "self-hosted" + branches: [main, develop, release/*] + # 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: From d9466b19011aa6a518838dd8d56f9d2d49cad3c9 Mon Sep 17 00:00:00 2001 From: Jorisvansteenbrugge <7196110+Jorisvansteenbrugge@users.noreply.github.com> Date: Fri, 3 Apr 2026 16:51:16 +0200 Subject: [PATCH 3/4] skip precommit --- .github/workflows/lint.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 391c8f8..832cdc4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,21 +20,20 @@ concurrency: env: NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # renovate: datasource=github-releases depName=nextflow/nextflow versioning=semver NXF_VER: "25.10.2" NXF_SYNTAX_PARSER: "v2" jobs: - pre-commit: - runs-on: ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }} - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - uses: nf-core/setup-nextflow@v2 - - name: Run prek - uses: j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1 - with: - extra_args: "" + # pre-commit: + # runs-on: ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }} + # steps: + # - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + # - uses: nf-core/setup-nextflow@v2 + # - name: Run prek + # uses: j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1 + # with: + # extra_args: "" ################### # nf-core linting # From f6bff136427b3777b8a4a53158f750eb4fbbff1d Mon Sep 17 00:00:00 2001 From: Jorisvansteenbrugge <7196110+Jorisvansteenbrugge@users.noreply.github.com> Date: Fri, 3 Apr 2026 17:00:18 +0200 Subject: [PATCH 4/4] making linting actually run --- .github/workflows/lint.yml | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 832cdc4..806c8bf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -42,10 +42,8 @@ jobs: # https://github.com/nf-core/tools/pull/3141 nf-core-changes: name: nf-core-changes - runs-on: - - runs-on=${{ github.run_id }}-nf-core-changes - - runner=4cpu-linux-x64 - - image=ubuntu22-full-x64 + runs-on: ubuntu-latest + outputs: # https://github.com/dorny/paths-filter?tab=readme-ov-file#custom-processing-of-changed-files modules: ${{ steps.filter.outputs.modules }} @@ -67,9 +65,9 @@ jobs: with: filters: | modules: - - added|modified: 'modules/nf-core/**' + - added|modified: 'modules/UMCUGenetics/**' subworkflows: - - added|modified: 'subworkflows/nf-core/**' + - added|modified: 'subworkflows/UMCUGenetics/**' token: "" list-files: "json" @@ -81,7 +79,7 @@ jobs: return [...new Set(${{ steps.filter.outputs.modules_files }} .filter(x => x.endsWith('main.nf') || x.endsWith('.nf.test.snap')) .map(path => path - .replace('modules/nf-core/', '') + .replace('modules/UMCUGenetics/', '') .replace(/\/(main\.nf|tests\/.*)$/, '') ) )]; @@ -93,7 +91,7 @@ jobs: return [...new Set(${{ steps.filter.outputs.subworkflows_files }} .filter(x => x.endsWith('main.nf') || x.endsWith('.nf.test.snap')) .map(path => path - .replace('subworkflows/nf-core/', '') + .replace('subworkflows/UMCUGenetics/', '') .replace(/\/(main\.nf|tests\/.*)$/, '') ) )]; @@ -106,10 +104,7 @@ jobs: echo ${{ steps.subworkflow_names.outputs.result }} nf-core-lint-modules: - runs-on: - - runs-on=${{ github.run_id }}-nf-core-lint-modules - - runner=4cpu-linux-x64 - - image=ubuntu22-full-x64 + runs-on: ubuntu-latest name: nf-core lint modules needs: nf-core-changes if: ${{ needs.nf-core-changes.outputs.modules_files != '[]' }} @@ -154,10 +149,7 @@ jobs: run: nf-core modules lint ${{ matrix.module }} nf-core-lint-subworkflows: - runs-on: - - runs-on=${{ github.run_id }}-nf-core-lint-subworkflows - - runner=4cpu-linux-x64 - - image=ubuntu22-full-x64 + runs-on: ubuntu-latest name: nf-core lint subworkflows needs: nf-core-changes if: ${{ needs.nf-core-changes.outputs.subworkflows_files != '[]' }} @@ -186,10 +178,7 @@ jobs: run: nf-core subworkflows lint ${{ matrix.subworkflow }} confirm-pass-lint: - runs-on: - - runs-on=${{ github.run_id }}-confirm-pass-lint - - runner=2cpu-linux-x64 - - image=ubuntu22-full-x64 + runs-on: ubuntu-latest needs: [nf-core-lint-modules, nf-core-lint-subworkflows] if: always() steps: