From f1e1073ed554075ee9a43f4cb9c272b321397c80 Mon Sep 17 00:00:00 2001 From: Andrew Fink Date: Mon, 14 Oct 2019 13:07:13 -0400 Subject: [PATCH] Fix scaladoc deployment to latest folder on master branch merges (#3104) * Fix scaladocs 'latest' deployment ...to geotrellis/scaladocs. Core issue was that the `on` matcher was failing because we removed oraclejdk in https://github.com/locationtech/geotrellis/commit/389cda41e1163598c8f361d5c097628744c0b30b#diff-354f30a63fb0907d4ad57269548329e3 We were also missing the autoAPIMappings in build.sbt and there were some file permissions issues with running the git checkout within the geotrellis repo. Permissions issues were resolved by checking the scaladocs repo out to a different directory, configurable in the script. * Fix docker volume permissions issues * Run scaladoc in separate RUN_SET To avoid build runtime limits --- .travis.yml | 5 ++++- .travis/build-and-test.sh | 4 +++- .travis/scaladocs.sh | 24 ++++++++++++++---------- build.sbt | 1 + 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index a071533757..427315c473 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ env: - RUN_SET=1 - RUN_SET=2 - RUN_SET=3 + - RUN_SET=scaladoc language: scala @@ -61,6 +62,7 @@ notifications: before_deploy: - export GEOTRELLIS_VERSION_SUFFIX="-${TRAVIS_COMMIT:0:7}" + - ./sbt unidoc deploy: - provider: script @@ -69,5 +71,6 @@ deploy: on: repo: locationtech/geotrellis branch: master - jdk: oraclejdk8 + condition: "$RUN_SET = 'scaladoc'" + jdk: openjdk8 scala: "2.11.12" diff --git a/.travis/build-and-test.sh b/.travis/build-and-test.sh index 7d9ba481eb..bafae63411 100755 --- a/.travis/build-and-test.sh +++ b/.travis/build-and-test.sh @@ -14,11 +14,13 @@ elif [ $RUN_SET = "2" ]; then else .travis/build-set-2.sh; fi -else +elif [ $RUN_SET = "3" ]; then echo "RUNNING SET 3"; if [ `echo $TRAVIS_SCALA_VERSION | cut -f1-2 -d "."` = "2.11" ]; then .travis/build-and-test-set-3.sh; else .travis/build-set-3.sh; fi +else + echo "Skipping RUN_SET = $RUN_SET in build-and-test.sh." fi diff --git a/.travis/scaladocs.sh b/.travis/scaladocs.sh index 47e8d29cc5..3797e7a4ad 100755 --- a/.travis/scaladocs.sh +++ b/.travis/scaladocs.sh @@ -8,23 +8,27 @@ then exit 0 fi -rev=$(git rev-parse --short HEAD) +DIR="$(dirname "$0")/.." +SCALADOCS_CHECKOUT_DIR="${1:-/tmp}/scaladocs" +SCALADOCS_REPO="https://github.com/geotrellis/scaladocs.git" +SCALADOCS_BRANCH="gh-pages" -# Build docs -./sbt "++$TRAVIS_SCALA_VERSION" unidoc +pushd "$DIR" +rev=$(git rev-parse --short HEAD) # Set up git git config --global user.email "azaveadev@azavea.com" git config --global user.name "azaveaci" -# Inside scaladocs from hereon -rm -rf scaladocs -git clone https://github.com/geotrellis/scaladocs.git -rm -rf scaladocs/latest -mv target/scala-2.11/unidoc scaladocs/latest -cd scaladocs +rm -rf "$SCALADOCS_CHECKOUT_DIR" +git clone "$SCALADOCS_REPO" "$SCALADOCS_CHECKOUT_DIR" +rm -rf "$SCALADOCS_CHECKOUT_DIR/latest" +mv "target/scala-2.11/unidoc" "$SCALADOCS_CHECKOUT_DIR/latest" + +pushd "$SCALADOCS_CHECKOUT_DIR" git remote add originAuth https://$CI_GH_TOKEN@github.com/geotrellis/scaladocs.git +echo "Pushing scaladoc to $SCALADOCS_REPO#$SCALADOCS_BRANCH" git add -A . git commit -m "rebuild scaladocs at ${rev}" -git push -q originAuth gh-pages +git push -q originAuth "$SCALADOCS_BRANCH" diff --git a/build.sbt b/build.sbt index ef9d8d1ab3..5300e56870 100644 --- a/build.sbt +++ b/build.sbt @@ -34,6 +34,7 @@ lazy val commonSettings = Seq( publishMavenStyle := true, publishArtifact in Test := false, pomIncludeRepository := { _ => false }, + autoAPIMappings := true, publishTo := { val sonatype = "https://oss.sonatype.org/"