Raised This Month: $ Target: $400
 0% 

Travis CI + Sourcemod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Toastbrot_290
SourceMod Donor
Join Date: Apr 2013
Old 05-01-2015 , 14:07   Travis CI + Sourcemod
Reply With Quote #1

I just started to switch from bitbucket to github and recognized that many developers use travis for testing their plugins against sourcemod compiler. Because I never worked with travis and couldn't find a tutorial for using it with sourcemod easily, i read their docs, created a configuration that fits to all of my plugins and posted it here.

Code:
language: c

env: 
  global:
    - INCLUDE=addons/sourcemod/scripting/include/
    - SCRIPTING=addons/sourcemod/scripting/
    - PLUGINS=addons/sourcemod/plugins/
    - HOME=ftp.toastdev.de/plugins
  matrix:
    - SOURCEMOD=1.7.1

before_install:
  - sudo apt-get update
  - sudo apt-get install gcc-multilib
  - sudo apt-get install lynx
  - sudo apt-get install lib32stdc++6
  - mkdir build-env

install:
  - cd build-env
  - wget http://sourcemod.gameconnect.net/files/sourcemod-$SOURCEMOD-linux.tar.gz
  - tar -xzvf sourcemod-$SOURCEMOD-linux.tar.gz
  - cd ../
  - find build-env/addons/sourcemod/scripting/ -name "*.sp" -type f -delete
  - cp -rv $SCRIPTING/. build-env/addons/sourcemod/scripting/
  - cp -rv $INCLUDE/. build-env/addons/sourcemod/scripting/include/

before_script:
  - chmod +rx build-env/addons/sourcemod/scripting/spcomp
  - chmod +rx build-env/addons/sourcemod/scripting/compile.sh
  - cd build-env/addons/sourcemod/scripting/
  
script:
  - ./compile.sh
  
after_success:
  - cd ../../../..
  - cp -rv build-env/addons/sourcemod/scripting/compiled/. $PLUGINS
  - cd $PLUGINS
  - find . -type f -exec curl --user $FTPUSER:$FTPPASS --ftp-create-dirs -T {} ftp://$HOME/$SOURCEMOD/{} \;
Configuration
You have to upload the custom includes, that your plugin needs, to your repo.
Then you have to set the env vars. The global one are holding the paths to your custom includes and sp files. Those are relative to your repo root. Also you can set the versions of sourcemod to test against. If you define multiple versions, multiple tests will be triggered.
For auto deployment you also need to set repo vars FTPUSER and FTPPASS.

Auto Deployment
This file contains a auto deployment after successfull build. This can be used for providing up to date downloads or pushing the plugin to test server for future tests. Anyway it has to get modified in most cases. Therefor you can edit HOME var and/or the last line (ftp://$HOME/$SOURCEMOD/) which holds the destination. If you don't need it simply remove the after_sucess part.

Example

Maybe somone can make use of it.
__________________

Last edited by Toastbrot_290; 05-01-2015 at 14:12.
Toastbrot_290 is offline
Wliu
Veteran Member
Join Date: Apr 2013
Old 05-01-2015 , 14:20   Re: Travis CI + Sourcemod
Reply With Quote #2

I suggest that you revise your script to remove the need for sudo and instead use the new container-based infrastructure (see https://github.com/50DKP/FF2-Officia...le/.travis.yml as an example).

Also, won't the password appear on Travis when that line gets called?
__________________
~Wliu

Last edited by Wliu; 05-01-2015 at 14:21.
Wliu is offline
Toastbrot_290
SourceMod Donor
Join Date: Apr 2013
Old 05-01-2015 , 14:59   Re: Travis CI + Sourcemod
Reply With Quote #3

Oh yes. I gonna have a lookt at it. No the password won't be shown unless you activate that in the repo settings. Have a look at the example.
__________________
Toastbrot_290 is offline
Wliu
Veteran Member
Join Date: Apr 2013
Old 05-01-2015 , 16:06   Re: Travis CI + Sourcemod
Reply With Quote #4

Quote:
Originally Posted by Toastbrot_290 View Post
Oh yes. I gonna have a lookt at it. No the password won't be shown unless you activate that in the repo settings. Have a look at the example.
Ah, perfect. I forgot that Travis doesn't expand env variables.
__________________
~Wliu
Wliu is offline
Reply



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 18:29.


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