Skip to content

Commit

Permalink
use Travis for (vastly simpler) PR validation
Browse files Browse the repository at this point in the history
use only sbt, avoid using external shell scripts and environment
variables.  we just need a few simple commands right here in
.travis.yml

doesn't publish anything to Artifactory.  let's discuss the way
forward on that at scala/scala-dev#507
  • Loading branch information
SethTisue committed May 12, 2018
1 parent 534a929 commit e3b2ae9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 61 deletions.
78 changes: 25 additions & 53 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,30 @@
sudo: required # GCE VMs have better performance (will be upgrading to premium VMs soon)
# GCE VMs have better performance (will be upgrading to premium VMs soon)
sudo: required

language: scala
jdk: openjdk8


cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt
- build/


before_script:
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then (cd admin && ./init.sh); fi'

stages:
- name: build # also builds the spec using jekyll
# tests are running into time limits (will re-enable once Jason's partest speedups are in)
- name: test
if: env(bla) = thisVarIsNotSet AND type != pull_request # just disabling tests for now, but commenting the stage here doesn't do the trick
- name: publish
if: type != pull_request
- name: build

# see comment in `bootstrap_fun` for details on the procedure
# env available in each stage
# - by travis config (see below): secret env vars
# - by `common` script: WORKSPACE, IVY2_DIR, SBT_CMD, integrationRepoUrl
# - by `bootstrap_fun`: publishPrivateTask, ...
# env computed in first stage, passed on to later stages with the `build/env` file
# - by `determineScalaVersion`: SCALA_VER, publishToSonatype
# - by `buildModules` / `constructUpdatedModuleVersions`: updatedModuleVersions
jobs:
include:

# full bootstrap and publish
- stage: build
# currently, not touching PR validation
# (also, we couldn't even, because the password to publish to artifactory is not there :-/)
if: type != pull_request
script:
# see comment in `bootstrap_fun` for details on the procedure
# env available in each stage
# - by travis config (see below): secret env vars
# - by `common` script: WORKSPACE, IVY2_DIR, SBT_CMD, integrationRepoUrl
# - by `bootstrap_fun`: publishPrivateTask, ...
- (cd admin && ./init.sh)
- source scripts/common
- source scripts/bootstrap_fun
- determineScalaVersion
Expand All @@ -45,38 +33,26 @@ jobs:
- if [ ! -z "$STARR_REF" ]; then buildStarr; fi
- buildLocker
- buildQuick
- set | grep -E '^SCALA_VER=|^SCALA_BINARY_VER=|^XML_VER=|^PARTEST_VER=|^SCALACHECK_VER=|^XML_BUILT=|^PARTEST_BUILT=|^SCALACHECK_BUILT=|^updatedModuleVersions=|^publishToSonatype=' > build/env
- cat build/env
- triggerScalaDist

# this builds the spec using jekyll
# based on http://www.paperplanes.de/2013/8/13/deploying-your-jekyll-blog-to-s3-with-travis-ci.html
# pull request validation (w/ mini-bootstrap)
- stage: build
if: type = pull_request
script:
- sbt -warn setupPublishCore generateBuildCharacterPropertiesFile publishLocal
- STARR=`cat buildcharacter.properties | grep ^maven.version.number | cut -d= -f2` && echo $STARR
- sbt -Dstarr.version=$STARR -warn setupValidateTest test:compile info testAll

# build the spec using jekyll
- stage: build
script: bundle exec jekyll build -s spec/ -d build/spec
rvm: 2.2
install: bundle install
# the key is restricted using forced commands so that it can only upload to the directory we need here
after_success: ./scripts/travis-publish-spec.sh

