forked from scilus/nf-neuro
-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (169 loc) · 6.24 KB
/
run_checks_suite.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Run checks Suite
on:
workflow_call:
inputs:
nextflow_version:
description: "Nextflow version to use"
required: false
type: string
default: "24.04.4"
nf_core_version:
description: "nf-core version to use"
required: false
type: string
default: "2.14.*"
nf_test_version:
description: "nf-test version to use"
required: false
type: string
default: "0.9.0"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
cache: "pip"
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
# FIXME Flip this off once we get to less than a couple hundred. Adding
# this so it will only run against changed files. It'll make it much
# easier to fix these as they come up rather than everything at once.
with:
extra_args: ""
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: "20"
cache: "npm"
- name: Install Prettier
run: npm ci
- name: Run Prettier --check
run: npx prettier --check .
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: "20"
cache: "npm"
- name: Install editorconfig-checker
run: npm ci
- name: Run ECLint check
run: npx editorconfig-checker -exclude README.md $(git ls-files | grep -v test)
nf-test-changes:
name: compute - changes
runs-on: ubuntu-latest
outputs:
paths: ${{ steps.changes.outputs.components }}
modules: ${{ steps.components.outputs.modules }}
subworkflows: ${{ steps.components.outputs.subworkflows }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: List nf-test files
id: changes
uses: adamrtalbot/detect-nf-test-changes@7c8be3ffd0d6538312b363c8c949dbbf5f26c3dd # v0.0.4
with:
head: ${{ github.sha }}
base: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}
n_parents: 2
- name: Separate modules and subworkflows
id: components
run: |
echo modules=$(echo '${{ steps.changes.outputs.components }}' | jq -c '. | map(select(contains("modules"))) | map(gsub("modules/nf-neuro/"; ""))') >> $GITHUB_OUTPUT
echo subworkflows=$(echo '${{ steps.changes.outputs.components }}' | jq '. | map(select(contains("subworkflows"))) | map(gsub("subworkflows/nf-neuro/"; ""))') >> $GITHUB_OUTPUT
- name: debug
run: |
echo ${{ steps.components.outputs.modules }}
echo ${{ steps.components.outputs.subworkflows }}
lint-modules:
name: lint - modules
needs: [nf-test-changes]
if: ${{ (needs.nf-test-changes.outputs.modules != '[]') }}
strategy:
fail-fast: false
matrix:
module: ["${{ fromJson(needs.nf-test-changes.outputs.modules) }}"]
uses: ./.github/workflows/lint_component.yml
with:
type: "module"
component: ${{ matrix.module }}
nextflow_version: ${{ inputs.nextflow_version }}
secrets: inherit
lint-subworkflows:
name: lint - subworkflows
needs: [nf-test-changes]
if: ${{ ( needs.nf-test-changes.outputs.subworkflows != '[]') }}
strategy:
fail-fast: false
matrix:
subworkflow: ["${{ fromJson(needs.nf-test-changes.outputs.subworkflows) }}"]
uses: ./.github/workflows/lint_component.yml
with:
type: "subworkflow"
component: ${{ matrix.subworkflow }}
nextflow_version: ${{ inputs.nextflow_version }}
secrets: inherit
nf-test:
name: test
needs: [nf-test-changes]
if: ${{ ( github.repository == 'scilus/nf-neuro' ) && ( needs.nf-test-changes.outputs.paths != '[]' ) }}
strategy:
fail-fast: false
matrix:
path: ["${{ fromJson(needs.nf-test-changes.outputs.paths) }}"]
include:
- profile: docker
- runner: scilus-nf-neuro-runners
- runner: scilus-nf-neuro-bigmem-runners
path: modules/nf-neuro/registration/easyreg
- runner: scilus-nf-neuro-bigmem-runners
path: modules/nf-neuro/segmentation/synthseg
exclude:
- path: subworkflows/nf-neuro/load_test_data
uses: ./.github/workflows/test_component.yml
with:
profile: ${{ matrix.profile }}
paths: ${{ matrix.path }}
runner: ${{ matrix.runner }}
nextflow_version: ${{ inputs.nextflow_version }}
nf_test_version: ${{ inputs.nf_test_version }}
secrets: inherit
upload-reports:
name: report
needs: [nf-test-changes, nf-test]
if: ${{ ( needs.nf-test-changes.outputs.paths != '[]' ) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
continue-on-error: true
with:
name: nf-test-reports
pattern: reports-*
delete-merged: true
retention-days: 10
compression-level: 9
confirm-pass:
name: status
runs-on: ubuntu-latest
needs: [prettier, editorconfig, nf-test-changes, lint-modules, lint-subworkflows, nf-test, upload-reports]
if: ${{ !cancelled() }}
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: ${{ !cancelled() }}
run: |
echo "toJSON(needs) = ${{ toJSON(needs) }}"
echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}"