@@ -3,50 +3,151 @@ name: Check-Build
33on: [push]
44
55jobs:
6- build:
7-
8- runs-on: windows-latest
6+ build-driver :
7+ name: Build C++ driver (${{ matrix.os }} • ${{ matrix.preset }})
8+ runs-on: ${{ matrix.os }}
99 strategy:
10+ fail-fast: false
1011 matrix:
11- dotnet-version: ['7.0.203' ]
12+ include:
13+ # Windows release presets
14+ - os: windows-latest
15+ preset: x64-release
16+ triplet: x64-windows-static
17+ vcpkgPkgs: "capnproto minhook"
18+ use_hooks: "ON"
19+ - os: windows-latest
20+ preset: x64-release-nohooks
21+ triplet: x64-windows-static
22+ vcpkgPkgs: "capnproto"
23+ use_hooks: "OFF"
24+ # Linux release preset
25+ - os: ubuntu-latest
26+ preset: linux-x64-release
27+ triplet: x64-linux
28+ vcpkgPkgs: "capnproto"
29+ use_hooks: "OFF"
1230
1331 steps:
14- - uses: actions/checkout@v3
15- with:
32+ - name: Checkout
33+ uses: actions/checkout@v4
34+ with:
1635 submodules: true
1736
18- - uses: actions/setup-dotnet@v3
37+ - name: Set up Ninja (Linux)
38+ if: runner.os == 'Linux'
39+ run: |
40+ sudo apt-get update
41+ sudo apt-get install -y ninja-build
42+
43+ - name: Set up Ninja (cross-platform)
44+ uses: seanmiddleditch/gha-setup-ninja@v4
45+
46+ - name: Set up MSVC developer command prompt (Windows)
47+ if: runner.os == 'Windows'
48+ uses: ilammy/msvc-dev-cmd@v1
49+
50+ - name: Set up CMake
51+ uses: lukka/get-cmake@latest
52+
53+ - name: Set up vcpkg
54+ id: runvcpkg
55+ uses: lukka/run-vcpkg@v11
1956 with:
20- dotnet-version: '7.0.203'
21-
22- - name: Add MSBuild to PATH
23- 57+ vcpkgGitCommitId: 0d9d4684352ba8de70bdf251c6fc9a3c464fa12b
2458
25- - name: Build the OpenVR Emulation driver
59+ - name: Install vcpkg packages (Windows)
60+ if: runner.os == 'Windows'
61+ shell: pwsh
2662 run: |
27- nuget restore
28- msbuild /restore /p:Platform=x64 /p:PlatformTarget=x64 /p:Configuration=Release /p:RuntimeIdentifier=win-x64 /t:driver_00Amethyst
29-
30- - name: Build the OpenVR driver
63+ $triplet = '${{ matrix.triplet }}'
64+ $pkgsRaw = '${{ matrix.vcpkgPkgs }}'
65+ $pkgs = $pkgsRaw -split '\s+' | Where-Object { $_ -and $_.Trim().Length -gt 0 }
66+ [string[]]$vcpkgArgs = @()
67+ foreach ($p in $pkgs) { $vcpkgArgs += ("$($p.Trim()):$triplet") }
68+ if ($vcpkgArgs.Count -eq 0) { Write-Host 'No vcpkg packages to install.' } else { & "$env:VCPKG_ROOT\vcpkg.exe" install @vcpkgArgs }
69+
70+ - name: Install vcpkg packages (Linux)
71+ if: runner.os == 'Linux'
72+ shell: bash
3173 run: |
32- nuget restore
33- msbuild /restore /p:Platform=x64 /p:PlatformTarget=x64 /p:Configuration=Release /p:RuntimeIdentifier=win-x64 /t:driver_Amethyst
34-
35- - name: Restore and build (publish)
36- run: msbuild /restore /p:Platform=x64 /p:PlatformTarget=x64 /p:Configuration=Release /p:RuntimeIdentifier=win-x64 /t:plugin_OpenVR:Publish /p:PublishProfile=plugin_OpenVR\Properties\PublishProfiles\FolderProfile.pubxml
74+ set -euo pipefail
75+ triplet='${{ matrix.triplet }}'
76+ pkgs='${{ matrix.vcpkgPkgs }}'
77+ args=""
78+ for p in $pkgs; do args+="$p:$triplet "; done
79+ "$VCPKG_ROOT/vcpkg" install $args
80+
81+ - name: Configure (CMake preset)
82+ working-directory: ${{ github.workspace }}
83+ run: >-
84+ cmake
85+ --preset "${{ matrix.preset }}"
86+ -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake"
87+ -DUSE_HOOKS=${{ matrix.use_hooks }}
88+
89+ - name: Build (CMake preset)
90+ working-directory: ${{ github.workspace }}
91+ run: cmake --build --preset "${{ matrix.preset }}" --parallel
92+
93+ - name: Upload driver pack artifact
94+ uses: actions/upload-artifact@v4
95+ with:
96+ name: driver_${{ matrix.preset }}_${{ runner.os }}
97+ path: |
98+ out/build/${{ matrix.preset }}/driver_Amethyst/Pack/**
99+ if-no-files-found: error
100+
101+ package-all:
102+ name: Package plugin + all drivers (single zip)
103+ needs: build-driver
104+ runs-on: windows-latest
105+ steps:
106+ - name: Checkout
107+ uses: actions/checkout@v4
108+ with:
109+ submodules: true
110+
111+ - name: Download all driver artifacts
112+ uses: actions/download-artifact@v4
113+ with:
114+ pattern: driver_*
115+ path: drivers
116+ merge-multiple: true
117+
118+ - name: Merge driver outputs into out/build
119+ shell: pwsh
120+ run: |
121+ $presets = @('x64-release','x64-release-nohooks','linux-x64-release')
122+ foreach ($p in $presets) {
123+ $src = Join-Path 'drivers' 'out/build' $p
124+ if (Test-Path $src) {
125+ $dst = Join-Path 'out/build' $p
126+ New-Item -ItemType Directory -Force -Path $dst | Out-Null
127+ Copy-Item -Recurse -Force (Join-Path $src '*') $dst
128+ }
129+ }
37130
131+ - name: Set up .NET
132+ uses: actions/setup-dotnet@v3
133+ with:
134+ dotnet-version: '10.0.x'
135+
136+ - name: Restore and build (publish)
137+ run: dotnet publish /p:Configuration=Release /p:TargetFramework=net8.0 /p:PublishProfile=FolderProfile
138+
38139 - name: Pack published files
39140 run: |
40- cd plugin_OpenVR/bin/Release/net8.0/win-x64/ publish
141+ cd plugin_OpenVR/bin/Release/publish
41142 7z a plugin_OpenVR.zip *
42-
143+
43144 - name: Upload plugin artifact
44145 uses: "marvinpinto/action-automatic-releases@latest"
45146 with:
46147 repo_token: "${{ secrets.GITHUB_TOKEN }}"
47- automatic_release_tag: "latest"
148+ automatic_release_tag: "ame2- latest"
48149 prerelease: true
49150 title: "plugin_OpenVR Build Artifact"
50151 files: |
51- ./plugin_OpenVR/bin/Release/net8.0/win-x64/ publish/plugin_OpenVR.zip
52- ./external/manifest.json
152+ ./plugin_OpenVR/bin/Release/publish/plugin_OpenVR.zip
153+ ./external/manifest.json
0 commit comments