starting over (again) #11
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: Check style | |
on: | |
push: | |
branches-ignore: | |
- gh-readonly-queue/** | |
- master | |
pull_request: | |
merge_group: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-style: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Prepare | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install clang-format ddnet-tools shellcheck pkg-config cmake ninja-build libsqlite3-dev python3-clang -y | |
pip3 install pylint | |
wget -O ~/.local/bin/shfmt https://github.com/mvdan/sh/releases/download/v3.8.0/shfmt_v3.8.0_linux_amd64 | |
chmod +x ~/.local/bin/shfmt | |
mkdir release | |
cd release | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. | |
- 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 absolute includes | |
run: "! grep -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 | |
- name: Shellcheck | |
run: find . -type f -name '*.sh' -print0 | xargs -0 shellcheck | |
- name: Shell format (shfmt) | |
run: find . -type f -name '*.sh' -print0 | xargs -0 shfmt -d | |
- 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" -print0 | xargs -0 pylint | |
- name: Unused header files | |
run: scripts/check_unused_header_files.py | |