Skip to content

Commit 64fa9c5

Browse files
authored
cleanup ci (#161)
* cleanup ci files * apply formatting * publish master * Update fs2-core, fs2-io to 3.1.3 * Update sbt to 1.5.5 * update sbt-scoverage 1.9.0
1 parent 908b569 commit 64fa9c5

File tree

7 files changed

+59
-49
lines changed

7 files changed

+59
-49
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
matrix:
2929
os: [ubuntu-latest]
30-
scala: [2.13.5, 2.12.13]
30+
scala: [2.13.6, 2.12.13]
3131
java: [graalvm-ce-java11@20.3.0]
3232
runs-on: ${{ matrix.os }}
3333
steps:
@@ -62,8 +62,7 @@ jobs:
6262
- name: Check that workflows are up to date
6363
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
6464

65-
- name: Build project
66-
run: sbt ++${{ matrix.scala }} test
65+
- run: sbt ++${{ matrix.scala }} check test
6766

6867
- name: Compress target directories
6968
run: tar cf targets.tar target project/target
@@ -77,11 +76,11 @@ jobs:
7776
publish:
7877
name: Publish Artifacts
7978
needs: [build]
80-
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
79+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v'))
8180
strategy:
8281
matrix:
8382
os: [ubuntu-latest]
84-
scala: [2.13.5]
83+
scala: [2.13.6]
8584
java: [graalvm-ce-java11@20.3.0]
8685
runs-on: ${{ matrix.os }}
8786
steps:
@@ -107,12 +106,12 @@ jobs:
107106
~/Library/Caches/Coursier/v1
108107
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
109108

110-
- name: Download target directories (2.13.5)
109+
- name: Download target directories (2.13.6)
111110
uses: actions/download-artifact@v2
112111
with:
113-
name: target-${{ matrix.os }}-2.13.5-${{ matrix.java }}
112+
name: target-${{ matrix.os }}-2.13.6-${{ matrix.java }}
114113

115-
- name: Inflate target directories (2.13.5)
114+
- name: Inflate target directories (2.13.6)
116115
run: |
117116
tar xf targets.tar
118117
rm targets.tar
@@ -127,4 +126,6 @@ jobs:
127126
tar xf targets.tar
128127
rm targets.tar
129128
129+
- uses: olafurpg/setup-gpg@v3
130+
130131
- run: sbt ++${{ matrix.scala }} ci-release

build.sbt

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,63 @@
11
lazy val scala212 = "2.12.13"
2-
lazy val scala213 = "2.13.5"
2+
lazy val scala213 = "2.13.6"
3+
val fs2Version = "3.1.3"
4+
35
val GraalVM11 = "graalvm-ce-java11@20.3.0"
46

7+
inThisBuild(
8+
List(
9+
organization := "com.github.regis-leray",
10+
homepage := Some(url("https://github.com/regis-leray/fs2-ftp")),
11+
scmInfo := Some(ScmInfo(url("https://github.com/regis-leray/fs2-ftp"), "git@github.com:regis-leray/fs2-ftp.git")),
12+
developers := List(
13+
Developer("regis_leray", "Regis Leray", "regis.leray at gmail dot com", url("https://github.com/regis-leray"))
14+
),
15+
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
16+
)
17+
)
518
ThisBuild / scalaVersion := scala213
619
ThisBuild / crossScalaVersions := List(scala213, scala212)
7-
820
ThisBuild / githubWorkflowJavaVersions := Seq(GraalVM11)
21+
ThisBuild / versionScheme := Some("early-semver")
922

10-
//sbt-ci-release settings
1123
ThisBuild / githubWorkflowBuildPreamble ++= Seq(
12-
WorkflowStep.Run(List(
13-
"chmod -R 777 ./ftp-home/",
14-
"docker-compose -f \"docker-compose.yml\" up -d --build",
15-
"chmod -R 777 ./ftp-home/sftp/home/foo/dir1"
16-
), name = Some("Start containers"))
24+
WorkflowStep.Run(
25+
List(
26+
"chmod -R 777 ./ftp-home/",
27+
"docker-compose -f \"docker-compose.yml\" up -d --build",
28+
"chmod -R 777 ./ftp-home/sftp/home/foo/dir1"
29+
),
30+
name = Some("Start containers")
31+
)
32+
)
33+
ThisBuild / githubWorkflowBuild := Seq(
34+
WorkflowStep.Sbt(List("check", "test"))
1735
)
1836

37+
//sbt-ci-release settings
1938
ThisBuild / githubWorkflowPublishPreamble := Seq(
20-
39+
WorkflowStep.Use(UseRef.Public("olafurpg", "setup-gpg", "v3"))
2140
)
2241

2342
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
24-
ThisBuild / githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v")))
43+
ThisBuild / githubWorkflowPublishTargetBranches := Seq(
44+
RefPredicate.StartsWith(Ref.Branch("master")),
45+
RefPredicate.StartsWith(Ref.Tag("v"))
46+
)
2547
ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release")))
2648
ThisBuild / githubWorkflowEnv ++= List(
2749
"PGP_PASSPHRASE",
2850
"PGP_SECRET",
2951
"SONATYPE_PASSWORD",
3052
"SONATYPE_USERNAME"
31-
).map { envKey =>
32-
envKey -> s"$${{ secrets.$envKey }}"
33-
}.toMap
34-
53+
).map(envKey => envKey -> s"$${{ secrets.$envKey }}").toMap
3554

