diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 55d92fa..63ba9ca 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,10 +14,14 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v2 - - name: Check formatting - run: ./scripts/checkfmt.sh + - name: Prepare + run: rustup component add clippy - name: Build run: ./scripts/buildall.sh + - name: Check formatting + run: ./scripts/checkfmt.sh + - name: Run clippy + run: ./scripts/lintall.sh - name: Run tests run: cargo test --verbose @@ -26,10 +30,12 @@ jobs: steps: - 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 + run: "rustup component add clippy && sudo apt -y install avahi-daemon libavahi-client-dev && sudo systemctl start avahi-daemon.service" - name: Build run: ./scripts/buildall.sh + - name: Check formatting + run: ./scripts/checkfmt.sh + - name: Run clippy + run: ./scripts/lintall.sh - name: Run tests run: cargo test --verbose diff --git a/scripts/buildall.sh b/scripts/buildall.sh index 6eb9d57..a40ae4f 100755 --- a/scripts/buildall.sh +++ b/scripts/buildall.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + cargo build --workspace --verbose ( cd examples diff --git a/scripts/checkfmt.sh b/scripts/checkfmt.sh index 3fdbb52..f772a61 100755 --- a/scripts/checkfmt.sh +++ b/scripts/checkfmt.sh @@ -1,3 +1,5 @@ #!/bin/bash +set -e + find examples/browser/src examples/service/src zeroconf/src zeroconf-macros/src -type f -name *.rs -print0 | xargs -0 -n1 rustfmt --check --verbose diff --git a/scripts/lintall.sh b/scripts/lintall.sh new file mode 100755 index 0000000..906fdad --- /dev/null +++ b/scripts/lintall.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +cargo clippy -- -D warnings +cargo clippy --all-targets --all-features -- -D warnings +( + cd examples + cargo clippy -- -D warnings + cargo clippy --all-targets --all-features -- -D warnings +)