|
| 1 | +name: SimpleEngine CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'attachments/simple_engine/**' |
| 7 | + - '.github/workflows/simple_engine_ci.yml' |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - 'attachments/simple_engine/**' |
| 11 | + - '.github/workflows/simple_engine_ci.yml' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + desktop: |
| 16 | + name: Build (${{ matrix.os }}) |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + os: [ubuntu-latest, windows-latest] |
| 22 | + |
| 23 | + defaults: |
| 24 | + run: |
| 25 | + working-directory: attachments/simple_engine |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Set up MSVC dev environment |
| 32 | + if: runner.os == 'Windows' |
| 33 | + uses: ilammy/msvc-dev-cmd@v1 |
| 34 | + |
| 35 | + - name: Set up Ninja |
| 36 | + if: runner.os == 'Windows' |
| 37 | + uses: seanmiddleditch/gha-setup-ninja@v5 |
| 38 | + |
| 39 | + - name: Install Vulkan SDK (Windows) |
| 40 | + if: runner.os == 'Windows' |
| 41 | + shell: pwsh |
| 42 | + run: | |
| 43 | + if (Test-Path "C:\VulkanSDK") { |
| 44 | + Write-Host "Using cached Vulkan SDK" |
| 45 | + } else { |
| 46 | + Write-Host "Downloading Vulkan SDK installer..." |
| 47 | + choco install -y aria2 |
| 48 | + aria2c --split=8 --max-connection-per-server=8 --min-split-size=1M --dir="$env:TEMP" --out="vulkan-sdk.exe" "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" |
| 49 | + Write-Host "Installing Vulkan SDK (minimal components)..." |
| 50 | + Start-Process -FilePath "$env:TEMP\vulkan-sdk.exe" -ArgumentList "--accept-licenses --default-answer --confirm-command install --components VulkanRT,VulkanSDK64,VulkanDXC,VulkanTools" -Wait -NoNewWindow |
| 51 | + } |
| 52 | +
|
| 53 | + $vulkanPath = "" |
| 54 | + if (Test-Path "C:\VulkanSDK") { |
| 55 | + $vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName |
| 56 | + } |
| 57 | + if (-not $vulkanPath) { |
| 58 | + throw "Vulkan SDK not found after install" |
| 59 | + } |
| 60 | +
|
| 61 | + "VULKAN_SDK=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
| 62 | + "$vulkanPath\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 63 | + "CMAKE_PREFIX_PATH=$vulkanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
| 64 | + "Vulkan_INCLUDE_DIR=$vulkanPath\Include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
| 65 | + "Vulkan_LIBRARY=$vulkanPath\Lib\vulkan-1.lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
| 66 | +
|
| 67 | + - name: Install Linux prerequisites |
| 68 | + if: runner.os == 'Linux' |
| 69 | + run: | |
| 70 | + sudo apt-get update |
| 71 | + sudo apt-get install -y ninja-build libvulkan-dev \ |
| 72 | + libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev |
| 73 | +
|
| 74 | + - name: Set up vcpkg (manifest) |
| 75 | + id: runvcpkg |
| 76 | + uses: lukka/run-vcpkg@v11 |
| 77 | + with: |
| 78 | + vcpkgJsonGlob: 'attachments/simple_engine/vcpkg.json' |
| 79 | + runVcpkgInstall: true |
| 80 | + |
| 81 | + - name: Configure |
| 82 | + run: > |
| 83 | + cmake -S . -B build -G Ninja |
| 84 | + -DCMAKE_BUILD_TYPE=Release |
| 85 | + -DCMAKE_TOOLCHAIN_FILE="${{ steps.runvcpkg.outputs.vcpkgRootDir }}/scripts/buildsystems/vcpkg.cmake" |
| 86 | +
|
| 87 | + - name: Build |
| 88 | + run: cmake --build build --target SimpleEngine --parallel 4 |
0 commit comments