From c4f6257a639173098965b32875e13f878fa55f5c Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Wed, 18 Sep 2024 13:35:34 -0500 Subject: [PATCH] ci: Keep running nf-core lint the way it was Blocked by https://github.com/nf-core/tools/issues/3140 --- .github/workflows/lint.yml | 63 ++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3c7cc08e4162..7be5435f36cb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,16 +70,53 @@ jobs: - name: Run ECLint check run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test) + ################### + # nf-core linting # + ################### + nf-core-changes: + name: nf-core-changes + runs-on: ubuntu-latest + outputs: + tags: ${{ steps.filter.outputs.changes }} + modules: ${{ steps.tags.outputs.modules }} + subworkflows: ${{ steps.tags.outputs.subworkflows }} + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + fetch-depth: 2 # To retrieve the preceding commit. + + # TODO: change back to using dorny/paths-filter when https://github.com/dorny/paths-filter/pull/133 is implemented + - uses: mirpedrol/paths-filter@main + id: filter + with: + filters: "tests/config/pytest_modules.yml" + token: "" + + - name: Fetch module tags + id: tags + run: | + echo modules=$(echo '${{ steps.filter.outputs.changes }}' | jq -c '. | map(select(contains("modules"))) | map(gsub("modules/"; ""))') >> $GITHUB_OUTPUT + echo subworkflows=$(echo '${{ steps.filter.outputs.changes }}' | jq '. | map(select(contains("subworkflow"))) | map(gsub("subworkflows/"; ""))') >> $GITHUB_OUTPUT + + - name: debug + run: | + echo ${{ steps.tags.outputs.modules }} + echo ${{ steps.tags.outputs.subworkflows }} + nf-core-lint-modules: runs-on: ${{ github.event.inputs.runners || 'self-hosted' }} - name: nf-core lint modules + name: nf-core-lint-modules + needs: nf-core-changes + if: ${{ (needs.nf-core-changes.outputs.modules != '[]') strategy: fail-fast: false + matrix: + tags: "${{ fromJson(needs.nf-core-changes.outputs.modules) }}" steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Set up Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 with: python-version: "3.11" @@ -94,7 +131,7 @@ jobs: - name: Install pip run: python -m pip install --upgrade pip - - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: distribution: "temurin" java-version: "17" @@ -105,24 +142,30 @@ jobs: - 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 modules - run: nf-core --hide-progress modules lint -a + - name: Lint module ${{ matrix.tags }} + run: nf-core modules lint ${{ matrix.tags }} nf-core-lint-subworkflows: runs-on: ubuntu-latest - name: nf-core lint subworkflows + name: nf-core-lint-modules + needs: nf-core-changes + if: ${{ (needs.nf-core-changes.outputs.subworkflows != '[]') + strategy: + fail-fast: false + matrix: + tags: "${{ fromJson(needs.nf-core-changes.outputs.subworkflows) }}" steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Set up Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 with: python-version: "3.11" - name: Install pip run: python -m pip install --upgrade pip - - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: distribution: "temurin" java-version: "17" @@ -133,5 +176,5 @@ jobs: - 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 subworkflows - run: nf-core --hide-progress subworkflows lint -a + - name: Lint module ${{ matrix.tags }} + run: nf-core subworkflows lint ${{ matrix.tags }}