Skip to content

CI

CI #1639

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
schedule:
- cron: "00 01 * * *"
# Stops the running workflow of previous pushes
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
RUST_BACKTRACE: 1
RUSTUP_MAX_RETRIES: 10
CARGO_NET_RETRY: 10
jobs:
lints:
name: Rustfmt & Clippy lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# use nightly for rustfmt & clippy checks
- name: Install Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- name: Rust format
run: cargo fmt --check
- name: Clippy lints
run: cargo clippy --no-deps -- -D warnings
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: ["1.70", stable, beta]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rust-src
toolchain: ${{ matrix.rust }}
- name: Build
run: cargo build
- name: Test --no-default-features
run: cargo test --no-default-features
- name: Test feature serde
# this includes default features, `std` and `all-sentences`
run: cargo test -F serde
- name: Test feature defmt-03
# this includes default features, `std` and `all-sentences`
if: ${{ matrix.os != 'windows-latest' }}
run: cargo test -F defmt-03
- name: Test (Release)
run: cargo test --release --no-default-features
- name: Test (Release) feature serde
# this includes default features, `std` and `all-sentences`
run: cargo test --release -F serde
- name: Test (Release) feature defmt-03
if: ${{ matrix.os != 'windows-latest' }}
# this includes default features, `std` and `all-sentences`
run: cargo test --release -F defmt-03
bench:
name: Benches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run Benches
run: cargo bench -p benches-harness
# Detect cases where documentation links don't resolve and such.
doc:
name: Docs check
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
# Docs.rs uses nightly, which allows for easier syntax for linking to functions.
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-docs
- name: Docs --all-features
run: cargo doc --all-features --no-deps
- name: Docs --no-default-features
run: cargo doc --no-default-features --no-deps
codecov:
name: Generate code coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate code coverage
# this includes default features, `std` and `all-sentences`
run: cargo +nightly tarpaulin --features serde --verbose --workspace --timeout 120 --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true