Add github step to check formatting

Signed-off-by: Walker Crouse <Walker.Crouse@bjss.com>
This commit is contained in:
Walker Crouse 2021-08-20 14:58:13 -04:00
parent 4bd53f33be
commit c0dbc9f22d
2 changed files with 21 additions and 14 deletions

View File

@ -2,9 +2,9 @@ name: Rust
on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
env:
CARGO_TERM_COLOR: always
@ -13,19 +13,23 @@ jobs:
macOS:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v2
- name: Check formatting
run: ./scripts/checkfmt.sh
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare
run: "sudo apt -y install avahi-daemon libavahi-client-dev && sudo systemctl start avahi-daemon.service"
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v2
- name: Prepare
run: "sudo apt -y install avahi-daemon libavahi-client-dev && sudo systemctl start avahi-daemon.service"
- name: Check formatting
run: ./scripts/checkfmt.sh
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

3
scripts/checkfmt.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
find examples/browser/src examples/service/src zeroconf/src zeroconf-macros/src -type f -name *.rs -print0 | xargs -0 -n1 rustfmt --check --verbose