Skip to content

Merge pull request #44 from pluots/doc-no-deps #172

Merge pull request #44 from pluots/doc-no-deps

Merge pull request #44 from pluots/doc-no-deps #172

---
# Main "useful" actions config file
# Cache config comes from https://github.com/actions/cache/blob/main/examples.md#rust---cargo
on:
push:
branches:
- main
pull_request:
name: Rust Validation
env:
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: -D warnings
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
clippy:
name: "Clippy (cargo clippy)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup default nightly
- run: rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev
- run: cargo clippy --all-features --all-targets -- -D warnings
- run: cargo clippy --no-default-features --all-targets -- -D warnings
test:
strategy:
fail-fast: true
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl
extension: ''
- build: macos
os: macos-latest
target: x86_64-apple-darwin
extension: ''
- build: windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
name: "Test on ${{ matrix.os }} (cargo test)"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
lfs: true
- run: rustup default 1.77
- run: rustup component add llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Install nextest
uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev
if: matrix.build == 'linux'
# Only run coverage on the `altium` package until
# <https://github.com/Smithay/wayland-rs/issues/717> gets fixed
- run: cargo llvm-cov nextest --no-fail-fast --lcov --output-path lcov.info --package altium
- run: cargo nextest run
- run: cargo test --doc
- name: Upload coverage data to codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: lcov.info
fmt:
name: "Format (cargo fmt)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup default nightly
- run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- uses: actions/setup-python@v3
doc:
name: "Docs (cargo doc)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup default nightly
- uses: Swatinem/rust-cache@v2
- run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev
- run: cargo doc --no-deps
outdated:
name: Outdated
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/install@cargo-outdated
- uses: Swatinem/rust-cache@v2
- run: cargo outdated --workspace --exit-code 1 --ignore rust-ini