Update main.nf #64
This file contains hidden or 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: Run Linting | |
| on: [push, pull_request] | |
| env: | |
| NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity | |
| NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| nf-core-changes: | |
| name: Detect changes | |
| 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 }} | |
| modules_files: ${{ steps.module_names.outputs.result }} | |
| subworkflows: ${{ steps.filter.outputs.subworkflows }} | |
| subworkflows_files: ${{ steps.subworkflow_names.outputs.result }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4 | |
| id: filter | |
| with: | |
| filters: | | |
| modules: | |
| - added|modified: 'modules/ensembl/**' | |
| subworkflows: | |
| - added|modified: 'subworkflows/ensembl/**' | |
| 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/ensembl/', '') | |
| .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\/.*)$/, '') | |
| ) | |
| )]; | |
| nf-core-lint: | |
| name: nf-core lint | |
| runs-on: ubuntu-latest | |
| 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: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip | |
| - uses: nf-core/setup-nextflow@v2 | |
| - name: Install nf-core tools | |
| run: pip install --upgrade git+https://github.com/nf-core/tools.git@dev | |
| - name: Lint modules | |
| run: nf-core modules lint ${{ matrix.module }} | |
| - name: Lint subworkflows | |
| if: needs.nf-core-changes.outputs.subworkflows == 'true' | |
| run: nf-core subworkflows lint --all |