3655
lazy val `fs2-ftp` = project
3756
.in(file("."))
3857
.settings(
39-
organization := "com.github.regis-leray",
4058
name := "fs2-ftp",
41-
description := "fs2-ftp",
4259
Test / fork := true,
4360
Test / parallelExecution := false,
44-
homepage := Some(url("https://github.com/regis-leray/fs2-ftp")),
45-
scmInfo := Some(ScmInfo(url("https://github.com/regis-leray/fs2-ftp"), "git@github.com:regis-leray/fs2-ftp.git")),
46-
developers := List(
47-
Developer("username", "Regis Leray", "regis.leray at gmail dot com", url("https://github.com/regis-leray"))
48-
),
49-
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")),
5061
publishMavenStyle := true,
5162
scalacOptions ++= Seq(
5263
"-encoding",
@@ -65,12 +76,12 @@ lazy val `fs2-ftp` = project
6576
.toList
6677
.flatten,
6778
//PgpKeys.pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray()),
68-
publishTo := sonatypePublishToBundle.value,
79+
publishTo := sonatypePublishToBundle.value
6980
)
7081
.settings(
7182
libraryDependencies ++= Seq(
72-
"co.fs2" %% "fs2-core" % "3.0.6",
73-
"co.fs2" %% "fs2-io" % "3.0.6",
83+
"co.fs2" %% "fs2-core" % fs2Version,
84+
"co.fs2" %% "fs2-io" % fs2Version,
7485
"org.scala-lang.modules" %% "scala-collection-compat" % "2.5.0",
7586
"com.hierynomus" % "sshj" % "0.31.0",
7687
"commons-net" % "commons-net" % "3.8.0",

project/build.properties

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

project/plugins.sbt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.7.0")
2-
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
3-
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
4-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.2")
5-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
1+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.0")
2+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
3+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.9")
64
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0")

src/main/scala/fs2/ftp/SecureFtp.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import fs2.ftp.FtpSettings.{ KeyFileSftpIdentity, RawKeySftpIdentity, SecureFtpS
1414

1515
import scala.jdk.CollectionConverters._
1616

17-
final private class SecureFtp[F[_]: Async](unsafeClient: SecureFtp.Client, maxUnconfirmedWrites: Int) extends FtpClient[F, JSFTPClient] {
17+
final private class SecureFtp[F[_]: Async](unsafeClient: SecureFtp.Client, maxUnconfirmedWrites: Int)
18+
extends FtpClient[F, JSFTPClient] {
1819

1920
def ls(path: String): fs2.Stream[F, FtpResource] =
2021
fs2.Stream

src/test/scala/fs2/ftp/SecureFtpSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class SecureFtpSpec extends AnyWordSpec with Matchers {
114114
connect[IO, JSFTPClient](settings)
115115
.use(
116116
_.readFile("/notes.txt")
117-
.through(Files[IO].writeAll(tmp))
117+
.through(Files[IO].writeAll(fs2.io.file.Path.fromNioPath(tmp)))
118118
.compile
119119
.drain
120120
)
@@ -134,7 +134,7 @@ class SecureFtpSpec extends AnyWordSpec with Matchers {
134134
connect[IO, JSFTPClient](settings)
135135
.use {
136136
_.readFile("/no-file.xml")
137-
.through(Files[IO].writeAll(tmp))
137+
.through(Files[IO].writeAll(fs2.io.file.Path.fromNioPath(tmp)))
138138
.compile
139139
.drain
140140
}

src/test/scala/fs2/ftp/UnsecureFtpSpec.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package fs2.ftp
22

33
import cats.effect.unsafe.IORuntime
4-
import cats.effect.{IO, Resource}
5-
import fs2.ftp.FtpSettings.{FtpCredentials, UnsecureFtpSettings}
4+
import cats.effect.{ IO, Resource }
5+
import fs2.ftp.FtpSettings.{ FtpCredentials, UnsecureFtpSettings }
66
import fs2.io.file.Files
7-
import org.apache.commons.net.ftp.{FTPClient => JFTPClient}
7+
import org.apache.commons.net.ftp.{ FTPClient => JFTPClient }
88
import org.scalatest.BeforeAndAfterAll
99
import org.scalatest.matchers.should.Matchers
1010
import org.scalatest.wordspec.AnyWordSpec
1111

1212
import java.io.FileNotFoundException
13-
import java.nio.file.{Paths, Files => JFiles}
13+
import java.nio.file.{ Paths, Files => JFiles }
1414
import scala.io.Source
1515

1616
trait BaseFtpTest extends AnyWordSpec with Matchers with BeforeAndAfterAll {
@@ -91,7 +91,7 @@ trait BaseFtpTest extends AnyWordSpec with Matchers with BeforeAndAfterAll {
9191

9292
connect[IO, JFTPClient](settings)
9393
.use(
94-
_.readFile("/notes.txt").through(Files[IO].writeAll(tmp)).compile.drain
94+
_.readFile("/notes.txt").through(Files[IO].writeAll(fs2.io.file.Path.fromNioPath(tmp))).compile.drain
9595
)
9696
.unsafeRunSync()
9797

@@ -109,7 +109,7 @@ trait BaseFtpTest extends AnyWordSpec with Matchers with BeforeAndAfterAll {
109109
connect[IO, JFTPClient](settings)
110110
.use {
111111
_.readFile("/no-file.xml")
112-
.through(Files[IO].writeAll(tmp))
112+
.through(Files[IO].writeAll(fs2.io.file.Path.fromNioPath(tmp)))
113113
.compile
114114
.drain
115115
}
@@ -172,7 +172,6 @@ trait BaseFtpTest extends AnyWordSpec with Matchers with BeforeAndAfterAll {
172172
"rm directory" in {
173173
val path = home.resolve("dir-to-delete")
174174

175-
176175
JFiles.createDirectory(path)
177176

178177
connect[IO, JFTPClient](settings)

0 commit comments

Comments
 (0)