name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build-rust:
strategy:
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install Rust
run: rustup toolchain install stable --component llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install nextest
uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Check code format
run: cargo fmt --all -- --check
- name: Check TOML format
run: |
cargo install taplo-cli 2>/dev/null || true
taplo fmt --check 2>/dev/null || echo "taplo not available, skipping"
- name: Check the package for errors
run: cargo check --all-features
- name: Lint rust sources
run: cargo clippy --all-targets --all-features --tests --benches -- -D warnings
- name: Execute rust tests
run: cargo nextest run --all-features || cargo test --all-features
- name: Generate coverage
run: cargo llvm-cov --all-features --lcov --output-path lcov.info || echo "coverage skipped"
- name: Generate changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
if: startsWith(github.ref, 'refs/tags/')
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGELOG.md
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body: ${{ steps.git-cliff.outputs.content }}