diff --git a/.github/release_drafter.yaml b/.github/release_drafter.yaml new file mode 100644 index 00000000..0a5d792c --- /dev/null +++ b/.github/release_drafter.yaml @@ -0,0 +1,4 @@ +template: | + ## What’s Changed + + $CHANGES \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..87ce28e5 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,40 @@ +name: Continuous Integration +on: + push: + branches: + - "**" + tags: + - "v*" +permissions: + contents: write + +env: + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + +jobs: + test_and_release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: coursier/cache-action@v6 + - uses: coursier/setup-action@v1 + with: + jvm: temurin:11 + - name: Lint + run: sbt "scalafmtSbtCheck;scalafmtCheckAll" + - name: Test + run: sbt "+test" + env: + APP_MAUTH_UUID: 398ea708-50eb-499f-98d3-14cc7692668c + APP_MAUTH_PRIVATE_KEY: ${{ secrets.FAKE_PRIVATE_KEY }} + - name: Release + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + run: sbt ci-release + env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/release_drafter.yaml b/.github/workflows/release_drafter.yaml new file mode 100644 index 00000000..9d9c9d10 --- /dev/null +++ b/.github/workflows/release_drafter.yaml @@ -0,0 +1,22 @@ +name: Release Drafter + +on: + push: + branches: + - master + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + contents: write + pull-requests: read + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + with: + disable-autolabeler: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 34a1f8d2..00000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: scala -jdk: - - openjdk11 -services: - - docker -env: - global: - - APP_MAUTH_UUID=398ea708-50eb-499f-98d3-14cc7692668c -cache: - directories: - - $HOME/.sbt - - $HOME/.ivy2/cache - - $HOME/.cache - - $HOME/.m2 -before_cache: - - find $HOME/.ivy2 -name "ivydata-*.properties" -delete - - find $HOME/.sbt -name "*.lock" -delete -before_install: - - export APP_MAUTH_PRIVATE_KEY=$(cat .travis/fake_private_key_for_testing) - - echo -e "machine github.com\n login $GITHUB_AUTH_TOKEN" >> ~/.netrc -jobs: - include: - - stage: test - name: Format Check - script: sbt scalafmtSbtCheck scalafmtCheckAll - - - stage: test - name: Test - script: sbt +test +suggestNextVersionAcrossAllProjects - - - stage: release - script: .travis/deploy.sh - if: tag IS present - -stages: - - Test - - release diff --git a/.travis/deploy.sh b/.travis/deploy.sh deleted file mode 100755 index cd1c2e5a..00000000 --- a/.travis/deploy.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -set -euxo pipefail - -git config --global user.email "${GIT_USER_EMAIL}" -git config --global user.name "${GIT_USER_NAME}" -openssl aes-256-cbc -K "$encrypted_ff550e95c537_key" -iv "$encrypted_ff550e95c537_iv" -in .travis/secret-key.asc.enc -out .travis/secret-key.asc -d -echo $PGP_PASSPHRASE | gpg --passphrase-fd 0 --batch --yes --import .travis/secret-key.asc - -sbt 'release cross with-defaults' updateChangelogAndPushOnLatestMaster diff --git a/.travis/fake_private_key_for_testing b/.travis/fake_private_key_for_testing deleted file mode 100644 index c0040d33..00000000 --- a/.travis/fake_private_key_for_testing +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAyNrCJIQqg26ZU1n+mSPzTzcZnvimVK+EUt9Ty76jX6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llUM6nrEOYVarGIaIhCoth1FpzhdaccM9SjXXI6fTkcYplJ/ -eY0rb3t1kdBJGCUlIvn9nNScm+QgH2XloWHaNf69TeniFEgUewCXC6Vpd1UD6cfK -9Z6rDTTRXlq7OlIugyGnX/vVAoGBAJxp3xgdPS05Cf7NibgHMUMKE4bBvSp8MDui -izKSv1b2Hv/5zXc8as7lGYWrCl6JSiuybkxxvKCUWJgLUAlGmnHl8NLlMblFsUov -HV8wEJXrfI3gHXbN4cIJAtnDiKGgz6EdmahRb8v/2QHT/Z1R0gPmh6mWxSVZBEgz -JeawxTTJAoGAKolzv0T6rZ/INg6+Ho4ioMbenoteb1a04k3l483YfApD8E2rnmaf -4z3KZFEUNdrDSg9HJTFHdYJxaJCJ0+2m+pEU0BbOWlrDaDqzm1MbeFBcmcKMmfLn -bl7ojUVTMutjrB4JXZ5778H9SwZ8HKCYYNjUiZppxQTwUjvFgZfvWaY= ------END RSA PRIVATE KEY----- diff --git a/.travis/secret-key.asc.enc b/.travis/secret-key.asc.enc deleted file mode 100644 index 33bfe465..00000000 Binary files a/.travis/secret-key.asc.enc and /dev/null differ diff --git a/build.sbt b/build.sbt index df38ab19..cd969e4f 100644 --- a/build.sbt +++ b/build.sbt @@ -205,6 +205,5 @@ lazy val `mauth-jvm-clients` = (project in file(".")) .settings( basicSettings, publishSettings, - publish / skip := false, - smartReleaseAggregateProjectSettings + publish / skip := false ) diff --git a/modules/mauth-test-utils/src/main/java/com/mdsol/mauth/test/utils/ProtocolTestSuiteHelper.java b/modules/mauth-test-utils/src/main/java/com/mdsol/mauth/test/utils/ProtocolTestSuiteHelper.java index 9ed9345c..08bf0574 100644 --- a/modules/mauth-test-utils/src/main/java/com/mdsol/mauth/test/utils/ProtocolTestSuiteHelper.java +++ b/modules/mauth-test-utils/src/main/java/com/mdsol/mauth/test/utils/ProtocolTestSuiteHelper.java @@ -22,6 +22,7 @@ public class ProtocolTestSuiteHelper { + final static String TEST_SUITE_RELATIVE_PATH = "../../mauth-protocol-test-suite/"; final static String MWSV2_TEST_CASE_PATH = getFullFilePath("protocols/MWSV2/"); @@ -31,7 +32,8 @@ public class ProtocolTestSuiteHelper { String configFile = getFullFilePath("signing-config.json"); try { ObjectMapper objectMapper = new ObjectMapper(); - byte[] jsonData = Files.readAllBytes(normalizePath(configFile)); + Path path = normalizePath(configFile).toAbsolutePath(); + byte[] jsonData = Files.readAllBytes(path); tmp = objectMapper.readValue(jsonData, SigningConfig.class); } catch (IOException ex) { throw new IllegalStateException("Failed to load the config file " + configFile, ex); diff --git a/project/BuildSettings.scala b/project/BuildSettings.scala index f41b0972..65cbf66d 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -1,12 +1,7 @@ import java.util -import com.jsuereth.sbtpgp.SbtPgp.autoImport._ import sbt.Keys._ import sbt._ -import sbtrelease.ReleasePlugin.autoImport._ -import smartrelease.SmartReleasePlugin.ReleaseSteps -import xerial.sbt.Sonatype.SonatypeKeys._ -import xerial.sbt.Sonatype._ object BuildSettings { val env: util.Map[String, String] = System.getenv() @@ -20,7 +15,7 @@ object BuildSettings { description := "MAuth clients", scalaVersion := scala213, resolvers += Resolver.mavenLocal, - resolvers += Resolver.sonatypeRepo("releases"), + resolvers ++= Resolver.sonatypeOssRepos("releases"), javacOptions ++= Seq("-encoding", "UTF-8"), // Avoid issues such as java.lang.IllegalAccessError: tried to access method org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey // By running tests in a separate JVM @@ -37,15 +32,7 @@ object BuildSettings { Seq.empty else Seq("-Xfatal-warnings") - }, - credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env.get("SONATYPE_USER"), env.get("SONATYPE_TOKEN")), - publishTo := Some( - if (isSnapshot.value) { - Opts.resolver.sonatypeSnapshots - } else { - Opts.resolver.sonatypeStaging - } - ) + } ) lazy val noPublishSettings = Seq( @@ -53,8 +40,6 @@ object BuildSettings { ) lazy val publishSettings = Seq( - sonatypeProfileName := "com.mdsol", - publishMavenStyle := true, licenses := Seq("MDSOL" -> url("https://github.com/mdsol/mauth-jvm-clients/blob/master/LICENSE.txt")), scmInfo := Some( ScmInfo( @@ -63,35 +48,12 @@ object BuildSettings { ) ), developers := List( - Developer(id = "austek", name = "Ali Ustek", email = "austek@mdsol.com", url = url("https://github.com/austek")) - ), - sonatypeProjectHosting := Some(GitHubHosting("austek", "mauth-jvm-clients", "austek@mdsol.com")), - publishTo := sonatypePublishToBundle.value, - releaseTagComment := s"Releasing ${(ThisBuild / version).value} [ci skip]", - releaseCommitMessage := s"Setting version to ${(ThisBuild / version).value} [ci skip]", - releaseNextCommitMessage := s"Setting version to ${(ThisBuild / version).value} [ci skip]", - releasePublishArtifactsAction := PgpKeys.publishSigned.value, - releaseCrossBuild := false, // true if you cross-build the project for multiple Scala versions - releaseProcess := releaseSteps, - credentials += Credentials( - "GnuPG Key ID", - "pgp", - "A9A6453ABA90E61B2492BDCD9F58C26F3772CEEE", - "ignored" + Developer( + "scala-mdsol", + "Medidata Scala Team", + "list_custom_Medidata.shared-jvm-libs@3ds.com", + url("https://github.com/mdsol/sbt-smartrelease") + ) ) ) - - val releaseSteps: Seq[ReleaseStep] = { - import sbtrelease.ReleaseStateTransformations._ - Seq( - checkSnapshotDependencies, - ReleaseSteps.checkCurrentVersionIsValidReleaseVersion, - ReleaseSteps.checkReleaseVersionStep, - ReleaseSteps.fetchAllFromOrigin, - ReleaseSteps.checkThisCommitExistOnMaster, - runClean, - releaseStepCommandAndRemaining("+publishSigned"), - releaseStepCommand("sonatypeBundleRelease") - ) - } } diff --git a/project/plugins.sbt b/project/plugins.sbt index aabf1a7c..ff0c966a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,5 @@ -addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") -addSbtPlugin("com.mdsol" % "sbt-smartrelease" % "0.3.4") -addSbtPlugin("com.mintbeans" % "sbt-ecr" % "0.15.0") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7") -addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.8.2") -addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.17") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") +addSbtPlugin("com.mintbeans" % "sbt-ecr" % "0.15.0") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") +addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.8.2") +addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.17")