Raised This Month: $12 Target: $400
 3% 

Testing compilability with travis


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 07-05-2015 , 07:51   Testing compilability with travis
Reply With Quote #1

Incase anyone who uses a github repo to hold their SM plugin source, if you want a way to test if your plugin compiles automatically and for free, here's a nice little snippet for you to use with travis-ci:

build.sh:
Code:
set -ev
wget --input-file=http://sourcemod.net/smdrop/$SMVERSION/sourcemod-latest-linux
tar -xzf $(cat sourcemod-latest-linux)
cd addons/sourcemod/scripting
#Required includes here.
#wget "http://www.doctormckay.com/download/scripting/include/morecolors.inc" -O include/morecolors.inc --no-check-certificate
#Include all optional includes in if statements like the example below(replace url with include's RAW url).
#if [ $BUILD_WITH_RTD == 1 ]; then
#	wget "https://forums.alliedmods.net/attachment.php?attachmentid=115795" -O include/rtd.inc
#fi
chmod +x spcomp
mkdir compiled
ARGS="TRAVIS_OVERRIDE="
#if you want any preprocessor defines to test if plugin can compile with/without said defines, place them in if blocks here.
#ex(from VSH):
#if [ $EASTER_BUNNY_BUILD == 1 ]; then #Note: Replace EASTER_BUNNY_BUILD with enviro variable you named.
#	ARGS="$ARGS EASTER_BUNNY_ON=" #This line here if ran will tell spcomp to include EASTER_BUNNY_ON with no value as a define(equal sign manditory).
#fi
ARGS="$ARGS " #place all paths relative to addons/sourcemod/scripting to sp files you want to compile here.
./spcomp $ARGS
.travis.yml:
Code:
#Use the new container-based infrastructure
sudo: false

#Install some apt packages needed for spcomp
addons:
    apt_packages:
        - lib32stdc++6

#Set the build environment
env: #All enviroment variable below(see the 4 examples below). Note: All variable combos that are allowed to fail must exist here.
#  - SMVERSION=1.7 EASTER_BUNNY_BUILD=1 MEDIGUN_OVERRIDE_BUILD=1 BUILD_WITH_RTD=1 BUILD_WITH_GOOMBA=1
#  - SMVERSION=1.7 EASTER_BUNNY_BUILD=1 MEDIGUN_OVERRIDE_BUILD=1 BUILD_WITH_RTD=1 BUILD_WITH_GOOMBA=0
#  - SMVERSION=1.8 EASTER_BUNNY_BUILD=1 MEDIGUN_OVERRIDE_BUILD=1 BUILD_WITH_RTD=1 BUILD_WITH_GOOMBA=1
#  - SMVERSION=1.8 EASTER_BUNNY_BUILD=1 MEDIGUN_OVERRIDE_BUILD=1 BUILD_WITH_RTD=1 BUILD_WITH_GOOMBA=0

matrix:
  fast_finish: true
  allow_failures: #Any env variable combo that can be a failed build go here(2 examples below).
#    - env: SMVERSION=1.8 EASTER_BUNNY_BUILD=1 MEDIGUN_OVERRIDE_BUILD=1 BUILD_WITH_RTD=1 BUILD_WITH_GOOMBA=1
#    - env: SMVERSION=1.8 EASTER_BUNNY_BUILD=1 MEDIGUN_OVERRIDE_BUILD=1 BUILD_WITH_RTD=1 BUILD_WITH_GOOMBA=0

#And compile!
before_script: chmod +x ./build.sh
script: ./build.sh

#Notifications
notifications:
    email: false #Comment this if you want to be emailed of build statuses.
Note: For all defines you test, make sure they reside in the following block.
PHP Code:
#if !defined TRAVIS_OVERRIDE
//Insert defines that travis pass to SPComp via command line here
#endif 
Credits:
1) Who ever first came up with the travis file(the one I found via google a long while ago).
2) Me(first version designed for FF2, minus build.sh). Also for build.sh
3) Wliu for porting it to container structure.
__________________

Last edited by WildCard65; 12-16-2015 at 17:39.
WildCard65 is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 09-25-2015 , 14:23   Re: Testing compilability with travis
Reply With Quote #2

Update build.sh to reflect new SM download page.
__________________
WildCard65 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-26-2015 , 16:04   Re: Testing compilability with travis
Reply With Quote #3

Quote:
Originally Posted by WildCard65 View Post
Update build.sh to reflect new SM download page.
If you want to scrape something, scrape the generated file listing rather than the download page ><
__________________
asherkin is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 09-26-2015 , 17:15   Re: Testing compilability with travis
Reply With Quote #4

Quote:
Originally Posted by asherkin View Post
If you want to scrape something, scrape the generated file listing rather than the download page ><
You mean the sm drop list correct?
__________________
WildCard65 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode