Skip to content

Commit

Permalink
Merge pull request #331 from ckipp01/release
Browse files Browse the repository at this point in the history
Update CI and release strategy
  • Loading branch information
ckipp01 authored May 1, 2021
2 parents 1660e91 + 3c41a98 commit 8c2c79e
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 68 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/pr.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: pr
name: CI

on:
pull_request:
push:
paths-ignore:
- 'doc/**'
- 'docs/**'
- '*.md'
branches:
- master
pull_request:

jobs:
scala:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release
on:
push:
branches:
- master
tags: ["*"]
jobs:
publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v10
- run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
95 changes: 39 additions & 56 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
name := "sbt-scoverage"
organization := "org.scoverage"

import sbt.ScriptedPlugin.autoImport.scriptedLaunchOpts
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._

releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
releaseStepCommandAndRemaining("test"),
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("publishSigned"),
setNextVersion,
commitNextVersion,
pushChanges
def localSnapshotVersion = "1.7.1-SNAPSHOT"
def isCI = System.getenv("CI") != null

inThisBuild(
List(
organization := "org.scoverage",
homepage := Some(url("http://scoverage.org/")),
developers := List(
Developer(
"sksamuel",
"Stephen Samuel",
"[email protected]",
url("https://github.com/sksamuel")
),
Developer(
"gslowikowski",
"Grzegorz Slowikowski",
"[email protected]",
url("https://github.com/gslowikowski")
)
),
licenses := Seq(
"Apache-2.0" -> url("http://www.apache.org/license/LICENSE-2.0")
),
scalaVersion := "2.12.13",
version ~= { dynVer =>
if (isCI) dynVer
else localSnapshotVersion // only for local publishing
}
)
)

lazy val root = Project("sbt-scoverage", file("."))
Expand All @@ -24,55 +40,22 @@ lazy val root = Project("sbt-scoverage", file("."))
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Compile
),
libraryDependencies += "org.scoverage" %% "scalac-scoverage-plugin" % "1.4.3" cross(CrossVersion.full),
scalaVersion := "2.12.13",
publishMavenStyle := true,
publishConfiguration := publishConfiguration.value.withOverwrite(true),
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true),
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
libraryDependencies += "org.scoverage" %% "scalac-scoverage-plugin" % "1.4.3" cross (CrossVersion.full),
Test / fork := false,
Test / publishArtifact := false,
Test / parallelExecution := false,
scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "-encoding", "utf8"),
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")
},
scalacOptions := Seq(
"-unchecked",
"-deprecation",
"-feature",
"-encoding",
"utf8"
),
resolvers ++= {
if (isSnapshot.value) Seq(Resolver.sonatypeRepo("snapshots")) else Nil
},
scriptedLaunchOpts ++= Seq(
"-Xmx1024M",
"-Dplugin.version=" + version.value
),
pomExtra := {
<url>https://github.com/scoverage/sbt-scoverage</url>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:scoverage/sbt-scoverage.git</url>
<connection>scm:git@github.com:scoverage/sbt-scoverage.git</connection>
</scm>
<developers>
<developer>
<id>sksamuel</id>
<name>sksamuel</name>
<url>http://github.com/sksamuel</url>
</developer>
<developer>
<id>gslowikowski</id>
<name>Grzegorz Slowikowski</name>
<url>http://github.com/gslowikowski</url>
</developer>
</developers>
}
)
)

scalariformAutoformat := false
7 changes: 1 addition & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")

addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.1")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
3 changes: 2 additions & 1 deletion src/main/scala/scoverage/ScoverageSbtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import sbt.Keys._
import sbt._
import sbt.plugins.JvmPlugin
import scoverage.report.{CoberturaXmlWriter, CoverageAggregator, ScoverageHtmlWriter, ScoverageXmlWriter}
import java.time.Instant

object ScoverageSbtPlugin extends AutoPlugin {

Expand Down Expand Up @@ -215,7 +216,7 @@ object ScoverageSbtPlugin extends AutoPlugin {

// Create the coverage report for teamcity (HTML files)
if (createCoverageZip)
IO.zip(Path.allSubpaths(reportDir), crossTarget / "coverage.zip")
IO.zip(Path.allSubpaths(reportDir), crossTarget / "coverage.zip", Some(Instant.now().toEpochMilli()))
}

private def loadCoverage(crossTarget: File, log: Logger): Option[Coverage] = {
Expand Down
1 change: 0 additions & 1 deletion version.sbt

This file was deleted.

0 comments on commit 8c2c79e

Please sign in to comment.