Merge pull request #6899 from VOREStation/aro-retravis

Rewrite how Travis works
This commit is contained in:
Aronai Sieyes
2020-03-17 19:06:56 -04:00
committed by GitHub
5 changed files with 160 additions and 38 deletions
+31 -28
View File
@@ -1,16 +1,12 @@
#pretending we're C because otherwise ruby will initialize, even with "language: dm".
language: c
sudo: false
env:
global:
- BASENAME="vorestation" # $BASENAME.dmb, $BASENAME.dme, etc.
- BYOND_MAJOR="513"
- BYOND_MINOR="1513"
- BYOND_MINOR="1514"
- MACRO_COUNT=4
matrix:
- TEST_DEFINE="MAP_TEST" TEST_FILE="code/_map_tests.dm" RUN="0"
- TEST_DEFINE="AWAY_MISSION_TEST" TEST_FILE="code/_away_mission_tests.dm" RUN="0"
- TEST_DEFINE="UNIT_TEST" TEST_FILE="code/_unit_tests.dm" RUN="1"
cache:
directories:
@@ -24,29 +20,36 @@ addons:
- libstdc++6:i386
- libssl-dev:i386
before_script:
- chmod +x ./install-byond.sh
- ./install-byond.sh
before_install:
- chmod -R +x ./tools/travis
install:
- pip install --user PyYaml -q
- pip install --user beautifulsoup4 -q
- ./tools/travis/install_byond.sh
before_script:
- shopt -s globstar
script:
- shopt -s globstar
- (! grep 'step_[xy]' maps/**/*.dmm)
- (! grep -Pn '( |\t|;|{)tag( ?)=' maps/**/*.dmm)
- (! find nano/templates/ -type f -exec md5sum {} + | sort | uniq -D -w 32 | grep nano)
- (! grep -En "<\s*span\s+class\s*=\s*('[^'>]+|[^'>]+')\s*>" **/*.dm)
- (! grep 'maps\\.*test.*' *.dme)
- awk -f tools/indentation.awk **/*.dm
- md5sum -c - <<< "88490b460c26947f5ec1ab1bb9fa9f17 *html/changelogs/example.yml"
- (num=`grep -E '\\\\(red|blue|green|black|b|i[^mc])' **/*.dm | wc -l`; echo "$num escapes (expecting ${MACRO_COUNT} or less)"; [ $num -le ${MACRO_COUNT} ])
- source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup
- python tools/TagMatcher/tag-matcher.py ../..
# Run our test
- cp config/example/* config/
- echo "#define ${TEST_DEFINE} 1" > ${TEST_FILE}
- DreamMaker vorestation.dme
- if [ $RUN -eq 1 ]; then DreamDaemon vorestation.dmb -invisible -trusted -core 2>&1 | tee log.txt; fi
- if [ $RUN -eq 1 ]; then grep "All Unit Tests Passed" log.txt; fi
- ./tools/travis/compile_and_run.sh
# Build-specific settings
jobs:
include:
- stage: "File Tests" #This is the odd man out, with specific installs and stuff.
name: "Validate Files"
install: #Need python for some of the tag matching stuff
- pip install --user PyYaml -q
- pip install --user beautifulsoup4 -q
script: ./tools/travis/validate_files.sh
addons:
apt:
packages: ~ # Don't need any packages for this
- stage: "Unit Tests"
env: TEST_DEFINE="UNIT_TEST" TEST_FILE="code/_unit_tests.dm" RUN="1"
name: "Compile normally (unit tests)"
- stage: "Isolation Tests"
env: TEST_DEFINE="MAP_TEST" TEST_FILE="code/_map_tests.dm" RUN="0"
name: "Compile POIs (no run)"
- env: TEST_DEFINE="AWAY_MISSION_TEST" TEST_FILE="code/_away_mission_tests.dm" RUN="0"
name: "Compile away missions (no run)"
+12 -10
View File
@@ -8,16 +8,18 @@
#include "tether_shuttle_defs.dm"
#include "tether_shuttles.dm"
#include "tether_telecomms.dm"
#include "tether-01-surface1.dmm"
#include "tether-02-surface2.dmm"
#include "tether-03-surface3.dmm"
#include "tether-04-transit.dmm"
#include "tether-05-station1.dmm"
#include "tether-06-station2.dmm"
#include "tether-07-station3.dmm"
#include "tether-08-mining.dmm"
#include "tether-09-solars.dmm"
#if !AWAY_MISSION_TEST //Don't include these for just testing away missions
#include "tether-01-surface1.dmm"
#include "tether-02-surface2.dmm"
#include "tether-03-surface3.dmm"
#include "tether-04-transit.dmm"
#include "tether-05-station1.dmm"
#include "tether-06-station2.dmm"
#include "tether-07-station3.dmm"
#include "tether-08-mining.dmm"
#include "tether-09-solars.dmm"
#endif
#include "submaps/_tether_submaps.dm"
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
RED='\033[0;31m'
NC='\033[0m'
source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/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
DreamMaker $BASENAME.dme
exitVal=$?
# 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
if [ $RUN -eq 1 ];
then
DreamDaemon $BASENAME.dmb -invisible -trusted -core 2>&1 | tee log.txt;
grep "All Unit Tests Passed" log.txt
fi
+80
View File
@@ -0,0 +1,80 @@
#!/bin/bash
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 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 ${MACRO_COUNT} or less)"; [ $num -le ${MACRO_COUNT} ])
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