Update actions/cache action to v4.2.0 #231
This file contains 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: Windows | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
windows-test-build-release: | |
runs-on: windows-latest | |
steps: | |
- name: Setup | |
uses: compnerd/[email protected] | |
with: | |
branch: swift-5.10-release | |
tag: 5.10-RELEASE | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Cache vcpkg | |
uses: actions/[email protected] | |
with: | |
key: windows-x64-vcpkg | |
path: C:\vcpkg\installed\x64-windows | |
- name: Build & Test | |
shell: pwsh | |
run: | | |
vcpkg integrate powershell | |
# install dependencies | |
vcpkg install sdl2[core,vulkan] --recurse --triplet x64-windows --no-print-usage | |
vcpkg install pkgconf --triplet x64-windows --no-print-usage | |
# setup pkgconf environment | |
$env:Path += ";C:\vcpkg\installed\x64-windows\tools\pkgconf\" | |
$env:PKG_CONFIG_PATH = "C:\vcpkg\installed\x64-windows\lib\pkgconfig\" | |
# generate windows header | |
$includedir = (pkgconf --variable includedir sdl2).Trim() | |
Write-Output ('#include "' + $includedir + '/SDL2/SDL.h"') > Sources/CSDL2/windows_generated.h | |
Write-Output ('#include "' + $includedir + '/SDL2/SDL_vulkan.h"') >> Sources/CSDL2/windows_generated.h | |
# build | |
swift build | |
# copy SDL libraries | |
$bindir = ((pkgconf --variable exec_prefix sdl2).Trim() + "/bin") | |
$libdir = (pkgconf --variable libdir sdl2).Trim() | |
foreach ($config in "debug", "release") { | |
$path = ".build/$config" | |
if (Test-Path -Path $path) { | |
Copy-Item ($bindir + '/SDL2.dll') $path | |
Copy-Item ($libdir + '/SDL2.lib') $path | |
} | |
} | |
# test | |
swift test | |
- name: Upload artifacts | |
if: always() | |
uses: actions/[email protected] | |
with: | |
name: test-artifacts-windows-${{ github.run_id }} | |
path: | | |
.build/*.yaml | |
.build/*.xml | |
.build/*.json | |
.build/*.txt | |
.build/**/*.json | |
.build/**/*.txt | |
.build/**/*.a | |
.build/**/*.lib | |
.build/**/*.pdb | |
.build/**/*.dSYM | |
.build/**/*.gdb | |
.build/**/*.xctest | |
.build/**/*.bundle | |
.build/**/MetalApp | |
.build/**/Minimal | |
if-no-files-found: warn | |
include-hidden-files: true |