Skip to content

CI

CI #177

Workflow file for this run

on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
schedule:
- cron: "13 3 * * 4"
name: CI
jobs:
build:
name: Build
runs-on: ubuntu-latest
env: {"RUSTFLAGS": "-D warnings"}
strategy:
matrix:
target:
- "x86_64-unknown-linux-gnu"
- "thumbv7em-none-eabi"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }} --features defmt
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --all-features
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-features -- --deny warnings
format:
name: Rust Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo +nightly fmt -- --check
rustdoc:
name: rustdoc
runs-on: ubuntu-latest
env: {"RUSTDOCFLAGS": "-D warnings --cfg docsrs"}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: rustdoc
run: |
cargo +nightly rustdoc \
--all-features \
-- -Z unstable-options --enable-index-page
chmod -R 777 target
- uses: actions/upload-pages-artifact@v3
with:
path: ./target/doc
deploy_docs:
runs-on: ubuntu-latest
needs: rustdoc
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v4
id: deployment
release:
name: crates.io release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build
- test
- clippy
- format
- rustdoc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo publish --token ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}