Skip to content

Commit

Permalink
[ci] Test GCC13 potential fixes
Browse files Browse the repository at this point in the history
get more output

update runner images

mariadb packages

brt

regex strings

str
  • Loading branch information
claywar committed May 16, 2024
1 parent bff4a57 commit 7e2f1fb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ concurrency:

jobs:
Sanity_Checks:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common cppcheck luajit-5.1-dev luarocks mariadb-server-10.6 mariadb-client-10.6 libmariadb-dev-compat binutils-dev
pip install -r tools/requirements.txt
sudo apt-get install -y software-properties-common cppcheck luajit-5.1-dev luarocks mariadb-server-core mariadb-server mariadb-client libmariadb-dev-compat binutils-dev
pip install --break-system-packages -r tools/requirements.txt
luarocks install luacheck --local
npm install -g diff-so-fancy
- id: changed-files
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
Linux_Clang15_64bit:
needs: Sanity_Checks
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -218,12 +218,12 @@ jobs:
Linux_ClangTidy15_64bit:
needs: Sanity_Checks
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
# workaround for broken clang on ubuntu runner until fixed: https://github.com/actions/runner-images/issues/8659
- uses: claywar/workaround8649@4892524a133793c85e25513fae79fc968e63877c
with:
os: ubuntu-22.04
os: ubuntu-24.04
- uses: actions/checkout@v3
with:
fetch-depth: 1
Expand Down Expand Up @@ -253,7 +253,7 @@ jobs:
Linux_GCC13_64bit:
needs: Sanity_Checks
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -363,7 +363,7 @@ jobs:
cmake --build build -j4
Full_Startup_Checks_Linux:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: Linux_Clang15_64bit
services:
mysql:
Expand Down Expand Up @@ -542,7 +542,7 @@ jobs:
fi
MultiInstance_Startup_Checks_Linux:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: Linux_Clang15_64bit
services:
mysql:
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/check_lua_binding_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def main():

line = line.replace("\n", "")

