180 lines (175 loc) · 5.12 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
name: build (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins)
strategy:
fail-fast: false
matrix:
os:
- ubuntu-18.04
gcc:
- 4.8
- 7
plugins:
- default
include:
- os: ubuntu-20.04
gcc: 10
plugins: all
steps:
- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: 3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
libgtk2.0-0 \
libncursesw5 \
libsdl-image1.2-dev \
libsdl-ttf2.0-dev \
libsdl1.2-dev \
libxml-libxml-perl \
libxml-libxslt-perl \
lua5.3 \
ninja-build \
zlib1g-dev
pip install 'sphinx<4.4.0'
- name: Install GCC
run: |
sudo apt-get install gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
- name: Clone DFHack
uses: actions/checkout@v1
with:
fetch-depth: 0 # unlimited - we need past tags
submodules: true
- name: Set up environment
id: env_setup
run: |
DF_VERSION="$(sh ci/get-df-version.sh)"
echo "::set-output name=df_version::${DF_VERSION}"
echo "DF_VERSION=${DF_VERSION}" >> $GITHUB_ENV
echo "DF_FOLDER=${HOME}/DF/${DF_VERSION}/df_linux" >> $GITHUB_ENV
- name: Fetch DF cache
uses: actions/cache@v2
with:
path: ~/DF
key: ${{ steps.env_setup.outputs.df_version }}
- name: Download DF
run: |
sh ci/download-df.sh
- name: Build DFHack
env:
CC: gcc-${{ matrix.gcc }}
CXX: g++-${{ matrix.gcc }}
run: |
cmake \
-S . \
-B build-ci \
-G Ninja \
-DDFHACK_BUILD_ARCH=64 \
-DBUILD_TESTS:BOOL=ON \
-DBUILD_DEV_PLUGINS:BOOL=${{ matrix.plugins == 'all' }} \
-DBUILD_SIZECHECK:BOOL=${{ matrix.plugins == 'all' }} \
-DBUILD_STONESENSE:BOOL=${{ matrix.plugins == 'all' }} \
-DBUILD_SUPPORTED:BOOL=1 \
-DCMAKE_INSTALL_PREFIX="$DF_FOLDER"
ninja -C build-ci install
- name: Run tests
id: run_tests
run: |
export TERM=dumb
status=0
mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init
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
- 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"
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: |
pip install 'sphinx<4.4.0'
- name: Clone DFHack
uses: actions/checkout@v1
with:
submodules: true
- name: Build docs
run: |
sphinx-build -W --keep-going -j3 . docs/html
- name: Upload docs
uses: actions/upload-artifact@v1
with:
name: docs
path: docs/html
lint:
runs-on: ubuntu-18.04
steps:
- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: 3
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install Lua
run: |
sudo apt-get update
sudo apt-get install lua5.3
- name: Clone DFHack
uses: actions/checkout@v1
with:
submodules: true
# don't need tags here
- name: Check whitespace
run: |
python ci/lint.py --git-only --github-actions
- name: Check Authors.rst
if: success() || failure()
run: |
python ci/authors-rst.py
- name: Check for missing documentation
if: success() || failure()
run: |
python ci/script-docs.py
- name: Check Lua syntax
if: success() || failure()
run: |
python ci/script-syntax.py --ext=lua --cmd="luac5.3 -p" --github-actions
- name: Check Ruby syntax
if: success() || failure()
run: |
python ci/script-syntax.py --ext=rb --cmd="ruby -c" --github-actions
check-pr:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
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