name: CI
on:
pull_request:
push:
branches:
- master
permissions:
contents: read
jobs:
check:
name: Lints and checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy --no-self-update
- uses: Swatinem/rust-cache@v2
- name: Run clippy checks
run: cargo clippy --all-targets -- -D warnings
- name: Run format checks
run: cargo fmt --check
msrv:
name: MSRV checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- run: rustup toolchain install 1.81.0 --profile minimal --no-self-update
- name: Check MSRV
run: cargo +1.81.0 check --all-targets
no_std:
name: no_std checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: rustup toolchain install stable --profile minimal --no-self-update
- run: rustup target add wasm32v1-none --toolchain stable
- uses: Swatinem/rust-cache@v2
- name: Run library tests without default features
run: cargo test --lib --no-default-features
- name: Check library for no_std target
run: cargo check --lib --no-default-features --target wasm32v1-none
test:
name: Test using Rust ${{ matrix.rust }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- run: git submodule update --init
- run: rustup toolchain install ${{ matrix.rust }} --profile minimal --no-self-update
- uses: Swatinem/rust-cache@v2
- name: Run build
run: cargo build
- name: Run tests
run: cargo test -v
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal
rustup default stable
rustup component add llvm-tools-preview
- name: Install cargo-llvm-cov
run: |
cargo install cargo-llvm-cov --locked
- name: Generate code coverage
run: |
cargo llvm-cov --all-features --lcov --output-path lcov.info
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: bourumir-wyngs/granit-parser
files: lcov.info
fail_ci_if_error: true