Skip to content

Commit 125d98e

Browse files
Add stages in travis file (#245)
* Separated functional tests and integration tests in parralel jobs
1 parent bb54a0e commit 125d98e

File tree

1 file changed

+47
-20
lines changed

1 file changed

+47
-20
lines changed

.travis.yml

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,59 @@ services:
88
jdk:
99
- oraclejdk8
1010

11+
# Run before every job
1112
before_install:
1213
- uname -a
1314
- chmod +x pom.xml
1415

15-
script:
16-
# since we run parallel tests using embedded mongodb in fresh environment all tests run first in parallel
17-
# will try to download the embedded mongo to this travis instance but the late ones will fail to write.
18-
# We will therefore run one test using mongodb first that will download the mongo instance and
19-
# then the rest of the test that will no longer need to download the embedded mongo since it will exist.
20-
#
21-
# It is also important that the first test to be run is a Spring Boot Test since spring boot also downloads
22-
# another version of embedded mongo db so all Spring Boot tests will end up in a race condition also
23-
- source docker-env.bash
24-
- docker-compose up -d
25-
- mvn -DsomeModule.test.includes="**/QueryServiceTest.java" test -DskipITs -B
26-
- mvn -DsomeModule.test.excludes="**/QueryServiceTest.java" test -DskipITs -B
27-
- mvn verify -DskipUTs -Der.url=http://localhost:8084/search/ -Drabbitmq.exchange.name=ei-exchange -Dspring.mail.host=localhost -Dspring.mail.port=1025 -Dwaitlist.fixedRateResend=1 -B
2816

17+
# This is only run before integrationTests job
18+
# To ensure docker containers are fully up and running we sleep 20s
19+
before_script:
20+
- source docker-env.bash
21+
- docker-compose up -d
22+
- sleep 20
23+
24+
25+
# Generate site documentation using mvn site plugin
2926
before_deploy:
3027
- rm -rf docs
3128
- mvn site -B
3229

33-
deploy:
34-
skip_cleanup: true
35-
provider: pages
36-
github-token: $GITHUB_TOKEN
37-
local_dir: docs/
38-
on:
39-
branch: master
30+
31+
# Using default stage 'test' for all our test jobs, and only running deploy stage
32+
# (after merge) to master branch
33+
stages:
34+
- test
35+
- name: deploy
36+
if: branch = master
37+
38+
39+
# List of jobs to run, tied to specific stages
40+
jobs:
41+
include:
42+
- stage: test
43+
name: functionalTests
44+
before_script: skip
45+
script:
46+
# We will run one test using embedded mongodb first that will download the mongo instance and
47+
# then the rest of the test that will no longer need to download the embedded mongo since it will exist.
48+
#
49+
# Also important that the first test to be run is a Spring Boot Test since spring boot also downloads
50+
# another version of embedded mongo db to avoid race conditions between Spring Boot tests
51+
- mvn -DsomeModule.test.includes="**/QueryServiceTest.java" test -DskipITs -B
52+
- mvn -DsomeModule.test.excludes="**/QueryServiceTest.java" test -DskipITs -B
53+
- stage: test
54+
name: integrationTests
55+
script:
56+
- mvn verify -DskipUTs -Der.url=http://localhost:8084/search/ -Drabbitmq.exchange.name=ei-exchange -Dspring.mail.host=localhost -Dspring.mail.port=1025 -Dwaitlist.fixedRateResend=1 -B
57+
- stage: deploy
58+
name: deployGitHubPages
59+
before_script: skip # do not run this on deploy
60+
script: skip # do not run default test scripts
61+
install: skip # do not run default mvn install
62+
deploy:
63+
provider: pages
64+
skip_cleanup: true
65+
github-token: $GITHUB_TOKEN
66+
local_dir: docs/

0 commit comments

Comments
 (0)