2020-09-10 02:06:46 +00:00
|
|
|
name: Check style
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches-ignore:
|
|
|
|
- master
|
|
|
|
- staging.tmp
|
|
|
|
- trying.tmp
|
|
|
|
- staging-squash-merge.tmp
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check-style:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
2022-10-25 11:50:49 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-09-10 22:00:33 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Prepare
|
2020-09-10 02:06:46 +00:00
|
|
|
run: |
|
|
|
|
sudo apt-get update -y
|
2022-10-02 15:27:48 +00:00
|
|
|
sudo apt-get install clang-format imagemagick ddnet-tools shellcheck pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev python3-clang libvulkan-dev glslang-tools spirv-tools rustc cargo -y
|
2022-07-07 12:04:41 +00:00
|
|
|
pip3 install pylint
|
2023-03-01 20:10:31 +00:00
|
|
|
git clone https://gitlab.com/Patiga/twmap.git/
|
2022-10-02 15:27:48 +00:00
|
|
|
cd twmap/twmap-tools
|
|
|
|
cargo install --path=.
|
|
|
|
cd ../..
|
|
|
|
rm -rf twmap
|
2020-09-10 22:00:33 +00:00
|
|
|
mkdir release
|
|
|
|
cd release
|
2022-02-14 21:34:43 +00:00
|
|
|
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDOWNLOAD_GTEST=OFF -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
|
|
|
|
cmake --build . --config Release --target dilate
|
2020-12-02 14:08:24 +00:00
|
|
|
- name: Check clang-format
|
|
|
|
run: clang-format -version
|
|
|
|
- name: Check fix_style
|
|
|
|
run: scripts/fix_style.py --dry-run
|
|
|
|
- name: Check header guards
|
|
|
|
run: scripts/check_header_guards.py
|
|
|
|
- name: Check languages
|
|
|
|
run: scripts/languages/update_all.py
|
|
|
|
- name: Check dilated images
|
|
|
|
run: scripts/check_dilate.sh release data
|
2023-02-23 10:05:01 +00:00
|
|
|
- name: Check absolute includes
|
|
|
|
run: "! grep --exclude-dir rust-bridge -rE '^#include \"(antibot|base|engine|game|steam|test)/' src/"
|
2023-02-27 23:59:23 +00:00
|
|
|
- name: Check standard header includes
|
|
|
|
run: scripts/check_standard_headers.sh
|
2023-05-31 18:00:50 +00:00
|
|
|
- name: Check config variables
|
|
|
|
run: scripts/check_config_variables.py
|
2022-10-02 22:18:57 +00:00
|
|
|
# TODO: Enable on release branches
|
|
|
|
#- name: Out-of-date translations
|
|
|
|
# run: |
|
|
|
|
# cp -a data/languages data/languages.orig
|
|
|
|
# scripts/languages/update_all.py
|
|
|
|
# diff_lang=$(diff data/languages.orig data/languages)
|
|
|
|
# if [ -n "$diff_lang" ]; then
|
|
|
|
# echo "Update translations:\n$diff_lang"
|
|
|
|
# exit 1
|
|
|
|
# fi
|
2020-12-02 13:56:12 +00:00
|
|
|
- name: Shellcheck
|
2020-12-02 14:22:26 +00:00
|
|
|
run: find . -type f -name '*.sh' -print0 | xargs -0 shellcheck
|
2021-08-03 14:14:54 +00:00
|
|
|
- name: Check log error case
|
|
|
|
run: |
|
|
|
|
if grep -Eqr '(msg|Print).*\(.*"[Ee]rror:' src/;
|
|
|
|
then
|
2021-08-21 09:49:28 +00:00
|
|
|
echo "Expected log errors to be in this format 'ERROR: error message'"
|
|
|
|
echo "Found these non uppercased log errors:"
|
2021-08-03 14:14:54 +00:00
|
|
|
grep -Er '(msg|Print).*\(.*"[Ee]rror:' src/
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-12-02 14:22:26 +00:00
|
|
|
- name: Pylint
|
|
|
|
run: |
|
|
|
|
pylint --version
|
2022-06-12 11:15:02 +00:00
|
|
|
find . -type f -name "*.py" -not -path './ddnet-libs/*' -not -path './googletest-src/*' -print0 | xargs -0 pylint
|
2022-07-30 11:50:24 +00:00
|
|
|
- name: Unused headers
|
|
|
|
run: |
|
2022-08-21 08:45:02 +00:00
|
|
|
find src -name '*.h' | while read -r i; do grep -r -q "$(basename "$i")" || (echo "Header file $i is unused" && exit 1); done
|
2022-10-02 15:27:48 +00:00
|
|
|
- name: Check maps
|
|
|
|
run: |
|
|
|
|
findings=$(find data -type f -name '*.map' -print0 | xargs -0 ~/.cargo/bin/twmap-check-ddnet 2>&1 | \
|
|
|
|
grep -v -E "\"data/maps/(ctf|dm).*\.map\": Time cps are missing on the map" | \
|
|
|
|
grep -v -E "\"data/themes/.*\.map\": Time cps are missing on the map" | \
|
2023-01-25 16:17:06 +00:00
|
|
|
grep -v -E "\"data/maps/ctf4\.map\": Map - In Image at index 3 -> Image 'jungle_doodads_old' is not a valid external image for DDNet06" | \
|
|
|
|
grep -v -E "\"data/themes/autumn_night\.map\": Map - In Image at index 3 -> Image 'generic_lamps' is not a valid external image for DDNet06" | \
|
2022-10-02 15:27:48 +00:00
|
|
|
grep -v -E "\"data/maps7?/Tutorial\.map\": Map setting - Unusual: 'sv_show_others_default'" || true)
|
|
|
|
if [ -n "$findings" ]; then
|
|
|
|
echo "$findings"
|
|
|
|
exit 1
|
|
|
|
fi
|