Skip to content

Commit

Permalink
Merge pull request #159 from mdsol/tech/update_http4s
Browse files Browse the repository at this point in the history
Replace SBT Smart Release
  • Loading branch information
mayman authored Feb 6, 2024
2 parents eb75000 + a01bede commit a6fb9a5
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 131 deletions.
4 changes: 4 additions & 0 deletions .github/release_drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
template: |
## What’s Changed
$CHANGES
40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
22 changes: 22 additions & 0 deletions .github/workflows/release_drafter.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .travis/deploy.sh

This file was deleted.

27 changes: 0 additions & 27 deletions .travis/fake_private_key_for_testing

This file was deleted.

Binary file removed .travis/secret-key.asc.enc
Binary file not shown.
3 changes: 1 addition & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,5 @@ lazy val `mauth-jvm-clients` = (project in file("."))
.settings(
basicSettings,
publishSettings,
publish / skip := false,
smartReleaseAggregateProjectSettings
publish / skip := false
)
Original file line number Diff line number Diff line change
Expand Up @@ -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/");

Expand All @@ -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);
Expand Down
54 changes: 8 additions & 46 deletions project/BuildSettings.scala
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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
Expand All @@ -37,24 +32,14 @@ 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(
publish / skip := true
)

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(
Expand All @@ -63,35 +48,12 @@ object BuildSettings {
)
),
developers := List(
Developer(id = "austek", name = "Ali Ustek", email = "[email protected]", url = url("https://github.com/austek"))
),
sonatypeProjectHosting := Some(GitHubHosting("austek", "mauth-jvm-clients", "[email protected]")),
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",
"[email protected]",
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")
)
}
}
14 changes: 5 additions & 9 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit a6fb9a5

Please sign in to comment.