Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to sbt-ci-release #227

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 44 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
name: CI

on: [push, pull_request]
on:
push:
branches: ["master"]
tags: ["v*"]
pull_request:
branches: ["master"]
workflow_dispatch:

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
scala:
- 2.13.8
- 3.2.0
- 2.12.15
- 2.13.11
- 3.3.0
- 2.12.18

steps:
- uses: actions/checkout@v3

- uses: coursier/cache-action@v6

- name: scala
uses: olafurpg/setup-scala@v11
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
java-version: "17"
distribution: "temurin"
cache: "sbt"

- name: build ${{ matrix.scala }}
run: sbt ++${{ matrix.scala }} clean coverage test
Expand All @@ -41,4 +51,29 @@ jobs:
with:
type: ${{ job.status }}
job_name: Build
url: ${{ secrets.SLACK_WEBHOOK }}
url: ${{ secrets.SLACK_WEBHOOK }}

publish:
name: Publish Artifacts
needs: [test]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: coursier/cache-action@v6

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: "sbt"

- name: Publish artifacts
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USER }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need some special configuration for this repository? I don't know if it's necessary to add secrets to each repo manually

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have access to repo and organization secrets, but if it SONATYPE_USER is an organization one, then adding it it's needed only once. Given fact that there are already 2 libraries which are using it, I assumed that this is already organization secret. Ca you check that? Also calling @t3hnar

SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASS }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
run: sbt ci-release
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
[![Build Status](https://github.com/evolution-gaming/cats-helper/workflows/CI/badge.svg)](https://github.com/evolution-gaming/cats-helper/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/evolution-gaming/cats-helper/badge.svg)](https://coveralls.io/r/evolution-gaming/cats-helper)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/69204a35e17b4e068db5861524bef5b7)](https://www.codacy.com/app/evolution-gaming/cats-helper?utm_source=github.com&utm_medium=referral&utm_content=evolution-gaming/cats-helper&utm_campaign=Badge_Grade)
[![Version](https://img.shields.io/badge/version-click-blue)](https://evolution.jfrog.io/artifactory/api/search/latestVersion?g=com.evolutiongaming&a=cats-helper_2.13&repos=public)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.evolution/cats-helper.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.evolution/cats-helper_2.13)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellowgreen.svg)](https://opensource.org/licenses/MIT)

## ClockHelper

```scala
import com.evolutiongaming.catshelper.ClockHelper._
import com.evolution.catshelper.ClockHelper._

val clock = Clock.const[Id](nanos = 1000, millis = 2)

Expand All @@ -24,7 +24,7 @@ Provides a way to measure duration of a computation in a pure way.

Example:
```scala
import com.evolutiongaming.catshelper.MeasureDuration
import com.evolution.catshelper.MeasureDuration

for {
duration <- MeasureDuration[IO].start
Expand All @@ -35,7 +35,7 @@ for {

Syntax extensions are also available, allowing to measure duration of a computation and execute an effect with it:
```scala
import com.evolutiongaming.catshelper.syntax.measureDuration._
import com.evolution.catshelper.syntax.measureDuration._

for {
int1 <- IO.pure(1).measured(elapsed => IO.println(s"elapsed: $elapsed"))
Expand All @@ -52,7 +52,7 @@ Like [`Ref`](https://typelevel.org/cats-effect/concurrency/ref.html) but allows
Ensures that updates are run serially

```scala
import com.evolutiongaming.catshelper.SerialRef
import com.evolution.catshelper.SerialRef

for {
ref <- SerialRef.of[IO, Int](0)
Expand Down Expand Up @@ -209,5 +209,5 @@ However we will do our best to avoid unnecessary breakages.
```scala
addSbtPlugin("com.evolution" % "sbt-artifactory-plugin" % "0.0.2")

libraryDependencies += "com.evolutiongaming" %% "cats-helper" % "2.2.3"
libraryDependencies += "com.evolution" %% "cats-helper" % "2.2.3"
```
79 changes: 47 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
import Dependencies._

def crossSettings[T](scalaVersion: String, if3: Seq[T], if2: Seq[T]) = {
CrossVersion.partialVersion(scalaVersion) match {
case Some((3, _)) => if3
case Some((2, 12 | 13)) => if2
case _ => Nil
}
def crossSettings[T](
scalaVersion: String,
if3: List[T] = Nil,
if2: List[T] = Nil
) = scalaVersion match {
case version if version.startsWith("3") => if3
case _ => if2
}

inThisBuild(Seq(
homepage := Some(new URL("http://github.com/evolution-gaming/cats-helper")),
enablePlugins(GitVersioning)

organization := "com.evolutiongaming",
organizationName := "Evolution",
organizationHomepage := Some(url("http://evolution.com")),
inThisBuild(
Seq(
homepage := Some(new URL("http://github.com/evolution-gaming/cats-helper")),
organization := "com.evolution",
organizationName := "Evolution",
organizationHomepage := Some(url("http://evolution.com")),

startYear := Some(2019),
licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))),
startYear := Some(2019),
licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))),

crossScalaVersions := Seq("2.13.8", "3.2.0", "2.12.15"),
versionScheme := Some("semver-spec"),
crossScalaVersions := Seq("2.13.11", "3.3.0", "2.12.18"),
scalaVersion := crossScalaVersions.value.head,

versionScheme := Some("semver-spec"),
sonatypeCredentialHost := "s01.oss.sonatype.org",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",

scalaVersion := crossScalaVersions.value.head,

publishTo := Some(Resolver.evolutionReleases),
))
scmInfo := Some(
ScmInfo(
url("https://github.com/evolution-gaming/cats-helper"),
"git@github.com:evolution-gaming/cats-helper.git"
)
),
Test / publishArtifact := false
)
)

// Settings that can't be defined on a higher level go here.
// Usually such settings have defaults defined by some plugin in its `projectSettings`.
lazy val commonSettings = Seq(
releaseCrossBuild := true,
scalacOptsFailOnWarn := Some(false),
scalacOptsFailOnWarn := Some(false)
)

lazy val root = project
Expand All @@ -40,12 +50,12 @@ lazy val root = project
commonSettings,
name := "cats-helper",
publish / skip := true,
publishArtifact := false,
publishArtifact := false
)
.aggregate(
core,
logback,
testkit,
testkit
)

lazy val core = project
Expand All @@ -59,21 +69,26 @@ lazy val core = project
Cats.effect,
`slf4j-api`,
Logback.classic % Test,
scalatest % Test,
scalatest % Test
),
libraryDependencies ++= crossSettings(
scalaVersion.value,
if3 = Nil,
if2 = List(compilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full))
if2 = List(
compilerPlugin(
"org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full
)
)
),
scalacOptions ++= crossSettings(
scalaVersion.value,
if3 = Seq("-Ykind-projector:underscores", "-language:implicitConversions"),
if3 =
List("-Ykind-projector:underscores", "-language:implicitConversions"),
if2 = List("-Xsource:3", "-P:kind-projector:underscore-placeholders")
),
)
)
.dependsOn(
testkit % Test,
testkit % Test
)

