forked from scilus/nf-scil
-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·149 lines (130 loc) · 4.39 KB
/
checks.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
name: nf-scil checks
on:
workflow_call:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
# 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:
- name: Check out repository
uses: actions/checkout@v4
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Prettier
run: npm install -g [email protected]
- name: Run Prettier --check
run: prettier --check .
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install editorconfig-checker
run: npm install -g editorconfig-checker
- name: Run ECLint check
run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test)
nf-test-changes:
name: nf-test-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@v4
with:
fetch-depth: 0
- name: List nf-test files
id: changes
uses: adamrtalbot/[email protected]
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-scil/"; ""))') >> $GITHUB_OUTPUT
echo subworkflows=$(echo '${{ steps.changes.outputs.components }}' | jq '. | map(select(contains("subworkflows"))) | map(gsub("subworkflows/nf-scil/"; ""))') >> $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_module.yml
with:
type: "module"
component: ${{ matrix.module }}
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_module.yml
with:
type: "subworkflow"
component: ${{ matrix.subworkflow }}
secrets: inherit
nf-test:
name: nf-test
needs: [nf-test-changes]
if: ${{ ( needs.nf-test-changes.outputs.paths != '[]' ) }}
strategy:
fail-fast: false
matrix:
path: [ "${{ fromJson(needs.nf-test-changes.outputs.paths) }}" ]
profile: ["docker"]
exclude:
- path: subworkflows/nf-scil/load_test_data
uses: ./.github/workflows/nf-test_module.yml
with:
profile: ${{ matrix.profile }}
paths: ${{ matrix.path }}
secrets: inherit
confirm-pass:
runs-on: ubuntu-latest
needs: [prettier, editorconfig, nf-test-changes, lint-modules, lint-subworkflows, nf-test]
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) }}"