for match in re.finditer('(?<=:)[^\(\/\\\: "]*', line):
for match in re.finditer(r'(?<=:)[^\(\/\\\: "]*', line):
if (
len(match.group()) > 1
and match.group() not in function_names
Expand Down
46 changes: 23 additions & 23 deletions tools/ci/lua_stylecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ def check_table_formatting(self, line):
# [ ]{0,} : Any number of spaces
# \n : newline character

for _ in re.finditer("[ ]{0,}=[ ]{0,}\{[ ]{0,}\n", line):
for _ in re.finditer(r"[ ]{0,}=[ ]{0,}\{[ ]{0,}\n", line):
self.error("Incorrectly defined table")

# \{ : Opening curly brace
# [^ \n\}] : Match single characters in list: NOT space or NOT newline or NOT closing curly brace

for _ in re.finditer("\{[^ \n\}]", line):
for _ in re.finditer(r"\{[^ \n\}]", line):
self.error("Table opened without an appropriate following space or newline")

# [^ \n\{] : Match single characters in list: NOT space or NOT newline or NOT opening curly brace
# \} : Closing curly brace

for _ in re.finditer("[^ \n\{]\}", line):
for _ in re.finditer(r"[^ \n\{]\}", line):
self.error("Table closed without an appropriate preceding space or newline")

def check_parameter_padding(self, line):
Expand All @@ -142,15 +142,15 @@ def check_parameter_padding(self, line):
"""
# ,[^ \n] : Any comma that does not have space or newline following

for _ in re.finditer(",[^ \n]", line):
for _ in re.finditer(r",[^ \n]", line):
self.error("Multiple parameters used without an appropriate following space or newline")

def check_conditional_padding(self, line):
# \s{2,}(and|or)(\s{1,}|$)|\s{1,}(and|or)\s{2,}

# lstrip current line to prevent false-positives from indentation
code_line = line.lstrip()
if re.search("\s{2,}(and|or)(\s{1,}|$)|\s{1,}(and|or)\s{2,}", code_line):
if re.search(r"\s{2,}(and|or)(\s{1,}|$)|\s{1,}(and|or)\s{2,}", code_line):
self.error("Multiple spaces detected around logical operator.")

def check_semicolon(self, line):
Expand All @@ -160,12 +160,12 @@ def check_semicolon(self, line):
"""

# Ignore strings in line
quote_regex = regex.compile("\"(([^\"\"]+)|(?R))*+\"|\'(([^\'\']+)|(?R))*+\'", re.S)
quote_regex = regex.compile(r"\"(([^\"\"]+)|(?R))*+\"|\'(([^\'\']+)|(?R))*+\'", re.S)
removed_quote_str = regex.sub(quote_regex, "", line)

# ; : Any line that contains a semicolon.

for _ in re.finditer(";", removed_quote_str):
for _ in re.finditer(r";", removed_quote_str):
self.error("Semicolon detected in line.")

def check_variable_names(self, line):
Expand All @@ -178,7 +178,7 @@ def check_variable_names(self, line):
# [^(ID)]) : A token that is NOT 'ID'
# (?=[A-Z]) : A token that starts with a capital letter

for match in re.finditer("local (?=[^(ID)])(?=[A-Z]){1,}", line):
for match in re.finditer(r"local (?=[^(ID)])(?=[A-Z]){1,}", line):
self.error("Capitalised local name")

if "local " in line and " =" in line:
Expand Down Expand Up @@ -206,14 +206,14 @@ def check_operator_padding(self, line):
"""
# [^ =~\<\>][\=\+\*\~\/\>\<]|[\=\+\*\/\>\<][^ =\n] : Require space before and after >, <, >=, <=, ==, +, *, ~=, / operators or comparators

for _ in re.finditer("[^ =~\<\>][\=\+\*\~\/\>\<]|[\=\+\*\/\>\<][^ =\n]", line):
for _ in re.finditer(r"[^ =~\<\>][\=\+\*\~\/\>\<]|[\=\+\*\/\>\<][^ =\n]", line):
self.error("Operator or comparator without padding detected at end of line")

# For now, ignore all content in single-line tables to allow for formatting
stripped_line = line.lstrip()
brace_regex = regex.compile("\{(([^\}\{]+)|(?R))*+\}", re.S)
brace_regex = regex.compile(r"\{(([^\}\{]+)|(?R))*+\}", re.S)
stripped_line = regex.sub(brace_regex, "", stripped_line)
for _ in re.finditer("\s{2,}(>=|<=|==|~=|\+|\*|%|>|<|\^)|(>=|<=|==|~=|\+|\*|%|>|<|\^)\s{2,}", stripped_line):
for _ in re.finditer(r"\s{2,}(>=|<=|==|~=|\+|\*|%|>|<|\^)|(>=|<=|==|~=|\+|\*|%|>|<|\^)\s{2,}", stripped_line):
self.error("Excessive padding detected around operator or comparator.")

def check_parentheses_padding(self, line):
Expand All @@ -223,7 +223,7 @@ def check_parentheses_padding(self, line):
See: https://github.com/LandSandBoat/server/wiki/Development-Guide#lua-no-excess-whitespace
"""

if len(re.findall("\([ ]| [\)]", line)) > 0:
if len(re.findall(r"\([ ]| [\)]", line)) > 0:
if not line.lstrip(' ')[0] == '(' and not line.lstrip(' ')[0] == ')': # Ignore large blocks ending or opening
self.error("No excess whitespace inside of parentheses or solely for alignment.")

Expand Down Expand Up @@ -283,7 +283,7 @@ def check_no_function_decl_padding(self, line):
See: TBD
"""

if re.search("function\s{1,}\(", line):
if re.search(r"function\s{1,}\(", line):
self.error("Padding detected between function and opening parenthesis")

def check_multiline_condition_format(self, line):
Expand All @@ -293,7 +293,7 @@ def check_multiline_condition_format(self, line):
See: https://github.com/LandSandBoat/server/wiki/Development-Guide#lua-formatting-conditional-blocks
"""

stripped_line = re.sub("\".*?\"|'.*?'", "", line) # Ignore data in quotes
stripped_line = re.sub(r"\".*?\"|'.*?'", "", line) # Ignore data in quotes
if contains_word('if')(stripped_line) or contains_word('elseif')(stripped_line):
condition_start = stripped_line.replace('elseif','').replace('if','').strip()
if not 'then' in condition_start and condition_start != '':
Expand Down Expand Up @@ -367,12 +367,12 @@ def run_style_check(self):
continue

comment_header = line.rstrip("\n")
if re.search("^-+$", comment_header) and len(comment_header) > 2 and len(comment_header) != 35:
if re.search(r"^-+$", comment_header) and len(comment_header) > 2 and len(comment_header) != 35:
# For now, ignore empty comments with only `--`
self.error("Standard comment block lines of '-' should be 35 characters.")

# Remove in-line comments
code_line = re.sub("(?=--)(.*?)(?=\r\n|\n)", "", line).rstrip()
code_line = re.sub(r"(?=--)(.*?)(?=\r\n|\n)", "", line).rstrip()

# Before replacing strings, see if we're only using single quotes and check requires
if re.search(r"\"[^\"']*\"(?=(?:[^']*'[^']*')*[^']*$)", code_line):
Expand All @@ -383,8 +383,8 @@ def run_style_check(self):
code_line = code_line.replace("\\'", '')
code_line = code_line.replace('\\"', '')

code_line = re.sub('\"([^\"]*?)\"', "strVal", code_line)
code_line = re.sub("\'([^\"]*?)\'", "strVal", code_line)
code_line = re.sub(r'\"([^\"]*?)\"', "strVal", code_line)
code_line = re.sub(r"\'([^\"]*?)\'", "strVal", code_line)

# Checks that apply to all lines
self.check_table_formatting(code_line)
Expand All @@ -406,10 +406,10 @@ def run_style_check(self):
# Keep track of ID variable assignments and if they are referenced.
# TODO: Track each unique variable, and expand this to potentially something
# more generic for other tests.
if re.search("ID[ ]+=[ ]+zones\[", code_line):
if re.search(r"ID[ ]+=[ ]+zones\[", code_line):
uses_id = True

if uses_id == True and re.search("ID\.", code_line):
if uses_id == True and re.search(r"ID\.", code_line):
has_id_ref = True

# Multiline conditionals should not have data in if, elseif, or then
Expand Down Expand Up @@ -441,16 +441,16 @@ def run_style_check(self):

if contains_word('then')(code_line):
condition_str = full_condition.replace('elseif','').replace('if','').replace('then','').strip()
paren_regex = regex.compile("\((([^\)\(]+)|(?R))*+\)", re.S)
paren_regex = regex.compile(r"\((([^\)\(]+)|(?R))*+\)", re.S)
removed_paren_str = regex.sub(paren_regex, "", condition_str)

if removed_paren_str == "":
self.error("Outer parentheses should be removed in condition")

if len(re.findall("== true|== false|~= true|~= false", condition_str)) > 0:
if len(re.findall(r"== true|== false|~= true|~= false", condition_str)) > 0:
self.error("Boolean with explicit value check")

if not in_condition and len(re.findall(" and | or ", condition_str)) > 0 and len(condition_str) > 72:
if not in_condition and len(re.findall(r" and | or ", condition_str)) > 0 and len(condition_str) > 72:
self.error("Multiline conditional format required")

in_condition = False
Expand Down

0 comments on commit 7e2f1fb

Please sign in to comment.