AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Testing compilability with travis (https://forums.alliedmods.net/showthread.php?t=265800)

WildCard65 07-05-2015 07:51

Testing compilability with travis
 
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.

WildCard65 09-25-2015 14:23

Re: Testing compilability with travis
 
Update build.sh to reflect new SM download page.

asherkin 09-26-2015 16:04

Re: Testing compilability with travis
 
Quote:

Originally Posted by WildCard65 (Post 2346896)
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 ><

WildCard65 09-26-2015 17:15

Re: Testing compilability with travis
 
Quote:

Originally Posted by asherkin (Post 2347284)
If you want to scrape something, scrape the generated file listing rather than the download page ><

You mean the sm drop list correct?


All times are GMT -4. The time now is 18:36.

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