From da1a8c8ffef67dd29fe1877f5bddb78c6fb272f5 Mon Sep 17 00:00:00 2001 From: Abhemanyu Sarin Date: Fri, 11 Oct 2024 13:23:27 +0530 Subject: [PATCH] update workflows, include cargo audit, code coverage --- .github/workflows/ci.yml | 74 +++++++++++++++++++---------------- .github/workflows/release.yml | 20 ---------- 2 files changed, 41 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11dfc35..ca7a996 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Continous integration +name: Rust on: [push, pull_request] @@ -6,40 +6,48 @@ env: CARGO_TERM_COLOR: always jobs: - build: + test: + name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Cache Cargo - id: cache-cargo - uses: actions/cache@v4 - with: - path: ~/.cargo - key: ${{ runner.os }}-cargo - - name: Check - run: cargo check - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose - - name: Build release - run: cargo build --release + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Run tests + run: cargo test - lints: + fmt: + name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Cache Cargo - id: cache-cargo - uses: actions/cache@v4 - with: - path: ~/.cargo - key: ${{ runner.os }}-cargo - - name: Formatting - run: cargo fmt --all --check - - name: Clippy - run: cargo clippy --workspace -- -D warnings - - name: Documentation - run: cargo doc --no-deps --workspace --document-private-items - env: - RUSTDOCFLAGS: -D warnings + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Enforce formatting + run: cargo fmt --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - uses: Swatinem/rust-cache@v2 + - name: Linting + run: cargo clippy -- -D warnings + + coverage: + name: Code coverage + runs-on: ubuntu-latest + container: + image: xd009642/tarpaulin + options: --security-opt seccomp=unconfined + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Generate code coverage + run: | + cargo tarpaulin --verbose --workspace diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 4109ba9..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Release - -on: - push: - tags: ["v[0-9]+.[0-9]+.[0-9]+*"] - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CARGO_TERM_COLOR: always - -jobs: - linux: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Test - run: cargo test - - name: Build - run: cargo build --release