From e56d91c4a918568e47937be81aa5b229a0e86b3a Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Fri, 21 Feb 2025 20:28:48 +0000 Subject: [PATCH] feat: github workflows Run clippy, tests and cargo fmt checks at PR and push time. --- .github/workflows/clippy.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/fmt.yml | 23 +++++++++++++++++++++++ .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 .github/workflows/clippy.yml create mode 100644 .github/workflows/fmt.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 00000000..54c97573 --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,33 @@ +name: Clippy + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + clippy: + name: Lint with Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: Run clippy + run: cargo clippy --all-targets --all-features -- -D warnings diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml new file mode 100644 index 00000000..14c951f6 --- /dev/null +++ b/.github/workflows/fmt.yml @@ -0,0 +1,23 @@ +name: Format + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + fmt: + name: Code Formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Check formatting + run: cargo fmt --all -- --check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..8408c6c6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Tests + +on: + 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@v3 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: Run tests + run: cargo test --all-features