-
Notifications
You must be signed in to change notification settings - Fork 5
172 lines (171 loc) · 5.34 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Checks
env:
MODULE_LIST_PATH: docs/assets/module-list.json
on:
push:
branches-ignore: [main]
repository_dispatch:
workflow_dispatch:
inputs:
fileList:
description: Files to Lint (space delimited). Use `docs/**/*.md` to lint all.
required: true
default: "docs/CONTRIBUTING.md"
type: string
checkSpelling:
description: Check Spelling
default: true
type: boolean
checkProse:
description: Check Prose
default: true
type: boolean
checkMarkdown:
description: Check Markdown
default: true
type: boolean
checkMeta:
description: Check Meta
default: true
type: boolean
checkSlurm:
description: Check Slurm
default: true
type: boolean
testBuild:
description: Test Build
default: true
type: boolean
jobs:
get:
name: Determine what files to check
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: get-changed-files
uses: tj-actions/changed-files@v40
with:
files: |
docs/**/*.md
- name: Push Changed files to output
if: inputs.fileList == ''
id: diff
run: |
echo "::info::Workflow triggered by PR"
echo "Changed files: '${{steps.get-changed-files.outputs.all_changed_files}}'"
echo "filelist=${{steps.get-changed-files.outputs.all_changed_files}}" >> $GITHUB_OUTPUT
outputs:
filelist: ${{steps.diff.outputs.filelist || inputs.fileList}}
spellcheck:
name: Check Spelling
if: ${{ github.event_name != 'workflow_dispatch' || inputs.checkSpelling }}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{! needs.get.outputs.filelist}}
name: No files to spellcheck
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Install dependencies
run: |
sudo apt install -y aspell
pip install pyspelling flashtext
- if: ${{needs.get.outputs.filelist}}
name: Run pyspelling
run: |
shopt -s globstar extglob
python3 checks/run_pyspelling.py ${{needs.get.outputs.filelist}}
proselint:
name: Check Prose
if: ${{github.event_name != 'workflow_dispatch'|| inputs.checkProse}}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{! needs.get.outputs.filelist}}
name: No files to proselint
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Install dependencies
run: pip install proselint
- if: ${{needs.get.outputs.filelist}}
name: Run proselint
run: |
shopt -s globstar extglob
python3 checks/run_proselint.py ${{needs.get.outputs.filelist}}
mdlint:
name: Check Markdown
if: ${{github.event_name != 'workflow_dispatch' || inputs.checkMarkdown}}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{! needs.get.outputs.filelist}}
name: No files to check Markdown
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Install dependencies
run: npm install -g markdownlint-cli
- if: ${{needs.get.outputs.filelist}}
name: Run markdownlint
run: |
shopt -s globstar extglob
markdownlint --config .markdownlint.json --json ${{needs.get.outputs.filelist}} 2>&1 | checks/parse_markdownlint.py
metacheck:
name: Check page meta
if: ${{github.event_name != 'workflow_dispatch'|| inputs.checkMeta}}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{ ! needs.get.outputs.filelist}}
name: No files to check meta on.
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Check markdown meta.
run: |
shopt -s globstar extglob
python3 checks/run_meta_check.py ${{needs.get.outputs.filelist}}
slurmcheck:
name: Check slurm scripts
if: ${{github.event_name != 'workflow_dispatch'|| inputs.checkSlurm}}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{ ! needs.get.outputs.filelist}}
name: No files to check meta on.
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Check markdown meta.
run: |
shopt -s globstar extglob
python3 checks/run_slurm_lint.py ${{needs.get.outputs.filelist}}
testBuild:
name: Test build
if: ${{github.event_name != 'workflow_dispatch' || inputs.testBuild}}
runs-on: ubuntu-22.04
needs: get
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pip install -r requirements.txt
- run: echo "::group::Test Build"
- run: ./checks/run_test_build.py
- run: echo "::endgroup::"