diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..a39ed31 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,108 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +env: + RUST_VERSION: 1.80.0 + CARGO_TERM_COLOR: always + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_VERSION }} + override: true + components: clippy + + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --workspace --all-targets --all-features -- -D warnings + + test: + name: Test Suite + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_VERSION }} + override: true + + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + command: test + # --all-targets includes --benches, which we don't want. + args: --workspace --all-features --lib --bins --tests --examples --verbose + + rustfmt: + name: Format + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install nightly toolchain with rustfmt available + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check --verbose + + doc: + name: Doc + runs-on: ubuntu-latest + env: + RUSTDOCFLAGS: -D warnings + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_VERSION }} + override: true + + - name: Run cargo doc + uses: actions-rs/cargo@v1 + with: + command: doc + args: --no-deps --verbose + + - name: Run cargo test --doc + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace --all-features --doc --verbose