Skip to content

Commit

Permalink
CI: Use BSP objects instead of names in job matrix
Browse files Browse the repository at this point in the history
This is a step towards allowing the job to continue if any tier >1 BSPs
fail to build.
  • Loading branch information
ianrrees committed Aug 18, 2024
1 parent 37a97c1 commit 7f3928f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/actions/list-BSPs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ runs:
- id: compute-matrix
shell: bash
run: |
matrix_json=$(cat crates.json | jq -Mr -c '{ "bsp": (.boards | keys ), "toolchain": ["stable", "nightly"] }')
matrix_json=$(cat crates.json | jq -Mr -c '{ "bsp": [ (.boards | to_entries | .[] | {"name": (.key), "tier": .value.tier}) ] , "toolchain": ["stable", "nightly"] }')
echo "matrix=${matrix_json}" >> $GITHUB_OUTPUT
15 changes: 8 additions & 7 deletions .github/workflows/build-bsp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
uses: ./.github/actions/list-BSPs

build:
name: "${{matrix.bsp.name}} (tier ${{matrix.bsp.tier}}, ${{matrix.toolchain}})"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
needs: setup
Expand All @@ -26,25 +27,25 @@ jobs:
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
target=$(cat ./crates.json | jq -Mr --arg board '${{ matrix.bsp }}' -c '.boards | .[$board] | .target')
target=$(cat ./crates.json | jq -Mr --arg board '${{ matrix.bsp.name }}' -c '.boards | .[$board] | .target')
rustup target add ${target}
rustup component add clippy
- name: Setup cache
uses: Swatinem/rust-cache@v2

- name: Build ${{ matrix.bsp }}
- name: Build ${{ matrix.bsp.name }}
run: |
build_invocation=$(cat ./crates.json | jq -Mr --arg board '${{ matrix.bsp }}' -c '.boards | .[$board] | .build')
build_invocation=$(cat ./crates.json | jq -Mr --arg board '${{ matrix.bsp.name }}' -c '.boards | .[$board] | .build')
set -ex
cd boards/${{ matrix.bsp }}
cd boards/${{ matrix.bsp.name }}
$(${build_invocation})
- name: Clippy ${{ matrix.bsp }}
- name: Clippy ${{ matrix.bsp.name }}
if: ${{ matrix.toolchain == 'nightly' }}
run: |
set -ex
build_invocation=$(cat ./crates.json | jq -Mr --arg board '${{ matrix.bsp }}' -c '.boards | .[$board] | .build')
build_invocation=$(cat ./crates.json | jq -Mr --arg board '${{ matrix.bsp.name }}' -c '.boards | .[$board] | .build')
clippy_invocation=$(echo ${build_invocation} | sed 's/cargo build/cargo clippy/g')
cd boards/${{ matrix.bsp }}
cd boards/${{ matrix.bsp.name }}
$(${clippy_invocation})

0 comments on commit 7f3928f

Please sign in to comment.