Skip to content

Commit 9cacd5a

Browse files
committed
GitHub Actions: Enforce exercises' formatting
Part of #659
1 parent d91f9e0 commit 9cacd5a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/tests.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,33 @@ jobs:
109109
run: sh ./_test/check-exercise-crate.sh
110110
continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }}
111111

112+
rustformat:
113+
name: Check Rust Formatting
114+
runs-on: ubuntu-latest
115+
116+
steps:
117+
- name: Checkout code
118+
uses: actions/checkout@v2
119+
120+
- name: Setup toolchain
121+
uses: actions-rs/toolchain@v1
122+
with:
123+
toolchain: stable
124+
default: true
125+
126+
- name: Rust Format Version
127+
run: rustfmt --version
128+
129+
- name: Format
130+
run: sh bin/format_exercises
131+
132+
- name: Diff
133+
run: |
134+
if ! git diff --color --exit-code; then
135+
echo "Please run cargo fmt, or see the diff above:"
136+
exit 1
137+
fi
138+
112139
clippy:
113140
name: Clippy
114141
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)