Skip to content

Commit 6aedc83

Browse files
authored
Update CI and release strategy (#315)
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.
1 parent 6eaaf61 commit 6aedc83

File tree

7 files changed

+88
-203
lines changed

7 files changed

+88
-203
lines changed

.github/stale.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/build.yml renamed to .github/workflows/ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
name: build
1+
name: CI
22

33
on:
44
push:
55
paths-ignore:
66
- 'doc/**'
77
- 'docs/**'
88
- '*.md'
9-
- '*.yml'
109
branches:
1110
- master
12-
- release/*
1311

1412
jobs:
1513
scala:
1614
runs-on: ubuntu-latest
1715
strategy:
16+
fail-fast: false
1817
matrix:
19-
java: [ '11' ]
18+
java: [ '1.8', '1.11' ]
2019
scala: [
2120
{ version: '2.12.13' },
2221
{ version: '2.12.12' },
@@ -37,10 +36,10 @@ jobs:
3736
with:
3837
fetch-depth: 0
3938

40-
- name: Set up JDK
41-
uses: actions/setup-java@v1
39+
- name: Set up Scala env
40+
uses: olafurpg/setup-scala@v10
4241
with:
43-
java-version: ${{ matrix.java }}
42+
java-version: adopt@${{ matrix.java }}
4443

4544
- name: run tests
4645
run: sbt ++${{ matrix.scala.version }} test

.github/workflows/pr.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 14 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,20 @@
1-
name: release
2-
1+
name: Release
32
on:
4-
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: "The release version"
8-
required: true
9-
branch:
10-
description: "The branch to release from"
11-
required: true
12-
3+
push:
4+
branches: [master]
5+
tags: ["*"]
136
jobs:
14-
scala:
15-
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
java: [ '11' ]
19-
scala: [
20-
{ version: '2.12.13' },
21-
{ version: '2.12.12' },
22-
{ version: '2.12.11' },
23-
{ version: '2.12.10' },
24-
{ version: '2.12.9' },
25-
{ version: '2.12.8' },
26-
{ version: '2.13.5' },
27-
{ version: '2.13.4' },
28-
{ version: '2.13.3' },
29-
{ version: '2.13.2' },
30-
{ version: '2.13.1' },
31-
{ version: '2.13.0' }
32-
]
7+
publish:
8+
runs-on: ubuntu-20.04
339
steps:
34-
- name: checkout the repo
35-
uses: actions/checkout@v2
10+
- uses: actions/checkout@v2.3.4
3611
with:
3712
fetch-depth: 0
38-
39-
- name: Set up JDK
40-
uses: actions/setup-java@v1
41-
with:
42-
java-version: ${{ matrix.java }}
43-
44-
- name: Import GPG key
45-
id: import_gpg
46-
uses: crazy-max/ghaction-import-gpg@v3
47-
with:
48-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
49-
passphrase: ${{ secrets.PGP_PASSPHRASE }}
50-
51-
- name: GPG user IDs
52-
run: |
53-
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
54-
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
55-
echo "name: ${{ steps.import_gpg.outputs.name }}"
56-
echo "email: ${{ steps.import_gpg.outputs.email }}"
57-
58-
- name: publish release
59-
run: sbt ++${{ matrix.scala.version }} publishSigned
13+
- uses: olafurpg/setup-scala@v10
14+
- uses: olafurpg/setup-gpg@v3
15+
- run: sbt ci-release
6016
env:
61-
RELEASE_VERSION: ${{ github.event.inputs.version }}
62-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
63-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
17+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
18+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
19+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
20+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

build.sbt

Lines changed: 67 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,99 @@
1-
import sbt._
2-
import sbt.Keys._
3-
import sbtrelease.ReleasePlugin.autoImport._
41
import sbtcrossproject.CrossProject
52
import sbtcrossproject.CrossType
63

7-
val Org = "org.scoverage"
4+
def localSnapshotVersion = "1.4.4-SNAPSHOT"
5+
def isCI = System.getenv("CI") != null
6+
87
val ScalatestVersion = "3.1.1"
98

109
val bin212 = Seq("2.12.13", "2.12.12", "2.12.11", "2.12.10", "2.12.9", "2.12.8")
1110
val bin213 = Seq("2.13.5", "2.13.4", "2.13.3", "2.13.2", "2.13.1", "2.13.0")
1211

13-
val appSettings = Seq(
14-
organization := Org,
15-
scalaVersion := "2.12.13",
12+
inThisBuild(
13+
List(
14+
organization := "org.scoverage",
15+
homepage := Some(url("http://scoverage.org/")),
16+
developers := List(
17+
Developer(
18+
"sksamuel",
19+
"Stephen Samuel",
20+
"sam@sksamuel.com",
21+
url("https://github.com/sksamuel")
22+
),
23+
Developer(
24+
"gslowikowski",
25+
"Grzegorz Slowikowski",
26+
"gslowikowski@gmail.com",
27+
url("https://github.com/gslowikowski")
28+
)
29+
),
30+
licenses := Seq(
31+
"Apache-2.0" -> url("http://www.apache.org/license/LICENSE-2.0")
32+
),
33+
version ~= { dynVer =>
34+
if (isCI) dynVer
35+
else localSnapshotVersion // only for local publishing
36+
},
37+
scalaVersion := bin213.head,
1638
crossScalaVersions := bin212 ++ bin213,
1739
crossVersion := CrossVersion.full,
18-
crossTarget := target.value / s"scala-${scalaVersion.value}",
1940
Test / fork := false,
20-
publishMavenStyle := true,
2141
Test / publishArtifact := false,
2242
Test / parallelExecution := false,
23-
scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "-encoding", "utf8"),
43+
scalacOptions := Seq(
44+
"-unchecked",
45+
"-deprecation",
46+
"-feature",
47+
"-encoding",
48+
"utf8"
49+
),
2450
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1),
25-
publishTo := {
26-
if (isSnapshot.value)
27-
Some("snapshots" at "https://oss.sonatype.org/content/repositories/snapshots")
28-
else
29-
Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
30-
},
3151
libraryDependencies ++= Seq(
3252
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Compile
33-
),
34-
pomExtra := {
35-
<url>https://github.com/scoverage/scalac-scoverage-plugin</url>
36-
<licenses>
37-
<license>
38-
<name>Apache 2</name>
39-
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
40-
<distribution>repo</distribution>
41-
</license>
42-
</licenses>
43-
<scm>
44-
<url>git@github.com:scoverage/scalac-scoverage-plugin.git</url>
45-
<connection>scm:git@github.com:scoverage/scalac-scoverage-plugin.git</connection>
46-
</scm>
47-
<developers>
48-
<developer>
49-
<id>sksamuel</id>
50-
<name>Stephen Samuel</name>
51-
<url>http://github.com/sksamuel</url>
52-
</developer>
53-
<developer>
54-
<id>gslowikowski</id>
55-
<name>Grzegorz Slowikowski</name>
56-
<url>http://github.com/gslowikowski</url>
57-
</developer>
58-
</developers>
59-
},
60-
pomIncludeRepository := {
61-
_ => false
62-
}
63-
) ++ Seq(
64-
releaseCrossBuild := true,
65-
releasePublishArtifactsAction := PgpKeys.publishSigned.value
53+
)
6654
)
55+
)
6756

6857
lazy val root = Project("scalac-scoverage", file("."))
69-
.settings(name := "scalac-scoverage")
70-
.settings(appSettings: _*)
71-
.settings(publishArtifact := false)
72-
.settings(publishLocal := {})
73-
.aggregate(plugin, runtime.jvm, runtime.js)
58+
.settings(name := "scalac-scoverage")
59+
.settings(publishArtifact := false)
60+
.settings(publishLocal := {})
61+
.aggregate(plugin, runtime.jvm, runtime.js)
7462

75-
lazy val runtime = CrossProject("scalac-scoverage-runtime", file("scalac-scoverage-runtime"))(JVMPlatform, JSPlatform)
76-
.crossType(CrossType.Full)
77-
.withoutSuffixFor(JVMPlatform)
78-
.settings(name := "scalac-scoverage-runtime")
79-
.settings(appSettings: _*)
80-
.settings(
81-
libraryDependencies += "org.scalatest" %%% "scalatest" % ScalatestVersion % Test
82-
)
83-
.jvmSettings(
84-
Test / fork := true
85-
)
86-
.jsSettings(
87-
crossVersion := CrossVersion.fullWith("sjs" + scalaJSVersion.take(1) + "_", ""),
88-
scalaJSStage := FastOptStage
89-
)
63+
lazy val runtime = CrossProject(
64+
"scalac-scoverage-runtime",
65+
file("scalac-scoverage-runtime")
66+
)(JVMPlatform, JSPlatform)
67+
.crossType(CrossType.Full)
68+
.withoutSuffixFor(JVMPlatform)
69+
.settings(name := "scalac-scoverage-runtime")
70+
.settings(
71+
crossTarget := target.value / s"scala-${scalaVersion.value}",
72+
libraryDependencies += "org.scalatest" %%% "scalatest" % ScalatestVersion % Test
73+
)
74+
.jvmSettings(
75+
Test / fork := true
76+
)
77+
.jsSettings(
78+
crossVersion := CrossVersion
79+
.fullWith("sjs" + scalaJSVersion.take(1) + "_", ""),
80+
scalaJSStage := FastOptStage
81+
)
9082

9183
lazy val `scalac-scoverage-runtimeJVM` = runtime.jvm
9284
lazy val `scalac-scoverage-runtimeJS` = runtime.js
9385

94-
lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plugin"))
86+
lazy val plugin =
87+
Project("scalac-scoverage-plugin", file("scalac-scoverage-plugin"))
9588
.dependsOn(`scalac-scoverage-runtimeJVM` % Test)
9689
.settings(name := "scalac-scoverage-plugin")
97-
.settings(appSettings: _*)
9890
.settings(
91+
crossTarget := target.value / s"scala-${scalaVersion.value}",
9992
libraryDependencies ++= Seq(
10093
"org.scala-lang.modules" %% "scala-xml" % "1.2.0",
10194
"org.scalatest" %% "scalatest" % ScalatestVersion % Test
10295
)
10396
)
104-
.settings(
105-
(Test/ unmanagedSourceDirectories) += (Test / sourceDirectory).value / "scala-2.12+"
106-
)
107-
97+
.settings(
98+
(Test / unmanagedSourceDirectories) += (Test / sourceDirectory).value / "scala-2.12+"
99+
)

project/plugins.sbt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
2-
3-
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
4-
51
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
6-
72
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
3+
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")

version.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)