Setting up your module with Travis CI - travis-ci

Anyone got a boilerplate the world can use for Travis CI build testing for modules?
I havn't used Travis CI before but I got it hooked up however all my builds are failing, and the logs just say phpunit exited with code 1. I assume I'm definitely missing something and I have a feeling I need to download all silverstripe composer dependecies but have no idea where to start
I'm wanting it to run tests against (mymodule)/tests folder and hoping it's possible
The section on "Connecting to CI" isn't very helpful!

To set up with travis you'll need to use the travis-support module.
It's quite straightforward to do with a boilerplate .travis.yml which you can see on pretty much any SilverStripe module that's using travis. Here's a pretty standard one.
That file will test against PHP 5.3-5.6 as well as against SilverStripe versions 3.1.x-dev (latest 3.1 development version) all the way to 3.x-dev (3.5 development version).
You'll also need to customise the final line to run the correct test suite.

Related

Travis-ci.org stuck "Build created succesfully"

I've got a lot of queued Travis-ci.org jobs showing 'Build created successfully" but nothing is happening. It looks like Travis has got itself into a look creating jobs for my last few commits and not processing any of them. How can I clear out these jobs?
OK so I really don't understand what a travis-ci.org 'request' is because the problem was a bad .travis.yml file and once I fixed that, the CI started again. But the 'requests' are still there :-(.
The 'solution' was to install the travis command-line tool which includes 'travis lint' and allowed me to lint my .travis.yml file until it was at least happy. The downside to this is that, on Windows at least, installing the travis tool took a lot of time and a lot of disk space as it instaled Ruby, MinGW and lots of other stuff that I will probably never use again!
But until travis-ci.org/com creates an on-line linter (how hard can it be?), that's what we're stuck with. OTOH, the first step of the travis-ci.org/com build could be to lint the file and complain if it fails - just a suggestion :-).

What is the proper way to get the karma test coverage path into Travis CI?

I'm using karma to run unit tests and generate coverage reports. That all works fine but I want to publish the lcov.info file to Code Climate from Travis CI. I've done it before and it works great, but the url from that test runner was static.
The issue is that karma creates a subfolder for each instance it runs such as test/coverage/PhantomJS 1.9.7 (Mac OS X)/lcov.info. Is there a clean way to get that url to feed into travis? I don't want to have to remember to update a hardcoded value every time PhantomJS gets updated. Does anyone know if the .travis.yml file supports something like glob patterns.
Thoughts?
A glob pattern will work and I'm using it successfully with a karma/travis/codeclimate set up.
Using
codeclimate < test/coverage/**/lcov.info
should work assuming have the CODECLIMATE_REPO_TOKEN variable set.
Also, options to change the subdirectory structure is being discussed on https://github.com/karma-runner/karma-coverage/pull/62.

Multiple Environments in Travis CI

Travis has an easy way to test a project against different PHP versions.
Now I want to run tests for plugins. For that I wrote a script that is called in the install phase of .travis.yml which checks out the main project and moves my plugin source into the correct directory. Then the tests are run. So far so good.
Now I would like to provide two of these scripts. One that checks out the main project's current master branch and one that checks out the latest stable version. The plugin should be tested against both checkouts in completely separate test runs just like it is ran against different PHP versions.
Is there a simple way to configure this in .travis.yml?
You need to use env option:
env:
- TEST_NAME=my_test_1
- TEST_NAME=my_test_2
- TEST_NAME=my_test_3
script:
- ./test-run.sh --test-name=${TEST_NAME}
documentation (Set environment variables section)
example

How to setup Bamboo to work with codeception?

I have been trying to get Bamboo working with codeception tests. I am using codeception to test my code in a symfony project.
After some research I found an article on how to setup Jenkins with codeception.
Once read I figured out that I should use Ant to run the codeception commands that run the tests.
The problem is I don't really know where to put everything. This article explains all the fields for a new Ant task but nothing seem to work.
Can someone please help me?
In case anyone else comes across this, this is how I have gotten codeception working in bamboo.
In Admin > Server Capabilities. Add a new executable for Codeception with the path /usr/local/bin/codecept.
In your job, create a new task of type Command. Set the executable as Codeception. The arguments should be run --xml (and any others you need).
Next, create another task with the type of JUnit Parser. Set the custom results directory to tests/_log/*.xml.
This works perfectly for me.
Additional: If you do not have admin rights to the server, set the command executable as PHP and add ./vendor/bin/codecept run --xml as the arguments.

Grails - Link checking as part of a continuous integration

So, we have a grails app set up with a Hudson CI build process. We're running unit tests, integration tests, and about to set up Selenium for some functional tests as well.
However, are there any good ways of fully testing a sites links to make sure nothing has broken in a release.
I know there's link checkers in general, but I'd like to have it be a part of the build process, so a build outright fails if something isn't right.
WebTest has a verifyLinks step you could use: http://webtest.canoo.com/webtest/manual/verifyLinks.html
You could install the webtest plugin (it should play nice with Selenium) and just have a single test that checks links.
cheers
Lee
I'm using selenium plugin (http://wiki.hudson-ci.org/display/HUDSON/Seleniumhq+Plugin) with test recorded from both developers and functional people. We start the new instance of the Grails app from the Hudson build with the Postbuild (http://wiki.hudson-ci.org/display/HUDSON/Groovy+Postbuild+Plugin)
What we ended up using was a command line program called linkchecker that we could install by apt-get and we ran from within our build script.

Resources