From 15236016965420316d0e708c189d9ab82136fddc Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 13 Nov 2020 22:04:48 -0500 Subject: [PATCH] Build from fresh modules --- .github/workflows/ci.yml | 32 ++++++++++++++++--- .github/workflows/nightly.yml | 60 +++++++++++++++++++++++++++++++++++ build.sbt | 15 ++++++--- project/Dependencies.scala | 3 +- sbt-allsources.sh | 2 +- 5 files changed, 101 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afd8ddeb2..f20780e65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,11 +29,28 @@ jobs: SCALA_212: 2.12.12 SCALA_213: 2.13.1 UTIL_TESTS: utilCache/test;utilControl/test;utilInterface/test;utilLogging/test;utilPosition/test;utilRelation/test;utilScripted/test;utilTracking/test - CURRENT_SNAPSHOT_VER: 1.4.3-SNAPSHOT SBT_LOCAL: false steps: - - name: Checkout - uses: actions/checkout@v1 + - name: Checkout sbt/sbt + uses: actions/checkout@v2 + - name: Checkout sbt/io + uses: actions/checkout@v2 + with: + repository: sbt/io + ref: develop + path: io + - name: Checkout sbt/librarymanagement + uses: actions/checkout@v2 + with: + repository: sbt/librarymanagement + ref: develop + path: librarymanagement + - name: Checkout sbt/zinc + uses: actions/checkout@v2 + with: + repository: sbt/zinc + ref: develop + path: zinc - name: Setup uses: olafurpg/setup-scala@v10 with: @@ -61,9 +78,14 @@ jobs: sbt -v "repoOverrideTest:scripted dependency-management/*; scripted source-dependencies/* project/*" ;; 5) - sbt -v publishLocalBin + # build from fresh IO, LM, and Zinc + BUILD_VERSION="1.4.0-SNAPSHOT" + cd io + sbt -v -Dsbt.build.version=${BUILD_VERSION} +publishLocal + cd ../ + sbt -Dsbtlm.path=$HOME/work/sbt/sbt/librarymanagement -Dsbtzinc.path=$HOME/work/sbt/sbt/zinc -Dsbt.build.version=$BUILD_VERSION -Dsbt.build.fatal=false "+lowerUtils/publishLocal; {librarymanagement}/publishLocal; {zinc}/publishLocal; upperModules/publishLocal" rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true - sbt -v -Dsbt.version=$CURRENT_SNAPSHOT_VER "++$SCALA_213; $UTIL_TESTS; ++$SCALA_212; $UTIL_TESTS; scripted actions/* source-dependencies/*1of3 dependency-management/*1of4 java/*" + sbt -v -Dsbt.version=$BUILD_VERSION "++$SCALA_213; $UTIL_TESTS; ++$SCALA_212; $UTIL_TESTS; scripted actions/* source-dependencies/*1of3 dependency-management/*1of4 java/*" ;; *) echo unknown jobtype diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 000000000..0a9db3e62 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,60 @@ +name: Nightly +on: + workflow_dispatch: + +jobs: + deploy: + strategy: + matrix: + include: + - os: ubuntu-latest + java: 8 + runs-on: ${{ matrix.os }} + env: + JAVA_OPTS: -Xms800M -Xmx800M -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8 + steps: + - name: Checkout sbt/sbt + uses: actions/checkout@v2 + - name: Checkout sbt/io + uses: actions/checkout@v2 + with: + repository: sbt/io + ref: wip/nightly + path: io + - name: Checkout sbt/librarymanagement + uses: actions/checkout@v2 + with: + repository: sbt/librarymanagement + ref: wip/nightly + path: librarymanagement + - name: Checkout sbt/zinc + uses: actions/checkout@v2 + with: + repository: sbt/zinc + ref: wip/nightly + path: zinc + - name: Setup + uses: olafurpg/setup-scala@v10 + with: + java-version: "adopt@1.${{ matrix.java }}" + - name: Coursier cache + uses: coursier/cache-action@v5 + - name: Build and deploy + run: | + # build from fresh IO, LM, and Zinc + TIMESTAMP=$(TZ=UTC date +%Y%m%dT%H%M%S) + export BUILD_VERSION="1.4.0-bin-${TIMESTAMP}" + echo publishing to Package Registry $RELEASE_GITHUB_PACKAGE_REGISTRY + cd io + sbt -v -Dsbt.sbtbintray=false +publish + cd ../ + sbt -Dsbtlm.path=$HOME/work/sbt/sbt/librarymanagement -Dsbtzinc.path=$HOME/work/sbt/sbt/zinc -Dsbt.sbtbintray=false -Dsbt.build.fatal=false "+lowerUtils/publish; {librarymanagement}/publish; {zinc}/publish; upperModules/publish" + rm -rf "$HOME/.ivy2/local" || true + rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true + find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true + find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true + find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true + find $HOME/.sbt -name "*.lock" -delete || true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_GITHUB_PACKAGE_REGISTRY: sbt/sbt diff --git a/build.sbt b/build.sbt index bf8ce1cfb..fe9dfd07d 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,6 @@ import java.nio.file.{ Files, Path => JPath } import scala.util.Try ThisBuild / version := { - // update .travis.yml too for dog fooding val v = "1.4.3-SNAPSHOT" nightlyVersion.getOrElse(v) } @@ -1544,9 +1543,17 @@ def customCommands: Seq[Setting[_]] = Seq( ThisBuild / publishTo := { val old = (ThisBuild / publishTo).value - sys.props.get("sbt.build.localmaven") match { - case Some(path) => Some(MavenCache("local-maven", file(path))) - case _ => old + sys.env.get("RELEASE_GITHUB_PACKAGE_REGISTRY") match { + case Some(repo) => + Some(s"GitHub Package Registry ($repo)" at s"https://maven.pkg.github.com/$repo") + case _ => old + } +} +ThisBuild / credentials ++= { + sys.env.get("GITHUB_TOKEN") match { + case Some(token) => + List(Credentials("GitHub Package Registry", "maven.pkg.github.com", "unused", token)) + case _ => Nil } } ThisBuild / whitesourceProduct := "Lightbend Reactive Platform" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 8bce987a6..a8ffac865 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -8,7 +8,8 @@ object Dependencies { val scala213 = "2.13.3" val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up") val baseScalaVersion = scala212 - def nightlyVersion = sys.props.get("sbt.build.version") + def nightlyVersion: Option[String] = + sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version") // sbt modules private val ioVersion = nightlyVersion.getOrElse("1.4.0") diff --git a/sbt-allsources.sh b/sbt-allsources.sh index a67b8e370..c14239763 100755 --- a/sbt-allsources.sh +++ b/sbt-allsources.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -sbt -Dsbtio.path=../io -Dsbtutil.path=../util -Dsbtlm.path=../librarymanagement -Dsbtzinc.path=../zinc "$@" +sbt -Dsbtio.path=../io -Dsbtlm.path=../librarymanagement -Dsbtzinc.path=../zinc "$@"