esp-hal/.github/workflows/ci.yml

204 lines
6.3 KiB
YAML

on:
pull_request:
branches:
- main
push:
workflow_dispatch:
name: CI
env:
CARGO_TERM_COLOR: always
jobs:
# --------------------------------------------------------------------------
# Check Examples
check-riscv:
name: Check RISC-V Examples
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
chip_features:
[
{ chip: esp32c2, features: "eh1,ufmt" },
{ chip: esp32c2, features: "direct-boot,eh1,ufmt" },
{ chip: esp32c3, features: "eh1,smartled,ufmt" },
{ chip: esp32c3, features: "direct-boot,eh1,smartled,ufmt" },
]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: riscv32imc-unknown-none-elf
toolchain: ${{ matrix.toolchain }}
default: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
args: --examples --manifest-path=${{ matrix.chip_features.chip }}-hal/Cargo.toml --target=riscv32imc-unknown-none-elf --features=${{ matrix.chip_features.features }}
check-xtensa:
name: Check Xtensa Examples
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
chip_features:
[
{ chip: esp32, features: "eh1,smartled,ufmt" },
{ chip: esp32s2, features: "eh1,smartled,ufmt" },
{ chip: esp32s3, features: "eh1,smartled,ufmt" },
{ chip: esp32s3, features: "direct-boot,eh1,smartled,ufmt" },
]
env:
RUSTFLAGS: '--cfg target_has_atomic="8" --cfg target_has_atomic="16" --cfg target_has_atomic="32" --cfg target_has_atomic="ptr"'
steps:
- uses: actions/checkout@v2
- uses: esp-rs/xtensa-toolchain@v1.4
with:
default: true
ldproxy: false
buildtargets: ${{ matrix.chip_features.chip }}
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
args: -Zbuild-std=core --examples --manifest-path=${{ matrix.chip_features.chip }}-hal/Cargo.toml --target=xtensa-${{ matrix.chip_features.chip }}-none-elf --features=${{ matrix.chip_features.features }}
# --------------------------------------------------------------------------
# Formatting & Clippy
rustfmt:
name: Check formatting
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
[
esp-hal-common,
esp32-hal,
esp32c2-hal,
esp32c3-hal,
esp32s2-hal,
esp32s3-hal,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --manifest-path=${{ matrix.package }}/Cargo.toml -- --check
clippy-riscv:
name: Run clippy on RISC-V builds
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
chip: [esp32c2, esp32c3]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: riscv32imc-unknown-none-elf
toolchain: ${{ matrix.toolchain }}
components: clippy
default: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path=${{ matrix.chip }}-hal/Cargo.toml --target=riscv32imc-unknown-none-elf -- --no-deps
clippy-xtensa:
name: Run clippy on Xtensa builds
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
chip: [esp32, esp32s2, esp32s3]
steps:
- uses: actions/checkout@v2
- uses: esp-rs/xtensa-toolchain@v1.4
with:
default: true
ldproxy: false
buildtargets: ${{ matrix.chip }}
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -Zbuild-std=core --manifest-path=${{ matrix.chip }}-hal/Cargo.toml --target=xtensa-${{ matrix.chip }}-none-elf -- --no-deps
# --------------------------------------------------------------------------
# MSRV Check
msrv-riscv:
name: Check RISC-V MSRV
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
chip_features:
[
{ chip: esp32c2, features: "eh1,ufmt" },
{ chip: esp32c2, features: "direct-boot,eh1,ufmt" },
{ chip: esp32c3, features: "eh1,smartled,ufmt" },
{ chip: esp32c3, features: "direct-boot,eh1,smartled,ufmt" },
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: riscv32imc-unknown-none-elf
toolchain: "1.60.0"
default: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path=${{ matrix.chip_features.chip }}-hal/Cargo.toml --target=riscv32imc-unknown-none-elf --features=${{ matrix.chip_features.features }}
msrv-xtensa:
name: Check Xtensa MSRV
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
chip_features:
[
{ chip: esp32, features: "eh1,smartled,ufmt" },
{ chip: esp32s2, features: "eh1,smartled,ufmt" },
{ chip: esp32s3, features: "eh1,smartled,ufmt" },
{ chip: esp32s3, features: "direct-boot,eh1,smartled,ufmt" },
]
steps:
- uses: actions/checkout@v2
- uses: esp-rs/xtensa-toolchain@v1.4
with:
default: true
ldproxy: false
buildtargets: ${{ matrix.chip_features.chip }}
version: "1.60.0"
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
args: -Zbuild-std=core --manifest-path=${{ matrix.chip_features.chip }}-hal/Cargo.toml --target=xtensa-${{ matrix.chip_features.chip }}-none-elf --features=${{ matrix.chip_features.features }}