Test of the travis cleanup

This commit is contained in:
AffectedArc07
2020-04-12 14:23:37 +01:00
parent 1d50569dcc
commit d992ef5008
11 changed files with 191 additions and 69 deletions
+24 -55
View File
@@ -1,74 +1,43 @@
#pretending we're C because otherwise ruby will initialize, even with "language: dm".
language: generic
dist: xenial
sudo: false
git:
depth: 1
cache:
directories:
- $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}
addons:
apt:
packages:
- libc6-i386
- libgcc1:i386
- libstdc++6:i386
env:
global:
- BYOND_MAJOR="513"
- BYOND_MINOR="1505"
- BYOND_MACRO_COUNT=4
matrix:
- DM_MAPFILE="cyberiad"
- DM_MAPFILE="metastation"
- DM_MAPFILE="delta"
- DM_MAPFILE="test_all_maps"
stages:
- File Checks
- test
before_script:
- chmod +x ./install-byond.sh
- ./install-byond.sh
script:
- source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup
- bash dm.sh -M${DM_MAPFILE} paradise.dme
jobs:
matrix:
include:
# Basic styling/functionality checks
- stage: File Checks
env:
- name: "Run Linters"
addons:
apt:
packages:
- python3
- python3-pip
- python3-setuptools
install:
- pip install --user PyYaml -q
- pip install --user beautifulsoup4 -q
- tools/travis/install_build_deps.sh
- tools/travis/install_dreamchecker.sh
before_script: skip
script:
- shopt -s globstar
- find . -name "*.php" -print0 | xargs -0 -n1 php -l
- find . -name "*.json" -not -path "./nano/node_modules/*" -print0 | xargs -0 python3 ./tools/json_verifier.py
- tools/travis/build_nanoUI.sh
- tools/travis/check_grep.sh
- tools/travis/check_changelogs.sh
- python3 tools/travis/check_line_endings.py
- (num=$(grep -Ern '\\(red|blue|green|black|italic|bold|b|i[^mc])' code/ | wc -l); echo "$num BYOND text macros (expecting ${BYOND_MACRO_COUNT} or fewer)"; [ $num -le ${BYOND_MACRO_COUNT} ])
- md5sum -c - <<< "6dc1b6bf583f3bd4176b6df494caa5f1 *html/changelogs/example.yml"
- python tools/ss13_genchangelog.py html/changelog.html html/changelogs
- ~/dreamchecker
# Compile NanoUI to make sure it works
- stage: NanoUI
language: node_js
node_js:
- "9"
env:
- name: "Compile All Maps"
addons:
before_install:
- npm install -g gulp-cli
- cd ./nano/
apt:
packages:
- libstdc++6:i386
cache:
directories:
- $HOME/BYOND
install:
- npm install --loglevel=error
before_script:
- tools/travis/install_byond.sh
- source $HOME/BYOND/byond/bin/byondsetup
script:
- node node_modules/gulp/bin/gulp.js --require less-loader
- tools/travis/dm.sh -M travis_map_testing paradise.dme
+5
View File
@@ -1,2 +1,7 @@
# This file has all the information on what versions of libraries are thrown into the code
# For dreamchecker
export SPACEMANDMM_TAG=suite-1.2
# For NanoUI
export NODEJS_VERSION=9
# For the scripts in tools
export PHP_VERSION=5.6
-14
View File
@@ -1,14 +0,0 @@
#!/bin/sh
set -e
if [ -d "$HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin" ];
then
echo "Using cached directory."
else
echo "Setting up BYOND."
mkdir -p "$HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}"
cd "$HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}"
curl "http://www.byond.com/download/build/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond_linux.zip" -o byond.zip
unzip byond.zip
cd byond
make here
fi
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
npm install -g gulp-cli
cd nano
npm install --loglevel=error
node node_modules/gulp/bin/gulp.js --require less-loader
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
set -euo pipefail
md5sum -c - <<< "6dc1b6bf583f3bd4176b6df494caa5f1 *html/changelogs/example.yml"
python tools/ss13_genchangelog.py html/changelog.html html/changelogs
Regular → Executable
View File
+97
View File
@@ -0,0 +1,97 @@
#!/bin/bash
dmepath=""
retval=1
for var
do
if [[ $var != -* && $var == *.dme ]]
then
dmepath=`echo $var | sed -r 's/.{4}$//'`
break
fi
done
if [[ $dmepath == "" ]]
then
echo "No .dme file specified, aborting."
exit 1
fi
if [[ -a $dmepath.mdme ]]
then
rm $dmepath.mdme
fi
cp $dmepath.dme $dmepath.mdme
if [[ $? != 0 ]]
then
echo "Failed to make modified dme, aborting."
exit 2
fi
for var
do
arg=`echo $var | sed -r 's/^.{2}//'`
if [[ $var == -D* ]]
then
sed -i '1s/^/#define '$arg'\n/' $dmepath.mdme
continue
fi
if [[ $var == -M* ]]
then
sed -i '1s/^/#define MAP_OVERRIDE\n/' $dmepath.mdme
sed -i 's!// BEGIN_INCLUDE!// BEGIN_INCLUDE\n#include "_maps\\'$arg'.dm"!' $dmepath.mdme
continue
fi
done
#windows
if [[ `uname` == MINGW* ]]
then
dm=""
if hash dm.exe 2>/dev/null
then
dm='dm.exe'
elif [[ -a '/c/Program Files (x86)/BYOND/bin/dm.exe' ]]
then
dm='/c/Program Files (x86)/BYOND/bin/dm.exe'
elif [[ -a '/c/Program Files/BYOND/bin/dm.exe' ]]
then
dm='/c/Program Files/BYOND/bin/dm.exe'
fi
if [[ $dm == "" ]]
then
echo "Couldn't find the DreamMaker executable, aborting."
exit 3
fi
"$dm" $dmepath.mdme 2>&1 | tee result.log
retval=$?
if ! grep '\- 0 errors, 0 warnings' result.log
then
retval=1 #hard fail, due to warnings or errors
fi
else
if hash DreamMaker 2>/dev/null
then
DreamMaker -max_errors 0 $dmepath.mdme 2>&1 | tee result.log
retval=$?
if ! grep '\- 0 errors, 0 warnings' result.log
then
retval=1 #hard fail, due to warnings or errors
fi
else
echo "Couldn't find the DreamMaker executable, aborting."
exit 3
fi
fi
mv $dmepath.mdme.dmb $dmepath.dmb
mv $dmepath.mdme.rsc $dmepath.rsc
rm $dmepath.mdme
exit $retval
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail
source dependencies.sh
source ~/.nvm/nvm.sh
nvm install $NODE_VERSION
pip3 install --user PyYaml
pip3 install --user beautifulsoup4
phpenv global $PHP_VERSION
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail
source dependencies.sh
if [ -d "$HOME/BYOND/byond/bin" ] && grep -Fxq "${BYOND_MAJOR}.${BYOND_MINOR}" $HOME/BYOND/version.txt;
then
echo "Using cached directory."
else
echo "Setting up BYOND."
rm -rf "$HOME/BYOND"
mkdir -p "$HOME/BYOND"
cd "$HOME/BYOND"
curl "http://www.byond.com/download/build/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond_linux.zip" -o byond.zip
unzip byond.zip
rm byond.zip
cd byond
make here
echo "$BYOND_MAJOR.$BYOND_MINOR" > "$HOME/BYOND/version.txt"
cd ~/
fi
+20
View File
@@ -0,0 +1,20 @@
import sys
import json
if len(sys.argv) <= 1:
exit(1)
status = 0
for file in sys.argv[1:]:
with open(file, encoding="ISO-8859-1") as f:
try:
json.load(f)
except ValueError as exception:
print("JSON error in {}".format(file))
print(exception)
status = 1
else:
print("Valid {}".format(file))
exit(status)