Skip to content

Commit

Permalink
Adds SQL to travis. Other travis optimizations (tgstation#38325)
Browse files Browse the repository at this point in the history
* Adds SQL to travis

* See if we can get this working

* :dab:

* Try dis

* wew

* Try this?

* Should do it

* DL the biatch

* oof

* bruh

* json in 10.2

* Fix schemas

* Actually separate tools and byond builds

* Dedent the ting

* Needs more include

* Fix script logic

* Caching and fixups

* Jesus neer

* Fix this

* And this

* Fix things

* Oh that's why she did it here

* Fuck a duck

* yadayadayada

* Cache cargo in the right build

* Idiot.commit

* *sighs*

* Tools build doesn't need BYOND cache

* Create a database with the prefixed schema as well

* Fix prefixed trigger names
  • Loading branch information
Cyberboss authored and vuonojenmustaturska committed Jun 11, 2018
1 parent fd656d3 commit a38ef37
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 43 deletions.
70 changes: 44 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,53 @@ env:
- BYOND_MINOR="1418"
- NODE_VERSION="4"
- RUST_G_VERSION="0.3.0"
- BUILD_TOOLS=false
- BUILD_TESTING=false
- DM_MAPFILE="loadallmaps"
matrix:
- BUILD_TOOLS=true
- BUILD_TESTING=true
- BUILD_TESTING=false

cache:
directories:
- $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}
- tgui/node_modules
- $HOME/.rustup
- $HOME/.cargo


addons:
apt:
packages:
- libc6-i386
- libgcc1:i386
- libstdc++6:i386
- gcc-multilib
- python3
- python3-pip
- libssl-dev:i386
matrix:
include:
- env:
- BUILD_TOOLS=true
addons:
apt:
packages:
- python3
- python3-pip
cache:
directories:
- tgui/node_modules
- env:
- BUILD_TESTING=true
- BUILD_TOOLS=false
addons:
apt:
packages:
- libc6-i386
- libstdc++6:i386
cache:
directories:
- $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}
- env:
- BUILD_TESTING=false
- BUILD_TOOLS=false
addons:
mariadb: '10.2'
apt:
packages:
- libc6-i386
- libstdc++6:i386
- libssl-dev:i386
- gcc-multilib
cache:
directories:
- $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}
- $HOME/libmariadb
- $HOME/.rustup
- $HOME/.cargo

install:
- tools/travis/install_build_tools.sh
- if [ $BUILD_TOOLS = false ] && [ $BUILD_TESTING = false ]; then mysql -u root -e 'CREATE DATABASE tg_travis;'; fi
- if [ $BUILD_TOOLS = false ] && [ $BUILD_TESTING = false ]; then mysql -u root tg_travis < SQL/tgstation_schema.sql; fi
- if [ $BUILD_TOOLS = false ] && [ $BUILD_TESTING = false ]; then mysql -u root -e 'CREATE DATABASE tg_travis_prefixed;'; fi
- if [ $BUILD_TOOLS = false ] && [ $BUILD_TESTING = false ]; then mysql -u root tg_travis_prefixed < SQL/tgstation_schema_prefixed.sql; fi

