diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index a35dc8e0461..19a4fa63369 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -14,77 +14,79 @@ jobs: env: CARGO_HTTP_MULTIPLEXING: false steps: - - uses: actions/checkout@v3 - with: - submodules: true - - name: Prepare - run: | - sudo apt-get update -y - 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 -y - rustup default stable - pip3 install pylint - git clone https://gitlab.com/Patiga/twmap.git/ - cd twmap/twmap-tools - cargo install --locked --path=. - cd ../.. - rm -rf twmap - mkdir release - cd release - cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDOWNLOAD_GTEST=OFF -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. .. - cmake --build . --config Release --target dilate - - 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 - - name: Check absolute includes - run: "! grep --exclude-dir rust-bridge -rE '^#include \"(antibot|base|engine|game|steam|test)/' src/" - - name: Check standard header includes - run: scripts/check_standard_headers.sh - - name: Check config variables - run: scripts/check_config_variables.py - # 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 - - name: Shellcheck - run: find . -type f -name '*.sh' -print0 | xargs -0 shellcheck - - name: Check log error case - run: | - if grep -Eqr '(msg|Print).*\(.*"[Ee]rror:' src/; - then - echo "Expected log errors to be in this format 'ERROR: error message'" - echo "Found these non uppercased log errors:" - grep -Er '(msg|Print).*\(.*"[Ee]rror:' src/ - exit 1 - fi - - name: Pylint - run: | - pylint --version - find . -type f -name "*.py" -not -path './ddnet-libs/*' -not -path './googletest-src/*' -print0 | xargs -0 pylint - - name: Unused headers - run: | - find src -name '*.h' | while read -r i; do grep -r -q "$(basename "$i")" || (echo "Header file $i is unused" && exit 1); done - - 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" | \ - 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" | \ - grep -v -E "\"data/maps7?/Tutorial\.map\": Map setting - Unusual: 'sv_show_others_default'" || true) - if [ -n "$findings" ]; then - echo "$findings" - exit 1 - fi + - uses: actions/checkout@v4 + with: + submodules: true + - uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: 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 -y + version: 1.0 + - uses: dtolnay/rust-toolchain@stable + - name: Prepare + run: | + pip3 install pylint + git clone https://gitlab.com/Patiga/twmap.git/ + cd twmap/twmap-tools + cargo install --locked --path=. + cd ../.. + rm -rf twmap + mkdir release + cd release + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDOWNLOAD_GTEST=OFF -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. .. + cmake --build . --config Release --target dilate + - 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 + - name: Check absolute includes + run: "! grep --exclude-dir rust-bridge -rE '^#include \"(antibot|base|engine|game|steam|test)/' src/" + - name: Check standard header includes + run: scripts/check_standard_headers.sh + - name: Check config variables + run: scripts/check_config_variables.py + # 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 + - name: Shellcheck + run: find . -type f -name '*.sh' -print0 | xargs -0 shellcheck + - name: Check log error case + run: | + if grep -Eqr '(msg|Print).*\(.*"[Ee]rror:' src/; + then + echo "Expected log errors to be in this format 'ERROR: error message'" + echo "Found these non uppercased log errors:" + grep -Er '(msg|Print).*\(.*"[Ee]rror:' src/ + exit 1 + fi + - name: Pylint + run: | + pylint --version + find . -type f -name "*.py" -not -path './ddnet-libs/*' -not -path './googletest-src/*' -print0 | xargs -0 pylint + - name: Unused headers + run: | + find src -name '*.h' | while read -r i; do grep -r -q "$(basename "$i")" || (echo "Header file $i is unused" && exit 1); done + - 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" | \ + 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" | \ + grep -v -E "\"data/maps7?/Tutorial\.map\": Map setting - Unusual: 'sv_show_others_default'" || true) + if [ -n "$findings" ]; then + echo "$findings" + exit 1 + fi