diff --git a/.github/workflows/connect.yml b/.github/workflows/connect.yml index d2a6ca3a3e..65be4b8856 100644 --- a/.github/workflows/connect.yml +++ b/.github/workflows/connect.yml @@ -21,7 +21,7 @@ on: - "connect/lib/**" jobs: - build-and-test-mercury: + build-and-test-connect: uses: ./.github/workflows/scala-unit-tests.yml with: component-name: "Connect Lib" diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index b392a75be8..1c5e61f0dd 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -65,7 +65,6 @@ jobs: PRISM_AGENT_PATH: "../../prism-agent/service/" GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} - ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} run: | cd "${PRISM_AGENT_PATH}" || exit 129 sbt docker:publishLocal @@ -106,8 +105,6 @@ jobs: - name: Run e2e tests continue-on-error: true - env: - ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} run: | ./gradlew test --tests "E2eTestsRunner" || true ./gradlew reports @@ -132,6 +129,7 @@ jobs: run: | JSON_RESULTS="target/site/serenity/serenity-summary.json" CONCLUSION=failure + SLACK_REPORT_FAILURE=true TOTAL_TESTS=0 FAILED_TESTS=0 SKIPPED_TESTS=0 @@ -145,9 +143,11 @@ jobs: TESTS_WITH_ERRORS="$(cat ${JSON_RESULTS} | jq '.results.counts.error')" if [[ ${FAILED_TESTS} == 0 && ${TESTS_WITH_ERRORS} == 0 ]] ; then CONCLUSION=success + SLACK_REPORT_FAILURE=false fi fi { + echo "slack_report_failure=${SLACK_REPORT_FAILURE}"; echo "conclusion=${CONCLUSION}"; echo "tests=${TOTAL_TESTS}"; echo "failures=${FAILED_TESTS}"; @@ -158,7 +158,7 @@ jobs: } >> "$GITHUB_OUTPUT" - name: Slack Notification - if: github.ref_name == 'main' + if: github.ref_name == 'main' && steps.analyze_test_results.outputs.slack_report_failure uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ steps.analyze_test_results.outputs.conclusion }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fedcd243c8..05a7554a5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,9 +29,8 @@ jobs: env: GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} - ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SBT_PACKAGER: "enable" # To enable the packager plugin on Mercury + PUBLISH_PACKAGES: "enable" # To enable the packager plugin on Mercury runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/scala-steward.yml b/.github/workflows/scala-steward.yml index 0f040df6bf..5b590fc9a8 100644 --- a/.github/workflows/scala-steward.yml +++ b/.github/workflows/scala-steward.yml @@ -25,7 +25,6 @@ jobs: uses: scala-steward-org/scala-steward-action@v2 env: GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} - ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} with: github-token: ${{ secrets.ATALA_GITHUB_TOKEN }} sign-commits: true diff --git a/.github/workflows/scala-unit-tests.yml b/.github/workflows/scala-unit-tests.yml index 9ac150f0c0..a54c49cfbe 100644 --- a/.github/workflows/scala-unit-tests.yml +++ b/.github/workflows/scala-unit-tests.yml @@ -16,9 +16,6 @@ jobs: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} - ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} - SBT_PACKAGER: "enable" - SBT_SCOVERAGE: "enable" defaults: run: working-directory: ${{ inputs.component-dir }} @@ -38,12 +35,7 @@ jobs: run: sbt scalafmtCheckAll - name: Run Unit Tests - run: | - if [[ ${{ inputs.component-dir }} == mercury/mercury-library ]]; then - SBT_SCOVERAGE=enable sbt clean coverage test coverageAggregate - else - sbt test - fi + run: sbt coverage test coverageAggregate - name: Aggregate test reports if: always() @@ -61,17 +53,16 @@ jobs: check_name: "${{ inputs.component-name }} Test Results" - name: Code coverage report - if: inputs.component-dir == 'mercury/mercury-library' uses: 5monkeys/cobertura-action@master with: path: "${{ inputs.component-dir }}/target/coverage/coverage-report/cobertura.xml" report_name: "${{ inputs.component-name }} Code Coverage" minimum_coverage: 10 fail_below_threshold: false + only_changed_files: true - name: Artifact coverage HTML uses: actions/upload-artifact@v2 - if: inputs.component-dir == 'mercury/mercury-library' with: - name: code-coverage-report-mercury + name: "code-coverage-report-${{ inputs.component-name }}" path: "${{ inputs.component-dir }}/target/coverage/scoverage-report" diff --git a/.mega-linter.yml b/.mega-linter.yml index 043949f57f..e6c677ca01 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -32,6 +32,8 @@ BASH_SHELLCHECK_DISABLE_ERRORS: true PRE_COMMANDS: - command: git config --global core.autocrlf input cwd: "workspace" + - command: pip install Click==8.1.3 + cwd: "workspace" # Linter customisation MARKDOWN_MARKDOWN_LINK_CHECK_FILTER_REGEX_EXCLUDE: "CHANGELOG.md" diff --git a/castor/lib/build.sbt b/castor/lib/build.sbt index 6dab90a189..95fd7b419e 100644 --- a/castor/lib/build.sbt +++ b/castor/lib/build.sbt @@ -1,31 +1,51 @@ import Dependencies._ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ inThisBuild( Seq( organization := "io.iohk.atala", - scalaVersion := "3.2.1", + scalaVersion := "3.2.2", fork := true, run / connectInput := true, versionScheme := Some("semver-spec"), - githubOwner := "input-output-hk", - githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN") + testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")), + resolvers += Resolver.githubPackages("input-output-hk"), + resolvers += "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven" ) ) -val commonSettings = Seq( - testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")), - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), - resolvers += Resolver.githubPackages("input-output-hk"), - // Needed for Kotlin coroutines that support new memory management mode - resolvers += "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven" -) +coverageDataDir := target.value / "coverage" + +SbtUtils.disablePlugins(publishConfigure) // SEE also SbtUtils.scala +lazy val publishConfigure: Project => Project = sys.env + .get("PUBLISH_PACKAGES") match { + case None => _.disablePlugins(GitHubPackagesPlugin) + case Some(_) => (p: Project) => p +} + +sys.env + .get("PUBLISH_PACKAGES") // SEE also plugin.sbt + .map { _ => + println("### Configure release process ###") + import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ + ThisBuild / releaseUseGlobalVersion := false + ThisBuild / githubOwner := "input-output-hk" + ThisBuild / githubRepository := "atala-prism-building-blocks" + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, + inquireVersions, + runClean, + runTest, + setReleaseVersion, + publishArtifacts, + setNextVersion + ) + } + .toSeq // Project definitions lazy val root = project .in(file(".")) - .settings(commonSettings) + .configure(publishConfigure) .settings( name := "castor-root", ) @@ -34,7 +54,7 @@ lazy val root = project lazy val core = project .in(file("core")) - .settings(commonSettings) + .configure(publishConfigure) .settings( name := "castor-core", libraryDependencies ++= coreDependencies @@ -42,20 +62,9 @@ lazy val core = project lazy val `sql-doobie` = project .in(file("sql-doobie")) - .settings(commonSettings) + .configure(publishConfigure) .settings( name := "castor-sql-doobie", libraryDependencies ++= sqlDoobieDependencies ) .dependsOn(core) - -// ### ReleaseStep ### -releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - runClean, - runTest, - setReleaseVersion, - publishArtifacts, - setNextVersion -) diff --git a/castor/lib/project/SbtUtils.scala b/castor/lib/project/SbtUtils.scala new file mode 100644 index 0000000000..9abea03dc1 --- /dev/null +++ b/castor/lib/project/SbtUtils.scala @@ -0,0 +1,10 @@ +object SbtUtils { + + import sbt._ + import sbt.internal.DslEntry.DslDisablePlugins + + def disablePlugins(f: Project => Project) = new DslDisablePlugins(Seq()) { + override val toFunction: Project => Project = f + } + +} diff --git a/castor/lib/project/build.sbt b/castor/lib/project/build.sbt index b7a5cff4f3..f5a93fd93d 100644 --- a/castor/lib/project/build.sbt +++ b/castor/lib/project/build.sbt @@ -1,3 +1,4 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") diff --git a/connect/.gitkeep b/connect/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/connect/lib/build.sbt b/connect/lib/build.sbt index ee48b35e34..5dd0f7ab7b 100644 --- a/connect/lib/build.sbt +++ b/connect/lib/build.sbt @@ -1,5 +1,4 @@ import Dependencies._ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ inThisBuild( Seq( @@ -10,29 +9,23 @@ inThisBuild( versionScheme := Some("semver-spec"), githubOwner := "input-output-hk", githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN") + resolvers += Resolver.githubPackages("input-output-hk"), + resolvers += "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven", + testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")) ) ) -val commonSettings = Seq( - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), - resolvers += Resolver.githubPackages("input-output-hk"), - // Needed for Kotlin coroutines that support new memory management mode - resolvers += "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven", - testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")) -) +coverageDataDir := target.value / "coverage" // Project definitions lazy val root = project .in(file(".")) - .settings(commonSettings) .settings(name := "connect") .aggregate(core, `sql-doobie`) -publish / skip := true //Do not publish the root +publish / skip := true // Do not publish the root lazy val core = project .in(file("core")) - .settings(commonSettings) .settings( name := "connect-core", libraryDependencies ++= coreDependencies, @@ -41,14 +34,14 @@ lazy val core = project lazy val `sql-doobie` = project .in(file("sql-doobie")) - .settings(commonSettings) .settings( name := "connect-sql-doobie", libraryDependencies ++= sqlDoobieDependencies ) .dependsOn(core % "compile->compile;test->test") -// ### ReleaseStep ### +// Configure release process +import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ releaseProcess := Seq[ReleaseStep]( checkSnapshotDependencies, inquireVersions, diff --git a/connect/lib/project/build.sbt b/connect/lib/project/build.sbt index af1c05c24b..aae73901f6 100644 --- a/connect/lib/project/build.sbt +++ b/connect/lib/project/build.sbt @@ -1,3 +1,4 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") diff --git a/connect/lib/project/plugins.sbt b/connect/lib/project/plugins.sbt deleted file mode 100644 index 0e7fcb22c1..0000000000 --- a/connect/lib/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6") \ No newline at end of file diff --git a/connect/project/build.properties b/connect/project/build.properties deleted file mode 100644 index e67343ae79..0000000000 --- a/connect/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=1.5.0 diff --git a/infrastructure/dev/README.md b/infrastructure/dev/README.md index 31d4fd3784..937e80b411 100644 --- a/infrastructure/dev/README.md +++ b/infrastructure/dev/README.md @@ -8,7 +8,7 @@ All components are built at the current repository version and published locally **Running using the scripts in this directory does not create a production-ready or secure environment. It is designed to allow easy development and should not be used to run a production instance** -Please ensure you have set the `ATALA_GITHUB_TOKEN` and `GITHUB_TOKEN` environment variable. These both need to be set to the same value. +Please ensure you have set the `GITHUB_TOKEN` environment variable. The value of this variable must be a Github token generated with the `read:packages` permission set on the `building-block` repository. @@ -16,7 +16,6 @@ The value of this variable must be a Github token generated with the `read:pack ``` export GITHUB_TOKEN=YOUR_TOKEN_HERE -export ATALA_GITHUB_TOKEN=$GITHUB_TOKEN ``` Please ensure you have logged into the ATALA IOHK Docker Registry using the following command [once the `GITHUB_TOKEN` is set] diff --git a/infrastructure/local/README.md b/infrastructure/local/README.md index 528bad2372..a31fc48464 100644 --- a/infrastructure/local/README.md +++ b/infrastructure/local/README.md @@ -8,7 +8,7 @@ All images will be pulled from a remote repository and the `.env` file controls **Running using the scripts in this directory does not create a production-ready or secure environment. It is designed to allow easy development and should not be used to run a production instance** -Please ensure you have set the `ATALA_GITHUB_TOKEN` and `GITHUB_TOKEN` environment variable. These both need to be set to the same value. +Please ensure you have set the `GITHUB_TOKEN` environment variable. The value of this variable must be a Github token generated with the `read:packages` permission set on the `building-block` repository. @@ -16,7 +16,6 @@ The value of this variable must be a Github token generated with the `read:pack ``` export GITHUB_TOKEN=YOUR_TOKEN_HERE -export ATALA_GITHUB_TOKEN=$GITHUB_TOKEN ``` Please ensure you have logged into the ATALA IOHK Docker Registry using the following command [once the `GITHUB_TOKEN` is set] diff --git a/infrastructure/multi/README.md b/infrastructure/multi/README.md index a61070d2fa..6ee77466c2 100644 --- a/infrastructure/multi/README.md +++ b/infrastructure/multi/README.md @@ -19,7 +19,7 @@ All images will be pulled from a remote repository and the `.env` file controls **Running using the scripts in this directory does not create a production-ready or secure environment. It is designed to allow easy development and should not be used to run a production instance** -Please ensure you have set the `ATALA_GITHUB_TOKEN` and `GITHUB_TOKEN` environment variable. These both need to be set to the same value. +Please ensure you have set the `GITHUB_TOKEN` environment variable. The value of this variable must be a Github token generated with the `read:packages` permission set on the `building-block` repository. @@ -27,7 +27,6 @@ The value of this variable must be a Github token generated with the `read:pack ``` export GITHUB_TOKEN=YOUR_TOKEN_HERE -export ATALA_GITHUB_TOKEN=$GITHUB_TOKEN ``` Please ensure you have logged into the ATALA IOHK Docker Registry using the following command [once the `GITHUB_TOKEN` is set] diff --git a/infrastructure/utils/python/github-helpers/github_helpers/cli.py b/infrastructure/utils/python/github-helpers/github_helpers/cli.py index f10b6be74a..038b438174 100644 --- a/infrastructure/utils/python/github-helpers/github_helpers/cli.py +++ b/infrastructure/utils/python/github-helpers/github_helpers/cli.py @@ -10,6 +10,7 @@ import logging import sys +# pylint: disable=import-error import click # pylint: disable=E0402 @@ -66,7 +67,7 @@ def __init__(self, token, owner, repo): @click.group() @click.option( "--token", - envvar="ATALA_GITHUB_TOKEN", + envvar="GITHUB_TOKEN", metavar="TOKEN", required=True, help="GitHub authentication token.", @@ -137,7 +138,7 @@ def get_latest_package_version(ctx, package, package_type): print(versions[0].get("metadata").get("container").get("tags")[0]) else: print(versions[0].get("name", "NOT EXIST")) - except: + except IndexError: print("NOT EXIST") diff --git a/infrastructure/utils/python/github-helpers/setup.py b/infrastructure/utils/python/github-helpers/setup.py index 67e0667ff2..ddad103090 100644 --- a/infrastructure/utils/python/github-helpers/setup.py +++ b/infrastructure/utils/python/github-helpers/setup.py @@ -13,7 +13,7 @@ "console_scripts": ["github=github_helpers.cli:cli"], }, install_requires=[ - "Click==8.0.1", + "Click==8.1.3", "requests==2.26.0", "pylint==2.10.2", "pytest==6.2.4", diff --git a/iris/client/scala-client/build.sbt b/iris/client/scala-client/build.sbt index b640466839..0aa9c4fccd 100644 --- a/iris/client/scala-client/build.sbt +++ b/iris/client/scala-client/build.sbt @@ -1,23 +1,20 @@ import Dependencies._ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ inThisBuild( Seq( organization := "io.iohk.atala", - scalaVersion := "3.2.1", + scalaVersion := "3.2.2", fork := true, run / connectInput := true, versionScheme := Some("semver-spec"), + releaseUseGlobalVersion := false, githubOwner := "input-output-hk", githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN") + resolvers += Resolver.githubPackages("input-output-hk"), ) ) -val commonSettings = Seq( - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), - resolvers += Resolver.githubPackages("input-output-hk"), -) +coverageDataDir := target.value / "coverage" // Custom keys val apiBaseDirectory = settingKey[File]("The base directory for Iris API specifications") @@ -32,9 +29,8 @@ lazy val root = project Compile / PB.targets := Seq(scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"), Compile / PB.protoSources := Seq(apiBaseDirectory.value / "grpc") ) - .settings(commonSettings) -// ### ReleaseStep ### +import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ releaseProcess := Seq[ReleaseStep]( checkSnapshotDependencies, inquireVersions, diff --git a/iris/client/scala-client/project/scalapb.sbt b/iris/client/scala-client/project/scalapb.sbt index 10d96725f5..e9c0adc109 100644 --- a/iris/client/scala-client/project/scalapb.sbt +++ b/iris/client/scala-client/project/scalapb.sbt @@ -2,5 +2,6 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") libraryDependencies ++= Seq("com.thesamet.scalapb" %% "compilerplugin" % "0.11.12") diff --git a/iris/service/build.sbt b/iris/service/build.sbt index bcf4968c76..28b5e67c7a 100644 --- a/iris/service/build.sbt +++ b/iris/service/build.sbt @@ -1,7 +1,6 @@ import Dependencies._ import sbt.Keys.testFrameworks import sbtghpackages.GitHubPackagesPlugin.autoImport._ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ // Custom keys val apiBaseDirectory = settingKey[File]("The base directory for Iris gRPC specifications") @@ -10,31 +9,22 @@ ThisBuild / apiBaseDirectory := baseDirectory.value / "../api" inThisBuild( Seq( organization := "io.iohk.atala", - scalaVersion := "3.2.1", + scalaVersion := "3.2.2", fork := true, run / connectInput := true, versionScheme := Some("semver-spec"), githubOwner := "input-output-hk", githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN") + resolvers += Resolver.githubPackages("input-output-hk"), + resolvers += + "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven" ) ) -def commonProject(project: Project): Project = - project.settings( - version := "0.1.0", - organization := "io.iohk.atala", - scalaVersion := "3.2.1", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), - versionScheme := Some("semver-spec"), - resolvers += Resolver - .githubPackages("input-output-hk"), - // Needed for Kotlin coroutines that support new memory management mode - resolvers += - "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven", - ) +coverageDataDir := target.value / "coverage" // Project definitions +publish / skip := true lazy val root = project .in(file(".")) .settings( @@ -42,7 +32,7 @@ lazy val root = project ) .aggregate(core, sql, server) -lazy val core = commonProject(project) +lazy val core = project .in(file("core")) .settings( name := "iris-core", @@ -53,7 +43,7 @@ lazy val core = commonProject(project) Compile / PB.protoSources := Seq(apiBaseDirectory.value / "grpc") ) -lazy val sql = commonProject(project) +lazy val sql = project .in(file("sql")) .settings( name := "iris-sql", @@ -61,7 +51,7 @@ lazy val sql = commonProject(project) ) .dependsOn(core) -lazy val server = commonProject(project) +lazy val server = project .in(file("server")) .settings( name := "iris-service", @@ -77,6 +67,7 @@ lazy val server = commonProject(project) .enablePlugins(JavaAppPackaging, DockerPlugin) .dependsOn(core, sql) +import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ releaseProcess := Seq[ReleaseStep]( checkSnapshotDependencies, inquireVersions, diff --git a/iris/service/project/plugins.sbt b/iris/service/project/plugins.sbt index a05825422a..833dc50a68 100644 --- a/iris/service/project/plugins.sbt +++ b/iris/service/project/plugins.sbt @@ -1,4 +1,5 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") -addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11") +addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") diff --git a/mercury/mercury-library/build.sbt b/mercury/mercury-library/build.sbt index 127ba45e55..de89039682 100644 --- a/mercury/mercury-library/build.sbt +++ b/mercury/mercury-library/build.sbt @@ -1,21 +1,42 @@ -val SCALA_VERSION = sys.env.get("SBT_SCOVERAGE") match { - case None => "3.2.1" - case Some(_) => "3.2.2-RC1-bin-20221026-a210b7f-NIGHTLY" // Needed for sbt-scoverage -} - inThisBuild( Seq( organization := "io.iohk.atala", - scalaVersion := SCALA_VERSION, + scalaVersion := "3.2.2", fork := true, run / connectInput := true, - releaseUseGlobalVersion := false, versionScheme := Some("semver-spec"), - githubOwner := "input-output-hk", - githubRepository := "atala-prism-building-blocks" ) ) +coverageDataDir := target.value / "coverage" + +SbtUtils.disablePlugins(publishConfigure) // SEE also SbtUtils.scala +lazy val publishConfigure: Project => Project = sys.env + .get("PUBLISH_PACKAGES") match { + case None => _.disablePlugins(GitHubPackagesPlugin) + case Some(_) => (p: Project) => p +} + +sys.env + .get("PUBLISH_PACKAGES") // SEE also plugin.sbt + .map { _ => + println("### Configure release process ###") + import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ + ThisBuild / releaseUseGlobalVersion := false + ThisBuild / githubOwner := "input-output-hk" + ThisBuild / githubRepository := "atala-prism-building-blocks" + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, + inquireVersions, + runClean, + runTest, + setReleaseVersion, + publishArtifacts, + setNextVersion + ) + } + .toSeq + inThisBuild( Seq( scalacOptions ++= Seq( @@ -95,6 +116,7 @@ publish / skip := true */ lazy val models = project .in(file("models")) + .configure(publishConfigure) .settings(name := "mercury-data-models") .settings( libraryDependencies ++= Seq(D.zio.value), @@ -121,6 +143,7 @@ models implementation for didcommx () */ lazy val protocolConnection = project .in(file("protocol-connection")) + .configure(publishConfigure) .settings(name := "mercury-protocol-connection") .settings(libraryDependencies += D.zio.value) .settings(libraryDependencies ++= Seq(D.circeCore.value, D.circeGeneric.value, D.circeParser.value)) @@ -129,6 +152,7 @@ lazy val protocolConnection = project lazy val protocolCoordinateMediation = project .in(file("protocol-coordinate-mediation")) + .configure(publishConfigure) .settings(name := "mercury-protocol-coordinate-mediation") .settings(libraryDependencies += D.zio.value) .settings(libraryDependencies ++= Seq(D.circeCore.value, D.circeGeneric.value, D.circeParser.value)) @@ -137,6 +161,7 @@ lazy val protocolCoordinateMediation = project lazy val protocolDidExchange = project .in(file("protocol-did-exchange")) + .configure(publishConfigure) .settings(name := "mercury-protocol-did-exchange") .settings(libraryDependencies += D.zio.value) .settings(libraryDependencies ++= Seq(D.circeCore.value, D.circeGeneric.value, D.circeParser.value)) @@ -144,6 +169,7 @@ lazy val protocolDidExchange = project lazy val protocolInvitation = project .in(file("protocol-invitation")) + .configure(publishConfigure) .settings(name := "mercury-protocol-invitation") .settings(libraryDependencies += D.zio.value) .settings( @@ -159,12 +185,14 @@ lazy val protocolInvitation = project lazy val protocolMercuryMailbox = project .in(file("protocol-mercury-mailbox")) + .configure(publishConfigure) .settings(name := "mercury-protocol-mailbox") .settings(libraryDependencies += D.zio.value) .dependsOn(models, protocolInvitation, protocolRouting) lazy val protocolLogin = project .in(file("protocol-outofband-login")) + .configure(publishConfigure) .settings(name := "mercury-protocol-outofband-login") .settings(libraryDependencies += D.zio.value) .settings(libraryDependencies += D.zio.value) @@ -174,6 +202,7 @@ lazy val protocolLogin = project lazy val protocolReportProblem = project .in(file("protocol-report-problem")) + .configure(publishConfigure) .settings(name := "mercury-protocol-report-problem") .settings(libraryDependencies += D.zio.value) .settings(libraryDependencies ++= Seq(D.circeCore.value, D.circeGeneric.value, D.circeParser.value)) @@ -182,12 +211,14 @@ lazy val protocolReportProblem = project lazy val protocolRouting = project .in(file("protocol-routing")) + .configure(publishConfigure) .settings(name := "mercury-protocol-routing-2-0") .settings(libraryDependencies += D.zio.value) .dependsOn(models) lazy val protocolIssueCredential = project .in(file("protocol-issue-credential")) + .configure(publishConfigure) .settings(name := "mercury-protocol-issue-credential") .settings(libraryDependencies += D.zio.value) .settings(libraryDependencies ++= Seq(D.circeCore.value, D.circeGeneric.value, D.circeParser.value)) @@ -196,6 +227,7 @@ lazy val protocolIssueCredential = project lazy val protocolPresentProof = project .in(file("protocol-present-proof")) + .configure(publishConfigure) .settings(name := "mercury-protocol-present-proof") .settings(libraryDependencies += D.zio.value) .settings(libraryDependencies ++= Seq(D.circeCore.value, D.circeGeneric.value, D.circeParser.value)) @@ -209,6 +241,7 @@ lazy val protocolPresentProof = project // TODO move stuff to the models module lazy val resolver = project // maybe merge into models .in(file("resolver")) + .configure(publishConfigure) .settings(name := "mercury-resolver") .settings( libraryDependencies ++= Seq( @@ -228,6 +261,7 @@ lazy val resolver = project // maybe merge into models lazy val agent = project // maybe merge into models .in(file("agent")) + .configure(publishConfigure) .settings(name := "mercury-agent-core") .settings(libraryDependencies ++= Seq(D.zioLog.value)) // , D.zioSLF4J.value)) .dependsOn( @@ -247,6 +281,7 @@ lazy val agent = project // maybe merge into models /** agents implementation with didcommx */ lazy val agentDidcommx = project .in(file("agent-didcommx")) + .configure(publishConfigure) .settings(name := "mercury-agent-didcommx") .settings(libraryDependencies += D.didcommx.value) .settings(libraryDependencies += D.munitZio.value) @@ -255,6 +290,7 @@ lazy val agentDidcommx = project /** Demos agents and services implementation with didcommx */ lazy val agentCliDidcommx = project .in(file("agent-cli-didcommx")) + .configure(publishConfigure) .settings(name := "mercury-agent-cli-didcommx") .settings(libraryDependencies += "com.google.zxing" % "core" % "3.5.0") .settings(libraryDependencies += D.zioHttp.value) @@ -263,6 +299,7 @@ lazy val agentCliDidcommx = project ///** TODO Demos agents and services implementation with did-scala */ lazy val agentDidScala = project + .configure(publishConfigure) .in(file("agent-did-scala")) .settings(name := "mercury-agent-didscala") .settings( @@ -272,32 +309,3 @@ lazy val agentDidScala = else (Compile / sources := Seq()), ) .dependsOn(agent) - -// ### Test coverage ### -sys.env - .get("SBT_SCOVERAGE") - .map { _ => - lazy val coverageDataDir: SettingKey[File] = - settingKey[File]("directory where the measurements and report files will be stored") - coverageDataDir := target.value / "coverage" - } - .toSeq - -// ### ReleaseStep ### -sys.env - .get("SBT_PACKAGER") // SEE also plugin.sbt - .map { _ => - println("### Config SBT_PACKAGER (releaseProcess) ###") - import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ - - releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - runClean, - runTest, - setReleaseVersion, - publishArtifacts, - setNextVersion - ) - } - .toSeq diff --git a/mercury/mercury-library/project/SbtUtils.scala b/mercury/mercury-library/project/SbtUtils.scala new file mode 100644 index 0000000000..9abea03dc1 --- /dev/null +++ b/mercury/mercury-library/project/SbtUtils.scala @@ -0,0 +1,10 @@ +object SbtUtils { + + import sbt._ + import sbt.internal.DslEntry.DslDisablePlugins + + def disablePlugins(f: Project => Project) = new DslDisablePlugins(Seq()) { + override val toFunction: Project => Project = f + } + +} diff --git a/mercury/mercury-library/project/plugins.sbt b/mercury/mercury-library/project/plugins.sbt index 538d172957..d909040fb0 100644 --- a/mercury/mercury-library/project/plugins.sbt +++ b/mercury/mercury-library/project/plugins.sbt @@ -1,25 +1,5 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") - -// USE> GITHUB_TOKEN=??? SBT_PACKAGER=enable sbt publish -new sbt.Def.SettingList( - sys.env - .get("SBT_PACKAGER") - .map { _ => - println("### Enable sbt-native-packager ###") - addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11") - } - .toSeq -) - -// USE> SBT_SCOVERAGE=enable sbt clean coverage test coverageAggregate -new sbt.Def.SettingList( - sys.env - .get("SBT_SCOVERAGE") // SEE also build.sbt - .map { _ => - println("### Enable sbt-scoverage ###") - addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6") // Needs scala version 3.2.2 - } - .toSeq -) +addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") diff --git a/mercury/mercury-mediator/build.sbt b/mercury/mercury-mediator/build.sbt index 758218abae..5be04f2383 100644 --- a/mercury/mercury-mediator/build.sbt +++ b/mercury/mercury-mediator/build.sbt @@ -1,23 +1,23 @@ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ - inThisBuild( Seq( organization := "io.iohk.atala", - scalaVersion := "3.2.1", + scalaVersion := "3.2.2", fork := true, run / connectInput := true, versionScheme := Some("semver-spec"), + resolvers += Resolver.githubPackages("input-output-hk"), + releaseUseGlobalVersion := false, githubOwner := "input-output-hk", - githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN") + githubRepository := "atala-prism-building-blocks" ) ) +coverageDataDir := target.value / "coverage" + // Custom keys val apiBaseDirectory = settingKey[File]("The base directory for Castor API specifications") ThisBuild / apiBaseDirectory := baseDirectory.value / "api" -ThisBuild / resolvers += Resolver.githubPackages("input-output-hk", "atala-prism-building-blocks") lazy val V = new { val munit = "1.0.0-M6" // "0.7.29" @@ -85,7 +85,6 @@ lazy val mediator = project libraryDependencies ++= Seq(D.mercuryModels.value, D.mercuryAgent.value, D.zioHttp.value), Compile / unmanagedResourceDirectories += apiBaseDirectory.value, testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")), - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), // ### Build Docker Image ### Docker / maintainer := "atala-coredid@iohk.io", Docker / dockerRepository := Some("ghcr.io"), @@ -97,7 +96,7 @@ lazy val mediator = project ) .enablePlugins(JavaAppPackaging, DockerPlugin) -// ### ReleaseStep ### +import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ releaseProcess := Seq[ReleaseStep]( checkSnapshotDependencies, inquireVersions, diff --git a/mercury/mercury-mediator/project/plugins.sbt b/mercury/mercury-mediator/project/plugins.sbt index 6ffc07af35..0be5a6131b 100644 --- a/mercury/mercury-mediator/project/plugins.sbt +++ b/mercury/mercury-mediator/project/plugins.sbt @@ -1,5 +1,5 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") -addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9") //1.9.11 +addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") - +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") diff --git a/pluto/.gitkeep b/pluto/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/pollux/.gitkeep b/pollux/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/pollux/lib/build.sbt b/pollux/lib/build.sbt index a03a93505a..8f7dede36d 100644 --- a/pollux/lib/build.sbt +++ b/pollux/lib/build.sbt @@ -1,6 +1,5 @@ import Dependencies._ import Dependencies_VC_JWT._ //TODO REMOVE -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ inThisBuild( Seq( @@ -9,34 +8,28 @@ inThisBuild( fork := true, run / connectInput := true, versionScheme := Some("semver-spec"), - githubOwner := "input-output-hk", - githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), Compile / javaOptions += "-Dquill.macro.log=false -Duser.timezone=UTC", Test / javaOptions += "-Dquill.macro.log=false -Duser.timezone=UTC -Xms2048m -Xmx2048m -Xss16M", - Test / envVars := Map("TZ" -> "UTC") + Test / envVars := Map("TZ" -> "UTC"), + testFrameworks ++= Seq(new TestFramework("zio.test.sbt.ZTestFramework")), + resolvers += Resolver.githubPackages("input-output-hk"), + resolvers += "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven", + githubOwner := "input-output-hk", + githubRepository := "atala-prism-building-blocks" ) ) -val commonSettings = Seq( - testFrameworks ++= Seq(new TestFramework("zio.test.sbt.ZTestFramework")), - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), - resolvers += Resolver.githubPackages("input-output-hk"), - // Needed for Kotlin coroutines that support new memory management mode - resolvers += "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven" -) +coverageDataDir := target.value / "coverage" // Project definitions lazy val root = project .in(file(".")) - .settings(commonSettings) .settings(name := "pollux-root") .aggregate(core, `sql-doobie`, vcJWT) -publish / skip := true //Do not publish the root +publish / skip := true // do not publish the root lazy val vcJWT = project .in(file("vc-jwt")) - .settings(commonSettings) .settings( name := "pollux-vc-jwt", libraryDependencies ++= polluxVcJwtDependencies @@ -44,7 +37,6 @@ lazy val vcJWT = project lazy val core = project .in(file("core")) - .settings(commonSettings) .settings( name := "pollux-core", libraryDependencies ++= coreDependencies @@ -53,14 +45,13 @@ lazy val core = project lazy val `sql-doobie` = project .in(file("sql-doobie")) - .settings(commonSettings) .settings( name := "pollux-sql-doobie", libraryDependencies ++= sqlDoobieDependencies ) .dependsOn(core % "compile->compile;test->test") -// ### ReleaseStep ### +import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ releaseProcess := Seq[ReleaseStep]( checkSnapshotDependencies, inquireVersions, diff --git a/pollux/lib/project/build.sbt b/pollux/lib/project/build.sbt index af1c05c24b..aae73901f6 100644 --- a/pollux/lib/project/build.sbt +++ b/pollux/lib/project/build.sbt @@ -1,3 +1,4 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") diff --git a/pollux/lib/project/plugins.sbt b/pollux/lib/project/plugins.sbt index 0e7fcb22c1..98b681d06d 100644 --- a/pollux/lib/project/plugins.sbt +++ b/pollux/lib/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6") \ No newline at end of file +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") diff --git a/pollux/project/build.properties b/pollux/project/build.properties deleted file mode 100644 index c8fcab543a..0000000000 --- a/pollux/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=1.6.2 diff --git a/prism-agent/service/build.sbt b/prism-agent/service/build.sbt index 2440a33f30..e43e945b4d 100644 --- a/prism-agent/service/build.sbt +++ b/prism-agent/service/build.sbt @@ -1,6 +1,5 @@ import Dependencies._ import sbtghpackages.GitHubPackagesPlugin.autoImport._ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ // Custom keys val apiBaseDirectory = @@ -9,34 +8,28 @@ val apiBaseDirectory = inThisBuild( Seq( organization := "io.iohk.atala", - scalaVersion := "3.2.1", + scalaVersion := "3.2.2", apiBaseDirectory := baseDirectory.value / "api", fork := true, run / connectInput := true, versionScheme := Some("semver-spec"), + testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")), + resolvers += Resolver.githubPackages("input-output-hk"), + resolvers += "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven", githubOwner := "input-output-hk", - githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN") + githubRepository := "atala-prism-building-blocks" ) ) -val commonSettings = Seq( - testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")), - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), - resolvers += Resolver.githubPackages("input-output-hk"), - // Needed for Kotlin coroutines that support new memory management mode - resolvers += "JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven" -) +coverageDataDir := target.value / "coverage" // Project definitions lazy val root = project .in(file(".")) - .settings(commonSettings) .aggregate(`wallet-api`, server) lazy val `wallet-api` = project .in(file("wallet-api")) - .settings(commonSettings) .settings( name := "prism-agent-wallet-api", libraryDependencies ++= keyManagementDependencies @@ -44,7 +37,6 @@ lazy val `wallet-api` = project lazy val server = project .in(file("server")) - .settings(commonSettings) .settings( name := "prism-agent", fork := true, @@ -75,6 +67,7 @@ lazy val server = project .enablePlugins(OpenApiGeneratorPlugin, JavaAppPackaging, DockerPlugin, BuildInfoPlugin) .dependsOn(`wallet-api`) +import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ releaseProcess := Seq[ReleaseStep]( checkSnapshotDependencies, inquireVersions, diff --git a/prism-agent/service/project/build.sbt b/prism-agent/service/project/build.sbt index dd64e24ba6..8f39cc0c78 100644 --- a/prism-agent/service/project/build.sbt +++ b/prism-agent/service/project/build.sbt @@ -1,8 +1,9 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") -addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9") +addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") //addDependencyTreePlugin libraryDependencies ++= Seq("org.openapitools" % "openapi-generator" % "6.0.1") diff --git a/prism-node/client/scala-client/build.sbt b/prism-node/client/scala-client/build.sbt index a4d5174f62..15904cf864 100644 --- a/prism-node/client/scala-client/build.sbt +++ b/prism-node/client/scala-client/build.sbt @@ -1,21 +1,43 @@ import Dependencies._ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ inThisBuild( Seq( organization := "io.iohk.atala", - scalaVersion := "3.2.1", + scalaVersion := "3.2.2", fork := true, run / connectInput := true, versionScheme := Some("semver-spec") ) ) -val commonSettings = Seq( - githubOwner := "input-output-hk", - githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN") -) +coverageDataDir := target.value / "coverage" + +SbtUtils.disablePlugins(publishConfigure) // SEE also SbtUtils.scala +lazy val publishConfigure: Project => Project = sys.env + .get("PUBLISH_PACKAGES") match { + case None => _.disablePlugins(GitHubPackagesPlugin) + case Some(_) => (p: Project) => p +} + +sys.env + .get("PUBLISH_PACKAGES") // SEE also plugin.sbt + .map { _ => + println("### Configure release process ###") + import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ + ThisBuild / releaseUseGlobalVersion := false + ThisBuild / githubOwner := "input-output-hk" + ThisBuild / githubRepository := "atala-prism-building-blocks" + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, + inquireVersions, + runClean, + runTest, + setReleaseVersion, + publishArtifacts, + setNextVersion + ) + } + .toSeq // Custom keys val apiBaseDirectory = settingKey[File]("The base directory for Node 2 API specifications") @@ -23,7 +45,7 @@ ThisBuild / apiBaseDirectory := baseDirectory.value / "./api" lazy val root = project .in(file(".")) - .settings(commonSettings) + .configure(publishConfigure) .settings( name := "prism-node-client", libraryDependencies ++= rootDependencies, @@ -31,14 +53,3 @@ lazy val root = project Compile / PB.targets := Seq(scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"), Compile / PB.protoSources := Seq(apiBaseDirectory.value / "grpc") ) - -// ### ReleaseStep ### -releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - runClean, - runTest, - setReleaseVersion, - publishArtifacts, - setNextVersion -) diff --git a/prism-node/client/scala-client/project/SbtUtils.scala b/prism-node/client/scala-client/project/SbtUtils.scala new file mode 100644 index 0000000000..9abea03dc1 --- /dev/null +++ b/prism-node/client/scala-client/project/SbtUtils.scala @@ -0,0 +1,10 @@ +object SbtUtils { + + import sbt._ + import sbt.internal.DslEntry.DslDisablePlugins + + def disablePlugins(f: Project => Project) = new DslDisablePlugins(Seq()) { + override val toFunction: Project => Project = f + } + +} diff --git a/prism-node/client/scala-client/project/scalapb.sbt b/prism-node/client/scala-client/project/scalapb.sbt index 10d96725f5..e9c0adc109 100644 --- a/prism-node/client/scala-client/project/scalapb.sbt +++ b/prism-node/client/scala-client/project/scalapb.sbt @@ -2,5 +2,6 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") libraryDependencies ++= Seq("com.thesamet.scalapb" %% "compilerplugin" % "0.11.12") diff --git a/shared/build.sbt b/shared/build.sbt index b4e5e4c1f1..d1716ce4c8 100644 --- a/shared/build.sbt +++ b/shared/build.sbt @@ -1,27 +1,48 @@ import sbtbuildinfo.BuildInfoPlugin import sbtbuildinfo.BuildInfoPlugin.autoImport._ import Dependencies._ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ inThisBuild( Seq( organization := "io.iohk.atala", - scalaVersion := "3.2.1", + scalaVersion := "3.2.2", fork := true, run / connectInput := true, versionScheme := Some("semver-spec"), - githubOwner := "input-output-hk", - githubRepository := "atala-prism-building-blocks", - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN") ) ) -val commonSettings = Seq( - githubTokenSource := TokenSource.Environment("ATALA_GITHUB_TOKEN"), - resolvers += Resolver.githubPackages("input-output-hk"), -) +coverageDataDir := target.value / "coverage" + +SbtUtils.disablePlugins(publishConfigure) // SEE also SbtUtils.scala +lazy val publishConfigure: Project => Project = sys.env + .get("PUBLISH_PACKAGES") match { + case None => _.disablePlugins(GitHubPackagesPlugin) + case Some(_) => (p: Project) => p +} + +sys.env + .get("PUBLISH_PACKAGES") // SEE also plugin.sbt + .map { _ => + println("### Configure release process ###") + import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ + ThisBuild / releaseUseGlobalVersion := false + ThisBuild / githubOwner := "input-output-hk" + ThisBuild / githubRepository := "atala-prism-building-blocks" + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, + inquireVersions, + runClean, + runTest, + setReleaseVersion, + publishArtifacts, + setNextVersion + ) + } + .toSeq lazy val root = (project in file(".")) + .configure(publishConfigure) .settings( organization := "io.iohk.atala", organizationName := "Input Output Global", @@ -30,16 +51,4 @@ lazy val root = (project in file(".")) crossPaths := false, libraryDependencies ++= dependencies ) - .settings(commonSettings) .enablePlugins(BuildInfoPlugin) - -// ### ReleaseStep ### -releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - runClean, - runTest, - setReleaseVersion, - publishArtifacts, - setNextVersion -) diff --git a/shared/project/SbtUtils.scala b/shared/project/SbtUtils.scala new file mode 100644 index 0000000000..9abea03dc1 --- /dev/null +++ b/shared/project/SbtUtils.scala @@ -0,0 +1,10 @@ +object SbtUtils { + + import sbt._ + import sbt.internal.DslEntry.DslDisablePlugins + + def disablePlugins(f: Project => Project) = new DslDisablePlugins(Seq()) { + override val toFunction: Project => Project = f + } + +} diff --git a/shared/project/plugins.sbt b/shared/project/plugins.sbt index 75e505574f..f7ac69b8b5 100644 --- a/shared/project/plugins.sbt +++ b/shared/project/plugins.sbt @@ -3,3 +3,4 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7")