2023-07-30 21:47:59 -06:00
|
|
|
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:
|
2023-07-30 22:39:39 -06:00
|
|
|
path: clcache
|
2023-07-30 21:47:59 -06:00
|
|
|
key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
win-msvc-${{ inputs.cache-id }}
|
|
|
|
win-msvc
|
2023-07-30 22:39:39 -06:00
|
|
|
- name: Clone DFHack
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: true
|
2023-07-31 00:50:47 -06:00
|
|
|
fetch-depth: 0
|
2023-07-30 21:47:59 -06:00
|
|
|
- name: Configure DFHack
|
2023-07-31 00:50:47 -06:00
|
|
|
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 }}
|
2023-07-30 21:47:59 -06:00
|
|
|
- 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/*
|