From 616eb026d54fa94f47b03ee15c03b72f2826ea87 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 | 161 +++++++++++++++++++++++-------------- 1 file changed, 102 insertions(+), 59 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3c7cc08e4162..3d28ecd71b5d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,68 +70,111 @@ jobs: - name: Run ECLint check run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test) - nf-core-lint-modules: - runs-on: ${{ github.event.inputs.runners || 'self-hosted' }} - name: nf-core lint modules - strategy: - fail-fast: false - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - name: Set up Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 - with: - python-version: "3.11" - - - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 - 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@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 - with: - distribution: "temurin" - java-version: "17" - - - name: Setup 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 modules - run: nf-core --hide-progress modules lint -a - - nf-core-lint-subworkflows: + ################### + # nf-core linting # + ################### + nf-core-changes: + name: nf-core-changes runs-on: ubuntu-latest - name: nf-core lint subworkflows + outputs: + tags: ${{ steps.filter.outputs.changes }} + modules: ${{ steps.tags.outputs.modules }} + subworkflows: ${{ steps.tags.outputs.subworkflows }} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - name: Set up Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 with: - python-version: "3.11" + fetch-depth: 2 # To retrieve the preceding commit. - - name: Install pip - run: python -m pip install --upgrade pip - - - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + # 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: - distribution: "temurin" - java-version: "17" - - - name: Setup Nextflow - uses: nf-core/setup-nextflow@561fcfc7146dcb12e3871909b635ab092a781f34 # 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 subworkflows - run: nf-core --hide-progress subworkflows lint -a + 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 + 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@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + with: + python-version: "3.11" + + - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + 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@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + with: + distribution: "temurin" + java-version: "17" + + - name: Setup 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.tags }} + run: nf-core modules lint ${{ matrix.tags }} + + nf-core-lint-subworkflows: + runs-on: ubuntu-latest + 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@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + with: + python-version: "3.11" + + - name: Install pip + run: python -m pip install --upgrade pip + + - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + with: + distribution: "temurin" + java-version: "17" + + - name: Setup Nextflow + uses: nf-core/setup-nextflow@561fcfc7146dcb12e3871909b635ab092a781f34 # 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.tags }} + run: nf-core subworkflows lint ${{ matrix.tags }}