diff --git a/.travis.yml b/.travis.yml index f527a4fa5b1..cbf5e3be958 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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)" + diff --git a/maps/tether/tether.dm b/maps/tether/tether.dm index 0d1f40f34a3..4660e3d1aea 100644 --- a/maps/tether/tether.dm +++ b/maps/tether/tether.dm @@ -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" diff --git a/tools/travis/compile_and_run.sh b/tools/travis/compile_and_run.sh new file mode 100644 index 00000000000..95979197460 --- /dev/null +++ b/tools/travis/compile_and_run.sh @@ -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 \ No newline at end of file diff --git a/install-byond.sh b/tools/travis/install_byond.sh similarity index 100% rename from install-byond.sh rename to tools/travis/install_byond.sh diff --git a/tools/travis/validate_files.sh b/tools/travis/validate_files.sh new file mode 100644 index 00000000000..1b5a756903c --- /dev/null +++ b/tools/travis/validate_files.sh @@ -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 \ No newline at end of file