reuse workflows for steam

develop
Myk Taylor 2023-07-31 01:49:02 -07:00
parent 1fad6d76f1
commit 5c664fca1c
No known key found for this signature in database
4 changed files with 94 additions and 176 deletions

@ -3,6 +3,9 @@ name: build-linux
on: on:
workflow_call: workflow_call:
inputs: inputs:
ref:
type: string
default: ''
artifact-name: artifact-name:
type: string type: string
append-date-and-hash: append-date-and-hash:
@ -56,6 +59,7 @@ jobs:
- name: Clone DFHack - name: Clone DFHack
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ref: ${{ inputs.ref }}
submodules: true submodules: true
fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} fetch-depth: ${{ !inputs.platform-files && 1 || 0 }}
- name: Fetch ccache - name: Fetch ccache

@ -3,6 +3,9 @@ name: build-windows
on: on:
workflow_call: workflow_call:
inputs: inputs:
ref:
type: string
default: ''
artifact-name: artifact-name:
type: string type: string
append-date-and-hash: append-date-and-hash:
@ -14,40 +17,52 @@ on:
common-files: common-files:
type: boolean type: boolean
default: true default: true
launchdf:
type: boolean
default: false
jobs: jobs:
build-win64: build-win64:
name: Build win64 name: Build win64
runs-on: windows-latest runs-on: ubuntu-22.04
steps: steps:
- run: pip install clcache - name: Install dependencies
- run: pip install 'sphinx<4.4.0' run: |
if: inputs.common-files sudo apt-get update
- name: Fetch clcache 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
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: clcache path: build/win64-cross/ccache
key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }} key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
restore-keys: | restore-keys: |
win-msvc-${{ inputs.cache-id }} win-msvc-${{ inputs.cache-id }}
win-msvc win-msvc
- name: Clone DFHack - name: Cross-compile
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Configure DFHack
env: env:
CC: clcache 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 }}'
CXX: clcache run: |
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 }} cd build
- name: Build DFHack bash -x build-win64-from-linux.sh
run: cmake --build build -j 2 --config Release --target install
- name: Trim cache - name: Trim cache
run: | run: |
clcache -M 52428800 ccache -d win64-cross/ccache --max-size 50M
clcache -c ccache -d win64-cross/ccache --cleanup
clcache -s ccache -d win64-cross/ccache --show-stats --verbose
- name: Format artifact name - name: Format artifact name
if: inputs.append-date-and-hash if: inputs.append-date-and-hash
id: artifactname id: artifactname
@ -57,4 +72,4 @@ jobs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ inputs.append-date-and-hash && steps.artifactname.outputs.name || inputs.artifact-name }} name: ${{ inputs.append-date-and-hash && steps.artifactname.outputs.name || inputs.artifact-name }}
path: build/image/* path: build/win64-cross/output/*

@ -75,7 +75,7 @@ jobs:
name: Linux package name: Linux package
uses: ./.github/workflows/build-linux.yml uses: ./.github/workflows/build-linux.yml
with: with:
artifact-name: dfhack-linux64 artifact-name: dfhack-linux64-build
append-date-and-hash: true append-date-and-hash: true
cache-id: release cache-id: release
stonesense: true stonesense: true
@ -84,53 +84,14 @@ jobs:
secrets: inherit secrets: inherit
package-win64: package-win64:
name: Win64 package (native) name: Win64 package
uses: ./.github/workflows/build-windows.yml uses: ./.github/workflows/build-windows.yml
with: with:
artifact-name: dfhack-win64 artifact-name: dfhack-win64-build
append-date-and-hash: true append-date-and-hash: true
cache-id: msvc cache-id: msvc
secrets: inherit secrets: inherit
build-cross-win64:
name: Win64 package
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install ccache
- name: Clone DFHack
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Fetch ccache
uses: actions/cache@v3
with:
path: build/win64-cross/ccache
key: ccache-win64-cross-msvc-${{ github.sha }}
restore-keys: |
ccache-win64-cross-msvc
- name: Cross-compile win64
env:
CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1'
run: |
cd build
bash -x build-win64-from-linux.sh
ccache -d win64-cross/ccache --max-size 200M
ccache -d win64-cross/ccache --cleanup
ccache -d win64-cross/ccache --show-stats
- name: Format artifact name
id: artifactname
run: |
echo name=$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dfhack-win64-build-${{ steps.artifactname.outputs.name }}
path: build/win64-cross/output/*
docs: docs:
uses: ./.github/workflows/build-linux.yml uses: ./.github/workflows/build-linux.yml
with: with:

@ -13,127 +13,65 @@ on:
type: string type: string
required: true required: true
release_channel: release_channel:
description: Release channel description: Steam release channel
type: string type: string
required: true required: true
default: staging default: staging
jobs: jobs:
deploy-to-steam: depot-common:
name: Deploy to Steam name: Common depot files
runs-on: ubuntu-22.04 uses: ./.github/workflows/build-linux.yml
steps: with:
- name: Set up Python 3 artifact-name: common-depot
uses: actions/setup-python@v4 ref: ${{ github.event.inputs.ref }}
platform-files: false
docs: true
stonesense: true
secrets: inherit
depot-linux:
name: Linux depot files
uses: ./.github/workflows/build-linux.yml
with: with:
python-version: 3 artifact-name: linux64-depot
- name: Install dependencies ref: ${{ github.event.inputs.ref }}
run: | cache-id: depot
sudo apt-get update common-files: false
sudo apt-get install \ stonesense: true
ccache \ gcc-ver: "10"
gcc-10 \ secrets: inherit
g++-10 \
libgl-dev \ depot-win64:
libxml-libxslt-perl \ name: Windows depot files
ninja-build uses: ./.github/workflows/build-windows.yml
pip install 'sphinx<4.4.0'
- name: Clone DFHack
uses: actions/checkout@v3
with: with:
submodules: true artifact-name: win64-depot
fetch-depth: 0
ref: ${{ github.event.inputs.ref }} ref: ${{ github.event.inputs.ref }}
- name: Get 3rd party SDKs cache-id: msvc
uses: actions/checkout@v3 common-files: false
launchdf: true
secrets: inherit
deploy-to-steam:
name: Deploy to Steam
runs-on: ubuntu-latest
steps:
- name: Stage common depot files
uses: actions/download-artifact@v3
with: with:
repository: DFHack/3rdparty name: common-depot
ref: main path: common
ssh-key: ${{ secrets.DFHACK_3RDPARTY_TOKEN }} - name: Stage linux64 depot files
path: depends/steam uses: actions/download-artifact@v3
- name: Fetch linux64 ccache
uses: actions/cache@v3
with: with:
path: ~/.ccache name: linux64-depot
key: ccache-ubuntu-22.04-gcc-10-${{ github.sha }} path: linux64
restore-keys: | - name: Stage win64 depot files
ccache-ubuntu-22.04-gcc-10 uses: actions/download-artifact@v3
- name: Fetch win64 ccache
uses: actions/cache@v3
with: with:
path: build/win64-cross/ccache name: win64-depot
key: ccache-win64-cross-msvc-${{ github.sha }} path: win64
restore-keys: |
ccache-win64-cross-msvc
- name: Set up environment
id: env_setup
run: |
echo "CCACHE_DIR=${HOME}/.ccache" >> $GITHUB_ENV
- name: Configure DFHack (common files)
env:
CC: gcc-10
CXX: g++-10
run: |
cmake \
-S . \
-B build \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=build/common-output \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DDFHACK_BUILD_ARCH=64 \
-DBUILD_DOCS:BOOL=1 \
-DBUILD_LIBRARY:BOOL=0 \
-DBUILD_PLUGINS:BOOL=0 \
-DBUILD_STONESENSE:BOOL=1 \
-DINSTALL_DATA_FILES:BOOL=1 \
-DINSTALL_SCRIPTS:BOOL=1
- name: Build DFHack (common files)
run: |
ninja -C build install
- name: Configure DFHack (linux build)
env:
CC: gcc-10
CXX: g++-10
run: |
cmake \
-S . \
-B build \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=build/linux-output \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DDFHACK_BUILD_ARCH=64 \
-DBUILD_DOCS:BOOL=0 \
-DBUILD_LIBRARY:BOOL=1 \
-DBUILD_PLUGINS:BOOL=1 \
-DBUILD_STONESENSE:BOOL=1 \
-DINSTALL_DATA_FILES:BOOL=0 \
-DINSTALL_SCRIPTS:BOOL=0
- name: Build DFHack (linux build)
run: |
ninja -C build install
ccache --max-size 50M
ccache --cleanup
ccache --show-stats
- name: Cross-compile win64 artifacts
env:
CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DFLAUNCH:BOOL=1 -DBUILD_DOCS:BOOL=0 -DINSTALL_DATA_FILES:BOOL=0 -DINSTALL_SCRIPTS:BOOL=0'
steam_username: ${{ secrets.STEAM_SDK_USERNAME }}
steam_password: ${{ secrets.STEAM_SDK_PASSWORD }}
run: |
echo "ref: ${{ github.event.inputs.ref }}"
echo "sha: ${{ github.sha }}"
echo "version: ${{ github.event.inputs.version }}"
echo "release_channel: ${{ github.event.inputs.release_channel }}"
echo
cd build
bash -x build-win64-from-linux.sh
ccache -d win64-cross/ccache --max-size 200M
ccache -d win64-cross/ccache --cleanup
ccache -d win64-cross/ccache --show-stats
- name: Steam deploy - name: Steam deploy
uses: game-ci/steam-deploy@v3 uses: game-ci/steam-deploy@v3
with: with:
@ -142,7 +80,7 @@ jobs:
appId: 2346660 appId: 2346660
buildDescription: ${{ github.event.inputs.version }} buildDescription: ${{ github.event.inputs.version }}
rootPath: build rootPath: build
depot1Path: common-output depot1Path: common
depot2Path: win64-cross/output depot2Path: win64
depot3Path: linux-output depot3Path: linux64
releaseBranch: ${{ github.event.inputs.release_channel }} releaseBranch: ${{ github.event.inputs.release_channel }}