Update CI

This commit is contained in:
Luca Palmieri 2024-08-30 11:58:39 +02:00
parent 2b4666d4fb
commit 7dce385f07

View file

@ -38,20 +38,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
with:
key: sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli - name: Install sqlx-cli
run: run:
cargo install sqlx-cli cargo install sqlx-cli
@ -76,8 +71,9 @@ 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:
components: rustfmt components: rustfmt
- name: Enforce formatting - name: Enforce formatting
@ -96,13 +92,11 @@ jobs:
ports: ports:
- 5432:5432 - 5432:5432
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
with:
key: sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli - name: Install sqlx-cli
run: cargo install sqlx-cli run: cargo install sqlx-cli
--version=${{ env.SQLX_VERSION }} --version=${{ env.SQLX_VERSION }}
@ -133,14 +127,11 @@ jobs:
ports: ports:
- 6379:6379 - 6379:6379
steps: steps:
- name: Checkout repository - uses: actions/checkout@v4
uses: actions/checkout@v3 - name: Install the Rust toolchain
- uses: dtolnay/rust-toolchain@stable uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
with: with:
key: sqlx-${{ env.SQLX_VERSION }} components: llvm-tools-preview
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Install sqlx-cli - name: Install sqlx-cli
run: cargo install sqlx-cli run: cargo install sqlx-cli
--version=${{ env.SQLX_VERSION }} --version=${{ env.SQLX_VERSION }}
@ -149,5 +140,13 @@ jobs:
--locked --locked
- name: Migrate database - name: Migrate database
run: SKIP_DOCKER=true ./scripts/init_db.sh run: SKIP_DOCKER=true ./scripts/init_db.sh
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage - name: Generate code coverage
run: cargo tarpaulin --verbose --workspace run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Generate report
run: cargo llvm-cov report --html --output-dir coverage
- uses: actions/upload-artifact@v4
with:
name: "Coverage report"
path: coverage/