forked from ddnet/ddnet
-
Notifications
You must be signed in to change notification settings - Fork 2
136 lines (113 loc) · 4.79 KB
/
style.yml
File metadata and controls
136 lines (113 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Check style
on:
push:
branches-ignore:
- gh-readonly-queue/**
- master
pull_request:
merge_group:
jobs:
check-style:
runs-on: ubuntu-latest
env:
CARGO_HTTP_MULTIPLEXING: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare Linux
run: |
sudo apt-get update -y
sudo apt-get install ddnet-tools shellcheck tidy pkg-config cmake graphviz ninja-build python3-clang -y
rustup default stable
pip3 install ruff
wget https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-796e77c/clang-format-20_linux-amd64
echo "bbb30a777d075dfbe91aa146a1ea1fa0c1d4745efa9c5490ebf9f5a7a7dec679c22f1c6015d5c85cb5b5b22964d86ae65002f1d4145bfdd7f27022d981b58979 clang-format-20_linux-amd64" | sha512sum -c
mv clang-format-20_linux-amd64 ~/.local/bin/clang-format
chmod +x ~/.local/bin/clang-format
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
wget --quiet -O doxygen.tar.gz https://www.doxygen.nl/files/doxygen-1.16.1.linux.bin.tar.gz
tar xf doxygen.tar.gz
mv doxygen-1.16.1/bin/doxygen ~/.local/bin
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Check code style (ClangFormat)
run: |
clang-format -version
scripts/fix_style.py --dry-run
- name: Check documentation style (Doxygen)
run: |
doxygen --version
doxygen -q
if [ -s docs/warn.log ]; then
echo "--------------------------------------------------"
echo "Doxygen warnings:"
cat docs/warn.log
exit 1
fi
- 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 Python code style (ruff format)
run: |
ruff --version
ruff format
- name: Check Python code style (ruff check)
run: |
ruff --version
ruff check
- name: Check header guards
run: scripts/check_header_guards.py
- name: Unused header files
run: scripts/check_unused_header_files.py
- name: Check standard header includes
run: scripts/check_standard_headers.py
- name: Check absolute includes
run: "! grep --exclude-dir rust-bridge -rE '^#include \"(antibot|base|engine|game|steam|test)/' src/"
- name: Check config variables
run: scripts/check_config_variables.py
- name: Check commands & settings export
run: |
echo "<!DOCTYPE html><html><head><title></title></head><body>" > settingscommands.html
scripts/export_settings_commands_table.py >> settingscommands.html
echo "</body></html>" >> settingscommands.html
tidy -errors --drop-empty-elements false settingscommands.html
- name: Check log error format
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: Validate languages
run: scripts/languages/validate.py
- name: Check languages
run: scripts/languages/update_all.py
- name: Build dilate tool
run: |
mkdir release
cd release
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCLIENT=OFF -DDOWNLOAD_GTEST=OFF ..
cmake --build . --config Release --target dilate
- name: Check dilated images
run: scripts/check_dilate.py release data
- name: Build twmap tool
run: |
cargo install twmap-tools --git https://gitlab.com/Patiga/twmap.git/ --rev 1f192def57429a1f64ddb3ac8580744476cfdf1c --locked
- name: Check maps
run: |
findings=$(find data -type f -name '*.map' ! -wholename 'data/maps/coverage.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