diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1074d7a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,58 @@ +name: Rust CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features + + - name: Run clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + + - name: Run rustfmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check