Fix compilation when device feature is off (#793) #665
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build HAL | |
on: [push, pull_request] | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- id: set-matrix | |
uses: ./.github/actions/list-HAL-variants | |
build: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.toolchain == 'nightly' }} | |
needs: setup | |
strategy: | |
matrix: ${{fromJson(needs.setup.outputs.matrix)}} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
run: | | |
rustup update | |
rustup set profile minimal | |
rustup override set ${{ matrix.toolchain }} | |
target=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_build_variants["${{matrix.pac}}"].target') | |
rustup target add ${target} | |
rustup component add clippy | |
- name: Setup cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build HAL for ${{ matrix.pac }} | |
run: | | |
set -ex | |
features=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_build_variants["${{matrix.pac}}"].features | join(",")') | |
target=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_build_variants["${{matrix.pac}}"].target') | |
cargo clippy --features=${features} --target=${target} --manifest-path=./hal/Cargo.toml -- -D warnings |