Skip to content

Commit 161fac7

Browse files
authored
Merge 873d12a into b2f4252
2 parents b2f4252 + 873d12a commit 161fac7

File tree

6 files changed

+84
-46
lines changed

6 files changed

+84
-46
lines changed

.github/workflows/core_build.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77

88
jobs:
99
build:
10+
strategy:
11+
fail-fast: false
12+
1013
runs-on: ubuntu-latest
1114

1215
steps:
@@ -20,11 +23,27 @@ jobs:
2023
- name: Install Required Packages
2124
run: sudo apt-get install -y git make cmake clang libssl-dev libbz2-dev build-essential default-libmysqlclient-dev libace-dev libreadline-dev
2225

23-
- name: Update Compilers
24-
run: source ./apps/ci/ci-compiler-update.sh
26+
- name: Install OpenSSL 3.5.1 Package Manually
27+
run: |
28+
wget https://www.openssl.org/source/openssl-3.5.1.tar.gz
29+
tar -xvf openssl-3.5.1.tar.gz
30+
cd openssl-3.5.1
31+
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
32+
make -j$(nproc)
33+
sudo make install
34+
35+
- name: Set OpenSSL 3.5.1 Environment Variables
36+
run: |
37+
echo "OPENSSL_ROOT_DIR=/usr/local/openssl" >> $GITHUB_ENV
38+
echo "OPENSSL_INCLUDE_DIR=/usr/local/openssl/include" >> $GITHUB_ENV
39+
echo "OPENSSL_LIBRARIES=/usr/local/openssl/lib" >> $GITHUB_ENV
40+
echo "/usr/local/openssl/lib" | sudo tee /etc/ld.so.conf.d/openssl-3.5.conf
41+
sudo ldconfig
2542
2643
- name: Check for Submodule Updates
27-
run: source ./apps/ci/ci-submodule-update.sh
44+
run: |
45+
git submodule init
46+
git submodule update
2847
2948
- name: Build Mangos Project
3049
run: source ./apps/ci/ci-compile.sh

.github/workflows/core_codestyle.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,19 @@ jobs:
1111
fail-fast: false
1212

1313
runs-on: ubuntu-latest
14+
1415
name: Check Codestyling
1516
steps:
1617
- uses: actions/checkout@v2
1718

19+
- name: Ensure grep supports -P
20+
run: |
21+
grep -P 'test' <<< 'test' || echo "::warning ::grep -P not supported"
22+
23+
- name: Install GNU grep (for full -P support)
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y grep
27+
1828
- name: Check Codestyling
1929
run: source ./apps/ci/ci-codestyle.sh

apps/ci/ci-codestyle.sh

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,62 @@
11
#!/bin/bash
22

3-
set -e
4-
3+
echo
4+
echo "Checking For MaNGOS Coding Standards:"
55
echo "Starting Codestyling Script:"
66
echo
77

88
declare -A singleLineRegexChecks=(
99
["[[:blank:]]$"]="Remove whitespace at the end of the lines above"
1010
["\t"]="Replace tabs with 4 spaces in the lines above"
11+
["^[[:blank:]]*(?:[a-zA-Z_][a-zA-Z_0-9]*[[:blank:]]+)*[a-zA-Z_][a-zA-Z_0-9]*[[:blank:]]*\([^)]*\)[[:blank:]]*\{[[:blank:]]*$"]="Move opening brace to a new line after function definition"
12+
["\{[[:blank:]]*\S"]="Opening brace must be on its own line (no code after '{')"
13+
["\S[[:blank:]]*\}"]="Closing brace must be on its own line (no code before '}')"
14+
["^[[:blank:]]*if\s*\(.*\)[[:blank:]]*(?!\{)"]="if statement must use braces"
15+
["^[[:blank:]]*else[[:blank:]]*(?!if|\{)"]="else statement must use braces"
16+
["\bif\("]="Missing space between 'if' and '('"
1117
)
1218