before_script:
- tools/travis/before_build_tools.sh
Expand Down
5 changes: 2 additions & 3 deletions SQL/tgstation_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,14 @@ CREATE TABLE `schema_revision` (
PRIMARY KEY (`major`, `minor`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DELIMITER
$$
DELIMITER $$
CREATE TRIGGER `role_timeTlogupdate` AFTER UPDATE ON `role_time` FOR EACH ROW BEGIN INSERT into role_time_log (ckey, job, delta) VALUES (NEW.CKEY, NEW.job, NEW.minutes-OLD.minutes);
END
$$
CREATE TRIGGER `role_timeTloginsert` AFTER INSERT ON `role_time` FOR EACH ROW BEGIN INSERT into role_time_log (ckey, job, delta) VALUES (NEW.ckey, NEW.job, NEW.minutes);
END
$$
CREATE TRIGGER `role_timeTlogdelete` AFTER DELETE ON `role_time` FOR EACH ROW BEGIN INSERT into role_time_log (ckey, job, delta) VALUES (OLD.ckey, OLD.job, 0-OLD.minutes);
CREATE TRIGGER `role_timeTlogdelete` AFTER DELETE ON `role_time` FOR EACH ROW BEGIN INSERT into role_time_log (ckey, job, delta) VALUES (OLD.ckey, OLD.job, 0-OLD.minutes);
END
$$

Expand Down
9 changes: 4 additions & 5 deletions SQL/tgstation_schema_prefixed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,14 @@ CREATE TABLE `SS13_schema_revision` (
PRIMARY KEY (`major`,`minor`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DELIMITER
$$
CREATE TRIGGER `role_timeTlogupdate` AFTER UPDATE ON `role_time` FOR EACH ROW BEGIN INSERT into role_time_log (ckey, job, delta) VALUES (NEW.CKEY, NEW.job, NEW.minutes-OLD.minutes);
DELIMITER $$
CREATE TRIGGER `SS13_role_timeTlogupdate` AFTER UPDATE ON `SS13_role_time` FOR EACH ROW BEGIN INSERT into SS13_role_time_log (ckey, job, delta) VALUES (NEW.CKEY, NEW.job, NEW.minutes-OLD.minutes);
END
$$
CREATE TRIGGER `role_timeTloginsert` AFTER INSERT ON `role_time` FOR EACH ROW BEGIN INSERT into role_time_log (ckey, job, delta) VALUES (NEW.ckey, NEW.job, NEW.minutes);
CREATE TRIGGER `SS13_role_timeTloginsert` AFTER INSERT ON `SS13_role_time` FOR EACH ROW BEGIN INSERT into SS13_role_time_log (ckey, job, delta) VALUES (NEW.ckey, NEW.job, NEW.minutes);
END
$$
CREATE TRIGGER `role_timeTlogdelete` AFTER DELETE ON `role_time` FOR EACH ROW BEGIN INSERT into role_time_log (ckey, job, delta) VALUES (OLD.ckey, OLD.job, 0-OLD.minutes);
CREATE TRIGGER `SS13_role_timeTlogdelete` AFTER DELETE ON `SS13_role_time` FOR EACH ROW BEGIN INSERT into SS13_role_time_log (ckey, job, delta) VALUES (OLD.ckey, OLD.job, 0-OLD.minutes);
END
$$

Expand Down
2 changes: 1 addition & 1 deletion tools/travis/before_build_byond.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [ "$BUILD_TOOLS" = true ]; then
exit 0
fi;
echo "Combining maps for building"
if [ "$DM_MAPFILE" = "loadallmaps" ]; then
if [ $BUILD_TESTING = true ]; then
python tools/travis/template_dm_generator.py
fi;

Expand Down
30 changes: 23 additions & 7 deletions tools/travis/build_byond.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,33 @@ if [ "$BUILD_TOOLS" = false ]; then
exit 1
fi;

#config folder should not be mandatory
rm -rf config/*

#disable all ruins
echo -e "LAVALAND_BUDGET 0\nSPACE_BUDGET 0" > config/config.txt

source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup
if [ "$BUILD_TESTING" = true ]; then
tools/travis/dm.sh -DTRAVISBUILDING -DTRAVISTESTING -DALL_MAPS tgstation.dme
else
tools/travis/dm.sh -DTRAVISBUILDING tgstation.dme && DreamDaemon tgstation.dmb -close -trusted -params "test-run&log-directory=travis"
tools/travis/dm.sh -DTRAVISBUILDING tgstation.dme

#config folder should not be mandatory
rm -rf config/*

#test config
cp tools/travis/travis_config.txt config/config.txt

# get libmariadb, cache it so limmex doesn't get angery
if [ -f $HOME/libmariadb ]; then
#travis likes to interpret the cache command as it being a file for some reason
rm $HOME/libmariadb
mkdir $HOME/libmariadb
fi
if [ ! -f $HOME/libmariadb/libmariadb.so ]; then
wget http://www.byond.com/download/db/mariadb_client-2.0.0-linux.tgz
tar -xvf mariadb_client-2.0.0-linux.tgz
mv mariadb_client-2.0.0-linux/libmariadb.so $HOME/libmariadb/libmariadb.so
rm -rf mariadb_client-2.0.0-linux.tgz mariadb_client-2.0.0-linux
fi
ln -s $HOME/libmariadb/libmariadb.so libmariadb.so

DreamDaemon tgstation.dmb -close -trusted -params "test-run&log-directory=travis"
cat data/logs/travis/clean_run.lk
fi;
fi;
2 changes: 1 addition & 1 deletion tools/travis/build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

if [ "$BUILD_TOOLS" = false ]; then
if [ $BUILD_TOOLS = false ] && [ $BUILD_TESTING = false ]; then
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host i686-unknown-linux-gnu
source ~/.profile

Expand Down
9 changes: 9 additions & 0 deletions tools/travis/travis_config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SQL_ENABLED
ADDRESS 127.0.0.1
PORT 3306
FEEDBACK_DATABASE tg_travis
FEEDBACK_TABLEPREFIX
FEEDBACK_LOGIN root
FEEDBACK_PASSWORD
LAVALAND_BUDGET 0
SPACE_BUDGET 0

0 comments on commit a38ef37

Please sign in to comment.