attempt to get windows build reusable

develop
Myk Taylor 2023-07-30 20:47:59 -07:00
parent 0b2877a538
commit 872720740a
No known key found for this signature in database
3 changed files with 68 additions and 2 deletions

@ -71,6 +71,7 @@ jobs:
env: env:
CC: gcc-${{ inputs.gcc-ver }} CC: gcc-${{ inputs.gcc-ver }}
CXX: g++-${{ inputs.gcc-ver }} CXX: g++-${{ inputs.gcc-ver }}
CCACHE_DIR: ${{ env.HOME }}/.ccache
run: | run: |
cmake \ cmake \
-S . \ -S . \
@ -82,7 +83,7 @@ jobs:
${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache' || '' }} \ ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache' || '' }} \
-DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} \ -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} \
-DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} \ -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} \
-DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} \ -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} \
-DBUILD_DEV_PLUGINS:BOOL=${{ inputs.extras }} \ -DBUILD_DEV_PLUGINS:BOOL=${{ inputs.extras }} \
-DBUILD_SIZECHECK:BOOL=${{ inputs.extras }} \ -DBUILD_SIZECHECK:BOOL=${{ inputs.extras }} \
-DBUILD_SKELETON:BOOL=${{ inputs.extras }} \ -DBUILD_SKELETON:BOOL=${{ inputs.extras }} \

@ -0,0 +1,65 @@
name: build-windows
on:
workflow_call:
inputs:
artifact-name:
type: string
append-date-and-hash:
type: boolean
default: false
cache-id:
type: string
default: ''
platform-files:
type: boolean
default: true
common-files:
type: boolean
default: true
jobs:
build-win64:
name: Build win64
runs-on: windows-latest
steps:
- run: pip install clcache
if: inputs.platform-files
- run: pip install 'sphinx<4.4.0'
if: inputs.common-files
- name: Clone DFHack
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: ${{ !inputs.platform-files && 1 || 0 }}
- name: Fetch clcache
if: inputs.platform-files
uses: actions/cache@v3
with:
path: ${{ env.HOME }}/clcache
key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
restore-keys: |
win-msvc-${{ inputs.cache-id }}
win-msvc
- name: Configure DFHack
env:
CLCACHE_DIR: ${{ env.HOME }}/clcache
run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image ${{ inputs.platform-files && '-DCMAKE_C_COMPILER_LAUNCHER=clcache' || '' }} ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=clcache' || '' }} -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} -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
if: inputs.platform-files
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/*

@ -4,7 +4,7 @@ on: [push, pull_request]
jobs: jobs:
build-linux: build-linux:
name: Build (Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }}) name: Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }}
uses: ./.github/workflows/build-linux.yml uses: ./.github/workflows/build-linux.yml
with: with:
artifact-name: ${{ matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }} artifact-name: ${{ matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }}