Skip to content

Merge pull request #1779 from martinling/mcu-pll-b #498

Merge pull request #1779 from martinling/mcu-pll-b

Merge pull request #1779 from martinling/mcu-pll-b #498

name: Check includes
on: [push, pull_request]
defaults:
run:
shell: bash
jobs:
includes-check:
runs-on: ubuntu-latest
container:
image: "debian:13"
options: --user 0
strategy:
matrix:
board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O', 'PRALINE', 'UNIVERSAL']
cmake: ['3.12.0', 'latest']
# Don't cancel all builds when one fails
fail-fast: false
steps:
- name: Make it work on debian
run: |
apt update
apt install -y git python3 python3-pip python3-venv nodejs unzip
# actions/checkout insists on putting the checkout in the
# working directory rather than ${{ github.workspace }}.
#
# This may just be because the 'runner' user does not exist
# in the docker image at startup.
#
# also see: https://github.com/actions/runner/issues/878
useradd -ms /bin/bash runner
ln -s /__w /home/runner/work
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: true
- name: Setup cmake
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ matrix.cmake }}
- name: Install Arm GNU Toolchain
uses: carlosperate/arm-none-eabi-gcc-action@v1
- name: Install dependencies
run: |
python3 -m venv environment && source environment/bin/activate
python3 -m pip install PyYAML
apt install -y iwyu
iwyu --version
- name: Build libopencm3
working-directory: ${{github.workspace}}/firmware/libopencm3/
run: |
source ../../environment/bin/activate
make
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/firmware/build
- name: Configure CMake
working-directory: ${{github.workspace}}/firmware/build
run: cmake ${{github.workspace}}/firmware/ -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }} -DCHECK_INCLUDES=1
- name: Build
working-directory: ${{github.workspace}}/firmware/build
run: |
source ../../environment/bin/activate
output="$(cmake --build . --config Release 2>&1)"
while IFS= read -r line
do
if [[ "${line}" == "Warning: include-what-you-use"* ]]; then
exit_code=1
dump=1
echo
elif [[ "${line}" == "---" ]]; then
dump=0
echo
fi
if [[ ${dump} == "1" ]]; then
echo "${line}"
fi
done <<< ${output}
if [[ ${exit_code} == "1" ]]; then
echo "Includes check failed for board target: ${{ matrix.board }}"
else
echo "Includes check succeeded for board target: ${{ matrix.board }}"
fi
echo $(include-what-you-use --version)
exit ${exit_code}