Merge pull request #163 from steve-downey/ci-fix-20251230 #781
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
| name: CI Tests | |
| on: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| push: | |
| pull_request: | |
| schedule: | |
| # minute hour day month day-of-week | |
| # Run at 12:25 UTC every day | |
| - cron: '25 12 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| permissions: | |
| checks: write # for coverallsapp/github-action to create new checks | |
| contents: read # for actions/checkout to fetch code | |
| name: ${{ matrix.config.name }} | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ghcr.io/bemanproject/testingcontainers-${{ matrix.config.tag }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {name: "Ubuntu Clang 21", tag: "clang:21", toolchain: "clang-21", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "} | |
| - {name: "Ubuntu Clang 20", tag: "clang:20", toolchain: "clang-20", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "} | |
| # Note: clang-19 + Asan setup causes errors on some platforms. Temporary skip some checks via .asan_options. | |
| - {name: "Ubuntu Clang 19", tag: "clang:19", toolchain: "clang-19", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" ", asan_options: "new_delete_type_mismatch=0"} | |
| - {name: "Ubuntu Clang 18", tag: "clang:18", toolchain: "clang-18", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "} | |
| - {name: "Ubuntu Clang 17", tag: "clang:17", toolchain: "clang-17", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "} | |
| - {name: "Ubuntu GCC 14", tag: "gcc:14", toolchain: "gcc-14", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan;Gcov\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" ", coverage: true} | |
| - {name: "Ubuntu GCC 13", tag: "gcc:13", toolchain: "gcc-13", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "} | |
| - {name: "Ubuntu GCC 12", tag: "gcc:12", toolchain: "gcc-12", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| submodules: 'true' | |
| # If Clang 17, install a newer version of libc++ and libc++abi. | |
| - name: Update packages | |
| run: | | |
| set -x | |
| sudo apt update | |
| sudo apt -y upgrade | |
| - name: Install libc++ | |
| if: matrix.config.tag == 'clang:17' | |
| run: | | |
| set -x | |
| sudo apt-get install -y libc++-dev libc++1 libc++abi-dev libc++abi1 | |
| find /usr/lib/x86_64-linux-gnu/ -name libc++.so* || true | |
| - name: Install Gcovr | |
| if: matrix.config.coverage | |
| run: | | |
| set -x | |
| sudo apt-get install -y gcovr | |
| - name: CMake Configure | |
| run: | | |
| set -x | |
| echo ${{ matrix.config.cmake_args }} | |
| echo ${{ matrix.config.toolchain }} | |
| rm -rf .build | |
| cmake ${{ matrix.config.cmake_args }} \ | |
| -DCMAKE_INSTALL_PREFIX=.install \ | |
| -DCMAKE_TOOLCHAIN_FILE="etc/${{ matrix.config.toolchain }}-toolchain.cmake" \ | |
| -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="./cmake/use-fetch-content.cmake" \ | |
| -B .build \ | |
| -S . | |
| - name: CMake ASAN Build | |
| run: | | |
| set -x | |
| cmake --build .build --config Asan --target all_verify_interface_header_sets -- -k 0 | |
| cmake --build .build --config Asan --target all -- -k 0 | |
| - name: CMake ASAN Test | |
| run: | | |
| set -x | |
| [[ ! -z "${{ matrix.config.asan_options }}" ]] && export ASAN_OPTIONS="${{ matrix.config.asan_options }}" | |
| ctest --build-config Asan --output-on-failure --test-dir .build | |
| - name: CMake RWDI Build | |
| run: | | |
| set -x | |
| cmake --build .build --config RelWithDebInfo --target all_verify_interface_header_sets -- -k 0 | |
| cmake --build .build --config RelWithDebInfo --target all -- -k 0 | |
| - name: CMake RWDI Test | |
| run: | | |
| set -x | |
| ctest --build-config RelWithDebInfo --output-on-failure --test-dir .build | |
| - name: Install | |
| run: | | |
| set -x | |
| cmake --install .build --config RelWithDebInfo --component beman_optional_development --verbose | |
| - name: CMake Gcov Build | |
| if: matrix.config.coverage | |
| run: | | |
| set -x | |
| cmake --build .build --config Gcov --target all_verify_interface_header_sets -- -k 0 | |
| cmake --build .build --config Gcov --target all -- -k 0 | |
| - name: CMake Gcov Test | |
| if: matrix.config.coverage | |
| run: | | |
| set -x | |
| ctest --build-config Gcov --output-on-failure --test-dir .build | |
| - name: Generate Coverage | |
| if: matrix.config.coverage | |
| run: | | |
| set -x | |
| cmake --build .build --config Gcov --target process_coverage -- -k 0 | |
| - name: Coveralls | |
| if: matrix.config.coverage | |
| uses: coverallsapp/github-action@ba6dae83310bbd6d33ff77092650dc40bd444a2a # main | |
| with: | |
| file: .build/coverage.json | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| create-issue-when-fault: | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: failure() && github.event_name == 'schedule' | |
| permissions: | |
| contents: read | |
| issues: write | |
| steps: | |
| # See https://github.com/cli/cli/issues/5075 | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Create issue | |
| run: | | |
| issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] Build & Test failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end') | |
| body="**Build-and-Test Failure Report** | |
| - **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z') | |
| - **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) | |
| - **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| The scheduled build-and-test triggered by cron has failed. | |
| Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error." | |
| if [[ $issue_num -eq -1 ]]; then | |
| gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body" | |
| else | |
| gh issue comment --repo ${{ github.repository }} $issue_num --body "$body" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} |