CI #165
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
build: | |
name: Cargo Build | |
runs-on: ubuntu-latest | |
env: {"RUSTFLAGS": "-D warnings"} | |
strategy: | |
matrix: | |
target: | |
- "x86_64-unknown-linux-gnu" | |
- "thumbv6m-none-eabi" | |
- "thumbv7em-none-eabi" | |
toolchain: | |
- "stable" | |
- "nightly" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
target: ${{ matrix.target }} | |
- run: rustup target add ${{ matrix.target }} | |
- run: cargo build --target ${{ matrix.target }} | |
test: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
env: {"RUSTFLAGS": "-D warnings"} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- run: cargo test | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: clippy | |
- run: cargo clippy -- -D warnings | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo +nightly fmt -- --check | |
deny: | |
name: Deny | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Run cargo-deny | |
uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
command: check all | |
links: | |
name: Links | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Run lychee | |
uses: lycheeverse/lychee-action@v2 | |
with: | |
args: -v *.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
typos: | |
name: Typos | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Check typos | |
uses: crate-ci/typos@master | |
msrv: | |
name: MSRV | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Install cargo-binstall | |
uses: taiki-e/install-action@cargo-binstall | |
- name: Install cargo-msrv | |
run: cargo binstall -y --force cargo-msrv | |
- name: Run cargo-msrv | |
run: cargo msrv --output-format json verify | tail -n 1 | jq --exit-status '.success' | |
doc: | |
name: doc | |
runs-on: ubuntu-latest | |
env: {"RUSTDOCFLAGS": "-D warnings --cfg docsrs"} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- run: cargo +nightly rustdoc | |
examples: | |
name: Examples | |
runs-on: ubuntu-latest | |
env: {"RUSTFLAGS": "-D warnings"} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- run: cargo build --examples | |
crates_io_publish: | |
name: Publish (crates.io) | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: | |
- build | |
- test | |
- clippy | |
- format | |
- examples | |
- doc | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: cargo-release Cache | |
id: cargo_release_cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/bin/cargo-release | |
key: ${{ runner.os }}-cargo-release | |
- run: cargo install cargo-release | |
if: steps.cargo_release_cache.outputs.cache-hit != 'true' | |
- name: cargo login | |
run: cargo login ${{ secrets.CRATES_IO_TOKEN }} | |
- name: "cargo release publish" | |
run: |- | |
cargo release \ | |
publish \ | |
--all-features \ | |
--allow-branch HEAD \ | |
--no-confirm \ | |
--execute |