-
Notifications
You must be signed in to change notification settings - Fork 519
225 lines (178 loc) · 6.17 KB
/
tests.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: CI
# Run this workflow every time a new commit is pushed to the repository
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
# Weekly.
- cron: "0 0 * * 0"
jobs:
ensure-conventions:
name: Ensure conventions are followed
runs-on: ubuntu-latest
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Ensure tool names are snake cased
run: ./bin/lint_tool_file_names.sh
- name: Ensure src/lib.rs files exist
run: ./_test/ensure_lib_src_rs_exist.sh
- name: Count ignores
run: ./_test/count_ignores.sh
- name: Check UUIDs
run: ./_test/check_uuids.sh
- name: Verify exercise difficulties
run: ./_test/verify_exercise_difficulties.sh
- name: Check exercises for authors
run: ./_test/check_exercises_for_authors.sh
- name: Ensure relevant files do not have trailing whitespace
run: ./bin/lint_trailing_spaces.sh
configlet:
name: configlet lint
runs-on: ubuntu-latest
steps:
# Checks out default branch locally so that it is available to the scripts.
- name: Checkout main
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: main
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Fetch configlet
run: ./bin/fetch-configlet
- name: Lint configlet
run: ./bin/configlet lint
markdownlint:
name: markdown lint
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: main
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Run markdown lint
run: ./bin/lint_markdown.sh
# stolen from https://raw.githubusercontent.com/exercism/github-actions/main/.github/workflows/shellcheck.yml
shellcheck:
name: shellcheck internal tooling lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Run shellcheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0
env:
SHELLCHECK_OPTS: -x -s bash -e SC2001 --norc
compilation:
name: Check compilation
runs-on: ubuntu-latest
strategy:
# Allows running the job multiple times with different configurations
matrix:
rust: ["stable", "beta"]
deny_warnings: ['', '1']
steps:
# Checks out main locally so that it is available to the scripts.
- name: Checkout main
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: main
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup toolchain
uses: actions-rs/[email protected]
with:
toolchain: ${{ matrix.rust }}
default: true
# run scripts as steps
- name: Check exercises
env:
DENYWARNINGS: ${{ matrix.deny_warnings }}
run: ./_test/check_exercises.sh
continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }}
- name: Ensure stubs compile
env:
DENYWARNINGS: ${{ matrix.deny_warnings }}
run: ./_test/ensure_stubs_compile.sh
continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }}
rustformat:
name: Check Rust Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup toolchain
uses: actions-rs/[email protected]
with:
toolchain: stable
default: true
- name: Rust Format Version
run: rustfmt --version
- name: Format
run: bin/format_exercises
- name: Diff
run: |
if ! git diff --color --exit-code; then
echo "Please run cargo fmt, or see the diff above:"
exit 1
fi
clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
rust: ["stable", "beta"]
steps:
- name: Checkout main
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: main
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup toolchain
uses: actions-rs/[email protected]
with:
toolchain: ${{ matrix.rust }}
default: true
# Clippy already installed on Stable, but not Beta.
# So, we must install here.
- name: Install Clippy
run: rustup component add clippy
- name: Clippy tests
env:
CLIPPY: true
run: ./_test/check_exercises.sh
- name: Clippy stubs
env:
CLIPPY: true
run: ./_test/ensure_stubs_compile.sh
nightly-compilation:
name: Check exercises on nightly (benchmark enabled)
runs-on: ubuntu-latest
continue-on-error: true # It's okay if the nightly job fails
steps:
# Checks out main locally so that it is available to the scripts.
- name: Checkout main
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: main
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup nightly toolchain
uses: actions-rs/[email protected]
with:
toolchain: nightly
default: true
- name: Check exercises
env:
BENCHMARK: '1'
run: ./_test/check_exercises.sh