Skip to content

Commit

Permalink
cleanup ci (#161)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
regis-leray authored Oct 2, 2021
1 parent 908b569 commit 64fa9c5
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 49 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.5, 2.12.13]
scala: [2.13.6, 2.12.13]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -62,8 +62,7 @@ jobs:
- name: Check that workflows are up to date
run: sbt ++${{ matrix.scala }} githubWorkflowCheck

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

- name: Compress target directories
run: tar cf targets.tar target project/target
Expand All @@ -77,11 +76,11 @@ jobs:
publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v'))
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.5]
scala: [2.13.6]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -107,12 +106,12 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.13.5)
- name: Download target directories (2.13.6)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.13.5-${{ matrix.java }}
name: target-${{ matrix.os }}-2.13.6-${{ matrix.java }}

- name: Inflate target directories (2.13.5)
- name: Inflate target directories (2.13.6)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -127,4 +126,6 @@ jobs:
tar xf targets.tar
rm targets.tar
- uses: olafurpg/setup-gpg@v3

- run: sbt ++${{ matrix.scala }} ci-release
61 changes: 36 additions & 25 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,52 +1,63 @@
lazy val scala212 = "2.12.13"
lazy val scala213 = "2.13.5"
lazy val scala213 = "2.13.6"
val fs2Version = "3.1.3"

val GraalVM11 = "[email protected]"

inThisBuild(
List(
organization := "com.github.regis-leray",
homepage := Some(url("https://github.com/regis-leray/fs2-ftp")),
scmInfo := Some(ScmInfo(url("https://github.com/regis-leray/fs2-ftp"), "[email protected]:regis-leray/fs2-ftp.git")),
developers := List(
Developer("regis_leray", "Regis Leray", "regis.leray at gmail dot com", url("https://github.com/regis-leray"))
),
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
)
)
ThisBuild / scalaVersion := scala213
ThisBuild / crossScalaVersions := List(scala213, scala212)

ThisBuild / githubWorkflowJavaVersions := Seq(GraalVM11)
ThisBuild / versionScheme := Some("early-semver")

//sbt-ci-release settings
ThisBuild / githubWorkflowBuildPreamble ++= Seq(
WorkflowStep.Run(List(
"chmod -R 777 ./ftp-home/",
"docker-compose -f \"docker-compose.yml\" up -d --build",
"chmod -R 777 ./ftp-home/sftp/home/foo/dir1"
), name = Some("Start containers"))
WorkflowStep.Run(
List(
"chmod -R 777 ./ftp-home/",
"docker-compose -f \"docker-compose.yml\" up -d --build",
"chmod -R 777 ./ftp-home/sftp/home/foo/dir1"
),
name = Some("Start containers")
)
)
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(List("check", "test"))
)

//sbt-ci-release settings
ThisBuild / githubWorkflowPublishPreamble := Seq(

WorkflowStep.Use(UseRef.Public("olafurpg", "setup-gpg", "v3"))
)

ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v")))
ThisBuild / githubWorkflowPublishTargetBranches := Seq(
RefPredicate.StartsWith(Ref.Branch("master")),
RefPredicate.StartsWith(Ref.Tag("v"))
)
ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release")))
ThisBuild / githubWorkflowEnv ++= List(
"PGP_PASSPHRASE",
"PGP_SECRET",
"SONATYPE_PASSWORD",
"SONATYPE_USERNAME"
).map { envKey =>
envKey -> s"$${{ secrets.$envKey }}"
}.toMap

).map(envKey => envKey -> s"$${{ secrets.$envKey }}").toMap

