name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
msrv: 1.57.0
nightly: nightly-2022-05-21
jobs:
build-msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-msrv-cargo-build-target
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.msrv }}
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-targets
- name: Run doc tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --doc
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-stable-build-target
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Clippy
uses: actions-rs/clippy-check@v1
with:
name: "Clippy"
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-targets -- -D warnings
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-targets
- name: Run doc tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --doc
build-nostd:
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-nostd-cargo-build-target
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.nightly }}
profile: minimal
override: true
target: thumbv7m-none-eabi
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --lib --target thumbv7m-none-eabi -Z avoid-dev-deps
document:
if: github.event_name == 'push'
needs:
- build
- build-msrv
- build-nostd
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-document-target
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build docs
run: |
cargo clean --doc && \
cargo rustdoc -p const-decoder -- --cfg docsrs
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: target/doc
SINGLE_COMMIT: true