Dropped Lod::readRaw, resolved a related TODO #1951
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: | |
pull_request: null | |
workflow_dispatch: | |
inputs: | |
myCommit: | |
description: Commit SHA1 | |
required: false | |
default: '' | |
type: string | |
releaseTag: | |
description: Release tag | |
required: false | |
default: '' | |
type: string | |
workflow_call: | |
inputs: | |
myCommit: | |
description: Commit SHA1 | |
required: false | |
default: '' | |
type: string | |
releaseTag: | |
description: Release tag | |
required: false | |
default: '' | |
type: string | |
push: null | |
release: | |
types: | |
- published | |
jobs: | |
build_windows: | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false | |
matrix: | |
configuration: | |
- Debug | |
- Release | |
architecture: | |
- x86 | |
- x86_64 | |
steps: | |
# Checkout Code | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
ref: '${{ inputs.myCommit }}' | |
# Data cache is created by Populate Data Cache build. | |
- name: Restore data cache | |
id: restore-data-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
OpenEnroth_GameData | |
key: data-cache | |
enableCrossOsArchive: true | |
# If datacache is restored than we will be running gametest and need shaders. | |
- name: Copy shaders | |
if: steps.restore-data-cache.outputs.cache-hit == 'true' | |
run: | | |
xcopy resources OpenEnroth_GameData\mm7 /E/H/C/I | |
# Setup the MSVC build enviroment | |
- name: Setup environment | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: '${{matrix.architecture}}' | |
# Restore ccache file from cache if possible so we don't have to download it. | |
- name: Restore cached ccache | |
id: ccache-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: 'C:\ProgramData\chocolatey\lib\ccache\' | |
key: windows-ccache | |
# Chocolatey uses shims so create the shim if we used the cached ccache exe | |
- name: Add ccache shim | |
if: steps.ccache-cache.outputs.cache-hit == 'true' | |
run: | | |
C:\ProgramData\chocolatey\tools\shimgen.exe -o=C:\ProgramData\chocolatey\bin\ccache.exe -p=C:\ProgramData\chocolatey\lib\ccache\tools\ccache-4.8.2-windows-x86_64\ccache.exe | |
# If ccache can't be restored from cache upgrade it | |
- name: Update ccache | |
if: steps.ccache-cache.outputs.cache-hit != 'true' | |
run: | | |
choco upgrade ccache --version=4.8.2 | |
# If ccache can't be restored from cache after upgrade cache it | |
- name: Save ccache to cache | |
if: steps.ccache-cache.outputs.cache-hit != 'true' | |
id: check-for-ccache-save | |
uses: actions/cache/save@v3 | |
with: | |
path: 'C:\ProgramData\chocolatey\lib\ccache\' | |
key: windows-ccache | |
# GH action for ccache, only save cache if its on master branch or has a release build tag | |
- name: Run ccache | |
uses: hendrikmuhs/ccache-action@v1.2.10 | |
with: | |
key: 'windows-${{matrix.configuration}}-${{matrix.architecture}}' | |
save: ${{ github.ref == 'refs/heads/master' || inputs.releaseTag != '' }} | |
verbose: 2 | |
max-size: 100M | |
# MSVC hit rate is higher with ignoring the hash_dir and is safe | |
- name: Set ccache config values | |
run: | | |
ccache --set-config=hash_dir=false | |
- name: Configure | |
run: | | |
cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.configuration}} | |
- name: Build | |
working-directory: build | |
shell: cmd | |
run: | | |
ninja -v | |
- name: Run unit tests | |
working-directory: build | |
run: | | |
ninja UnitTest | |
# Only run gametest if we restored game data. | |
- name: Run game tests | |
if: steps.restore-data-cache.outputs.cache-hit == 'true' | |
working-directory: build | |
run: | | |
ninja GameTest_Headless | |
env: | |
OPENENROTH_MM7_PATH: 'D:\a\OpenEnroth\OpenEnroth\OpenEnroth_GameData\mm7' | |
- name: Prepare files for release | |
run: | | |
mkdir dist | |
copy build\src\Bin\OpenEnroth\OpenEnroth.exe dist\ | |
xcopy resources dist\ /E/H/C/I | |
- name: Zip folder for release | |
if: inputs.releaseTag != '' | |
uses: thedoctor0/zip-release@0.7.1 | |
with: | |
type: zip | |
filename: ${{runner.os}}_${{inputs.releaseTag}}_${{matrix.configuration}}_${{matrix.architecture}}.zip | |
path: dist | |
- name: Publish release | |
if: inputs.releaseTag != '' | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: true | |
tag_name: '${{ inputs.releaseTag }}' | |
files: | | |
${{runner.os}}_${{inputs.releaseTag}}_${{matrix.configuration}}_${{matrix.architecture}}.zip | |
- name: Check dependencies | |
run: | | |
dumpbin /imports build\src\Bin\OpenEnroth\OpenEnroth.exe | |
- name: Cleanup ccache | |
run: | | |
ccache -c |