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: - uses: actions/checkout@v2 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 pip3 install pylint 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: 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 i; do grep -r -q $(basename $i) || (echo "Header file $i is unused" && exit 1); done