lazy val `fs2-ftp` = project
.in(file("."))
.settings(
organization := "com.github.regis-leray",
name := "fs2-ftp",
description := "fs2-ftp",
Test / fork := true,
Test / parallelExecution := false,
homepage := Some(url("https://github.com/regis-leray/fs2-ftp")),
scmInfo := Some(ScmInfo(url("https://github.com/regis-leray/fs2-ftp"), "[email protected]:regis-leray/fs2-ftp.git")),
developers := List(
Developer("username", "Regis Leray", "regis.leray at gmail dot com", url("https://github.com/regis-leray"))
),
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")),
publishMavenStyle := true,
scalacOptions ++= Seq(
"-encoding",
Expand All @@ -65,12 +76,12 @@ lazy val `fs2-ftp` = project
.toList
.flatten,
//PgpKeys.pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray()),
publishTo := sonatypePublishToBundle.value,
publishTo := sonatypePublishToBundle.value
)
.settings(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % "3.0.6",
"co.fs2" %% "fs2-io" % "3.0.6",
"co.fs2" %% "fs2-core" % fs2Version,
"co.fs2" %% "fs2-io" % fs2Version,
"org.scala-lang.modules" %% "scala-collection-compat" % "2.5.0",
"com.hierynomus" % "sshj" % "0.31.0",
"commons-net" % "commons-net" % "3.8.0",
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.5.2
sbt.version = 1.5.5
8 changes: 3 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.7.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.9")
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0")
3 changes: 2 additions & 1 deletion src/main/scala/fs2/ftp/SecureFtp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import fs2.ftp.FtpSettings.{ KeyFileSftpIdentity, RawKeySftpIdentity, SecureFtpS

import scala.jdk.CollectionConverters._

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

def ls(path: String): fs2.Stream[F, FtpResource] =
fs2.Stream
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/fs2/ftp/SecureFtpSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SecureFtpSpec extends AnyWordSpec with Matchers {
connect[IO, JSFTPClient](settings)
.use(
_.readFile("/notes.txt")
.through(Files[IO].writeAll(tmp))
.through(Files[IO].writeAll(fs2.io.file.Path.fromNioPath(tmp)))
.compile
.drain
)
Expand All @@ -134,7 +134,7 @@ class SecureFtpSpec extends AnyWordSpec with Matchers {
connect[IO, JSFTPClient](settings)
.use {
_.readFile("/no-file.xml")
.through(Files[IO].writeAll(tmp))
.through(Files[IO].writeAll(fs2.io.file.Path.fromNioPath(tmp)))
.compile
.drain
}
Expand Down
13 changes: 6 additions & 7 deletions src/test/scala/fs2/ftp/UnsecureFtpSpec.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package fs2.ftp

import cats.effect.unsafe.IORuntime
import cats.effect.{IO, Resource}
import fs2.ftp.FtpSettings.{FtpCredentials, UnsecureFtpSettings}
import cats.effect.{ IO, Resource }
import fs2.ftp.FtpSettings.{ FtpCredentials, UnsecureFtpSettings }
import fs2.io.file.Files
import org.apache.commons.net.ftp.{FTPClient => JFTPClient}
import org.apache.commons.net.ftp.{ FTPClient => JFTPClient }
import org.scalatest.BeforeAndAfterAll
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

import java.io.FileNotFoundException
import java.nio.file.{Paths, Files => JFiles}
import java.nio.file.{ Paths, Files => JFiles }
import scala.io.Source

trait BaseFtpTest extends AnyWordSpec with Matchers with BeforeAndAfterAll {
Expand Down Expand Up @@ -91,7 +91,7 @@ trait BaseFtpTest extends AnyWordSpec with Matchers with BeforeAndAfterAll {

connect[IO, JFTPClient](settings)
.use(
_.readFile("/notes.txt").through(Files[IO].writeAll(tmp)).compile.drain
_.readFile("/notes.txt").through(Files[IO].writeAll(fs2.io.file.Path.fromNioPath(tmp))).compile.drain
)
.unsafeRunSync()

Expand All @@ -109,7 +109,7 @@ trait BaseFtpTest extends AnyWordSpec with Matchers with BeforeAndAfterAll {
connect[IO, JFTPClient](settings)
.use {
_.readFile("/no-file.xml")
.through(Files[IO].writeAll(tmp))
.through(Files[IO].writeAll(fs2.io.file.Path.fromNioPath(tmp)))
.compile
.drain
}
Expand Down Expand Up @@ -172,7 +172,6 @@ trait BaseFtpTest extends AnyWordSpec with Matchers with BeforeAndAfterAll {
"rm directory" in {
val path = home.resolve("dir-to-delete")


JFiles.createDirectory(path)

connect[IO, JFTPClient](settings)
Expand Down

0 comments on commit 64fa9c5

Please sign in to comment.