-
Notifications
You must be signed in to change notification settings - Fork 200
97 lines (87 loc) · 3.07 KB
/
build-bsp.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Build BSPs
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-BSPs
build:
name: "${{matrix.bsp.name}} (Tier ${{matrix.bsp.tier}}, ${{matrix.toolchain}})"
runs-on: ubuntu-latest
# There is a subtle difference between continue-on-error and setting
# strategy.fail-fast=false. Both will allow all jobs to run to completion,
# however continue-on-error lets the next workflow stage run regardless of
# failed jobs, strategy.fail-fast=false will skip subsequent stages if any
# job fails.
continue-on-error: true
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 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 }}
run: |
build_invocation=$(cat ./crates.json | jq -Mr --arg board '${{ matrix.bsp.name }}' -c '.boards | .[$board] | .build')
set -ex
pushd boards/${{ matrix.bsp.name }}
$(${build_invocation})
popd
mkdir -p output
touch "output/build"
- name: Clippy ${{ matrix.bsp.name }}
if: ${{ matrix.toolchain == 'nightly' }}
run: |
set -ex
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.name }}
$(${clippy_invocation})
- name: Done
uses: actions/upload-artifact@v4
with:
# name needs to be unique in the workspace
name: "${{ matrix.bsp.name }}-${{ matrix.toolchain }}"
path: output
check-tier-1-bsps-build-stable:
runs-on: ubuntu-latest
needs: [setup, build]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: successful-jobs
- name: Do checks
env:
MATRIX: ${{ needs.setup.outputs.matrix }}
run: |
tier_1_bsps=$(jq -Mr -c '.bsp[] | select(.tier == 1) | .name' <<< ${MATRIX})
success="true"
for bsp in ${tier_1_bsps}; do
if [ -f successful-jobs/"${bsp}"-stable/build ]; then
echo "${bsp}" built on stable toolchain
else
echo "${bsp}" failed to build on stable toolchain
success="false"
fi
done
if [ ${success} = "true" ]; then
echo "Tier 1 BSPs all built on stable"
else
false
fi