Skip to content

Commit

Permalink
fix publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
micossow committed Nov 8, 2022
1 parent 230bd4d commit ce487cc
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 27 deletions.
59 changes: 39 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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"
16 changes: 9 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ val buildSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
ScmInfo(url("https://github.com/softwaremill/elasticmq"), "scm:[email protected]:softwaremill/elasticmq.git")
),
scalaVersion := resolvedScalaVersion,
scalacOptions += "-Xasync",
scalacOptions ++= Seq("-Xasync", "-target:jvm-1.8"),
libraryDependencies += scalaXml,
dependencyOverrides := akka25Overrides,
parallelExecution := false,
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ce487cc

Please sign in to comment.