|
| 1 | +name: Check includes |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + includes-check: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + strategy: |
| 8 | + matrix: |
| 9 | + board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O', 'PRALINE'] |
| 10 | + cmake: ['3.10.0', 'latest'] |
| 11 | + |
| 12 | + # Don't cancel all builds when one fails |
| 13 | + fail-fast: false |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + submodules: true |
| 19 | + |
| 20 | + - name: Setup cmake |
| 21 | + uses: jwlawson/actions-setup-cmake@v2 |
| 22 | + with: |
| 23 | + cmake-version: ${{ matrix.cmake }} |
| 24 | + |
| 25 | + - name: Install Arm GNU Toolchain |
| 26 | + uses: carlosperate/arm-none-eabi-gcc-action@v1 |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: | |
| 30 | + python3 -m venv environment && source environment/bin/activate |
| 31 | + python3 -m pip install PyYAML |
| 32 | + sudo apt update |
| 33 | + sudo apt install iwyu |
| 34 | +
|
| 35 | + - name: Build libopencm3 |
| 36 | + shell: bash |
| 37 | + working-directory: ${{github.workspace}}/firmware/libopencm3/ |
| 38 | + run: | |
| 39 | + source ../../environment/bin/activate |
| 40 | + make |
| 41 | +
|
| 42 | + - name: Create Build Environment |
| 43 | + run: cmake -E make_directory ${{github.workspace}}/firmware/build |
| 44 | + |
| 45 | + - name: Configure CMake |
| 46 | + shell: bash |
| 47 | + working-directory: ${{github.workspace}}/firmware/build |
| 48 | + run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }} -DCHECK_INCLUDES=1 |
| 49 | + |
| 50 | + - name: Build |
| 51 | + working-directory: ${{github.workspace}}/firmware/build |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + source ../../environment/bin/activate |
| 55 | + output="$(cmake --build . --config Release 2>&1)" |
| 56 | + while IFS= read -r line |
| 57 | + do |
| 58 | + if [[ "${line}" == "Warning: include-what-you-use"* ]]; then |
| 59 | + exit_code=1 |
| 60 | + dump=1 |
| 61 | + elif [[ "${line}" == "---" ]]; then |
| 62 | + dump=0 |
| 63 | + fi |
| 64 | + if [[ ${dump} == "1" ]]; then |
| 65 | + echo "${line}" |
| 66 | + fi |
| 67 | + done <<< ${output} |
| 68 | + if [[ ${exit_code} == "1" ]]; then |
| 69 | + echo "Includes check failed for board target: ${{ matrix.board }}" |
| 70 | + else |
| 71 | + echo "Includes check succeeded for board target: ${{ matrix.board }}" |
| 72 | + fi |
| 73 | + echo $(include-what-you-use --version) |
| 74 | + exit ${exit_code} |
0 commit comments