Skip to content

Bump the ci-dependencies group with 2 updates #525

Bump the ci-dependencies group with 2 updates

Bump the ci-dependencies group with 2 updates #525

Workflow file for this run

name: Checks
permissions:
contents: read
on:
pull_request:
branches-ignore:
- 'release/**'
merge_group:
branches:
- main
jobs:
build:
name: Build and test
runs-on: "${{ matrix.os }}"
strategy:
matrix:
include:
- rust: "stable"
target: "x86_64-unknown-linux-gnu"
os: ubuntu-latest
features: "--all-features"
- rust: "msrv"
target: "x86_64-unknown-linux-gnu"
os: ubuntu-latest
features: "--all-features"
- rust: "stable"
target: "x86_64-unknown-linux-musl"
os: ubuntu-latest
features: "--all-features"
- rust: "stable"
target: "aarch64-unknown-linux-gnu"
os: ubuntu-latest
features: "--all-features"
- rust: "stable"
target: "x86_64-unknown-linux-gnu"
os: ubuntu-latest
features: "--no-default-features --features=postgres"
- rust: "stable"
target: "x86_64-unknown-linux-gnu"
os: ubuntu-latest
features: "--no-default-features --features=postgres,internal-oauth"
steps:
- name: Checkout sources
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Set target rust version
run: echo "TARGET_RUST_VERSION=$(if [ "${{matrix.rust}}" = "msrv" ]; then grep rust-version Cargo.toml | grep MSRV | cut -d'"' -f2; else echo "${{matrix.rust}}"; fi)" >> $GITHUB_ENV
- name: Install toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
with:
toolchain: "${TARGET_RUST_VERSION}"
targets: "${{ matrix.target }}"
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@84e58a47fc2bcd3821a2aa8c153595bbffb0e10f # v1.32.1
with:
target: ${{ matrix.target }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@d6912b47771be2c443ec90dbb3d28e023987e782 # v2.62.1
with:
tool: cargo-llvm-cov
- name: Rust cache
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
with:
shared-key: "${{matrix.rust}}-${{matrix.target}}"
- name: Setup Postgres DB
run: |
docker compose up db --wait && \
cargo install sqlx-cli --no-default-features --features rustls,postgres && \
cargo sqlx migrate run --source openleadr-vtn/migrations && \
psql -U openadr -W openadr -h localhost openadr < fixtures/test_user_credentials.sql
- name: cargo build
run: cargo build ${{ matrix.features }}
- name: cargo test
run: cargo llvm-cov --target ${{matrix.target}} ${{ matrix.features }} --lcov --output-path lcov.info
env:
RUST_BACKTRACE: 1
- name: Bring Postgres DB down
run: docker compose down
- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
unused:
name: Check unused dependencies
runs-on: ubuntu-latest
env:
SQLX_OFFLINE: true
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
with:
toolchain: nightly
- name: Install udeps
uses: taiki-e/install-action@d6912b47771be2c443ec90dbb3d28e023987e782 # v2.62.1
with:
tool: cargo-udeps
- name: cargo udeps
run: cargo udeps --workspace --all-targets
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
with:
toolchain: nightly
components: rustfmt
- name: Check formatting
run: cargo +nightly fmt --all --check -- --config imports_granularity="Crate"
clippy:
name: Clippy
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
use_zig: false
zig_args: ""
- target: aarch64-unknown-linux-gnu
use_zig: true
zig_args: "-target aarch64-linux-gnu -g"
- target: armv7-unknown-linux-gnueabihf
use_zig: true
zig_args: "-target arm-linux-gnueabihf -mcpu=generic+v7a+vfp3-d32+thumb2-neon -g"
- target: x86_64-unknown-linux-musl
use_zig: true
zig_args: "-target x86_64-linux-musl"
runs-on: ubuntu-latest
env:
SQLX_OFFLINE: true
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
with:
toolchain: stable
components: clippy
targets: ${{matrix.target}}
# Use zig as our C compiler for convenient cross-compilation. We run into rustls having a dependency on `ring`.
# This crate uses C and assembly code, and because of its build scripts, `cargo clippy` needs to be able to compile
# that code for our target.
- uses: mlugg/setup-zig@v2
with:
version: latest
if: ${{matrix.use_zig}}
- name: Install cargo-zigbuild
uses: taiki-e/install-action@d6912b47771be2c443ec90dbb3d28e023987e782 # v2.62.1
with:
tool: cargo-zigbuild
if: ${{matrix.use_zig}}
- name: Set TARGET_CC for zig
run: echo "TARGET_CC=/home/runner/.cargo/bin/cargo-zigbuild zig cc -- ${{matrix.zig_args}}" >> $GITHUB_ENV
if: ${{matrix.use_zig}}
- name: Rust cache
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
with:
shared-key: "stable-${{matrix.target}}"
- name: Run clippy
run: cargo clippy --target ${{matrix.target}} --workspace --all-targets --all-features -- -D warnings
audit-dependencies:
name: Audit dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: EmbarkStudios/cargo-deny-action@f2ba7abc2abebaf185c833c3961145a3c275caad
with:
arguments: --workspace --all-features