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-04-06 17:57:20 -06:00
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2020-04-06 18:00:10 -06:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install \
|
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
|
|
|
|
sudo pip3 install --system sphinx
|
|
|
|
- name: Clone DFHack
|
|
|
|
uses: actions/checkout@v1
|
2020-04-10 21:38:32 -06:00
|
|
|
with:
|
|
|
|
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)"
|
|
|
|
echo "::set-env name=DF_VERSION::${DF_VERSION}"
|
2020-06-29 20:40:58 -06:00
|
|
|
echo "::set-output name=df_version::${DF_VERSION}"
|
2020-06-29 20:02:53 -06:00
|
|
|
echo "::set-env name=DF_FOLDER::${HOME}/DF/${DF_VERSION}/df_linux"
|
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
|
|
|
|
- name: Build docs
|
|
|
|
run: |
|
|
|
|
sphinx-build -qW -j3 . docs/html
|
2020-04-10 21:46:19 -06:00
|
|
|
- name: Upload docs
|
2020-04-10 22:10:28 -06:00
|
|
|
uses: actions/upload-artifact@v1
|
2020-04-06 17:57:20 -06:00
|
|
|
with:
|
|
|
|
name: docs
|
|
|
|
path: docs/html
|
2020-04-10 21:56:28 -06:00
|
|
|
- name: Build DFHack
|
|
|
|
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_DOCS:BOOL=ON \
|
|
|
|
-DBUILD_TESTS:BOOL=ON \
|
|
|
|
-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
|
|
|
|
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
|
|
|
|
if: success() || failure()
|
|
|
|
with:
|
|
|
|
name: test-artifacts
|
|
|
|
path: artifacts
|
2020-04-10 21:46:19 -06:00
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install \
|
|
|
|
lua5.3 \
|
|
|
|
ruby
|
2020-04-10 21:47:47 -06:00
|
|
|
- name: Clone DFHack
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
submodules: true
|
2020-04-10 21:46:19 -06:00
|
|
|
- name: Check whitespace
|
|
|
|
run: |
|
|
|
|
python travis/lint.py
|
|
|
|
- name: Check Authors.rst
|
|
|
|
run: |
|
|
|
|
python travis/authors-rst.py
|
|
|
|
- name: Check for missing documentation
|
|
|
|
run: |
|
|
|
|
python travis/script-docs.py
|
|
|
|
- name: Check Lua syntax
|
|
|
|
run: |
|
|
|
|
python travis/script-syntax.py --ext=lua --cmd="luac5.3 -p"
|
|
|
|
- name: Check Ruby syntax
|
|
|
|
run: |
|
|
|
|
python travis/script-syntax.py --ext=rb --cmd="ruby -c"
|
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
|