# Reusable: unit + integration tests on all platforms name: Test on: workflow_call: inputs: skip_perf: description: 'Skip incremental perf tests (phases 2-7)' type: boolean default: true broad_platforms: description: 'Test the broad platform matrix (older glibc + extra OS versions) instead of the core set' type: boolean default: false permissions: contents: read jobs: # Emit the platform matrices as JSON. The CORE set is the default (fast, # unchanged); the BROAD set adds extra free runners (older glibc / # additional OS versions) for a wider "does it build everywhere" picture. setup-matrix: runs-on: ubuntu-latest timeout-minutes: 5 outputs: unix: ${{ steps.set.outputs.unix }} windows: ${{ steps.set.outputs.windows }} steps: - name: Compute matrices id: set env: BROAD: ${{ inputs.broad_platforms }} run: | CORE_UNIX='[ {"os":"ubuntu-latest","cc":"gcc","cxx":"g++"}, {"os":"ubuntu-24.04-arm","cc":"gcc","cxx":"g++"}, {"os":"macos-14","cc":"cc","cxx":"c++"}, {"os":"macos-15-intel","cc":"cc","cxx":"c++"} ]' BROAD_UNIX='[ {"os":"ubuntu-22.04","cc":"gcc","cxx":"g++","optional":true}, {"os":"ubuntu-22.04-arm","cc":"gcc","cxx":"g++","optional":true}, {"os":"macos-15","cc":"cc","cxx":"c++","optional":true} ]' CORE_WIN='[{"os":"windows-latest"}]' BROAD_WIN='[{"os":"windows-2025","optional":true},{"os":"windows-11-arm","optional":true}]' if [ "$BROAD" = "true" ]; then UNIX=$(jq -cn --argjson a "$CORE_UNIX" --argjson b "$BROAD_UNIX" '$a + $b') WIN=$(jq -cn --argjson a "$CORE_WIN" --argjson b "$BROAD_WIN" '$a + $b') else UNIX=$(jq -cn --argjson a "$CORE_UNIX" '$a') WIN=$(jq -cn --argjson a "$CORE_WIN" '$a') fi echo "unix={\"include\":$UNIX}" >> "$GITHUB_OUTPUT" echo "windows={\"include\":$WIN}" >> "$GITHUB_OUTPUT" test-unix: needs: setup-matrix strategy: fail-fast: false matrix: ${{ fromJSON(needs.setup-matrix.outputs.unix) }} runs-on: ${{ matrix.os }} # Broad-only legs (extra OS versions) are informational: visible but # non-blocking, so a flaky/less-common runner can't block a release. continue-on-error: ${{ matrix.optional == true }} timeout-minutes: 60 steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - name: Install deps (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: sudo apt-get update && sudo apt-get install -y zlib1g-dev - name: Test run: scripts/test.sh CC=${{ matrix.cc }} CXX=${{ matrix.cxx }} env: CBM_SKIP_PERF: ${{ inputs.skip_perf && '1' || '' }} test-windows: needs: setup-matrix strategy: fail-fast: false matrix: ${{ fromJSON(needs.setup-matrix.outputs.windows) }} runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.optional == true }} timeout-minutes: 60 steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2 with: msystem: CLANG64 path-type: inherit install: >- mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-compiler-rt mingw-w64-clang-x86_64-zlib make git - name: Test shell: msys2 {0} run: scripts/test.sh CC=clang CXX=clang++ env: CBM_SKIP_PERF: ${{ inputs.skip_perf && '1' || '' }}