on: [push, pull_request]
name: CI
jobs:
clippy:
name: Clippy
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
components: clippy
- name: cargo clippy
uses: actions-rs/clippy-check@v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
test:
name: Test
runs-on: ubuntu-20.04
timeout-minutes: 10
strategy:
matrix:
toolchain:
- "" target:
- ""
- "riscv64imac-unknown-none-elf"
- "riscv32i-unknown-none-elf"
- "thumbv6m-none-eabi"
features:
- ""
- "alloc"
- "std"
- "unstable"
- "alloc,unstable"
- "std,unstable"
exclude:
- { target: "riscv64imac-unknown-none-elf", features: "std" }
- { target: "riscv64imac-unknown-none-elf", features: "std,unstable" }
- { target: "riscv32i-unknown-none-elf", features: "std" }
- { target: "riscv32i-unknown-none-elf", features: "std,unstable" }
- { target: "thumbv6m-none-eabi", features: "std" }
- { target: "thumbv6m-none-eabi", features: "std,unstable" }
include:
- { toolchain: "1.54.0", features: "std,unstable" }
- { toolchain: "1.60.0", features: "std,unstable" }
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Change the target toolchain
if: ${{ matrix.toolchain != '' }}
run: |
echo ${{ matrix.toolchain }} > rust-toolchain
- uses: actions-rs/toolchain@v1
with:
profile: minimal
- name: Install the target standard library
if: ${{ matrix.target != '' }}
run: |
rustup target add ${{ matrix.target }}
- name: Derive `--target` parameter
if: ${{ matrix.target != '' }}
run: echo "target_param=--target ${{ matrix.target }}" >> $GITHUB_ENV
- name: Skip doctests if `not(feature = "std")`
if: ${{ !startsWith(matrix.features, 'std') }}
run: echo "test_param=--lib" >> $GITHUB_ENV
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: -p tokenlock ${{ env.target_param }} --no-default-features --features "${{ matrix.features }}"
- name: cargo test
uses: actions-rs/cargo@v1
if: ${{ matrix.target == '' }}
with:
command: test
args: -p tokenlock ${{ env.target_param }} --no-default-features --features "${{ matrix.features }}" ${{ env.test_param }}