Add more tables with editable values. #107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |