Skip to content

Commit bf3cdcd

Browse files
authored
Switch to GitHub actions + Maven Central (#22)
* Update sbt version * Update scalafmt and add github scalafmt action * Update dependencies * Update scapegoat * Update plugins * Remove bintray plugin * Add github ci * Tweak workflow triggers * Set JDK distribution in workflow * Move scalafmt into main ci * Remove travis * Typo in workflow
1 parent 6cc845b commit bf3cdcd

File tree

11 files changed

+83
-64
lines changed

11 files changed

+83
-64
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
java: [8, 11]
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: coursier/cache-action@v6
19+
- uses: actions/setup-java@v2
20+
with:
21+
java-version: ${{matrix.java}}
22+
distribution: adopt
23+
- name: Run tests
24+
uses: lokkju/github-action-sbt@master
25+
with:
26+
commands: test scripted headerCheck scapegoat
27+
28+
scalafmt:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
# only fetch the head commits of our branch & mainline
33+
# loosely based on https://github.com/actions/checkout/issues/329#issuecomment-717076567
34+
- name: Checkout branch history
35+
run: |
36+
git remote set-branches origin "${{github.base_ref}}" "${{github.head_ref}}"
37+
git fetch --depth 1
38+
git checkout "${{github.head_ref}}"
39+
40+
- name: Run scalafmt
41+
uses: stringbean/scalafmt-action@v2.0.0-beta
42+
with:
43+
compare-branch: master

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
*.class
2-
*.log
3-
41
target
52
project/project
63
project/target
74
.cache
85
.classpath
96
.project
107
.settings
11-
bin
8+
.bsp

.scalafmt.conf

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
version = 2.2.1
1+
version = 2.7.5
22
style = default
33
maxColumn = 120
44

55
align.openParenCallSite = false
66
align.openParenDefnSite = false
7-
danglingParentheses = false
7+
danglingParentheses.callSite = false
8+
danglingParentheses.defnSite = false
89

910
# don't align arrows in match statements
10-
align.tokens = []
11+
align.preset = none
1112

12-
rewrite.rules = [SortModifiers]
13-
rewrite.rules = [SortImports]
13+
docstrings.style = Asterisk
1414

15-
includeNoParensInSelectChains = true
16-
17-
docstrings = JavaDoc
15+
fileOverride {
16+
# align libraryDependencies in *.sbt
17+
"glob:**/*.sbt" {
18+
align.preset = most
19+
}
20+
}

.travis.yml

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

build.sbt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ enablePlugins(
99
// target sbt 1.2.8 to allow 1.0+ compatibility
1010
pluginCrossBuild / sbtVersion := "1.2.8"
1111

12-
val circeVersion = "0.12.3"
12+
val circeVersion = "0.14.1"
1313

1414
libraryDependencies ++= Seq(
1515
"io.circe" %% "circe-core",
@@ -18,8 +18,8 @@ libraryDependencies ++= Seq(
1818
).map(_ % circeVersion)
1919

2020
libraryDependencies ++= Seq(
21-
"software.purpledragon" %% "text-utils" % "1.2.0",
22-
"org.scalatest" %% "scalatest" % "3.1.0" % Test
21+
"software.purpledragon" %% "text-utils" % "1.3.0",
22+
"org.scalatest" %% "scalatest" % "3.2.9" % Test
2323
)
2424

2525
organizationName := "Michael Stringer"
@@ -30,7 +30,7 @@ scriptedLaunchOpts := { scriptedLaunchOpts.value ++
3030
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
3131
}
3232

33-
scapegoatVersion in ThisBuild := "1.3.11"
33+
ThisBuild / scapegoatVersion := "1.4.9"
3434

3535
developers := List(
3636
Developer("stringbean", "Michael Stringer", "@the_stringbean", url("https://github.com/stringbean"))
@@ -43,8 +43,6 @@ scmInfo := Some(
4343
"https://github.com/stringbean/sbt-dependency-lock.git"))
4444
git.remoteRepo := "git@github.com:stringbean/sbt-dependency-lock.git"
4545

46-
bintrayPackageLabels := Seq("sbt", "sbt-plugin", "lockfile")
47-
4846
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
4947

5048
releasePublishArtifactsAction := PgpKeys.publishSigned.value
@@ -64,3 +62,5 @@ releaseProcess := Seq[ReleaseStep](
6462
commitNextVersion,
6563
pushChanges
6664
)
65+
66+
previewLaunchBrowser := false

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.3.8
1+
sbt.version=1.5.3

project/plugins.sbt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// publishing
2-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
3-
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")
4-
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12")
2+
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
3+
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.0.15")
54

65
// code style
7-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.2.0")
8-
addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.9")
6+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
7+
addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.1.0")
98

109
// documentation
11-
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
12-
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.6.8")
10+
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
11+
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.9.2")
1312
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")

src/main/scala/software/purpledragon/sbt/lock/DependencyUtils.scala

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,15 @@ object DependencyUtils {
6464
module: ModuleReport,
6565
checksumCache: mutable.Map[File, String]): ResolvedDependency = {
6666

67-
val artifacts: immutable.Seq[ResolvedArtifact] = module.artifacts map {
68-
case (artifact, file) =>
69-
val hash = checksumCache.getOrElseUpdate(file, hashFile(file))
67+
val artifacts: immutable.Seq[ResolvedArtifact] = module.artifacts map { case (artifact, file) =>
68+
val hash = checksumCache.getOrElseUpdate(file, hashFile(file))
7069

71-
val qualifier = artifact.`type` match {
72-
case "jar" | "bundle" => ""
73-
case q => s"-$q"
74-
}
70+
val qualifier = artifact.`type` match {
71+
case "jar" | "bundle" => ""
72+
case q => s"-$q"
73+
}
7574

76-
ResolvedArtifact(s"${artifact.name}$qualifier.${artifact.extension}", hash)
75+
ResolvedArtifact(s"${artifact.name}$qualifier.${artifact.extension}", hash)
7776
}
7877

7978
ResolvedDependency(

src/main/scala/software/purpledragon/sbt/lock/model/DependencyLockFile.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ final case class DependencyLockFile(
6969
val added: Set[DependencyRef] = otherDeps.keySet -- ourDeps.keySet
7070
val removed: Set[DependencyRef] = ourDeps.keySet -- otherDeps.keySet
7171

72-
val changed = ourDeps.keySet.intersect(otherDeps.keySet).foldLeft(Seq.empty[ChangedDependency]) {
73-
(changes, depref) =>
72+
val changed =
73+
ourDeps.keySet.intersect(otherDeps.keySet).foldLeft(Seq.empty[ChangedDependency]) { (changes, depref) =>
7474
val ourDep = ourDeps(depref)
7575
val otherDep = otherDeps(depref)
7676

@@ -87,7 +87,7 @@ final case class DependencyLockFile(
8787
} else {
8888
changes
8989
}
90-
}
90+
}
9191

9292
if (added.nonEmpty || removed.nonEmpty || changed.nonEmpty) {
9393
acc.withDependencyChanges(

src/main/scala/software/purpledragon/sbt/lock/model/LockFileStatus.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ final case class LockFileDiffers(
5757
changedDependencies: Seq[ChangedDependency])
5858
extends LockFileStatus {
5959

60-
override def withConfigurationsChanged(addedConfigs: Seq[String], removedConfigs: Seq[String]): LockFileStatus = {
61-
copy(addedConfigs = addedConfigs, removedConfigs = removedConfigs)
60+
override def withConfigurationsChanged(added: Seq[String], removed: Seq[String]): LockFileStatus = {
61+
copy(addedConfigs = added, removedConfigs = removed)
6262
}
6363

6464
override def withDependencyChanges(
@@ -175,7 +175,7 @@ final case class LockFileDiffers(
175175
}
176176

177177
private def separateArtifactChanges(
178-
changedDependencies: Seq[ChangedDependency]): (Seq[ChangedDependency], Seq[ChangedDependency]) = {
179-
changedDependencies.partition(change => change.configurationsChanged || change.versionChanged)
178+
changes: Seq[ChangedDependency]): (Seq[ChangedDependency], Seq[ChangedDependency]) = {
179+
changes.partition(change => change.configurationsChanged || change.versionChanged)
180180
}
181181
}

0 commit comments

Comments
 (0)