|
| 1 | +name: windows-build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: windows-latest |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - arch: x64 |
| 15 | + cmake_platform: x64 |
| 16 | + configuration: Release |
| 17 | + - arch: x86 |
| 18 | + cmake_platform: Win32 |
| 19 | + configuration: Release |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + - name: Cache CMake deps |
| 23 | + uses: actions/cache@v4 |
| 24 | + with: |
| 25 | + path: Projects/VS/_deps |
| 26 | + key: ${{ runner.os }}-${{ matrix.arch }}-cmake-deps-${{ hashFiles('CMakeLists.txt') }} |
| 27 | + - name: Configure |
| 28 | + run: cmake -S . -B Projects/VS -G "Visual Studio 17 2022" -A ${{ matrix.cmake_platform }} |
| 29 | + - name: Build |
| 30 | + run: cmake --build Projects/VS --config ${{ matrix.configuration }} |
| 31 | + - name: Test |
| 32 | + shell: pwsh |
| 33 | + run: | |
| 34 | + New-Item -ItemType Directory -Path C:\built -Force | Out-Null |
| 35 | + Set-Location C:\built |
| 36 | + git clone --single-branch https://github.com/OpenFodder/data.git . |
| 37 | + git clone https://github.com/OpenFodder/tests.git Tests |
| 38 | + Copy-Item "$env:GITHUB_WORKSPACE\Run\openfodder.exe" -Destination C:\built -Force |
| 39 | + Copy-Item "$env:GITHUB_WORKSPACE\Run\SDL3.dll" -Destination C:\built -Force |
| 40 | + Copy-Item "$env:GITHUB_WORKSPACE\Run\SDL3_mixer.dll" -Destination C:\built -Force |
| 41 | + .\openfodder.exe --appveyor --unit-test-headless |
| 42 | + - name: Package |
| 43 | + shell: pwsh |
| 44 | + run: | |
| 45 | + $archive = "OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest.zip" |
| 46 | + $items = @( |
| 47 | + "$env:GITHUB_WORKSPACE\Run\openfodder.exe", |
| 48 | + "$env:GITHUB_WORKSPACE\Run\SDL3.dll", |
| 49 | + "$env:GITHUB_WORKSPACE\Run\SDL3_mixer.dll", |
| 50 | + "$env:GITHUB_WORKSPACE\README.md", |
| 51 | + "$env:GITHUB_WORKSPACE\COPYING", |
| 52 | + "$env:GITHUB_WORKSPACE\openfodder.ini.example" |
| 53 | + ) |
| 54 | + if (Test-Path $archive) { Remove-Item $archive -Force } |
| 55 | + Compress-Archive -Path $items -DestinationPath $archive |
| 56 | + - name: Upload artifact |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest |
| 60 | + path: OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest.zip |
0 commit comments