# be careful to not set any env vars, as this will result in a cache miss
- &test
stage: test
before_script:
- source build/env
- if [ -z "$SCALA_VER" ]; then echo "Environment not propagated. Caching issue?"; cat build/env ; exit 1; fi
- source scripts/common
- source scripts/bootstrap_fun
# - find build -type f -exec touch {} + # "set antStyle := true" seems to cause really long compiles for the test suite??
script: invokeQuick testRest # shouldn't rebuild, since build/ is cached
- <<: *test
script: invokeQuick testPosPres
- <<: *test
script: invokeQuick testRun
- script: testStability
script:
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then (cd admin && ./init.sh); fi'
- bundle exec jekyll build -s spec/ -d build/spec
after_success:
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./scripts/travis-publish-spec.sh; fi'

# cat /dev/urandom | head -c 10000 | openssl sha1 > ./secret
# openssl aes-256-cbc -pass "file:./secret" -in id_dsa_spec212_b4096 -out spec/id_dsa_travis.enc -a
# travis encrypt "PRIV_KEY_SECRET=`cat ./secret`"
env:
global:
- secure: "TuJOUtALynPd+MV1AuMeIpVb8BUBHr7Ul7FS48XhS2PyuTRpEBkSWybYcNg3AXyzmWDAuOjUxbaNMQBvP8vvehTbIYls5H5wTGKvj0D0TNVaPIXjF8bA8KyNat9xGNzhnWm2/2BMaWpKBJWRF7Jb+zHhijMYCJEbkMtoiE5R/mY=" # PRIV_KEY_SECRET, for scripts/travis-publish-spec.sh
Expand All @@ -86,10 +62,6 @@ env:
- secure: "dbAvl6KEuLwZ0MVQPZihFsPzCdiLbX0EFk3so+hcfEbksrmLQ1tn4X5ZM7Wy1UDR8uN9lxngEwHch7a7lKqpugzmXMew9Wnikr9WBWbJT77Z+XJ/jHI6YuiCRpRo+nvxXGp9Ry80tSIgx5eju0J83IaJL41BWlBkvyAd7YAHORI=" # GPG_SUBKEY_SECRET
- secure: "ee0z/1jehBjFa2M2JlBHRjeo6OEn/zmVl72ukBP1ISeKqz18Cswc4gDI5tV9RW9SlYFLkIlGsR2qnRCyJ/pqgQLcNdrpsCRFFc79oyLhfEtmPdAHlWfj4RSP68zINRtDdFuJ8iSy8XYP0NaqpVIYpkNdv9I6q7N85ljmMQpHO+U=" # TRAVIS_TOKEN (login with GitHub as lrytz)


# using S3 would be simpler, but we want to upload to scala-lang.org
# after_success: bundle exec s3_website push --headless

before_cache:
# Cleanup the cached directories to avoid unnecessary cache updates
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
Expand Down
19 changes: 11 additions & 8 deletions scripts/travis-publish-spec.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/bash

if [ "${PRIV_KEY_SECRET}" != "" -a "${TRAVIS_PULL_REQUEST}" = "false" ] ; then
openssl aes-256-cbc -pass "pass:$PRIV_KEY_SECRET" -in spec/id_dsa_travis.enc -out spec/id_dsa_travis -d -a
chmod 600 spec/id_dsa_travis
eval "$(ssh-agent)"
ssh-add -D
ssh-add spec/id_dsa_travis
rsync -e "ssh -o StrictHostKeyChecking=no" -rzv build/spec/ [email protected]:/home/linuxsoft/archives/scala/spec/2.12/
fi
# based on http://www.paperplanes.de/2013/8/13/deploying-your-jekyll-blog-to-s3-with-travis-ci.html

set -e
openssl aes-256-cbc -pass "pass:$PRIV_KEY_SECRET" -in spec/id_dsa_travis.enc -out spec/id_dsa_travis -d -a
chmod 600 spec/id_dsa_travis
eval "$(ssh-agent)"
ssh-add -D
ssh-add spec/id_dsa_travis

# the key is restricted using forced commands so that it can only upload to the directory we need here
rsync -e "ssh -o StrictHostKeyChecking=no" -rzv build/spec/ \
[email protected]:/home/linuxsoft/archives/scala/spec/2.12/

0 comments on commit e3b2ae9

Please sign in to comment.