Skip to content

Commit

Permalink
Add a check that the code is formatted (#10)
Browse files Browse the repository at this point in the history
This will prevent merge conflicts in future PRs
  • Loading branch information
dae authored Aug 21, 2023
1 parent 7162af4 commit 14f7b07
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

cargo fmt --check || (
echo
echo "Please run 'cargo fmt' to format the code."
exit 1
)
25 changes: 25 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check code
on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Rust Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-rust-release-v5-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-release-v5
${{ runner.os }}-rust-release
- name: Run checks
run: .github/workflows/check.sh

0 comments on commit 14f7b07

Please sign in to comment.