name: Build
on: [push, pull_request]
jobs:
check:
name: Type checking
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [1.34.0, 1.36.0, stable]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache target
uses: actions/cache@v1
env:
cache-name: target
with:
path: ./target
key: ${{ matrix.os }}-typecheck-target-${{ matrix.rust }}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Run `cargo check --no-default-features`
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features
if: matrix.rust != '1.34.0'
- name: Run `cargo check --no-default-features --features serde,rand`
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --features serde,rand
if: matrix.rust != '1.34.0'
- name: Run `cargo check --features serde,deprecated,panicking-api,rand`
uses: actions-rs/cargo@v1
with:
command: check
args: --features serde,deprecated,panicking-api,rand
check-embedded:
name: Type checking (embedded)
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.34.0, 1.36.0, stable]
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache target
uses: actions/cache@v1
env:
cache-name: target
with:
path: ./target
key: ubuntu-latest-typecheck-target-${{ matrix.rust }}-thumbv7em-none-eabihf
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: thumbv7em-none-eabihf
override: true
- name: Run `cargo check --no-default-features`
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --target thumbv7em-none-eabihf
if: matrix.rust != '1.34.0'
- name: Run `cargo check --no-default-features --features serde,rand`
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --features serde,rand --target thumbv7em-none-eabihf
if: matrix.rust != '1.34.0'
test:
name: Test suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [1.34.0, 1.36.0, stable] os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache target
uses: actions/cache@v1
env:
cache-name: target
with:
path: ./target
key: ${{ matrix.os }}-test-target-${{ matrix.rust }}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Run `cargo test --no-default-features`
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features
if: matrix.rust != '1.34.0'
- name: Run `cargo test --features serde,deprecated,panicking-api,rand`
uses: actions-rs/cargo@v1
with:
command: test
args: --features serde,deprecated,panicking-api,rand
fmt:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Run `cargo fmt -- --check`
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache target
uses: actions/cache@v1
env:
cache-name: clippy
with:
path: ./target
key: ubuntu-latest-clippy-target-stable
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run `cargo clippy --features serde,deprecated,rand,panicking-api`
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features serde,deprecated,rand,panicking-api
documentation:
name: Documentation
runs-on: ubuntu-latest
needs: [check, test, fmt, clippy]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Cache target
uses: actions/cache@v1
env:
cache-name: target
with:
path: ./target
key: ubuntu-latest-docs-target-nightly
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Run `cargo doc --all-features`
uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features
- name: Publish documentation
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: target/doc
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.master_branch)