13-
for check in ${!singleLineRegexChecks[@]}; do
14-
echo " Checking RegEx: '${check}'"
15-
16-
if grep -P -r -I -n ${check} src; then
17-
echo
18-
echo "${singleLineRegexChecks[$check]}"
19-
exit 1
20-
fi
21-
done
19+
# Ignore directories
20+
grep_exclude_args=(
21+
--exclude-dir="Eluna"
22+
--exclude-dir="Extractor_Binaries"
23+
--exclude-dir="MangosStrings_LanguageHGenerator"
24+
--exclude-dir="restart-scripts"
25+
)
26+
27+
# Accept multiple input paths
28+
input_paths=("$@")
29+
if [[ ${#input_paths[@]} -eq 0 ]]; then
30+
input_paths=("src") # fallback
31+
fi
2232

23-
# declare -A multiLineRegexChecks=(
24-
# ["\n\n\n"]="Multiple blank lines detected, keep only one. Check the files above"
25-
# )
33+
hadError=0
34+
declare -a triggeredDescriptions
2635

27-
# for check in ${!multiLineRegexChecks[@]}; do
28-
# echo " Checking RegEx: '${check}'"
36+
for check in "${!singleLineRegexChecks[@]}"; do
37+
ruleDesc="${singleLineRegexChecks[$check]}"
38+
matches=$(grep -P -r -I -n "${grep_exclude_args[@]}" "${input_paths[@]}" -e "$check" 2>/dev/null)
2939

30-
# if grep -Pzo -r -I ${check} src; then
31-
# echo
32-
# echo
33-
# echo "${multiLineRegexChecks[$check]}"
34-
# exit 1
35-
# fi
36-
# done
40+
if [[ -n "$matches" ]]; then
41+
echo
42+
echo "== Rule triggered: $ruleDesc =="
43+
echo "$matches"
44+
triggeredDescriptions+=("$ruleDesc")
45+
hadError=1
46+
fi
47+
done
3748

3849
echo
39-
echo "Awesome! No issues..."
50+
echo "------------------------------------------"
51+
echo "Summary of Triggered Rules:"
52+
echo "------------------------------------------"
53+
54+
if [[ ${#triggeredDescriptions[@]} -eq 0 ]]; then
55+
echo "No style violations found."
56+
else
57+
for rule in "${triggeredDescriptions[@]}"; do
58+
echo "$rule"
59+
done
60+
fi
61+
62+
exit $hadError

apps/ci/ci-compile.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
set -e
44

55
# Check for & make directories
6-
time test -d _build || mkdir _build
7-
time test -d _install || mkdir _install
6+
test -d _build || mkdir _build
7+
test -d _install || mkdir _install
88

99
# Move to build folder
10-
time cd _build
10+
cd _build
1111

1212
# Run CMake Configurations
13-
time cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DBUILD_TOOLS:BOOL=1 -DBUILD_MANGOSD:BOOL=1 -DBUILD_REALMD:BOOL=1 -DSOAP:BOOL=1 -DSCRIPT_LIB_ELUNA:BOOL=1 -DSCRIPT_LIB_SD3:BOOL=1 -DPLAYERBOTS:BOOL=1 -DUSE_STORMLIB:BOOL=1
13+
cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DBUILD_TOOLS:BOOL=1 -DBUILD_MANGOSD:BOOL=1 -DBUILD_REALMD:BOOL=1 -DSOAP:BOOL=1 -DSCRIPT_LIB_ELUNA:BOOL=1 -DSCRIPT_LIB_SD3:BOOL=1 -DPLAYERBOTS:BOOL=1 -DUSE_STORMLIB:BOOL=1
1414

1515
# Compile the Project
16-
time make -j 6
16+
make -j$(nproc)

apps/ci/ci-compiler-update.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

apps/ci/ci-submodule-update.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)