lazy val logback = project
Expand All @@ -82,12 +97,12 @@ lazy val logback = project
name := "cats-helper-logback",
libraryDependencies ++= Seq(
Logback.classic,
scalatest % Test,
scalatest % Test
)
)
.dependsOn(
core,
testkit % Test,
testkit % Test
)

lazy val testkit = project
Expand All @@ -98,6 +113,6 @@ lazy val testkit = project
Cats.effectStd,
Cats.effectTestkit,
Cats.effectLaws,
scalatest % Optional,
),
scalatest % Optional
)
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.arrow.FunctionK
import cats.effect.kernel.Async
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.data.EitherT
import cats.effect.implicits.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.effect.Clock
import cats.implicits._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.{Applicative, Functor}
import cats.effect.syntax.all._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.Order
import cats.data.{NonEmptyList => Nel, NonEmptyMap => Nem, NonEmptySet => Nes}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.effect.kernel.{Deferred, Fiber}
import cats.effect.{Concurrent, MonadCancel}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.effect.kernel.{Deferred, Ref}
import cats.effect.implicits._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.Foldable
import cats.data.{NonEmptyList => Nel, NonEmptySet => Nes}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.arrow.FunctionK
import cats.effect.{Async, Sync}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.effect.IO
import cats.implicits._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.data.{NonEmptyList => Nel}
import cats.effect.kernel.Ref
Expand All @@ -7,7 +7,7 @@ import cats.effect.implicits._
import cats.effect.{Clock, Concurrent, Resource, Temporal}
import cats.implicits._
import cats.{Applicative, ~>}
import com.evolutiongaming.catshelper.ClockHelper._
import com.evolution.catshelper.ClockHelper._

import scala.concurrent.duration._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper


import cats.{Functor, ~>}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.data.NonEmptyMap
import cats.effect.Sync
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.effect.Sync
import cats.implicits._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.effect.Clock
import cats.syntax.all._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.effect.kernel.{Deferred, Ref}
import cats.effect.implicits._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.data.{NonEmptyList => Nel}
import com.evolutiongaming.catshelper.DataHelper._
import com.evolution.catshelper.DataHelper._

@deprecated("use DataHelper instead", "1.2.0")
object NelHelper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.evolutiongaming.catshelper
package com.evolution.catshelper

import cats.{Foldable, Monoid, Parallel}
import cats.data.{NonEmptyMap => Nem}
import com.evolutiongaming.catshelper.Foldable1.implicits._
import com.evolution.catshelper.Foldable1.implicits._

object ParallelHelper {

Expand Down
Loading