-
Notifications
You must be signed in to change notification settings - Fork 731
153 lines (137 loc) · 5 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Run Linting
on:
push:
branches:
# https://docs.renovatebot.com/key-concepts/automerge/#branch-vs-pr-automerging
- "renovate/**" # branches Renovate creates
pull_request:
branches: [master]
merge_group:
types: [checks_requested]
branches: [master]
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: "24.10.1"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.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: 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 2 # To retrieve the preceding commit.
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: filter
with:
filters: |
modules:
- added|modified: 'modules/nf-core/**'
- added|modified: 'tests/modules/nf-core/**'
subworkflows:
- added|modified: 'subworkflows/nf-core/**'
- added|modified: 'tests/subworkflows/nf-core/**'
token: ""
list-files: "json"
- name: Get module name
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
id: module_names
with:
script: |
return [...new Set(${{ steps.filter.outputs.modules_files }}
.map(path => path
.replace('modules/nf-core/', '')
.split('/')
.slice(0, 2)
.filter(x => !x.startsWith('main.nf') && x !== 'tests' && x !== 'meta.yml' && x !== 'environment.yml')
.join('/'))
)
];
- name: debug
run: |
echo ${{ steps.filter.outputs.modules_files }}
echo ${{ steps.module_names.outputs.result }}
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 == 'true') }}
strategy:
fail-fast: false
matrix:
module: "${{ fromJson(needs.nf-core-changes.outputs.modules_files) }}"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: "3.11"
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # 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@8df1039502a15bceb9433410b1a100fbe190c53b # 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.module }}
run: nf-core modules lint ${{ matrix.module }}
confirm-pass:
runs-on: ubuntu-latest
needs: [nf-core-lint-modules]
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) }}"