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

76 lines
2.3 KiB
YAML

2023-07-30 21:47:59 -06:00
name: build-windows
on:
workflow_call:
inputs:
2023-07-31 02:49:02 -06:00
ref:
type: string
default: ''
2023-07-30 21:47:59 -06:00
artifact-name:
type: string
append-date-and-hash:
type: boolean
default: false
cache-id:
type: string
default: ''
common-files:
type: boolean
default: true
2023-07-31 02:49:02 -06:00
launchdf:
type: boolean
default: false
2023-07-30 21:47:59 -06:00
jobs:
build-win64:
name: Build win64
2023-07-31 02:49:02 -06:00
runs-on: ubuntu-22.04
2023-07-30 21:47:59 -06:00
steps:
2023-07-31 02:49:02 -06:00
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install ccache
- name: Clone DFHack
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
submodules: true
fetch-depth: 0
- name: Get 3rd party SDKs
if: inputs.launchdf
uses: actions/checkout@v3
with:
repository: DFHack/3rdparty
ref: main
ssh-key: ${{ secrets.DFHACK_3RDPARTY_TOKEN }}
path: depends/steam
- name: Fetch ccache
2023-07-30 21:47:59 -06:00
uses: actions/cache@v3
with:
2023-07-31 02:49:02 -06:00
path: build/win64-cross/ccache
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-31 02:49:02 -06:00
- name: Cross-compile
2023-07-31 00:50:47 -06:00
env:
2023-07-31 02:49:02 -06:00
CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }}'
run: |
cd build
bash -x build-win64-from-linux.sh
2023-07-30 21:47:59 -06:00
- name: Trim cache
run: |
2023-07-31 02:49:02 -06:00
ccache -d win64-cross/ccache --max-size 50M
ccache -d win64-cross/ccache --cleanup
ccache -d win64-cross/ccache --show-stats --verbose
2023-07-30 21:47:59 -06:00
- 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 }}
2023-07-31 02:49:02 -06:00
path: build/win64-cross/output/*