XXX: Play with CI to set up IWYU #778
Workflow file for this run
This file contains hidden or 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
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Build & Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Setup Ubuntu | |
| run: ./scripts/setup-ubuntu.sh | |
| - name: Check License Header | |
| uses: apache/skywalking-eyes/header@v0.4.0 | |
| - name: Formatting Cmake files | |
| run: ./scripts/run-cmake-format.sh | |
| - name: Formatting Clang files | |
| run: ./scripts/run-clang-format.sh | |
| - name: Checking formatting | |
| run: git diff --exit-code | |
| ubuntu-build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| # Set up IWYU tool (begin) -------------------------------------------- # | |
| - name: Cache IWYU tool | |
| uses: actions/cache@v5 | |
| id: iwyu-tool-cache | |
| with: | |
| path: /opt/bin/include-what-you-use | |
| key: ${{ runner.os }}-iwyu-tool | |
| - name: Install dependencies to build IWYU tool | |
| if: steps.iwyu-tool-cache.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install \ | |
| llvm-18-dev \ | |
| libclang-18-dev | |
| - name: Check out IWYU repo | |
| if: steps.iwyu-tool-cache.outputs.cache-hit != 'true' | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: include-what-you-use/include-what-you-use | |
| ref: clang_18 | |
| path: 'iwyu' | |
| - name: Build and install IWYU tool | |
| if: steps.iwyu-tool-cache.outputs.cache-hit != 'true' | |
| run: | | |
| cmake -G Ninja -S iwyu -B iwyu/build \ | |
| -DCMAKE_PREFIX_PATH=/usr/lib/llvm-18 | |
| cmake --build iwyu/build | |
| sudo cmake --install iwyu/build --prefix /opt | |
| - name: IWYU smoke test | |
| run: /opt/bin/include-what-you-use --version | |
| # Set up IWYU tool (end) ---------------------------------------------- # | |
| - name: Setup Ubuntu | |
| run: ./scripts/setup-ubuntu.sh | |
| - name: Cache CMake FetchContent dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/build/_deps | |
| key: ${{ runner.os }}-cmake-deps | |
| restore-keys: | | |
| ${{ runner.os }}-cmake-deps | |
| - name: Set up ccache | |
| uses: hendrikmuhs/ccache-action@1bbbcda0748b3e340dee71a314fa68ffcbd6df79 # v1.2.21 | |
| with: | |
| key: ${{ runner.os }} | |
| max-size: 500M | |
| - name: Configure CMake | |
| run: | | |
| cmake --version | |
| cmake -B build -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DBUILD_TZ_LIB=ON \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DSUBSTRAIT_CPP_ENABLE_CLANG_TIDY=ON \ | |
| -DSUBSTRAIT_CPP_ENABLE_IWYU=ON \ | |
| -DSUBSTRAIT_CPP_IWYU_PATH=/opt/bin/include-what-you-use | |
| - name: Build | |
| run: | | |
| cmake --build build | |
| - name: Test | |
| run: ctest --test-dir build --output-on-failure --timeout 30 | |
| windows-build-and-test: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '11' | |
| - name: Cache CMake FetchContent dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/build/_deps | |
| key: ${{ runner.os }}-cmake-deps | |
| restore-keys: | | |
| ${{ runner.os }}-cmake-deps | |
| - name: Set up sccache | |
| uses: hendrikmuhs/ccache-action@1bbbcda0748b3e340dee71a314fa68ffcbd6df79 # v1.2.21 | |
| with: | |
| variant: sccache | |
| key: ${{ runner.os }} | |
| max-size: 500M | |
| - name: Set up CMake | |
| # We enable a compilation cache with `sccache`. This conflicts with the | |
| # default way of creating debug symbols; we want to use the `Embedded` | |
| # format, which works with caching. However, the corresponding flag is | |
| # only used properly if CMP0141 is set to the `NEW` behavior. | |
| # Furthermore, protobuf overwrites that policiy, but has a special | |
| # mechanism to handle the debug format. | |
| run: | | |
| ./scripts/find_vs.ps1 | |
| cmake --version | |
| cmake -B build -G Ninja ` | |
| -DCMAKE_C_COMPILER_LAUNCHER=sccache ` | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ` | |
| -DCMAKE_POLICY_DEFAULT_CMP0141=NEW ` | |
| -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded ` | |
| -Dprotobuf_ALLOW_CCACHE=ON ` | |
| -DCMAKE_BUILD_TYPE=Debug ` | |
| -DBUILD_TZ_LIB=ON | |
| - name: Build | |
| run: | | |
| ./scripts/find_vs.ps1 | |
| cmake --build build | |
| - name: Test | |
| run: ctest --test-dir build --output-on-failure --timeout 30 |