Merge pull request #2610 from lewri/068-b2ORrc1 #44
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-ignore: | |
- 'gh-pages' | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
preset: | |
description: 'Select CMake preset' | |
default: 'win-x64-rel' | |
type: choice | |
options: | |
- win-dev | |
- win-x64-rel | |
- win-x86-rel | |
animview: | |
description: 'Build AnimView?' | |
default: 'false' | |
type: boolean | |
pr: | |
description: 'Build this PR (optional)' | |
type: number | |
jobs: | |
Windows: | |
runs-on: windows-2022 | |
env: | |
PRESET: ${{inputs.preset || 'win-x64-rel'}} | |
ANIMVIEW: ${{inputs.animview && 'ON' || 'OFF'}} | |
NAME: CorsixTH${{inputs.animview && '_and_AnimView' || ''}}${{inputs.preset == 'win-x86-rel' && '_x86' || ''}} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout selected PR | |
env: | |
GH_TOKEN: ${{github.token}} | |
if: inputs.PR | |
run: gh pr checkout --repo CorsixTH/CorsixTH ${{inputs.pr}} | |
- name: Get CMake | |
uses: lukka/[email protected] | |
- name: Setup vcpkg | |
uses: lukka/run-vcpkg@v11 | |
with: | |
vcpkgGitCommitId: 'a1212c93cabaa9c5c36c1ffdb4bddd59fdf31e43' | |
- name: Run CMake dev configure | |
if: inputs.PRESET == 'win-dev' | |
uses: lukka/run-cmake@v10 | |
with: | |
configurePreset: 'win-dev' | |
- name: Run CMake release build | |
if: inputs.PRESET != 'win-dev' | |
uses: lukka/run-cmake@v10 | |
with: | |
configurePreset: ${{env.PRESET}} | |
configurePresetAdditionalArgs: "['-DBUILD_ANIMVIEW=${{env.ANIMVIEW}}', | |
'-DCMAKE_INSTALL_PREFIX=build/${{env.PRESET}}/CorsixTH/RelWithDebInfo/']" | |
buildPreset: ${{env.PRESET}} | |
buildPresetAdditionalArgs: "['--verbose', '--target install']" | |
testPreset: ${{env.PRESET}} | |
- name: Download soundfont | |
if: inputs.PRESET != 'win-dev' | |
run: | | |
aria2c -d "build/${{env.PRESET}}/CorsixTH/RelWithDebInfo" \ | |
https://raw.githubusercontent.com/Jacalz/fluid-soundfont/master/SF3/FluidR3.sf3 | |
- name: Copy data files for archive | |
if: inputs.PRESET != 'win-dev' | |
run: | | |
cp -r build/${{env.PRESET}}/. . | |
cp -Ru CorsixTH/RelWithDebInfo/CorsixTH/. CorsixTH/RelWithDebInfo/ | |
rm -rf CorsixTH/RelWithDebInfo/CorsixTH/ | |
if [ "${{inputs.animview}}" == "true" ]; then | |
mkdir -p artifact | |
mv AnimView/RelWithDebInfo artifact/AnimView | |
mv CorsixTH/RelWithDebInfo artifact/CorsixTH | |
else | |
mv CorsixTH/RelWithDebInfo artifact | |
fi | |
ls -R artifact | |
- name: Upload build | |
if: inputs.PRESET != 'win-dev' | |
uses: actions/upload-artifact@v4 | |
with: | |
path: artifact | |
name: ${{env.NAME}} |