Test #98
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: Check-Build | |
| on: [push] | |
| jobs: | |
| build-driver: | |
| name: Build C++ driver (${{ matrix.os }} • ${{ matrix.preset }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Windows release presets | |
| - os: windows-latest | |
| preset: x64-release | |
| triplet: x64-windows-static | |
| vcpkgPkgs: "capnproto minhook" | |
| use_hooks: "ON" | |
| - os: windows-latest | |
| preset: x64-release-nohooks | |
| triplet: x64-windows-static | |
| vcpkgPkgs: "capnproto" | |
| use_hooks: "OFF" | |
| # Linux release preset | |
| - os: ubuntu-latest | |
| preset: linux-x64-release | |
| triplet: x64-linux | |
| vcpkgPkgs: "capnproto" | |
| use_hooks: "OFF" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Debug workspace and presets (Linux) | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| echo "Workspace: $GITHUB_WORKSPACE" | |
| pwd | |
| ls -la | |
| test -f CMakePresets.json || (echo 'Missing CMakePresets.json at workspace root' && exit 1) | |
| cmake --version | |
| cmake --list-presets | |
| - name: Debug workspace and presets (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| Write-Host "Workspace: $env:GITHUB_WORKSPACE" | |
| Get-Location | |
| Get-ChildItem -Force | Format-Table -AutoSize | |
| if (-not (Test-Path 'CMakePresets.json')) { Write-Error 'Missing CMakePresets.json at workspace root'; exit 1 } | |
| cmake --version | |
| cmake --list-presets | |
| - name: Set up Ninja (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ninja-build | |
| - name: Set up Ninja (cross-platform) | |
| uses: seanmiddleditch/gha-setup-ninja@v4 | |
| - name: Set up MSVC developer command prompt (Windows) | |
| if: runner.os == 'Windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Set up CMake | |
| uses: lukka/get-cmake@latest | |
| - name: Set up vcpkg | |
| id: runvcpkg | |
| uses: lukka/run-vcpkg@v11 | |
| with: | |
| vcpkgGitCommitId: 0d9d4684352ba8de70bdf251c6fc9a3c464fa12b | |
| - name: Install vcpkg packages (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $triplet = '${{ matrix.triplet }}' | |
| $pkgsRaw = '${{ matrix.vcpkgPkgs }}' | |
| $pkgs = $pkgsRaw -split '\s+' | Where-Object { $_ -and $_.Trim().Length -gt 0 } | |
| [string[]]$vcpkgArgs = @() | |
| foreach ($p in $pkgs) { $vcpkgArgs += ("$($p.Trim()):$triplet") } | |
| if ($vcpkgArgs.Count -eq 0) { Write-Host 'No vcpkg packages to install.' } else { & "$env:VCPKG_ROOT\vcpkg.exe" install @vcpkgArgs } | |
| - name: Install vcpkg packages (Linux) | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| triplet='${{ matrix.triplet }}' | |
| pkgs='${{ matrix.vcpkgPkgs }}' | |
| args="" | |
| for p in $pkgs; do args+="$p:$triplet "; done | |
| "$VCPKG_ROOT/vcpkg" install $args | |
| - name: Configure (CMake preset) | |
| working-directory: ${{ github.workspace }} | |
| run: >- | |
| cmake | |
| --preset "${{ matrix.preset }}" | |
| -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" | |
| -DUSE_HOOKS=${{ matrix.use_hooks }} | |
| - name: Build (CMake preset) | |
| working-directory: ${{ github.workspace }} | |
| run: cmake --build "out/build/${{ matrix.preset }}" --parallel | |
| - name: Upload driver pack artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: driver_${{ matrix.preset }}_${{ runner.os }} | |
| path: | | |
| out/build/${{ matrix.preset }}/driver_Amethyst/Pack/** | |
| if-no-files-found: error | |
| package-all: | |
| name: Package plugin + all drivers (single zip) | |
| needs: build-driver | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Download all driver artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: driver_* | |
| path: drivers | |
| merge-multiple: true | |
| - name: Merge driver outputs into out/build | |
| shell: pwsh | |
| run: | | |
| $presets = @('x64-release','x64-release-nohooks','linux-x64-release') | |
| foreach ($p in $presets) { | |
| $src = Join-Path 'drivers' 'out/build' $p | |
| if (Test-Path $src) { | |
| $dst = Join-Path 'out/build' $p | |
| New-Item -ItemType Directory -Force -Path $dst | Out-Null | |
| Copy-Item -Recurse -Force (Join-Path $src '*') $dst | |
| } | |
| } | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Restore and build (publish) | |
| run: dotnet publish /p:Configuration=Release /p:TargetFramework=net8.0 /p:PublishProfile=FolderProfile | |
| - name: Pack published files | |
| run: | | |
| cd plugin_OpenVR/bin/Release/publish | |
| 7z a plugin_OpenVR.zip * | |
| - name: Upload plugin artifact | |
| uses: "marvinpinto/action-automatic-releases@latest" | |
| with: | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| automatic_release_tag: "ame2-latest" | |
| prerelease: true | |
| title: "plugin_OpenVR Build Artifact" | |
| files: | | |
| ./plugin_OpenVR/bin/Release/publish/plugin_OpenVR.zip | |
| ./external/manifest.json |