Skip to content

Commit ab0e5bf

Browse files
ceedubskailuowang
authored andcommitted
Experiment with modularizing Travis jobs (#2737)
Resolves #2570 This sets up the Cats Travis build to use Travis's stages feature and modularizes the Travis jobs. This probably introduces a little bit of extra overhead since each new job needs to spin up a virtual machine and pull the cache. However, I think that this extra overhead is offset by a number of factors (see further below). We are now only publishing code coverage reports for the default Scala version (currently 2.12.x). I don't think that publishing multiple coverage reports for the same commit even has well-defined results, and I suspect that we didn't really mean to do that. Since running the tests with code coverage is probably the most time-consuming thing that the tests do, this is a significant time saver. Each individual job has a smaller run duration (usually < 20 min). This means that if an individual job does fail and we have to restart it, we are waiting for a smaller amount of time than previously. In theory at least, there's more ability for parallelization. In testing on my fork, it looks like Travis tends to run 3 to 5 jobs in parallel. So since we already had that many jobs before, this may not be much of a win. Modularizing the build allowed for a few small installation optimizations (only installing jekyll for the docs job, only installing node.js for the JS builds, etc). Lastly, I'm hoping that this sets the stage to move toward releasing via [sbt-ci-release](https://github.com/olafurpg/sbt-ci-release) instead of requiring a maintainer to awkwardly publish from their personal computer. This new Travis configuration allows us to run a bunch of tests/validation in parallel and then if all goes well, move on to a stage that is responsible for releasing. Since each job has its own time limit, we can probably avoid previous problems of releasing from Travis causing builds to take too long. Note that Travis stages have awkward interactions with the build matrix, so I'm now using YAML anchors (essentially templates) to reduce duplication rather than the build matrix. This allows for finer-grained control that I think works out pretty nicely.
1 parent 2ad9901 commit ab0e5bf

File tree

1 file changed

+65
-15
lines changed

1 file changed

+65
-15
lines changed

.travis.yml

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,78 @@ group: edge
99
git:
1010
depth: 9999
1111

12-
scala:
13-
- 2.11.12
14-
- 2.13.0-M5
15-
- 2.12.7
16-
1712
jdk:
1813
- oraclejdk8
1914

15+
scala_version_211: &scala_version_211 2.11.12
16+
scala_version_212: &scala_version_212 2.12.7
17+
scala_version_213: &scala_version_213 2.13.0-M5
18+
2019
before_install:
2120
- export PATH=${PATH}:./vendor/bundle
2221

23-
script:
24-
- scripts/travis-publish.sh
22+
stages:
23+
- name: test
24+
- name: publish snapshot
25+
if: (branch = master AND type = push)
26+
27+
jobs:
28+
include:
29+
# it can speed up the overall build to have the longer-running jobs at the top of this list.
30+
- env: TEST="coverage"
31+
install: pip install --user codecov
32+
script: sbt coverage buildJVM bench/test coverageReport && codecov
33+
34+
- &js_tests
35+
env: TEST="JS tests"
36+
# http://austinpray.com/ops/2015/09/20/change-travis-node-version.html
37+
install: rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
38+
script: sbt ++$TRAVIS_SCALA_VERSION! validateJS && sbt ++$TRAVIS_SCALA_VERSION! validateKernelJS && sbt ++$TRAVIS_SCALA_VERSION! validateFreeJS
39+
scala: *scala_version_211
40+
- <<: *js_tests
41+
scala: *scala_version_212
42+
43+
- &jvm_tests
44+
env: TEST="JVM tests"
45+
script: sbt ++$TRAVIS_SCALA_VERSION! buildJVM bench/test
46+
scala: *scala_version_211
47+
- <<: *jvm_tests
48+
scala: *scala_version_212
49+
- <<: *jvm_tests
50+
scala: *scala_version_213
51+
# the bench module has dependencies not available in Scala 2.13, so don't test it
52+
script: sbt ++$TRAVIS_SCALA_VERSION! buildJVM
53+
54+
- env: TEST="docs"
55+
install: gem install jekyll -v 2.5
56+
script: sbt makeMicrosite
57+
58+
- env: TEST="linting"
59+
script: sbt scalastyle fmtCheck
60+
61+
- env: TEST="scalafix"
62+
script: cd scalafix && sbt tests/test
63+
64+
- &bincompat_check
65+
env: TEST="binary compatibility"
66+
script: sbt ++$TRAVIS_SCALA_VERSION! validateBC
67+
scala: *scala_version_211
68+
- <<: *bincompat_check
69+
scala: *scala_version_212
2570

26-
# http://austinpray.com/ops/2015/09/20/change-travis-node-version.html
27-
install:
28-
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
29-
- pip install --user codecov
30-
- gem install jekyll -v 2.5
71+
- &publish_snapshot
72+
stage: publish snapshot
73+
script: |
74+
if [[ $(cat version.sbt) =~ "-SNAPSHOT" ]]; then
75+
sbt ++$TRAVIS_SCALA_VERSION! publish gitSnapshots publish
76+
else
77+
echo Not publishing a snapshot because the version does not end with -SNAPSHOT for version $TRAVIS_SCALA_VERSION
78+
fi
79+
scala: *scala_version_211
80+
- <<: *publish_snapshot
81+
scala: *scala_version_212
82+
- <<: *publish_snapshot
83+
scala: *scala_version_213
3184

3285
notifications:
3386
webhooks:
@@ -38,9 +91,6 @@ notifications:
3891
on_start: false
3992

4093
env:
41-
matrix:
42-
- JS_BUILD=false
43-
- JS_BUILD=true
4494
global:
4595
- secure: Kf44XQFpq2QGe3rn98Dsf5Uz3WXzPDralS54co7sqT5oQGs1mYLYZRYz+I75ZSo5ffZ86H7M+AI9YFofqGwAjBixBbqf1tGkUh3oZp2fN3QfqzazGV3HzC+o41zALG5FL+UBaURev9ChQ5fYeTtFB7YAzejHz4y5E97awk934Rg=
4696
- secure: QbNAu0jCaKrwjJi7KZtYEBA/pYbTJ91Y1x/eLAJpsamswVOvwnThA/TLYuux+oiZQCiDUpBzP3oxksIrEEUAhl0lMtqRFY3MrcUr+si9NIjX8hmoFwkvZ5o1b7pmLF6Vz3rQeP/EWMLcljLzEwsrRXeK0Ei2E4vFpsg8yz1YXJg=

0 commit comments

Comments
 (0)