I'd like to run Travis CI builds for two different build scripts. For example something like that:
./prepare.sh
mvn verify -Psystem-tests
./prepare.sh
mvn verify -Pintegration-tests
In documentation I see that Build Matrix feature is exactly what I need, but samples there refer only how to create matrix over different environments.
How can I create such matrix over different build commands?
Here's my current .travis.yml
:
language: java
cache:
directories:
- $HOME/.m2
script:
- ./prepare.sh
- mvn verify -Psystem-tests
- mvn clean verify -Pintegration-tests
In the matrix
section, you can specify either:
the commands themselves:
matrix:
- env: MAVEN_SCRIPT="mvn verify -Psystem-tests"
- env: MAVEN_SCRIPT="mvn clean verify -Pintegration-tests"
script:
- ./prepare.sh
- $MAVEN_SCRIPT
which command to run, and then if
on them:
matrix:
- env: MAVEN_TESTS=system
- env: MAVEN_TESTS=integration
script:
- ./prepare.sh
- if [ "$MAVEN_TESTS" == "system" ]; then mvn verify -Psystem-tests; fi
- if [ "$MAVEN_TESTS" == "integration" ]; then mvn clean verify -Pintegration-tests; fi
the specific parts that differentiate the tests:
matrix:
- env: MAVEN_TEST_CLEANLINESS="" MAVEN_TESTS=system
- env: MAVEN_TEST_CLEANLINESS=clean MAVEN_TESTS=integration
script:
- ./prepare.sh
- mvn $MAVEN_CLEANLINESS verify -P$MAVEN_TESTS-tests