forked from CorsixTH/CorsixTH
-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (146 loc) · 6.19 KB
/
Linux.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
---
name: Linux and Tests
on: # yamllint disable-line rule:trurhy
push:
branches-ignore:
- 'gh-pages'
pull_request:
jobs:
Linux:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- static_analysis: 0
docs: 0
cmake: 1
lua: LuaJIT
luac: luac5.1
animview: and AnimView
packages: libluajit-5.1-dev luajit libwxgtk3.0-gtk3-dev
cmakejit: '-DBUILD_ANIMVIEWER=ON -DWITH_LUAJIT=ON -DLUA_LIBRARY=/usr/lib/x86_64-linux-gnu/libluajit-5.1.so'
- static_analysis: 0
docs: 0
lua: Lua 5.1
luac: luac5.1
packages: liblua5.1-dev lua5.1
- static_analysis: 1
docs: 1
lua: Lua 5.3
luac: luac5.3
packages: liblua5.3-dev lua5.3
catch2: -DENABLE_UNIT_TESTS=ON
name: Linux and Tests on ${{ matrix.lua }}
steps:
- uses: actions/checkout@v3 # Keeps the git OAuth token after checkout
- name: Install ${{ matrix.lua }} ${{ matrix.animview }}
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.packages }} luarocks
# Required for LDocGen
sudo luarocks install lpeg
# Required for lua lint check
sudo luarocks install luacheck
# Required for lua unit tests
sudo luarocks install busted
- name: Install CorsixTH requirements
run: |
sudo apt-get install libsdl2-dev libsdl2-mixer-dev \
libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev
- name: Install static analysis requirements
if: matrix.static_analysis
run: |
sudo apt-get install doxygen yamllint clang-tidy-11
sudo pip3 install -I codespell==2.0 cmakelint==1.4
# Build catch2
git clone --quiet https://github.com/catchorg/Catch2 \
--branch v3.1.1 --depth=1
cd Catch2
cmake . -Bbuild
cd build
sudo make install
cd ../../
rm -rf Catch2
- name: Install CMake 3.10
if: matrix.cmake
run: |
# Install CMake version 3.10, the oldest CorsixTH-supported version, which does not support Lua 5.4
curl -L https://github.com/Kitware/CMake/releases/download/v3.10.3/cmake-3.10.3-Linux-x86_64.sh -o cmake.sh
sudo bash cmake.sh --prefix=/usr/local/ --exclude-subdir --skip-license
cmake --version
- name: Create CorsixTH ${{ matrix.animview }} makefiles with ${{ matrix.lua }}
run: |
cmake . -G"Unix Makefiles" -Bbuild --debug-output \
-DWITH_AUDIO=ON -DWITH_MOVIES=ON ${{ matrix.catch2 }} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON ${{ matrix.cmakejit }}
- name: Build CorsixTH ${{ matrix.animview }} with ${{ matrix.lua }}
run: |
cmake --build build/ -- VERBOSE=1
sudo cmake --build build/ -- install
- name: Run ${{ matrix.lua }} tests
run: |
# Validate lua files
find CorsixTH -name '*.lua' -print0 | xargs -0 -I{} ${{ matrix.luac }} -p {}
# Run lua lint check
luacheck --quiet --codes --ranges CorsixTH
# Run lua unit tests
busted --verbose --directory=CorsixTH/Luatest
- name: Run simple code tests
if: matrix.static_analysis
run: |
# Check if there are trailing whitespaces.
python3 scripts/check_trailing_whitespaces.py
# Check for incorrectly encoded files.
python3 scripts/check_language_files_not_BOM.py
# Check if there are lua classes with invalid/improper declarations.
python3 scripts/check_lua_classes.py
# Check for tabs (should be spaces)
grep -Ire '\t' CorsixTH/Lua --exclude-dir=languages
# Run CPP Tests
cd build/CorsixTH
ctest --extra-verbose --build-config Release --output-on-failure
cd ../..
# Build and package LevelEdit
ant -buildfile LevelEdit/build.xml dist
# Run codespell
codespell --enable-colors --quiet-level 2 --skip="languages,corsix-th.6" \
-L sav,unexpect,persistance,defin,uint,inout,currenty,blong \
AnimView CorsixTH CorsixTH/Lua/languages/english.lua LevelEdit libs
# Cmake file linter
cmakelint --filter=-linelength AnimView/CMakeLists.txt CMakeLists.txt CorsixTH/CMakeLists.txt \
CorsixTH/CppTest/CMakeLists.txt CorsixTH/Src/CMakeLists.txt CorsixTH/SrcUnshared/CMakeLists.txt \
libs/CMakeLists.txt libs/rnc/CMakeLists.txt \
CMake/GenerateDoc.cmake CMake/PrecompiledDeps.cmake CMake/VcpkgDeps.cmake
# Validate these build files
yamllint --config-data "rules: {line-length: disable}" .github/workflows/Linux.yml
shellcheck --shell sh scripts/macos_luarocks
- name: Run clang code tests
if: matrix.static_analysis
run: |
# Check cpp format
clang-format-11 -i CorsixTH/Src/*.cpp CorsixTH/Src/*.h AnimView/*.cpp \
AnimView/*.h libs/rnc/*.cpp libs/rnc/*.h CorsixTH/SrcUnshared/main.cpp
git diff --exit-code
# Clang-tidy linter
clang-tidy-11 -p build --warnings-as-errors=\* \
CorsixTH/Src/*.c CorsixTH/Src/*.cpp libs/rnc/*.cpp CorsixTH/SrcUnshared/main.cpp
- name: Generate documentation
if: matrix.docs
run: |
cmake --build build/ --target doc
- name: Upload documentation
if: github.ref == 'refs/heads/master' && github.repository == 'CorsixTH/CorsixTH' && matrix.docs
run: |
git config user.email "[email protected]"
git config user.name "Docs Bot"
git fetch origin gh-pages
git checkout --force gh-pages
rsync --recursive build/doc/ .
git add animview/ corsixth_engine/ corsixth_lua/ index.html leveledit/
if ! git diff --cached --exit-code; then
git commit --message "Documentation from $(git rev-parse --short master) [no CI]"
git push origin gh-pages
else
echo "No change to documentation."
fi