dfhack/.github/workflows/build.yml

197 lines
6.0 KiB
YAML

name: Build
2020-04-06 17:57:20 -06:00
on: [push, pull_request]
jobs:
2023-07-30 20:36:12 -06:00
build-linux:
2023-07-30 21:47:59 -06:00
name: Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }}
2023-07-30 20:36:12 -06:00
uses: ./.github/workflows/build-linux.yml
with:
2023-07-30 20:53:46 -06:00
artifact-name: ${{ matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }}
append-date-and-hash: ${{ matrix.append-date-and-hash && true || false }}
2023-07-30 20:36:12 -06:00
cache-id: ${{ matrix.type }}
stonesense: ${{ matrix.stonesense }}
docs: ${{ matrix.type == 'release' }}
extras: ${{ matrix.extras }}
gcc-ver: ${{ matrix.gcc }}
secrets: inherit
strategy:
fail-fast: false
matrix:
include:
- type: release
gcc: "10"
artifact-name: dfhack-linux64
append-date-and-hash: true
stonesense: true
extras: false
- type: test
gcc: "10"
stonesense: false
extras: false
- type: test
gcc: "12"
stonesense: true
extras: true
test-linux:
2023-07-23 02:46:33 -06:00
name: Test (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins)
2023-07-30 20:36:12 -06:00
needs: build-linux
runs-on: ubuntu-22.04
2020-10-06 22:37:35 -06:00
strategy:
fail-fast: false
matrix:
2023-07-30 20:36:12 -06:00
gcc: [10]
plugins: [default]
include:
2023-07-30 20:36:12 -06:00
- gcc: 12
plugins: all
2020-04-06 17:57:20 -06:00
steps:
2023-07-30 20:36:12 -06:00
- name: Download artifact
uses: actions/download-artifact@v3
2020-06-29 20:53:05 -06:00
with:
2023-07-30 20:36:12 -06:00
name: test-${{ matrix.gcc }}
2023-07-23 02:46:33 -06:00
# - name: Fetch DF cache
# uses: actions/cache@v3
# with:
# path: ~/DF
2023-07-30 20:36:12 -06:00
# key: df-${{ hashFiles('ci/download-df.sh') }}
2023-07-23 02:46:33 -06:00
# - name: Download DF
# run: |
# sh ci/download-df.sh
# - name: Run lua tests
# id: run_tests_lua
# run: |
# export TERM=dumb
# status=0
# script -qe -c "python ci/run-tests.py --headless --keep-status \"$DF_FOLDER\"" || status=$((status + 1))
# python ci/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" || status=$((status + 2))
# mkdir -p artifacts
# cp "$DF_FOLDER"/test*.json "$DF_FOLDER"/*.log artifacts || status=$((status + 4))
# exit $status
# - name: Upload test artifacts
# uses: actions/upload-artifact@v3
# if: (success() || failure()) && steps.run_tests.outcome != 'skipped'
# continue-on-error: true
# with:
# name: test-artifacts-${{ matrix.gcc }}
# path: artifacts
# - name: Clean up DF folder
# # prevent DFHack-generated files from ending up in the cache
# # (download-df.sh also removes them, this is just to save cache space)
# if: success() || failure()
# run: |
# rm -rf "$DF_FOLDER"
package-win64:
name: Win64 package (native)
runs-on: windows-latest
steps:
2023-07-30 20:36:12 -06:00
- run: pip install clcache
- run: pip install 'sphinx<4.4.0'
2023-07-30 01:08:58 -06:00
- name: Fetch cache
uses: actions/cache@v3
with:
2023-07-30 20:36:12 -06:00
path: ~/clcache
2023-07-30 01:08:58 -06:00
key: clcache-win64-${{ github.sha }}
restore-keys: |
clcache-win64
- name: Clone DFHack
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Configure DFHack
2023-07-30 17:45:01 -06:00
run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DCMAKE_C_COMPILER_LAUNCHER=clcache -DCMAKE_CXX_COMPILER_LAUNCHER=clcache -DBUILD_DOCS:BOOL=1 -DBUILD_STONESENSE:BOOL=1
- name: Build DFHack
2023-07-30 17:45:01 -06:00
run: cmake --build build -j 2 --config Release --target install
2023-07-30 17:58:27 -06:00
- name: Format artifact name
uses: benjlevesque/short-sha@v2.2
2023-07-30 17:45:01 -06:00
id: short-sha
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
2023-07-30 17:45:01 -06:00
name: dfhack-win64-build-${{ steps.short-sha.outputs.sha }}
path: build/image/*
build-cross-win64:
2023-07-23 02:46:33 -06:00
name: Win64 package
runs-on: ubuntu-22.04
steps:
2023-04-30 00:31:44 -06:00
- 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
2023-01-24 20:27:12 -07:00
- name: Fetch ccache
uses: actions/cache@v3
with:
path: build/win64-cross/ccache
key: ccache-win64-cross-msvc-${{ github.sha }}
2023-01-24 20:27:12 -07:00
restore-keys: |
ccache-win64-cross-msvc
2023-07-23 02:46:33 -06:00
- 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
2023-07-23 02:46:33 -06:00
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dfhack-win64-build-${{ steps.artifactname.outputs.name }}
path: build/win64-cross/output/*
2020-10-06 22:28:51 -06:00
docs:
2023-07-30 20:36:12 -06:00
uses: ./.github/workflows/build-linux.yml
with:
platform-files: false
common-files: false
docs: true
secrets: inherit
2020-10-06 22:28:51 -06:00
2020-04-10 21:46:19 -06:00
lint:
2023-03-06 16:18:06 -07:00
runs-on: ubuntu-22.04
2020-04-10 21:46:19 -06:00
steps:
2020-06-29 22:41:02 -06:00
- name: Install Lua
2020-04-10 21:46:19 -06:00
run: |
sudo apt-get update
2020-06-29 22:41:02 -06:00
sudo apt-get install lua5.3
2020-04-10 21:47:47 -06:00
- name: Clone DFHack
2023-07-22 23:54:21 -06:00
uses: actions/checkout@v3
2020-04-10 21:47:47 -06:00
with:
submodules: true
2020-04-10 21:46:19 -06:00
- name: Check whitespace
2023-07-30 20:36:12 -06:00
run: python ci/lint.py --git-only --github-actions
2020-04-10 21:46:19 -06:00
- name: Check Authors.rst
2023-07-30 20:36:12 -06:00
if: always()
run: python ci/authors-rst.py
2020-04-10 21:46:19 -06:00
- name: Check for missing documentation
2023-07-30 20:36:12 -06:00
if: always()
run: python ci/script-docs.py
2020-04-10 21:46:19 -06:00
- name: Check Lua syntax
2023-07-30 20:36:12 -06:00
if: always()
run: python ci/script-syntax.py --ext=lua --cmd="luac5.3 -p" --github-actions
2020-04-11 00:22:12 -06:00
check-pr:
runs-on: ubuntu-latest
2020-04-11 00:24:40 -06:00
if: github.event_name == 'pull_request'
2020-04-11 00:22:12 -06:00
steps:
- name: Check that PR is based on develop branch
env:
BASE_BRANCH: ${{ github.base_ref }}
run: |
echo "PR base branch: $BASE_BRANCH"
test "$BASE_BRANCH" = develop