Update README.md #107
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
| # https://docs.github.com/en/actions | |
| name: build_test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| BUILD_TYPE: Debug | |
| jobs: | |
| test: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: ${{ matrix.timeout || 4 }} | |
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: ubuntu-gcc | |
| os: ubuntu-latest | |
| test: ./bin/test | |
| - name: ubuntu-clang | |
| os: ubuntu-latest | |
| args: '-DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread"' | |
| test: ./bin/test | |
| - name: ubuntu-clang-msan | |
| os: ubuntu-latest | |
| timeout: 10 | |
| args: '-DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=memory"' | |
| test: ./bin/test | |
| msan-options: abort_on_error=1:halt_on_error=1 | |
| - name: macos | |
| os: macos-latest | |
| args: -DBOX3D_SANITIZE=ON | |
| test: ./bin/test | |
| # Pure MSVC cannot build the fixed-point core (no __int128); all | |
| # Windows coverage uses clang-cl. No Windows ASan: clang-cl rejects | |
| # /MTd with -fsanitize=address, and macos/ubuntu cover sanitizers. | |
| # Fixed3D is width-4 SIMD only, so this covers the clang-cl toolchain, not AVX2. | |
| - name: windows-clang-cl | |
| os: windows-latest | |
| msvc: true | |
| args: -T ClangCL | |
| test: ./bin/Debug/test | |
| - name: windows-arm64 | |
| os: windows-11-arm | |
| # No ASan here: arm64 clang-cl rejects /MTd with -fsanitize=address | |
| args: -A arm64 -T ClangCL -DBOX3D_DISABLE_SIMD=TRUE | |
| test: ./bin/Debug/test | |
| # GitHub runners are not guaranteed AVX-512 hardware, so this job | |
| # promises compile coverage only and runs the suite opportunistically | |
| # when the runner happens to support the ISA. RelWithDebInfo (the | |
| # trailing -D wins over the env BUILD_TYPE) also exercises the LTO | |
| # default on clang. | |
| - name: ubuntu-clang-avx512 | |
| os: ubuntu-latest | |
| args: '-DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DBOX3D_AVX512=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo' | |
| test: 'sh -c "if grep -q avx512dq /proc/cpuinfo; then ./bin/test; else echo runner lacks AVX-512, compile-only; fi"' | |
| # 128-bit world positions: build the wide b3Pos path under Debug+VALIDATE | |
| # and ASan/UBSan (the int128 boundary, wire, and lerp reformulation are | |
| # exercised here) so it cannot silently regress as upstream ports land. | |
| # Carries its own determinism golden; OFF coverage is every other job. | |
| - name: ubuntu-wide-positions | |
| os: ubuntu-latest | |
| timeout: 10 | |
| args: '-DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DBOX3D_WIDE_POSITIONS=ON -DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"' | |
| test: ./bin/test | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup MSVC dev command prompt | |
| if: ${{ matrix.msvc }} | |
| uses: TheMrMilchmann/setup-msvc-dev@v4 | |
| with: | |
| arch: x64 | |
| - name: Configure CMake | |
| run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON ${{ matrix.args }} | |
| - name: Build | |
| run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
| - name: Test | |
| working-directory: ${{github.workspace}}/build | |
| env: | |
| MSAN_OPTIONS: ${{ matrix['msan-options'] || '' }} | |
| run: ${{ matrix.test }} | |
| # mingw needs some extra setup so keeping it separate from the matrix. | |
| build-windows-mingw: | |
| name: windows-mingw | |
| runs-on: windows-latest | |
| timeout-minutes: 4 | |
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup MSYS2 UCRT64 | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: UCRT64 | |
| update: true | |
| install: >- | |
| mingw-w64-ucrt-x86_64-gcc | |
| mingw-w64-ucrt-x86_64-cmake | |
| mingw-w64-ucrt-x86_64-ninja | |
| - name: Configure CMake | |
| run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
| - name: Build | |
| run: cmake --build build --config ${{env.BUILD_TYPE}} | |
| - name: Test | |
| working-directory: build | |
| run: ./bin/test | |
| # Build-only: running the wasm test needs a node + pthread/SharedArrayBuffer harness. | |
| # This still catches compile breaks in the box3d library and the test target. | |
| emscripten: | |
| name: emscripten | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 8 | |
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: mymindstorm/setup-emsdk@v14 | |
| - name: Configure CMake | |
| run: emcmake cmake -B build -DCMAKE_BUILD_TYPE=Debug -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON | |
| - name: Build | |
| run: cmake --build build --config Debug | |
| samples: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| # macOS runners: the Release sample build plus the 102-TU conversion audit runs | |
| # ~8+ min and was intermittently killed at the old 8-minute cap (a 8m21s run | |
| # tripped it). Headroom, not a hang — the audit is bounded and exits on findings. | |
| timeout-minutes: 15 | |
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: samples-ubuntu-gcc-static | |
| os: ubuntu-latest | |
| linux-deps: true | |
| args: -DBUILD_SHARED_LIBS=OFF | |
| - name: samples-macos-static | |
| os: macos-latest | |
| # This entry also runs the fixed/float conversion audit: it needs a | |
| # clang compile database (AppleClang here), which the export flag emits. | |
| args: -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
| conversion-audit: true | |
| - name: samples-macos-dynamic | |
| os: macos-latest | |
| args: -DBUILD_SHARED_LIBS=ON | |
| - name: samples-windows-static | |
| os: windows-latest | |
| msvc: true | |
| args: -T ClangCL -DBUILD_SHARED_LIBS=OFF | |
| - name: samples-windows-dynamic | |
| os: windows-latest | |
| msvc: true | |
| args: -T ClangCL -DBUILD_SHARED_LIBS=ON | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup MSVC dev command prompt | |
| if: ${{ matrix.msvc }} | |
| uses: TheMrMilchmann/setup-msvc-dev@v4 | |
| with: | |
| arch: x64 | |
| # sokol_app needs X11/Xi/Xcursor + GL, the file dialog needs GTK3. | |
| - name: Install Linux sample dependencies | |
| if: ${{ matrix['linux-deps'] }} | |
| run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev libx11-dev libxi-dev libxcursor-dev libgtk-3-dev | |
| - name: Configure CMake | |
| run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBOX3D_SAMPLES=ON -DBOX3D_UNIT_TESTS=OFF ${{ matrix.args }} | |
| - name: Build | |
| run: cmake --build ${{github.workspace}}/build --config Release | |
| # Type-aware audit of every b3Fixed<->float/int conversion in consumer code | |
| # (exits 1 on findings). Catches the silent-truncation bug classes that | |
| # -Wfloat-conversion cannot see; clang-only, hence the macos entry. | |
| - name: Conversion audit | |
| if: ${{ matrix['conversion-audit'] }} | |
| run: python3 tools/fixed-point/conversion_audit.py --db ${{github.workspace}}/build/compile_commands.json |