2020-04-11 00:15:57 -06:00
|
|
|
name: Build
|
2020-04-06 17:57:20 -06:00
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
2020-04-10 21:46:19 -06:00
|
|
|
build:
|
2020-10-07 10:04:34 -06:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-10-21 15:52:23 -06:00
|
|
|
name: build (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins)
|
2020-10-06 22:37:35 -06:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2020-10-07 10:04:34 -06:00
|
|
|
os:
|
2023-03-06 16:18:06 -07:00
|
|
|
- ubuntu-22.04
|
2020-10-06 22:37:35 -06:00
|
|
|
gcc:
|
2023-03-06 16:29:11 -07:00
|
|
|
- 10
|
2020-10-21 15:52:23 -06:00
|
|
|
plugins:
|
2020-10-25 23:23:24 -06:00
|
|
|
- default
|
2020-10-07 10:04:34 -06:00
|
|
|
include:
|
2023-03-06 16:23:45 -07:00
|
|
|
- os: ubuntu-22.04
|
|
|
|
gcc: 12
|
2022-06-05 17:20:02 -06:00
|
|
|
plugins: all
|
2020-04-06 17:57:20 -06:00
|
|
|
steps:
|
2020-06-29 20:53:05 -06:00
|
|
|
- name: Set up Python 3
|
2023-04-10 01:14:30 -06:00
|
|
|
uses: actions/setup-python@v4
|
2020-06-29 20:53:05 -06:00
|
|
|
with:
|
|
|
|
python-version: 3
|
2020-04-06 17:57:20 -06:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2020-04-06 18:00:10 -06:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install \
|
2022-05-01 09:55:25 -06:00
|
|
|
ccache \
|
2023-07-22 23:54:21 -06:00
|
|
|
libsdl2-dev \
|
2020-04-06 17:57:20 -06:00
|
|
|
libxml-libxml-perl \
|
|
|
|
libxml-libxslt-perl \
|
|
|
|
ninja-build \
|
|
|
|
zlib1g-dev
|
2022-01-30 23:23:51 -07:00
|
|
|
pip install 'sphinx<4.4.0'
|
2020-10-07 09:37:46 -06:00
|
|
|
- name: Install GCC
|
|
|
|
run: |
|
|
|
|
sudo apt-get install gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
|
2020-04-06 17:57:20 -06:00
|
|
|
- name: Clone DFHack
|
2023-07-22 23:54:21 -06:00
|
|
|
uses: actions/checkout@v3
|
2020-04-10 21:38:32 -06:00
|
|
|
with:
|
2020-06-29 21:00:20 -06:00
|
|
|
fetch-depth: 0 # unlimited - we need past tags
|
2020-04-10 21:38:32 -06:00
|
|
|
submodules: true
|
2020-04-06 17:57:20 -06:00
|
|
|
- name: Set up environment
|
2020-06-29 20:40:58 -06:00
|
|
|
id: env_setup
|
2020-04-06 17:57:20 -06:00
|
|
|
run: |
|
2021-09-05 20:48:41 -06:00
|
|
|
DF_VERSION="$(sh ci/get-df-version.sh)"
|
2022-12-11 11:33:47 -07:00
|
|
|
echo "df_version=${DF_VERSION}" >> $GITHUB_OUTPUT
|
2020-10-07 18:19:37 -06:00
|
|
|
echo "DF_VERSION=${DF_VERSION}" >> $GITHUB_ENV
|
|
|
|
echo "DF_FOLDER=${HOME}/DF/${DF_VERSION}/df_linux" >> $GITHUB_ENV
|
2022-06-08 23:02:37 -06:00
|
|
|
echo "CCACHE_DIR=${HOME}/.ccache" >> $GITHUB_ENV
|
2022-12-15 23:41:33 -07:00
|
|
|
# - name: Fetch DF cache
|
|
|
|
# uses: actions/cache@v3
|
|
|
|
# with:
|
|
|
|
# path: ~/DF
|
|
|
|
# key: dfcache-${{ steps.env_setup.outputs.df_version }}-${{ hashFiles('ci/download-df.sh') }}
|
2022-05-01 09:55:25 -06:00
|
|
|
- name: Fetch ccache
|
2022-12-11 11:39:26 -07:00
|
|
|
uses: actions/cache@v3
|
2022-05-01 09:55:25 -06:00
|
|
|
with:
|
|
|
|
path: ~/.ccache
|
2023-06-08 14:44:09 -06:00
|
|
|
key: ccache-${{ matrix.os }}-gcc-${{ matrix.gcc }}-${{ github.ref_name }}-${{ github.sha }}
|
2022-06-05 22:46:24 -06:00
|
|
|
restore-keys: |
|
2023-06-08 14:44:09 -06:00
|
|
|
ccache-${{ matrix.os }}-gcc-${{ matrix.gcc }}-${{ github.ref_name }}
|
|
|
|
ccache-${{ matrix.os }}-gcc-${{ matrix.gcc }}
|
2022-12-15 23:41:33 -07:00
|
|
|
# - name: Download DF
|
|
|
|
# run: |
|
|
|
|
# sh ci/download-df.sh
|
2022-05-01 11:48:54 -06:00
|
|
|
- name: Configure DFHack
|
2020-10-06 22:37:35 -06:00
|
|
|
env:
|
|
|
|
CC: gcc-${{ matrix.gcc }}
|
|
|
|
CXX: g++-${{ matrix.gcc }}
|
2020-04-10 21:56:28 -06:00
|
|
|
run: |
|
2020-04-10 22:31:15 -06:00
|
|
|
cmake \
|
|
|
|
-S . \
|
|
|
|
-B build-ci \
|
2020-04-10 21:56:28 -06:00
|
|
|
-G Ninja \
|
|
|
|
-DDFHACK_BUILD_ARCH=64 \
|
2022-11-28 18:16:48 -07:00
|
|
|
-DBUILD_TESTS:BOOL=ON \
|
2020-10-25 23:23:24 -06:00
|
|
|
-DBUILD_DEV_PLUGINS:BOOL=${{ matrix.plugins == 'all' }} \
|
|
|
|
-DBUILD_SIZECHECK:BOOL=${{ matrix.plugins == 'all' }} \
|
2022-08-03 01:33:24 -06:00
|
|
|
-DBUILD_SKELETON:BOOL=${{ matrix.plugins == 'all' }} \
|
2020-10-25 23:23:24 -06:00
|
|
|
-DBUILD_STONESENSE:BOOL=${{ matrix.plugins == 'all' }} \
|
|
|
|
-DBUILD_SUPPORTED:BOOL=1 \
|
2022-06-08 20:18:13 -06:00
|
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
2020-04-10 21:56:28 -06:00
|
|
|
-DCMAKE_INSTALL_PREFIX="$DF_FOLDER"
|
2022-05-01 11:48:54 -06:00
|
|
|
- name: Build DFHack
|
|
|
|
run: |
|
2020-04-10 22:31:15 -06:00
|
|
|
ninja -C build-ci install
|
2023-04-30 00:46:06 -06:00
|
|
|
ccache --max-size 50M
|
2023-04-29 23:30:42 -06:00
|
|
|
ccache --cleanup
|
2022-06-08 20:21:48 -06:00
|
|
|
ccache --show-stats
|
2022-11-28 18:16:48 -07:00
|
|
|
- name: Run cpp unit tests
|
|
|
|
id: run_tests_cpp
|
2022-11-11 20:01:10 -07:00
|
|
|
run: |
|
2022-11-28 18:22:17 -07:00
|
|
|
ninja -C build-ci test
|
2022-11-28 18:16:48 -07:00
|
|
|
exit $?
|
2022-12-15 23:41:33 -07:00
|
|
|
# - 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@v1
|
|
|
|
# if: (success() || failure()) && steps.run_tests.outcome != 'skipped'
|
|
|
|
# continue-on-error: true
|
|
|
|
# with:
|
|
|
|
# name: test-artifacts-${{ matrix.gcc }}
|
|
|
|
# path: artifacts
|
2020-06-29 20:52:44 -06:00
|
|
|
- name: Clean up DF folder
|
2020-10-06 22:28:51 -06:00
|
|
|
# prevent DFHack-generated files from ending up in the cache
|
2020-06-29 20:52:44 -06:00
|
|
|
# (download-df.sh also removes them, this is just to save cache space)
|
|
|
|
if: success() || failure()
|
|
|
|
run: |
|
|
|
|
rm -rf "$DF_FOLDER"
|
2020-06-29 22:29:30 -06:00
|
|
|
|
2023-01-24 17:17:49 -07:00
|
|
|
build-cross-win64:
|
|
|
|
name: Build MSVC win64
|
|
|
|
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
|
2023-01-24 17:17:49 -07:00
|
|
|
- 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.ref_name }}-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
ccache-win64-cross-msvc-${{ github.ref_name }}
|
|
|
|
ccache-win64-cross-msvc
|
2023-01-24 17:17:49 -07:00
|
|
|
- name: Cross-compile win64 artifacts
|
2023-02-03 15:08:56 -07:00
|
|
|
env:
|
2023-05-18 15:39:49 -06:00
|
|
|
CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1'
|
2023-01-24 17:17:49 -07:00
|
|
|
run: |
|
|
|
|
cd build
|
2023-02-03 15:08:56 -07:00
|
|
|
bash -x build-win64-from-linux.sh
|
2023-04-30 00:46:06 -06:00
|
|
|
ccache -d win64-cross/ccache --max-size 200M
|
|
|
|
ccache -d win64-cross/ccache --cleanup
|
|
|
|
ccache -d win64-cross/ccache --show-stats
|
2023-01-24 17:17:49 -07:00
|
|
|
- name: Format artifact name
|
|
|
|
id: artifactname
|
|
|
|
run: |
|
2023-01-24 19:48:06 -07:00
|
|
|
echo name=$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
|
2023-01-24 17:17:49 -07:00
|
|
|
- name: Upload win64 artifacts
|
|
|
|
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-03-06 16:18:06 -07:00
|
|
|
runs-on: ubuntu-22.04
|
2020-10-06 22:28:51 -06:00
|
|
|
steps:
|
|
|
|
- name: Set up Python 3
|
2023-04-10 01:14:30 -06:00
|
|
|
uses: actions/setup-python@v4
|
2020-10-06 22:28:51 -06:00
|
|
|
with:
|
|
|
|
python-version: 3
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2022-07-05 13:21:41 -06:00
|
|
|
pip install 'sphinx'
|
2020-10-06 22:28:51 -06:00
|
|
|
- name: Clone DFHack
|
2023-07-22 23:54:21 -06:00
|
|
|
uses: actions/checkout@v3
|
2020-10-06 22:28:51 -06:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Build docs
|
|
|
|
run: |
|
2022-07-05 13:21:41 -06:00
|
|
|
sphinx-build -W --keep-going -j auto --color . docs/html
|
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:29:30 -06:00
|
|
|
- name: Set up Python 3
|
2023-04-10 01:14:30 -06:00
|
|
|
uses: actions/setup-python@v4
|
2020-06-29 22:29:30 -06:00
|
|
|
with:
|
|
|
|
python-version: 3
|
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-06-29 22:34:40 -06:00
|
|
|
# don't need tags here
|
2020-04-10 21:46:19 -06:00
|
|
|
- name: Check whitespace
|
|
|
|
run: |
|
2021-09-06 16:59:08 -06:00
|
|
|
python ci/lint.py --git-only --github-actions
|
2020-04-10 21:46:19 -06:00
|
|
|
- name: Check Authors.rst
|
2020-06-29 22:35:01 -06:00
|
|
|
if: success() || failure()
|
2020-04-10 21:46:19 -06:00
|
|
|
run: |
|
2021-09-05 20:48:41 -06:00
|
|
|
python ci/authors-rst.py
|
2020-04-10 21:46:19 -06:00
|
|
|
- name: Check for missing documentation
|
2020-06-29 22:35:01 -06:00
|
|
|
if: success() || failure()
|
2020-04-10 21:46:19 -06:00
|
|
|
run: |
|
2021-09-05 20:48:41 -06:00
|
|
|
python ci/script-docs.py
|
2020-04-10 21:46:19 -06:00
|
|
|
- name: Check Lua syntax
|
2020-06-29 22:35:01 -06:00
|
|
|
if: success() || failure()
|
2020-04-10 21:46:19 -06:00
|
|
|
run: |
|
2021-09-05 20:48:41 -06:00
|
|
|
python ci/script-syntax.py --ext=lua --cmd="luac5.3 -p" --github-actions
|
2020-06-29 22:35:01 -06:00
|
|
|
|
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
|