From 5eba3c56e46974c9a090bcec9740f09d4b359f00 Mon Sep 17 00:00:00 2001 From: ckipp01 Date: Sat, 1 May 2021 10:15:05 +0200 Subject: [PATCH] Update CI and release strategy This simplifies the CI a bit and also moves to a process that I'm a bit more familiar with. Mainly, everything for releases should now be able to be handled fully by just creating a tag. I've found this to be much easier to manage. I also removed the `state.yml` since it's currently not working, and I'm not sure how I feel about having something that will auto-close issues. --- .github/stale.yml | 16 --- .github/workflows/{build.yml => ci.yml} | 13 +-- .github/workflows/pr.yml | 42 ------- .github/workflows/release.yml | 71 +++--------- build.sbt | 142 +++++++++++------------- project/plugins.sbt | 6 +- version.sbt | 1 - 7 files changed, 88 insertions(+), 203 deletions(-) delete mode 100644 .github/stale.yml rename .github/workflows/{build.yml => ci.yml} (82%) delete mode 100644 .github/workflows/pr.yml delete mode 100644 version.sbt diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 2b2bf472..00000000 --- a/.github/stale.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 180 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 14 -# Issues with these labels will never be considered stale -exemptLabels: - - pinned -# Label to use when marking an issue as stale -staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/.github/workflows/build.yml b/.github/workflows/ci.yml similarity index 82% rename from .github/workflows/build.yml rename to .github/workflows/ci.yml index 147e27fd..00fb7d03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: build +name: CI on: push: @@ -6,17 +6,16 @@ on: - 'doc/**' - 'docs/**' - '*.md' - - '*.yml' branches: - master - - release/* jobs: scala: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - java: [ '11' ] + java: [ '1.8', '1.11' ] scala: [ { version: '2.12.13' }, { version: '2.12.12' }, @@ -37,10 +36,10 @@ jobs: with: fetch-depth: 0 - - name: Set up JDK - uses: actions/setup-java@v1 + - name: Set up Scala env + uses: olafurpg/setup-scala@v10 with: - java-version: ${{ matrix.java }} + java-version: adopt@${{ matrix.java }} - name: run tests run: sbt ++${{ matrix.scala.version }} test diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index cb1d2a53..00000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: pr - -on: - pull_request: - paths-ignore: - - 'doc/**' - - 'docs/**' - - '*.md' - -jobs: - scala: - runs-on: ubuntu-latest - strategy: - matrix: - java: [ '11' ] - scala: [ - { version: '2.12.13' }, - { version: '2.12.12' }, - { version: '2.12.11' }, - { version: '2.12.10' }, - { version: '2.12.9' }, - { version: '2.12.8' }, - { version: '2.13.5' }, - { version: '2.13.4' }, - { version: '2.13.3' }, - { version: '2.13.2' }, - { version: '2.13.1' }, - { version: '2.13.0' } - ] - steps: - - name: checkout the repo - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - - - name: run tests - run: sbt ++${{ matrix.scala.version }} test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97438d20..ae31d4f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,63 +1,20 @@ -name: release - +name: Release on: - workflow_dispatch: - inputs: - version: - description: "The release version" - required: true - branch: - description: "The branch to release from" - required: true - + push: + branches: [master] + tags: ["*"] jobs: - scala: - runs-on: ubuntu-latest - strategy: - matrix: - java: [ '11' ] - scala: [ - { version: '2.12.13' }, - { version: '2.12.12' }, - { version: '2.12.11' }, - { version: '2.12.10' }, - { version: '2.12.9' }, - { version: '2.12.8' }, - { version: '2.13.5' }, - { version: '2.13.4' }, - { version: '2.13.3' }, - { version: '2.13.2' }, - { version: '2.13.1' }, - { version: '2.13.0' } - ] + publish: + runs-on: ubuntu-20.04 steps: - - name: checkout the repo - uses: actions/checkout@v2 + - uses: actions/checkout@v2.3.4 with: fetch-depth: 0 - - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.PGP_PASSPHRASE }} - - - name: GPG user IDs - run: | - echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}" - echo "keyid: ${{ steps.import_gpg.outputs.keyid }}" - echo "name: ${{ steps.import_gpg.outputs.name }}" - echo "email: ${{ steps.import_gpg.outputs.email }}" - - - name: publish release - run: sbt ++${{ matrix.scala.version }} publishSigned + - uses: olafurpg/setup-scala@v10 + - uses: olafurpg/setup-gpg@v3 + - run: sbt ci-release env: - RELEASE_VERSION: ${{ github.event.inputs.version }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/build.sbt b/build.sbt index c4298c43..7912d038 100644 --- a/build.sbt +++ b/build.sbt @@ -1,107 +1,99 @@ -import sbt._ -import sbt.Keys._ -import sbtrelease.ReleasePlugin.autoImport._ import sbtcrossproject.CrossProject import sbtcrossproject.CrossType -val Org = "org.scoverage" +def localSnapshotVersion = "1.4.4-SNAPSHOT" +def isCI = System.getenv("CI") != null + val ScalatestVersion = "3.1.1" val bin212 = Seq("2.12.13", "2.12.12", "2.12.11", "2.12.10", "2.12.9", "2.12.8") val bin213 = Seq("2.13.5", "2.13.4", "2.13.3", "2.13.2", "2.13.1", "2.13.0") -val appSettings = Seq( - organization := Org, - scalaVersion := "2.12.13", +inThisBuild( + List( + organization := "org.scoverage", + homepage := Some(url("http://scoverage.org/")), + developers := List( + Developer( + "sksamuel", + "Stephen Samuel", + "sam@sksamuel.com", + url("https://github.com/sksamuel") + ), + Developer( + "gslowikowski", + "Grzegorz Slowikowski", + "gslowikowski@gmail.com", + url("https://github.com/gslowikowski") + ) + ), + licenses := Seq( + "Apache-2.0" -> url("http://www.apache.org/license/LICENSE-2.0") + ), + version ~= { dynVer => + if (isCI) dynVer + else localSnapshotVersion // only for local publishing + }, + scalaVersion := bin213.head, crossScalaVersions := bin212 ++ bin213, crossVersion := CrossVersion.full, - crossTarget := target.value / s"scala-${scalaVersion.value}", Test / fork := false, - publishMavenStyle := true, Test / publishArtifact := false, Test / parallelExecution := false, - scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "-encoding", "utf8"), + scalacOptions := Seq( + "-unchecked", + "-deprecation", + "-feature", + "-encoding", + "utf8" + ), Global / concurrentRestrictions += Tags.limit(Tags.Test, 1), - publishTo := { - if (isSnapshot.value) - Some("snapshots" at "https://oss.sonatype.org/content/repositories/snapshots") - else - Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2") - }, libraryDependencies ++= Seq( "org.scala-lang" % "scala-compiler" % scalaVersion.value % Compile - ), - pomExtra := { - https://github.com/scoverage/scalac-scoverage-plugin - - - Apache 2 - http://www.apache.org/licenses/LICENSE-2.0 - repo - - - - git@github.com:scoverage/scalac-scoverage-plugin.git - scm:git@github.com:scoverage/scalac-scoverage-plugin.git - - - - sksamuel - Stephen Samuel - http://github.com/sksamuel - - - gslowikowski - Grzegorz Slowikowski - http://github.com/gslowikowski - - - }, - pomIncludeRepository := { - _ => false - } - ) ++ Seq( - releaseCrossBuild := true, - releasePublishArtifactsAction := PgpKeys.publishSigned.value + ) ) +) lazy val root = Project("scalac-scoverage", file(".")) - .settings(name := "scalac-scoverage") - .settings(appSettings: _*) - .settings(publishArtifact := false) - .settings(publishLocal := {}) - .aggregate(plugin, runtime.jvm, runtime.js) + .settings(name := "scalac-scoverage") + .settings(publishArtifact := false) + .settings(publishLocal := {}) + .aggregate(plugin, runtime.jvm, runtime.js) -lazy val runtime = CrossProject("scalac-scoverage-runtime", file("scalac-scoverage-runtime"))(JVMPlatform, JSPlatform) - .crossType(CrossType.Full) - .withoutSuffixFor(JVMPlatform) - .settings(name := "scalac-scoverage-runtime") - .settings(appSettings: _*) - .settings( - libraryDependencies += "org.scalatest" %%% "scalatest" % ScalatestVersion % Test - ) - .jvmSettings( - Test / fork := true - ) - .jsSettings( - crossVersion := CrossVersion.fullWith("sjs" + scalaJSVersion.take(1) + "_", ""), - scalaJSStage := FastOptStage - ) +lazy val runtime = CrossProject( + "scalac-scoverage-runtime", + file("scalac-scoverage-runtime") +)(JVMPlatform, JSPlatform) + .crossType(CrossType.Full) + .withoutSuffixFor(JVMPlatform) + .settings(name := "scalac-scoverage-runtime") + .settings( + crossTarget := target.value / s"scala-${scalaVersion.value}", + libraryDependencies += "org.scalatest" %%% "scalatest" % ScalatestVersion % Test + ) + .jvmSettings( + Test / fork := true + ) + .jsSettings( + crossVersion := CrossVersion + .fullWith("sjs" + scalaJSVersion.take(1) + "_", ""), + scalaJSStage := FastOptStage + ) lazy val `scalac-scoverage-runtimeJVM` = runtime.jvm lazy val `scalac-scoverage-runtimeJS` = runtime.js -lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plugin")) +lazy val plugin = + Project("scalac-scoverage-plugin", file("scalac-scoverage-plugin")) .dependsOn(`scalac-scoverage-runtimeJVM` % Test) .settings(name := "scalac-scoverage-plugin") - .settings(appSettings: _*) .settings( + crossTarget := target.value / s"scala-${scalaVersion.value}", libraryDependencies ++= Seq( "org.scala-lang.modules" %% "scala-xml" % "1.2.0", "org.scalatest" %% "scalatest" % ScalatestVersion % Test ) ) - .settings( - (Test/ unmanagedSourceDirectories) += (Test / sourceDirectory).value / "scala-2.12+" - ) - + .settings( + (Test / unmanagedSourceDirectories) += (Test / sourceDirectory).value / "scala-2.12+" + ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 7c2b97ab..a56379c4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,3 @@ -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") - -addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13") - addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") - addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") +addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") diff --git a/version.sbt b/version.sbt deleted file mode 100644 index 0a133bb2..00000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -version in ThisBuild := "1.4.4-SNAPSHOT"