diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3c13d1b..55c515f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,22 +1,41 @@ -name: Rust +name: Check on every push -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always +on: [push, pull_request] jobs: - build: + build_ubuntu: runs-on: ubuntu-latest + env: + RUST_BACKTRACE: 1 steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v1 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + components: rustfmt, clippy + + - name: Formatter + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Clippy + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all --all-features + + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test + args: --all --verbose + + # This is used to ensure that Cargo.lock is up to date + - name: Check for unstaged files + run: git diff --exit-code