Files
Polaris/tools/ci/validate_files.sh
Spookerton 3fb0304096 update various versions & workflows
sdmm 1.7 -> 1.9
- Also updated sdmm config for future strictness changes

rust_g 0.46.x -> 3.9.0
- Ships the 3.9.0 windows dll for easy desktop dev. Removed the .so
because new versions are a large binary blob; instead these are fetched
from tgstation release build artifacts for tests, and can be collected
or preferably built locally for linux hosting.

Workflow OS targets updated from ubuntu-20 -> ubuntu-24

stefanzweifel/git-auto-commit-action v5 -> v6 to satisfy dependabot

Mislabeled actions/checkout 3 -> 4

Added cancel-in-progress concurrency rule to CI & label workflows
- Causes new runs of the workflows to cancel older runs still in
progress for a given ref (branch, pr, etc)

Where not using an official action, uses commit hash targets instead of
tags

Added permissions strictness to CI & labels workflows

Made workflows manually runnable

Added preflight change checks to CI workflow
- Only changes to byond sources, byond source validation, or version
definitions should trigger a full test of that matter
- Only changes to tgui sources or version definitions should trigger
a full test of that matter
2025-07-10 12:12:41 +01:00

107 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
source _build_dependencies.sh
RED='\033[0;31m'
NC='\033[0m'
FAILED=0
#Checking for step_x/step_y defined in any maps anywhere.
(! grep 'step_[xy]' maps/**/*.dmm)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}The variables 'step_x' and 'step_y' are present on a map, and they 'break' movement ingame.${NC}"
FAILED=1
fi
#Checking for 'tag' set to something on maps
(! grep -Pn '( |\t|;|{)tag( ?)=' maps/**/*.dmm)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A map has 'tag' set on an atom. It may cause problems and should be removed.${NC}"
FAILED=1
fi
#Checking for duplicate nanoui templates
(! find nano/templates/ -type f -exec md5sum {} + | sort | uniq -D -w 32 | grep nano)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}There are identical nanoui template files present.${NC}"
FAILED=1
fi
#Checking for broken HTML tags (didn't close the quote for class)
(! grep -En "<\s*span\s+class\s*=\s*('[^'>]+|[^'>]+')\s*>" **/*.dm)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A broken span tag class is present (check quotes).${NC}"
FAILED=1
fi
#Checking for bare globals with a leading /
(! grep -En "^/var" **/*.dm)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A bare global definition starting with / is present.${NC}"
FAILED=1
fi
#Checking for bare globals with no /global/ sugar
(! grep -En "^var/(?!global/)" **/*.dm)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A bare global definition without the /global/ sugar is present.${NC}"
FAILED=1
fi
#Checking for lists with trailing attributes
(! grep -En "list/((global/)|(static/)|(tmp/)|(const/))" **/*.dm)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A list with trailing /global/, /static/, /tmp/, or /const/ is present.${NC}"
FAILED=1
fi
#Checking for any 'checked' maps that include 'test'
(! grep 'maps\\.*test.*' *.dme)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A map containing the word 'test' is included. This is not allowed to be committed.${NC}"
FAILED=1
fi
#Check for weird indentation in any .dm files
awk -f tools/indentation.awk **/*.dm
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}Indention testing failed. Please see results and fix indentation.${NC}"
FAILED=1
fi
#Checking for a change to html/changelogs/example.yml
md5sum -c - <<< "88490b460c26947f5ec1ab1bb9fa9f17 *html/changelogs/example.yml"
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}Do not modify the example.yml changelog file.${NC}"
FAILED=1
fi
#Checking for color macros
(num=`grep -E '\\\\(red|blue|green|black|b|i[^mc])' **/*.dm | wc -l`; echo "$num escapes (expecting 0)"; [ $num -le 0 ])
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}Do not use any byond color macros (such as \blue), they are deprecated.${NC}"
FAILED=1
fi
#Checking for missed tags
python tools/TagMatcher/tag-matcher.py ../..
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}Some HTML tags are missing their opening/closing partners. Please correct this.${NC}"
FAILED=1
fi
# Quit with our status code
exit $FAILED