From ce487cc7ea6ab0093df09bfe0e187e340c74996b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ossowski?= Date: Tue, 8 Nov 2022 10:07:53 +0100 Subject: [PATCH] fix publishing --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++-------------- build.sbt | 16 ++++++----- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b84faba35..25938b439 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: - name: Run tests id: run-tests - run: SCALA_MAJOR_VERSION=${{ env.scala }} sbt test + run: SCALA_MAJOR_VERSION=${{ env.scala }} sbt core/test persistenceCore/test persistenceFile/test persistenceSql/test restSqs/test restSqsTestingAmazonJavaSdk/test server/test ci-2-13: # run on external PRs, but not on internal PRs since those will be run by push to branch @@ -66,7 +66,7 @@ jobs: - name: Run tests id: run-tests - run: SCALA_MAJOR_VERSION=${{ env.scala }} sbt test + run: SCALA_MAJOR_VERSION=${{ env.scala }} sbt core/test persistenceCore/test persistenceFile/test persistenceSql/test restSqs/test restSqsTestingAmazonJavaSdk/test server/test ci-docker: # run on external PRs, but not on internal PRs since those will be run by push to branch @@ -83,7 +83,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: 8 + java-version: 11 - name: Cache SBT id: cache-sbt @@ -104,8 +104,7 @@ jobs: - name: Build native docker image run: sbt "project nativeServer; assembly; GraalVMNativeImage / packageBin; Docker / publishLocal" - publish: - name: Publish release + publish-jar: needs: [ci-2-12, ci-2-13, ci-docker] if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) runs-on: ubuntu-20.04 @@ -128,9 +127,6 @@ jobs: ~/.coursier key: ${{ runner.os }}-sbt-release-${{ hashFiles('**/build.sbt') }} - - name: Compile - run: sbt compile - - name: Publish artifacts run: sbt ci-release env: @@ -139,18 +135,6 @@ jobs: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Publish JVM docker image - run: sbt "project server; assembly; Docker / publish" - - - name: Publish JVM native docker image - run: sbt "project nativeServer; assembly; GraalVMNativeImage / packageBin; Docker / publish" - - name: Upload to S3 run: sbt "server / s3Upload" env: @@ -174,3 +158,38 @@ jobs: version: "v${{ env.VERSION }}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish-docker: + needs: [ci-2-12, ci-2-13, ci-docker] + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: 11 + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier + key: ${{ runner.os }}-sbt-release-${{ hashFiles('**/build.sbt') }} + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Publish JVM docker image + run: sbt "project server; assembly; Docker / publish" + + - name: Publish JVM native docker image + run: sbt "project nativeServer; assembly; GraalVMNativeImage / packageBin; Docker / publish" diff --git a/build.sbt b/build.sbt index d54484ef7..c4a1536e9 100644 --- a/build.sbt +++ b/build.sbt @@ -70,7 +70,7 @@ val buildSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq( ScmInfo(url("https://github.com/softwaremill/elasticmq"), "scm:git@github.com:softwaremill/elasticmq.git") ), scalaVersion := resolvedScalaVersion, - scalacOptions += "-Xasync", + scalacOptions ++= Seq("-Xasync", "-target:jvm-1.8"), libraryDependencies += scalaXml, dependencyOverrides := akka25Overrides, parallelExecution := false, @@ -89,13 +89,13 @@ val s3Upload = TaskKey[PutObjectResult]("s3-upload", "Uploads files to an S3 buc lazy val root: Project = (project in file(".")) .enablePlugins(GitVersioning) .settings(buildSettings) - .settings(name := "elasticmq-root", publishArtifact := false) - .aggregate(commonTest, core, rest, persistence, server, nativeServer, ui) + .settings(name := "elasticmq-root", publish / skip := true) + .aggregate(commonTest, core, rest, persistence, server, ui) lazy val commonTest: Project = (project in file("common-test")) .settings(buildSettings) .settings(name := "elasticmq-common-test") - .settings(Seq(libraryDependencies ++= Seq(scalatest, awaitility, logback), publishArtifact := false)) + .settings(Seq(libraryDependencies ++= Seq(scalatest, awaitility, logback), publish / skip := true)) lazy val core: Project = (project in file("core")) .settings(buildSettings) @@ -185,7 +185,7 @@ lazy val restSqsTestingAmazonJavaSdk: Project = Seq( name := "elasticmq-rest-sqs-testing-amazon-java-sdk", libraryDependencies ++= Seq(amazonJavaSdkSqs, jclOverSlf4j) ++ common, - publishArtifact := false + publish / skip := true ) ) .dependsOn(restSqs % "test->test", persistenceFile % "test", persistenceSql % "test") @@ -268,6 +268,7 @@ lazy val nativeServer: Project = (project in file("native-server")) libraryDependencies ++= Seq( "org.graalvm.nativeimage" % "svm" % graalVmVersion % "compile-internal" ), + publish / skip := true, // configures sbt-native-packager to build app using dockerized graalvm // docker image source: https://github.com/graalvm/container/pkgs/container/graalvm-ce/versions (GraalVMNativeImage / containerBuildImage) := GraalVMNativeImagePlugin @@ -344,7 +345,7 @@ lazy val performanceTests: Project = (project in file("performance-tests")) Seq( name := "elasticmq-performance-tests", libraryDependencies ++= Seq(amazonJavaSdkSqs, jclOverSlf4j, logback) ++ common, - publishArtifact := false + publish / skip := true ) ) .dependsOn(core, restSqs, commonTest % "test") @@ -407,7 +408,8 @@ lazy val ui = (project in file("ui")) (Compile / compile).value }, cleanFiles += baseDirectory.value / "build", - Compile / unmanagedResourceDirectories += baseDirectory.value / "build" + Compile / unmanagedResourceDirectories += baseDirectory.value / "build", + publish / skip := true ) def haltOnCmdResultError(result: Int) {