Upgrade Travis and finally do the impossible

This commit is contained in:
Zandario
2020-09-28 01:01:55 -05:00
parent 5ee98184c5
commit ed5b6492eb
8 changed files with 180 additions and 54 deletions

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="citadelrp" # $BASENAME.dmb, $BASENAME.dme, etc.
- BYOND_MAJOR="513"
- BYOND_MINOR="1513"
- BYOND_MINOR="1520"
- 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,26 +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)
#- 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
# Run our test
- echo "#define ${TEST_DEFINE} 1" > ${TEST_FILE}
- DreamMaker vorestation.dme
- if [ $RUN -eq 1 ]; then DreamDaemon vorestation.dmb -close -trusted -verbose -params "test-run&log-directory=travis" -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)"

View File

@@ -1,15 +1,15 @@
## Citadel Station 13 - RP Server
[![Build Status](https://travis-ci.org/Citadel-Station-13/Citadel-Station-13-RP.png)](https://travis-ci.org/Citadel-Station-13/Citadel-Station-13-RP)
[![Build Status](https://travis-ci.org/Citadel-Station-13/Citadel-Station-13-RP.png)](https://travis-ci.org/Citadel-Station-13/Citadel-Station-13-RP)
[![Percentage of issues still open](https://isitmaintained.com/badge/open/Citadel-Station-13/Citadel-Station-13-RP.svg)](https://isitmaintained.com/project/Citadel-Station-13/Citadel-Station-13-RP "Percentage of issues still open")
[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/Citadel-Station-13/Citadel-Station-13-RP.svg)](https://isitmaintained.com/project/Citadel-Station-13/Citadel-Station-13-RP "Average time to resolve an issue")
[![forthebadge](http://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg)](http://forthebadge.com) [![forthebadge](http://forthebadge.com/images/badges/compatibility-club-penguin.svg)](http://forthebadge.com) [![forthebadge](http://forthebadge.com/images/badges/no-ragrets.svg)](http://forthebadge.com) [![forinfinityandbyond](https://user-images.githubusercontent.com/5211576/29499758-4efff304-85e6-11e7-8267-62919c3688a9.gif)](https://www.reddit.com/r/SS13/comments/5oplxp/what_is_the_main_problem_with_byond_as_an_engine/dclbu1a)
**Upstream Information**
**Upstream Information**
* **Code:** <https://github.com/VOREStation/VOREStation>
**Citadel Station RP Information**
**Citadel Station RP Information**
* **Website:** <http://citadel-station.net>
* **Code:** <https://github.com/Citadel-Station-13/Citadel-Station-13-RP>
* **Wiki:** <https://citadel-station.net/wiki/index.php?title=Main_Page>
@@ -26,8 +26,8 @@ Citadel Station 13 - RP was originally a fork of VOREStation, which separated on
There are a number of ways to download the source code. Some are described here.
Option 1: The more complicated and easier to update method is using git.
You'll need to download git or some client from [here](http://git-scm.com/).
When that's installed, right click in any folder and click on "Git Bash".
You'll need to download git or some client from [here](http://git-scm.com/).
When that's installed, right click in any folder and click on "Git Bash".
When that opens, type in:
```
@@ -48,13 +48,13 @@ First-time installation should be fairly straightforward. First, you'll need
BYOND installed. You can get it from <https://secure.byond.com/download>. Once you've done
that, extract the game files to wherever you want to keep them. This is a
sourcecode-only release, so the next step is to compile the server files.
Open vorestation.dme by double-clicking it, open the Build menu, and click
Open citadelrp.dme by double-clicking it, open the Build menu, and click
compile. This'll take a little while, and if everything's done right you'll get
a message like this:
```
saving vorestation.dmb (DEBUG mode)
vorestation.dmb - 0 errors, 0 warnings
saving citadelrp.dmb (DEBUG mode)
citadelrp.dmb - 0 errors, 0 warnings
```
If you see any errors or warnings, something has gone wrong - possibly a corrupt
@@ -79,11 +79,11 @@ byondkey = Rank
```
where the BYOND key must be in lowercase and the admin rank must be properly
capitalised. There are a bunch more admin ranks, but these two should be
capitalised. There are a bunch more admin ranks, but these two should be
enough for most servers, assuming you have trustworthy admins.
Finally, to start the server, run Dream Daemon and enter the path to your
compiled vorestation.dmb file. Make sure to set the port to the one you
compiled citadelrp.dmb file. Make sure to set the port to the one you
specified in the config.txt, and set the Security box to 'Safe'. Then press GO
and the server should start up and be ready to join. It is also recommended that
you set up the SQL backend (see below).
@@ -111,7 +111,7 @@ For a basic setup, simply copy every file from config/example to config.
## SQL Setup
The SQL backend for the library and stats tracking requires a MySQL server.
The SQL backend for the library and stats tracking requires a MySQL server.
Your server details go in /config/dbconfig.txt, and the SQL schema is in /SQL/tgstation_schema.sql.
More detailed setup instructions arecoming soon, for now ask in our Discord.

View File

@@ -1,4 +1,4 @@
// DM Environment file for baystation12.dme.
// DM Environment file for citadelrp.dme.
// All manual changes should be made outside the BEGIN_ and END_ blocks.
// New source code should be placed in .dm files: choose File/New --> Code File.
// BEGIN_INTERNALS

View File

@@ -11,12 +11,13 @@
#include "triumph_telecomms.dm"
#include "triumph_overmap.dm"
#include "../../_maps/map_files/NSV_Triumph/triumph-01-deck1.dmm"
#include "../../_maps/map_files/NSV_Triumph/triumph-02-deck2.dmm"
#include "../../_maps/map_files/NSV_Triumph/triumph-03-deck3.dmm"
#include "../../_maps/map_files/NSV_Triumph/triumph-04-deck4.dmm"
#include "../../_maps/map_files/NSV_Triumph/triumph-05-flagship.dmm"
#if !AWAY_MISSION_TEST //Don't include these for just testing away missions
#include "triumph-01-deck1.dmm"
#include "triumph-02-deck2.dmm"
#include "ttriumph-03-deck3.dmm"
#include "triumph-04-deck4.dmm"
#include "triumph-05-flagship.dmm"
#endif
#include "submaps/_triumph_submaps.dm"

View File

@@ -10,16 +10,18 @@
#include "tether_shuttles.dm"
#include "tether_telecomms.dm"
#include "../../_maps/map_files/Tether/tether-01-surface1.dmm"
#include "../../_maps/map_files/Tether/tether-02-surface2.dmm"
#include "../../_maps/map_files/Tether/tether-03-surface3.dmm"
#include "../../_maps/map_files/Tether/tether-04-transit.dmm"
#include "../../_maps/map_files/Tether/tether-05-station1.dmm"
#include "../../_maps/map_files/Tether/tether-06-station2.dmm"
#include "../../_maps/map_files/Tether/tether-07-station3.dmm"
#include "../../_maps/map_files/Tether/tether-08-mining.dmm"
#include "../../_maps/map_files/Tether/tether-09-solars.dmm"
#include "../../_maps/map_files/Tether/tether-10-colony.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"
#include "tether-10-colony.dmm"
#endif
#include "submaps/_tether_submaps.dm"
@@ -29,4 +31,4 @@
#warn A map has already been included, ignoring Tether
#endif
#endif

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

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