dfhack/.github/workflows/build-windows.yml

61 lines
1.9 KiB
YAML

name: build-windows
on:
workflow_call:
inputs:
artifact-name:
type: string
append-date-and-hash:
type: boolean
default: false
cache-id:
type: string
default: ''
common-files:
type: boolean
default: true
jobs:
build-win64:
name: Build win64
runs-on: windows-latest
steps:
- run: pip install clcache
- run: pip install 'sphinx<4.4.0'
if: inputs.common-files
- name: Fetch clcache
uses: actions/cache@v3
with:
path: clcache
key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
restore-keys: |
win-msvc-${{ inputs.cache-id }}
win-msvc
- name: Clone DFHack
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Configure DFHack
env:
CC: clcache
CXX: clcache
run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }}
- name: Build DFHack
run: cmake --build build -j 2 --config Release --target install
- name: Trim cache
run: |
clcache -M 52428800
clcache -c
clcache -s
- name: Format artifact name
if: inputs.append-date-and-hash
id: artifactname
run: echo "name=${{ inputs.artifact-name }}-$(date +%Y%m%d)-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Upload artifact
if: inputs.artifact-name
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.append-date-and-hash && steps.artifactname.outputs.name || inputs.artifact-name }}
path: build/image/*