Files
CHOMPStation2/tools/ci/compile_and_run.sh
Aronai Sieyes f8ff773412 Merge pull request #10573 from VOREStation/upstream-merge-8120
[MIRROR] Add CI annotations to compile errors/warnings.
2021-06-07 04:49:20 +00:00

44 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
RED='\033[0;31m'
NC='\033[0m'
source $HOME/BYOND/byond/bin/byondsetup
# Copy example configs
cp config/example/* config/
# Define any unit test defines that need to run
echo "#define ${TEST_DEFINE} 1" > ${TEST_FILE}
# Compile a copy of the codebase, and print errors as Github Actions annotations
DreamMaker $BASENAME.dme > compile.log
exitVal=$?
cat compile.log
if [ $exitVal -gt 0 ]; then
sed -E -n 's/^(.+?\.dm):([0-9]+):(error|warning): (.+)$/::\3 file=\1,line=\2::\4/gp' < compile.log
fi
# Compile failed on map_test
if [ $exitVal -gt 0 ] && [ $TEST_DEFINE = "MAP_TEST" ]; then
echo "${RED}Some POIs appear to contain map-specific objects or code. Please isolate map-specific items/code from POIs.${NC}"
exit 1
# Compile failed on away_mission_test
elif [ $exitVal -gt 0 ] && [ $TEST_DEFINE = "AWAY_MISSION_TEST" ]; then
echo "${RED}Some away missions failed to compile. Please check them for missing items/objects by trying to compile them in DreamMaker.${NC}"
exit 1
# Compile failed on unit_test
elif [ $exitVal -gt 0 ] && [ $TEST_DEFINE = "UNIT_TEST" ]; then
echo "${RED}Compiling the codebase normally failed. Please review the compile errors and correct them, usually before making your PR.${NC}"
exit 1
fi
# If we're running, run
# YW Edit removes "|| exit 1" until we can fix our submaps
if [ $RUN -eq 1 ];
then
DreamDaemon $BASENAME.dmb -close -trusted -invisible -verbose -core 2>&1 | tee log.txt;
grep "All Unit Tests Passed" log.txt
grep "Caught 0 Runtimes" log.txt
fi