From f6f162d80dd95df164839dff68bffa077bd729f8 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 14 Nov 2023 21:32:45 +0100 Subject: [PATCH] Add GitHub actions CI --- .github/workflows/ci.yml | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f889377 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,67 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo test + + docs: + name: Check documentation + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo doc --all-features + env: + RUSTDOCFLAGS: "-D warnings" + + formatting: + name: Check Formatting + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + components: rustfmt + - run: cargo fmt -- --check + + clippy: + name: Run clippy (Rust nightly) + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + components: clippy + - uses: Swatinem/rust-cache@v2 + - run: cargo clippy -- -D warnings + + typos: + name: Spell Check with Typos + runs-on: ubuntu-latest + if: github.event_name == 'push' || !github.event.pull_request.draft + + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@v1.16.23