mirror of https://github.com/sbt/sbt.git
Refactor travis.sh
This commit is contained in:
parent
bf92539b53
commit
c59c7d45ca
13
.travis.yml
13
.travis.yml
|
|
@ -1,12 +1,10 @@
|
|||
language: java
|
||||
install:
|
||||
- npm install
|
||||
- curl -L -o ~/sbt https://github.com/paulp/sbt-extras/raw/478a364a2d43d6e1ac4451f8b84cdafe43a2e43f/sbt
|
||||
- chmod +x ~/sbt
|
||||
os:
|
||||
- osx
|
||||
script:
|
||||
- scripts/travis.sh "${TRAVIS_SCALA_VERSION:-2.11.8}" "$TRAVIS_PULL_REQUEST" "$TRAVIS_BRANCH" "$PUBLISH"
|
||||
- scripts/travis.sh
|
||||
# Uncomment once https://github.com/scoverage/sbt-scoverage/issues/111 is fixed
|
||||
# after_success:
|
||||
# - bash <(curl -s https://codecov.io/bash)
|
||||
|
|
@ -27,6 +25,15 @@ matrix:
|
|||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
- env: TRAVIS_SCALA_VERSION=2.12.1 PUBLISH=1 SCALA_JS=1
|
||||
os: linux
|
||||
jdk: oraclejdk8
|
||||
- env: TRAVIS_SCALA_VERSION=2.11.8 PUBLISH=1 SCALA_JS=1
|
||||
os: linux
|
||||
jdk: oraclejdk8
|
||||
- env: TRAVIS_SCALA_VERSION=2.10.6 PUBLISH=1 SCALA_JS=1
|
||||
os: linux
|
||||
jdk: oraclejdk8
|
||||
env:
|
||||
global:
|
||||
- secure: miHFMwVRD/yjOLy794nOwc2lJTMyL5O0MXABT9ksg5ejQy1FrFVc2YH86Agp80W02/lGLGl0qWCiK1TBcs9q4Apt01nkD1a/0/iuTRm//bdhnu8BbRxFITf+2cyYJVytKPsF585aHldMv1rwZs3TDaTzEEecAEki5r50yyTVo7ycG0lVj9aVWXerKRMIT54Wb8M6nqbyRB1jGWT0ETNU13vOvQznPTUXQG5hsiKnGYRf8T3umOMdOHpV0rvdwYqAIMsikaAFcYCS5P/pLXMtmRHICH9KUG8TV/ST07p1BXtbBg9y1Q+lpnXotXh4ZNoWOp8B6v7fxJ/WlLYTDROWCiHJ4s2V4Di00db/nW4OWrEEBlrh7vJ/npZqyt9V9YeNv6alxi+DCESwusgvD4Cx5c3zh+2X6RB6BYwWHlFnd80rmsLe4R4fFUcc8E/ZR9vUFjP1CsQKqfJ5yfKR6V+n8jK8FjLpoaU9PHPo2H4V3FZM/fCLcxhE37vfaYI7/O7MqE/cdGpZIuz7g3c4toWCgNZJDn8iJCPmrgcbW5zbfDxvWU2K816ycgnUwSQ5dufrJpAbLNrjR1O8EPRkMDDp9bB7/4RVQvfDfP9GGoiHPHHgxGzY0Lf5bm+Bj1mRfB5/SXHd3IjhUCD9q7eD1/ANifEYALC5BJ4TB8RhQUPU8uM=
|
||||
|
|
|
|||
35
build.sbt
35
build.sbt
|
|
@ -429,6 +429,41 @@ lazy val okhttp = project
|
|||
)
|
||||
)
|
||||
|
||||
lazy val jvm = project
|
||||
.aggregate(
|
||||
coreJvm,
|
||||
testsJvm,
|
||||
cache,
|
||||
bootstrap,
|
||||
cli,
|
||||
`sbt-coursier`,
|
||||
`sbt-shading`,
|
||||
`sbt-launcher`,
|
||||
doc,
|
||||
`http-server`,
|
||||
okhttp
|
||||
)
|
||||
.settings(commonSettings)
|
||||
.settings(noPublishSettings)
|
||||
.settings(releaseSettings)
|
||||
.settings(
|
||||
moduleName := "coursier-jvm"
|
||||
)
|
||||
|
||||
lazy val js = project
|
||||
.aggregate(
|
||||
coreJs,
|
||||
`fetch-js`,
|
||||
testsJs,
|
||||
web
|
||||
)
|
||||
.settings(commonSettings)
|
||||
.settings(noPublishSettings)
|
||||
.settings(releaseSettings)
|
||||
.settings(
|
||||
moduleName := "coursier-js"
|
||||
)
|
||||
|
||||
lazy val `coursier` = project.in(file("."))
|
||||
.aggregate(
|
||||
coreJvm,
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ev
|
||||
|
||||
# We're not using a jdk6 matrix entry with Travis here as some sources of coursier require Java 7 to compile
|
||||
# (even though it won't try to call Java 7 specific methods if it detects it runs under Java 6).
|
||||
# The tests here check that coursier is nonetheless fine when run under Java 6.
|
||||
|
||||
if echo "$TRAVIS_SCALA_VERSION" | grep -q "^2\.11"; then
|
||||
~/sbt ++${TRAVIS_SCALA_VERSION} cli/pack
|
||||
docker run -it --rm \
|
||||
-v $(pwd)/cli/target/pack:/opt/coursier \
|
||||
-e CI=true \
|
||||
openjdk:6-jre \
|
||||
/opt/coursier/bin/coursier fetch org.scalacheck::scalacheck:1.13.4
|
||||
|
||||
docker run -it --rm \
|
||||
-v $(pwd)/cli/target/pack:/opt/coursier \
|
||||
-e CI=true \
|
||||
openjdk:6-jre \
|
||||
/opt/coursier/bin/coursier launch --help
|
||||
fi
|
||||
|
||||
function clean_plugin_sbt() {
|
||||
mv plugins.sbt plugins.sbt0
|
||||
grep -v coursier plugins.sbt0 > plugins.sbt || true
|
||||
echo '
|
||||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-SNAPSHOT")
|
||||
' >> plugins.sbt
|
||||
}
|
||||
|
||||
if echo "$TRAVIS_SCALA_VERSION" | grep -q "^2\.10"; then
|
||||
~/sbt ++${TRAVIS_SCALA_VERSION} publishLocal
|
||||
git clone https://github.com/alexarchambault/scalacheck-shapeless.git
|
||||
cd scalacheck-shapeless
|
||||
cd project
|
||||
clean_plugin_sbt
|
||||
cd project
|
||||
clean_plugin_sbt
|
||||
cd ../..
|
||||
docker run -it --rm \
|
||||
-v $HOME/.ivy2/local:/root/.ivy2/local \
|
||||
-v $HOME/sbt:/root/sbt \
|
||||
-v $(pwd):/root/project \
|
||||
-e CI=true \
|
||||
openjdk:6-jre \
|
||||
/bin/bash -c "cd /root/project && /root/sbt update"
|
||||
cd ..
|
||||
fi
|
||||
|
|
@ -1,93 +1,188 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -ev
|
||||
|
||||
TRAVIS_SCALA_VERSION="$1"
|
||||
shift
|
||||
TRAVIS_PULL_REQUEST="$1"
|
||||
shift
|
||||
TRAVIS_BRANCH="$1"
|
||||
shift
|
||||
PUBLISH="$1"
|
||||
shift
|
||||
SCALA_VERSION="${SCALA_VERSION:-${TRAVIS_SCALA_VERSION:-2.12.1}}"
|
||||
PULL_REQUEST="${PULL_REQUEST:-${TRAVIS_PULL_REQUEST:-false}}"
|
||||
BRANCH="${BRANCH:-${TRAVIS_BRANCH:-$(git rev-parse --abbrev-ref HEAD)}}"
|
||||
PUBLISH="${PUBLISH:-0}"
|
||||
SCALA_JS="${SCALA_JS:-0}"
|
||||
|
||||
JARJAR_VERSION="${JARJAR_VERSION:-1.0.1-coursier-SNAPSHOT}"
|
||||
|
||||
function isNotPr() {
|
||||
[ "$TRAVIS_PULL_REQUEST" = "false" ]
|
||||
setupCoursierBinDir() {
|
||||
mkdir -p bin
|
||||
cp coursier bin/
|
||||
export PATH="$(pwd)/bin:$PATH"
|
||||
}
|
||||
|
||||
function publish() {
|
||||
[ "$PUBLISH" = 1 ]
|
||||
downloadInstallSbtExtras() {
|
||||
curl -L -o bin/sbt https://github.com/paulp/sbt-extras/raw/9ade5fa54914ca8aded44105bf4b9a60966f3ccd/sbt
|
||||
chmod +x bin/sbt
|
||||
}
|
||||
|
||||
function isMaster() {
|
||||
[ "$TRAVIS_BRANCH" = "master" ]
|
||||
integrationTestsRequirements() {
|
||||
# Required for ~/.ivy2/local repo tests
|
||||
sbt ++2.11.8 coreJVM/publishLocal http-server/publishLocal
|
||||
|
||||
# Required for HTTP authentication tests
|
||||
coursier launch \
|
||||
io.get-coursier:http-server-java7_2.11:1.0.0-SNAPSHOT \
|
||||
-r http://dl.bintray.com/scalaz/releases \
|
||||
-- \
|
||||
-d tests/jvm/src/test/resources/test-repo/http/abc.com \
|
||||
-u user -P pass -r realm \
|
||||
--list-pages \
|
||||
-v &
|
||||
}
|
||||
|
||||
function isMasterOrDevelop() {
|
||||
[ "$TRAVIS_BRANCH" = "master" -o "$TRAVIS_BRANCH" = "develop" ]
|
||||
setupCustomJarjar() {
|
||||
if [ ! -d "$HOME/.m2/repository/org/anarres/jarjar/jarjar-core/$JARJAR_VERSION" ]; then
|
||||
git clone https://github.com/alexarchambault/jarjar.git
|
||||
cd jarjar
|
||||
if ! grep -q "^version=$JARJAR_VERSION\$" gradle.properties; then
|
||||
echo "Expected jarjar version not found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
git checkout 249c8dbb970f8
|
||||
./gradlew :jarjar-core:install
|
||||
cd ..
|
||||
rm -rf jarjar
|
||||
fi
|
||||
}
|
||||
|
||||
# Required for ~/.ivy2/local repo tests
|
||||
~/sbt ++2.11.8 coreJVM/publishLocal http-server/publishLocal
|
||||
isScalaJs() {
|
||||
[ "$SCALA_JS" = 1 ]
|
||||
}
|
||||
|
||||
is210() {
|
||||
echo "$SCALA_VERSION" | grep -q "^2\.10"
|
||||
}
|
||||
|
||||
is211() {
|
||||
echo "$SCALA_VERSION" | grep -q "^2\.11"
|
||||
}
|
||||
|
||||
runSbtCoursierTests() {
|
||||
sbt ++$SCALA_VERSION coreJVM/publishLocal cache/publishLocal sbt-coursier/scripted
|
||||
}
|
||||
|
||||
runSbtShadingTests() {
|
||||
setupCustomJarjar
|
||||
sbt ++$SCALA_VERSION sbt-coursier/publishLocal sbt-shading/scripted
|
||||
}
|
||||
|
||||
jsCompile() {
|
||||
sbt ++$SCALA_VERSION js/compile js/test:compile coreJS/fastOptJS fetch-js/fastOptJS testsJS/test:fastOptJS js/test:fastOptJS
|
||||
}
|
||||
|
||||
jvmCompile() {
|
||||
sbt ++$SCALA_VERSION jvm/compile jvm/test:compile
|
||||
}
|
||||
|
||||
runJsTests() {
|
||||
sbt ++$SCALA_VERSION js/test
|
||||
}
|
||||
|
||||
runJvmTests() {
|
||||
sbt ++$SCALA_VERSION jvm/test jvm/it:test
|
||||
}
|
||||
|
||||
validateReadme() {
|
||||
sbt ++${SCALA_VERSION} tut
|
||||
}
|
||||
|
||||
checkBinaryCompatibility() {
|
||||
sbt ++${SCALA_VERSION} coreJVM/mimaReportBinaryIssues cache/mimaReportBinaryIssues
|
||||
}
|
||||
|
||||
testLauncherJava6() {
|
||||
sbt ++${SCALA_VERSION} cli/pack
|
||||
docker run -it --rm \
|
||||
-v $(pwd)/cli/target/pack:/opt/coursier \
|
||||
-e CI=true \
|
||||
openjdk:6-jre \
|
||||
/opt/coursier/bin/coursier fetch org.scalacheck::scalacheck:1.13.4
|
||||
|
||||
docker run -it --rm \
|
||||
-v $(pwd)/cli/target/pack:/opt/coursier \
|
||||
-e CI=true \
|
||||
openjdk:6-jre \
|
||||
/opt/coursier/bin/coursier launch --help
|
||||
}
|
||||
|
||||
testSbtCoursierJava6() {
|
||||
sbt ++${SCALA_VERSION} publishLocal
|
||||
git clone https://github.com/alexarchambault/scalacheck-shapeless.git
|
||||
cd scalacheck-shapeless
|
||||
cd project
|
||||
clean_plugin_sbt
|
||||
cd project
|
||||
clean_plugin_sbt
|
||||
cd ../..
|
||||
docker run -it --rm \
|
||||
-v $HOME/.ivy2/local:/root/.ivy2/local \
|
||||
-v $(pwd):/root/project \
|
||||
-v $(pwd)/../bin:/root/bin \
|
||||
-e CI=true \
|
||||
openjdk:6-jre \
|
||||
/bin/bash -c "cd /root/project && /root/bin/sbt update"
|
||||
cd ..
|
||||
}
|
||||
|
||||
clean_plugin_sbt() {
|
||||
mv plugins.sbt plugins.sbt0
|
||||
grep -v coursier plugins.sbt0 > plugins.sbt || true
|
||||
echo '
|
||||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-SNAPSHOT")
|
||||
' >> plugins.sbt
|
||||
}
|
||||
|
||||
publish() {
|
||||
sbt ++${SCALA_VERSION} publish
|
||||
}
|
||||
|
||||
# Required for HTTP authentication tests
|
||||
./coursier launch \
|
||||
io.get-coursier:http-server-java7_2.11:1.0.0-SNAPSHOT \
|
||||
-r http://dl.bintray.com/scalaz/releases \
|
||||
-- \
|
||||
-d tests/jvm/src/test/resources/test-repo/http/abc.com \
|
||||
-u user -P pass -r realm \
|
||||
--list-pages \
|
||||
-v &
|
||||
|
||||
# TODO Add coverage once https://github.com/scoverage/sbt-scoverage/issues/111 is fixed
|
||||
|
||||
SBT_COMMANDS="compile test it:test"
|
||||
setupCoursierBinDir
|
||||
downloadInstallSbtExtras
|
||||
|
||||
RUN_SHADING_TESTS=1
|
||||
if isScalaJs; then
|
||||
jsCompile
|
||||
runJsTests
|
||||
else
|
||||
integrationTestsRequirements
|
||||
jvmCompile
|
||||
runJvmTests
|
||||
|
||||
if echo "$TRAVIS_SCALA_VERSION" | grep -q "^2\.10"; then
|
||||
SBT_COMMANDS="$SBT_COMMANDS publishLocal" # to make the scripted tests happy
|
||||
SBT_COMMANDS="$SBT_COMMANDS sbt-coursier/scripted"
|
||||
if is210; then
|
||||
runSbtCoursierTests
|
||||
runSbtShadingTests
|
||||
fi
|
||||
|
||||
if [ "$RUN_SHADING_TESTS" = 1 ]; then
|
||||
# for the shading scripted test
|
||||
sudo cp coursier /usr/local/bin/
|
||||
validateReadme
|
||||
checkBinaryCompatibility
|
||||
|
||||
JARJAR_VERSION=1.0.1-coursier-SNAPSHOT
|
||||
# We're not using a jdk6 matrix entry with Travis here as some sources of coursier require Java 7 to compile
|
||||
# (even though it won't try to call Java 7 specific methods if it detects it runs under Java 6).
|
||||
# The tests here check that coursier is nonetheless fine when run under Java 6.
|
||||
|
||||
if [ ! -d "$HOME/.m2/repository/org/anarres/jarjar/jarjar-core/$JARJAR_VERSION" ]; then
|
||||
git clone https://github.com/alexarchambault/jarjar.git
|
||||
cd jarjar
|
||||
if ! grep -q "^version=$JARJAR_VERSION\$" gradle.properties; then
|
||||
echo "Expected jarjar version not found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
git checkout 249c8dbb970f8
|
||||
./gradlew :jarjar-core:install
|
||||
cd ..
|
||||
rm -rf jarjar
|
||||
fi
|
||||
if is211; then
|
||||
testLauncherJava6
|
||||
fi
|
||||
|
||||
SBT_COMMANDS="$SBT_COMMANDS sbt-coursier/publishLocal sbt-shading/scripted"
|
||||
if is210; then
|
||||
testSbtCoursierJava6
|
||||
fi
|
||||
fi
|
||||
|
||||
SBT_COMMANDS="$SBT_COMMANDS tut coreJVM/mimaReportBinaryIssues cache/mimaReportBinaryIssues"
|
||||
|
||||
~/sbt ++${TRAVIS_SCALA_VERSION} $SBT_COMMANDS
|
||||
if [ "$PUBLISH" = 1 -a "$PULL_REQUEST" = false -a "$BRANCH" = master ]; then
|
||||
publish
|
||||
|
||||
scripts/java-6-test.sh
|
||||
|
||||
if isNotPr && publish && isMaster; then
|
||||
~/sbt ++${TRAVIS_SCALA_VERSION} publish
|
||||
fi
|
||||
|
||||
PUSH_GHPAGES=0
|
||||
if isNotPr && publish && isMasterOrDevelop; then
|
||||
if echo "$TRAVIS_SCALA_VERSION" | grep -q "^2\.11"; then
|
||||
PUSH_GHPAGES=1
|
||||
if is211 && isScalaJs; then
|
||||
#"$(dirname "$0")/push-gh-pages.sh" "$SCALA_VERSION"
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
# [ "$PUSH_GHPAGES" = 0 ] || "$(dirname "$0")/push-gh-pages.sh" "$TRAVIS_SCALA_VERSION"
|
||||
|
|
|
|||
Loading…
Reference in New Issue