Test Release Platforms #58
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
| # Tests for the platforms used by release builds | |
| name: Test Release Platforms | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| inputs: | |
| platform: | |
| description: 'Which platform to run (all, linux-x64, linux-arm64, macos-x64, macos-arm64, windows-x64)' | |
| required: false | |
| default: 'all' | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| build-and-test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| triplet: x64-linux | |
| platform: linux-x64 | |
| host_triplet: x64-linux | |
| target_triplet: x64-linux | |
| setup_cross_compile: false | |
| - os: ubuntu-latest | |
| triplet: arm64-linux | |
| platform: linux-arm64 | |
| host_triplet: x64-linux | |
| target_triplet: arm64-linux | |
| setup_cross_compile: true | |
| - os: macos-13 | |
| triplet: x64-osx | |
| platform: macos-x64 | |
| host_triplet: x64-osx | |
| target_triplet: x64-osx | |
| setup_cross_compile: false | |
| - os: macos-14 | |
| triplet: arm64-osx | |
| platform: macos-arm64 | |
| host_triplet: arm64-osx | |
| target_triplet: arm64-osx | |
| setup_cross_compile: false | |
| - os: windows-latest | |
| triplet: x64-windows | |
| platform: windows-x64 | |
| host_triplet: x64-windows | |
| target_triplet: x64-windows | |
| setup_cross_compile: false | |
| # Note: Step-level conditions below decide whether a matrix job executes | |
| steps: | |
| - name: Checkout code | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.platform == 'all' || matrix.platform == github.event.inputs.platform }} | |
| uses: actions/checkout@v4 | |
| - name: Setup Linux ARM64 cross-compilation | |
| if: ${{ (github.event_name != 'workflow_dispatch' || github.event.inputs.platform == 'all' || matrix.platform == github.event.inputs.platform) && matrix.setup_cross_compile == true && matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| - name: Set up CMake | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.platform == 'all' || matrix.platform == github.event.inputs.platform }} | |
| uses: jwlawson/actions-setup-cmake@v1 | |
| with: | |
| cmake-version: '3.27.x' | |
| - name: Set up Ninja | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.platform == 'all' || matrix.platform == github.event.inputs.platform }} | |
| uses: seanmiddleditch/gha-setup-ninja@v5 | |
| - name: Setup vcpkg | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.platform == 'all' || matrix.platform == github.event.inputs.platform }} | |
| uses: lukka/run-vcpkg@v11 | |
| with: | |
| vcpkgDirectory: ${{ github.workspace }}/../vcpkg | |
| - name: Configure with CMake | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.platform == 'all' || matrix.platform == github.event.inputs.platform }} | |
| run: | | |
| cmake --preset=vcpkg-release -DVCPKG_HOST_TRIPLET=${{ matrix.host_triplet }} -DVCPKG_TARGET_TRIPLET=${{ matrix.target_triplet }} | |
| env: | |
| CC: ${{ matrix.setup_cross_compile && 'aarch64-linux-gnu-gcc' || '' }} | |
| CXX: ${{ matrix.setup_cross_compile && 'aarch64-linux-gnu-g++' || '' }} | |
| - name: Build | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.platform == 'all' || matrix.platform == github.event.inputs.platform }} | |
| run: cmake --build build --preset release | |
| - name: Test (skip cross-compiled targets) | |
| if: ${{ (github.event_name != 'workflow_dispatch' || github.event.inputs.platform == 'all' || matrix.platform == github.event.inputs.platform) && matrix.setup_cross_compile != true }} | |
| working-directory: ${{ github.workspace }}/build | |
| run: | | |
| ctest -N -C ${{ env.BUILD_TYPE }} | |
| ctest -C ${{ env.BUILD_TYPE }} --output-on-failure | |