Skip to content

Commit cdc1d25

Browse files
authored
Merge dcec82b into b2f4252
2 parents b2f4252 + dcec82b commit cdc1d25

File tree

6 files changed

+77
-47
lines changed

6 files changed

+77
-47
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ jobs:
1111
fail-fast: false
1212

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

1819
- name: Check Codestyling
19-
run: source ./apps/ci/ci-codestyle.sh
20+
run: bash ./apps/ci/ci-codestyle.sh

apps/ci/ci-codestyle.sh

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,63 @@
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+
--exclude="CMakeLists.txt"
26+
)
27+
28+
# Accept multiple input paths
29+
input_paths=("$@")
30+
if [[ ${#input_paths[@]} -eq 0 ]]; then
31+
input_paths=("src") # fallback
32+
fi
2233

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

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

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

3850
echo
39-
echo "Awesome! No issues..."
51+
echo "------------------------------------------"
52+
echo "Summary of Triggered Rules:"
53+
echo "------------------------------------------"
54+
55+
if [[ ${#triggeredDescriptions[@]} -eq 0 ]]; then
56+
echo "No style violations found."
57+
else
58+
for rule in "${triggeredDescriptions[@]}"; do
59+
echo "$rule"
60+
done
61+
fi
62+
63+
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)