diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b85d44..db99ef9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,23 +9,47 @@ on: - main jobs: - build: + build-debug: + name: Build Debug runs-on: [self-hosted, DESKTOP-N792BI5] - + steps: - name: Checkout repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup vcpkg uses: lukka/run-vcpkg@v11 with: vcpkgJsonGlob: 'vcpkg.json' + useVcpkgInstallArtifactCaching: true - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 + - name: Install Chocolatey and Ninja + shell: powershell + run: | + # Ensure running as administrator + if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { + Write-Error "This script must be run as Administrator!" + exit 1 + } + + # Install Chocolatey + Set-ExecutionPolicy Bypass -Scope Process -Force + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + + # Refresh environment variables to make choco available + $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") + + # Install Ninja + & choco install ninja -y + - name: Configure CMake (Debug) - run: cmake --preset debug -G "Visual Studio 17 2022" -DBUILD_DOC=OFF -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=OFF -DBUILD_GRPC=ON + run: cmake --preset debug -DBUILD_DOC=OFF -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=OFF -DBUILD_GRPC=ON -G "Visual Studio 17 2022" env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg @@ -37,7 +61,68 @@ jobs: with: name: panoptes-debug path: | - build/debug/**/*.dll - build/debug/**/*.exe - build/debug/**/*.pdb + bin/Debug/**/*.dll + bin/Debug/**/*.exe + bin/Debug/**/*.pdb + bin/tests/Debug/**/*.exe + bin/tests/Debug/**/*.pdb + if-no-files-found: warn + + build-release: + name: Build Release + runs-on: [self-hosted, DESKTOP-N792BI5] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgJsonGlob: 'vcpkg.json' + useVcpkgInstallArtifactCaching: true + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Install Chocolatey and Ninja + shell: powershell + run: | + # Ensure running as administrator + if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { + Write-Error "This script must be run as Administrator!" + exit 1 + } + + # Install Chocolatey + Set-ExecutionPolicy Bypass -Scope Process -Force + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + + # Refresh environment variables to make choco available + $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") + + # Install Ninja + & choco install ninja -y + + - name: Configure CMake (Release) + run: cmake --preset release -DBUILD_DOC=OFF -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=OFF -DBUILD_GRPC=ON -G "Visual Studio 17 2022" + env: + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + + - name: Build (Release) + run: msbuild build/release/Panoptes.sln /p:Configuration=Release /p:Platform=x64 /m + + - name: Upload Release Artifacts + uses: actions/upload-artifact@v4 + with: + name: panoptes-release + path: | + bin/Release/**/*.dll + bin/Release/**/*.exe + bin/Release/**/*.pdb + bin/tests/Release/**/*.exe + bin/tests/Release/**/*.pdb if-no-files-found: warn