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:
|
|
|
|
- ubuntu-18.04
|
2020-10-06 22:37:35 -06:00
|
|
|
gcc:
|
2020-10-07 09:37:46 -06:00
|
|
|
- 4.8
|
2020-10-06 22:37:35 -06:00
|
|
|
- 7
|
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:
|
|
|
|
- os: ubuntu-20.04
|
|
|
|
gcc: 10
|
2020-10-25 23:23:24 -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
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
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 \
|
2020-10-07 10:25:26 -06:00
|
|
|
libgtk2.0-0 \
|
2020-04-06 17:57:20 -06:00
|
|
|
libsdl-image1.2-dev \
|
|
|
|
libsdl-ttf2.0-dev \
|
|
|
|
libsdl1.2-dev \
|
|
|
|
libxml-libxml-perl \
|
|
|
|
libxml-libxslt-perl \
|
|
|
|
lua5.3 \
|
|
|
|
ninja-build \
|
|
|
|
zlib1g-dev
|
2020-06-29 20:53:05 -06:00
|
|
|
pip install sphinx
|
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
|
2020-07-26 23:12:14 -06:00
|
|
|
uses: actions/checkout@v1
|
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: |
|
2020-06-29 20:02:53 -06:00
|
|
|
DF_VERSION="$(sh travis/get-df-version.sh)"
|
2020-06-29 20:40:58 -06:00
|
|
|
echo "::set-output name=df_version::${DF_VERSION}"
|
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
|
2020-06-29 20:35:36 -06:00
|
|
|
- name: Fetch DF cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/DF
|
2020-06-29 20:40:58 -06:00
|
|
|
key: ${{ steps.env_setup.outputs.df_version }}
|
2020-04-06 17:57:20 -06:00
|
|
|
- name: Download DF
|
|
|
|
run: |
|
|
|
|
sh travis/download-df.sh
|
2020-04-10 21:56:28 -06:00
|
|
|
- name: Build 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 \
|
|
|
|
-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' }} \
|
|
|
|
-DBUILD_STONESENSE:BOOL=${{ matrix.plugins == 'all' }} \
|
|
|
|
-DBUILD_SUPPORTED:BOOL=1 \
|
2020-04-10 21:56:28 -06:00
|
|
|
-DCMAKE_INSTALL_PREFIX="$DF_FOLDER"
|
2020-04-10 22:31:15 -06:00
|
|
|
ninja -C build-ci install
|
2020-04-10 22:10:28 -06:00
|
|
|
- name: Run tests
|
2020-10-21 18:13:50 -06:00
|
|
|
id: run_tests
|
2020-04-10 22:10:28 -06:00
|
|
|
run: |
|
2020-04-10 23:58:06 -06:00
|
|
|
export TERM=dumb
|
2020-04-10 22:10:28 -06:00
|
|
|
mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init
|
2020-04-10 23:49:53 -06:00
|
|
|
script -qe -c "python travis/run-tests.py --headless --keep-status \"$DF_FOLDER\""
|
2020-04-10 22:10:28 -06:00
|
|
|
python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt"
|
|
|
|
mkdir -p artifacts
|
|
|
|
cp "$DF_FOLDER/test_status.json" "$DF_FOLDER"/*.log artifacts
|
|
|
|
- name: Upload test artifacts
|
|
|
|
uses: actions/upload-artifact@v1
|
2020-10-21 18:13:50 -06:00
|
|
|
if: (success() || failure()) && steps.run_tests.outcome != 'skipped'
|
|
|
|
continue-on-error: true
|
2020-04-10 22:10:28 -06:00
|
|
|
with:
|
2020-10-21 18:14:16 -06:00
|
|
|
name: test-artifacts-${{ matrix.gcc }}
|
2020-04-10 22:10:28 -06:00
|
|
|
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
|
|
|
|
2020-10-06 22:28:51 -06:00
|
|
|
docs:
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
|
|
|
- name: Set up Python 3
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2021-05-11 17:49:13 -06:00
|
|
|
pip install sphinx
|
2020-10-06 22:28:51 -06:00
|
|
|
- name: Clone DFHack
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Build docs
|
|
|
|
run: |
|
2020-10-06 22:31:32 -06:00
|
|
|
sphinx-build -W --keep-going -j3 . docs/html
|
2020-10-06 22:28:51 -06:00
|
|
|
- name: Upload docs
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
|
|
|
name: docs
|
|
|
|
path: docs/html
|
|
|
|
|
2020-04-10 21:46:19 -06:00
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
2020-06-29 22:29:30 -06:00
|
|
|
- name: Set up Python 3
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3
|
2020-06-29 22:41:02 -06:00
|
|
|
- name: Set up Ruby 2.7
|
|
|
|
uses: actions/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: 2.7
|
|
|
|
- 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
|
2020-07-26 23:12:14 -06:00
|
|
|
uses: actions/checkout@v1
|
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-05 20:44:42 -06:00
|
|
|
python travis/lint.py --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: |
|
|
|
|
python travis/authors-rst.py
|
|
|
|
- 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: |
|
|
|
|
python travis/script-docs.py
|
|
|
|
- name: Check Lua syntax
|
2020-06-29 22:35:01 -06:00
|
|
|
if: success() || failure()
|
2020-04-10 21:46:19 -06:00
|
|
|
run: |
|
2020-06-29 22:24:03 -06:00
|
|
|
python travis/script-syntax.py --ext=lua --cmd="luac5.3 -p" --github-actions
|
2020-04-10 21:46:19 -06:00
|
|
|
- name: Check Ruby syntax
|
2020-06-29 22:35:01 -06:00
|
|
|
if: success() || failure()
|
2020-04-10 21:46:19 -06:00
|
|
|
run: |
|
2020-06-29 22:24:03 -06:00
|
|
|
python travis/script-syntax.py --ext=rb --cmd="ruby -c" --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
|