Skip to content

ci: improve the CI #231

ci: improve the CI

ci: improve the CI #231

Workflow file for this run

name: Build
on:
schedule:
- cron: "0 0 1 * *"
push:
paths-ignore:
- changelog
branches-ignore:
- main
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: '--deny warnings'
MINIMUM_SUPPORTED_RUST_VERSION: 1.80.1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Run cargo check
run: cargo check --all-features --locked --release --all
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
build:
name: Build w/o features
needs: check
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Run cargo build
run: cargo build
build-for-targets:
name: Build for targets
needs: check
runs-on: ${{ matrix.platforms.os }}
continue-on-error: true
strategy:
matrix:
platforms:
- os: macOS-latest
target: aarch64-apple-darwin
features: ""
- os: macos-latest-large
target: x86_64-apple-darwin
features: ""
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
features: ""
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
features: "--no-default-features"
- os: windows-latest
target: x86_64-pc-windows-gnu
features: "--no-default-features"
- os: windows-latest
target: x86_64-pc-windows-msvc
features: "--no-default-features"
steps:
- uses: actions/checkout@v4
- uses: houseabsolute/actions-rust-cross@v1
# if: (github.event.pull_request.base.ref == 'main' && matrix.platforms.os == 'macos-latest-large') == false
with:
target: ${{ matrix.platforms.target }}
args: "--locked ${{ matrix.platforms.features }}"
env:
KRB5_CV_ATTR_CONSTRUCTOR_DESTRUCTOR: yes
AC_CV_FUNC_REGCOMP: yes
AC_CV_PRINTF_POSITIONAL: yes
clippy:
needs: check
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Run cargo clippy
run: cargo clippy --all-targets --all-features -- --deny warnings
format:
needs: check
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
run: cargo fmt --all -- --check
unused-dependencies:
needs: check
name: Unused dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: bnjbvr/cargo-machete@main
code-coverage:
name: Code coverage
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Run cargo tarpaulin
run: cargo tarpaulin --all-features --out Xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CI: "true"
doc:
needs: check
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Build documentation
run: cargo doc --no-deps --document-private-items --verbose
lychee:
name: Lychee
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v4
- uses: lycheeverse/lychee-action@v2
name: Link Checker
typos:
name: Typos
runs-on: ubuntu-latest
needs: [check]
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Install typos-cli
run: cargo install typos-cli
- name: Run typos-cli
run: typos --exclude ./benches/*
cargo-deny:
name: Cargo deny
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2