Update CI

This commit is contained in:
Luca Palmieri 2024-08-30 11:58:39 +02:00
parent 1e7b7523de
commit aec9a4fd0a

View file

@ -29,18 +29,15 @@ jobs:
steps: steps:
# Downloads a copy of the code in your repository before running CI tests # Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code - name: Check out repository code
# The uses keyword specifies that this step will run v3 of the actions/checkout action. # The uses keyword specifies that this step will run v4 of the actions/checkout action.
# This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools). # This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools).
# You should use the checkout action any time your workflow will run against the repository's code. # You should use the checkout action any time your workflow will run against the repository's code.
uses: actions/checkout@v3 uses: actions/checkout@v4
# This GitHub Action installs a Rust toolchain using rustup. It is designed for one-line concise usage and good defaults. # This GitHub Action installs a Rust toolchain using rustup. It is designed for one-line concise usage and good defaults.
# It also takes care of caching intermediate build artifacts.
- name: Install the Rust toolchain - name: Install the Rust toolchain
uses: dtolnay/rust-toolchain@stable uses: actions-rust-lang/setup-rust-toolchain@v1
# A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.
- name: Rust Cache Action
uses: Swatinem/rust-cache@v2
- name: Run tests - name: Run tests
run: cargo test run: cargo test
@ -50,10 +47,10 @@ jobs:
name: Rustfmt name: Rustfmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - name: Install the Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
# Specific to dtolnay/rust-toolchain: Comma-separated string of additional components to install
components: rustfmt components: rustfmt
- name: Enforce formatting - name: Enforce formatting
run: cargo fmt --check run: cargo fmt --check
@ -62,11 +59,11 @@ jobs:
name: Clippy name: Clippy
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - name: Install the Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
components: clippy components: clippy
- uses: Swatinem/rust-cache@v2
- name: Linting - name: Linting
run: cargo clippy -- -D warnings run: cargo clippy -- -D warnings
@ -74,12 +71,19 @@ jobs:
coverage: coverage:
name: Code coverage name: Code coverage
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin
options: --security-opt seccomp=unconfined
steps: steps:
- name: Checkout repository - uses: actions/checkout@v4
uses: actions/checkout@v3 - name: Install the Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage - name: Generate code coverage
run: | run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
cargo tarpaulin --verbose --workspace - name: Generate report
run: cargo llvm-cov report --html --output-dir coverage
- uses: actions/upload-artifact@v4
with:
name: "Coverage report"
path: coverage/