diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 348e484..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: CI -on: [push, pull_request] -env: - CI: true - CI_SNAPSHOT_RELEASE: +publishSigned - SCALA_VERSION: 2.13.2 -jobs: - validate: - name: Scala ${{ matrix.scala }}, Java ${{ matrix.java }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - java: [adopt@1.8, adopt@1.11, adopt@1.14] - scala: [2.13.2] - env: - SCALA_VERSION: ${{ matrix.scala }} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: olafurpg/setup-scala@v10 - with: - java-version: ${{ matrix.java }} - - name: Cache Coursier - uses: actions/cache@v1 - with: - path: ~/.cache/coursier - key: sbt-coursier-cache - - name: Cache SBT - uses: actions/cache@v1 - with: - path: ~/.sbt - key: sbt-${{ hashFiles('**/build.sbt') }} - - name: Compile - run: sbt ++$SCALA_VERSION test:compile - - name: Check compatibility - run: sbt ++$SCALA_VERSION mimaReportBinaryIssues - - name: Test - run: sbt ++$SCALA_VERSION test - - name: Scaladoc - run: sbt ++$SCALA_VERSION doc - docs: - name: Doc Site - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: olafurpg/setup-scala@v10 - - name: Cache Coursier - uses: actions/cache@v1 - with: - path: ~/.cache/coursier - key: sbt-coursier-cache - - name: Cache SBT - uses: actions/cache@v1 - with: - path: ~/.sbt - key: sbt-${{ hashFiles('**/build.sbt') }} - - name: Set up Ruby 2.6 - uses: actions/setup-ruby@v1 - with: - ruby-version: 2.6 - - name: Install Jekyll - run: | - gem install bundler - bundle install --gemfile=site/Gemfile - - name: Build project site - run: sbt ++$SCALA_VERSION site/makeMicrosite \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dd0bc2..a90a442 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,12 +9,17 @@ name: Continuous Integration on: pull_request: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] push: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] tags: [v*] env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: @@ -24,7 +29,8 @@ jobs: matrix: os: [ubuntu-latest] scala: [2.12.14, 2.13.8, 3.1.2] - java: [adopt@1.8, adopt@1.11] + java: [temurin@8] + project: [rootJS, rootJVM] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -32,10 +38,21 @@ jobs: with: fetch-depth: 0 - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v12 + - name: Download Java (temurin@8) + id: download-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: typelevel/download-java@v1 with: - java-version: ${{ matrix.java }} + distribution: temurin + java-version: 8 + + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 + with: + distribution: jdkfile + java-version: 8 + jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt uses: actions/cache@v2 @@ -49,25 +66,38 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - name: Setup Ruby - if: matrix.scala == '2.13.8' - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.0.1 + - name: Check that workflows are up to date + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck - - name: Install microsite dependencies - if: matrix.scala == '2.13.8' - run: | - gem install saas - gem install jekyll -v 4.2.0 + - name: scalaJSLink + if: matrix.project == 'rootJS' + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult - - name: Check that workflows are up to date - run: sbt --client '++${{ matrix.scala }}; githubWorkflowCheck' + - name: Test + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test + + - name: Check binary compatibility + if: matrix.java == 'temurin@8' + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues + + - name: Generate API documentation + if: matrix.java == 'temurin@8' + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc - - run: sbt --client '++${{ matrix.scala }}; test; mimaReportBinaryIssues' + - name: Make target directories + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + run: mkdir -p http4s/.jvm/target http4s/.js/target examples/target target .js/target site/target core/.js/target core/.jvm/target .jvm/target .native/target project/target - - if: matrix.scala == '2.13.8' - run: sbt --client '++${{ matrix.scala }}; site/makeMicrosite' + - name: Compress target directories + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + run: tar cf targets.tar http4s/.jvm/target http4s/.js/target examples/target target .js/target site/target core/.js/target core/.jvm/target .jvm/target .native/target project/target + + - name: Upload target directories + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + uses: actions/upload-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }} + path: targets.tar publish: name: Publish Artifacts @@ -77,7 +107,7 @@ jobs: matrix: os: [ubuntu-latest] scala: [3.1.2] - java: [adopt@1.8] + java: [temurin@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -85,10 +115,21 @@ jobs: with: fetch-depth: 0 - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v12 + - name: Download Java (temurin@8) + id: download-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: typelevel/download-java@v1 + with: + distribution: temurin + java-version: 8 + + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 with: - java-version: ${{ matrix.java }} + distribution: jdkfile + java-version: 8 + jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt uses: actions/cache@v2 @@ -102,27 +143,129 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - uses: olafurpg/setup-gpg@v3 + - name: Download target directories (2.12.14, rootJS) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.14-rootJS + + - name: Inflate target directories (2.12.14, rootJS) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.12.14, rootJVM) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.14-rootJVM + + - name: Inflate target directories (2.12.14, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.13.8, rootJS) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJS + + - name: Inflate target directories (2.13.8, rootJS) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.13.8, rootJVM) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM + + - name: Inflate target directories (2.13.8, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (3.1.2, rootJS) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootJS + + - name: Inflate target directories (3.1.2, rootJS) + run: | + tar xf targets.tar + rm targets.tar - - name: Setup Ruby - uses: ruby/setup-ruby@v1 + - name: Download target directories (3.1.2, rootJVM) + uses: actions/download-artifact@v2 with: - ruby-version: 3.0.1 + name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootJVM - - name: Install microsite dependencies + - name: Inflate target directories (3.1.2, rootJVM) run: | - gem install saas - gem install jekyll -v 4.2.0 + tar xf targets.tar + rm targets.tar - - name: Publish artifacts to Sonatype - env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - run: sbt --client '++${{ matrix.scala }}; ci-release' + - name: Import signing key + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' + run: echo $PGP_SECRET | base64 -di | gpg --import - - uses: christopherdavenport/create-ghpages-ifnotexists@v1 + - name: Import signing key and strip passphrase + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + run: | + echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg + echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg + (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) + + - name: Publish + run: sbt '++${{ matrix.scala }}' tlRelease + + site: + name: Generate Site + strategy: + matrix: + os: [ubuntu-latest] + scala: [3.1.2] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Download Java (temurin@8) + id: download-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: typelevel/download-java@v1 + with: + distribution: temurin + java-version: 8 - - name: Publish microsite - run: sbt --client '++${{ matrix.scala }}; site/publishMicrosite' \ No newline at end of file + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 + with: + distribution: jdkfile + java-version: 8 + jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: Generate site + run: sbt '++${{ matrix.scala }}' site/tlSite + + - name: Publish site + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + uses: peaceiris/actions-gh-pages@v3.8.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: site/target/docs/site + keep_files: true diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml index b535fcc..547aaa4 100644 --- a/.github/workflows/clean.yml +++ b/.github/workflows/clean.yml @@ -56,4 +56,4 @@ jobs: printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size ghapi -X DELETE $REPO/actions/artifacts/$id done - done \ No newline at end of file + done diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index e45ebdf..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release -on: - push: - branches: - - main - tags: - - '*' -env: - CI: true - SCALA_VERSION: 2.13.2 -jobs: - release: - name: Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 0 - - uses: olafurpg/setup-scala@v10 - - name: Cache Coursier - uses: actions/cache@v1 - with: - path: ~/.cache/coursier - key: sbt-coursier-cache - - name: Cache SBT - uses: actions/cache@v1 - with: - path: ~/.sbt - key: sbt-${{ hashFiles('**/build.sbt') }} - - uses: olafurpg/setup-gpg@v3 - - name: Publish - run: sbt ci-release - env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - CI_SNAPSHOT_RELEASE: "+publishSigned" \ No newline at end of file diff --git a/.github/workflows/site.yaml b/.github/workflows/site.yaml deleted file mode 100644 index 6ca3dee..0000000 --- a/.github/workflows/site.yaml +++ /dev/null @@ -1,42 +0,0 @@ -name: Site -on: - push: - branches: - - main - tags: - - '*' -env: - CI: true - SCALA_VERSION: 2.13.2 -jobs: - release: - name: Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 0 - - uses: olafurpg/setup-scala@v10 - - name: Cache Coursier - uses: actions/cache@v1 - with: - path: ~/.cache/coursier - key: sbt-coursier-cache - - name: Cache SBT - uses: actions/cache@v1 - with: - path: ~/.sbt - key: sbt-${{ hashFiles('**/build.sbt') }} - - name: Set up Ruby 2.6 - uses: actions/setup-ruby@v1 - with: - ruby-version: 2.6 - - name: Install Jekyll - run: | - gem install bundler - bundle install --gemfile=site/Gemfile - - name: Publish microsite - run: | - sbt ++$SCALA_VERSION site/publishMicrosite - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 02066a9..4791842 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# rediculous-concurrent- Redis Concurrency Structures [![Build Status](https://travis-ci.com/ChristopherDavenport/rediculous-concurrent.svg?branch=master)](https://travis-ci.com/ChristopherDavenport/rediculous-concurrent) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/rediculous-concurrent_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/rediculous-concurrent_2.13) ![Code of Consuct](https://img.shields.io/badge/Code%20of%20Conduct-Scala-blue.svg) +# rediculous-concurrent- Redis Concurrency Structures [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/rediculous-concurrent_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/rediculous-concurrent_2.13) ![Code of Conduct](https://img.shields.io/badge/Code%20of%20Conduct-Scala-blue.svg) ## Microsite diff --git a/build.sbt b/build.sbt index 87c3c50..7ae9d0c 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,21 @@ -val catsV = "2.7.0" -val catsEffectV = "3.3.11" -val fs2V = "3.2.7" +ThisBuild / tlBaseVersion := "0.3" // your current series x.y + +ThisBuild / organization := "io.chrisdavenport" +ThisBuild / organizationName := "Christopher Davenport" +ThisBuild / licenses := Seq(License.MIT) +ThisBuild / developers := List( + // your GitHub handle and name + tlGitHubDev("christopherdavenport", "Christopher Davenport") +) +ThisBuild / tlCiReleaseBranches := Seq("main") + +// true by default, set to false to publish to s01.oss.sonatype.org +ThisBuild / tlSonatypeUseLegacyHost := true + + +val catsV = "2.8.0" +val catsEffectV = "3.3.13" +val fs2V = "3.2.9" val circeV = "0.14.1" ThisBuild / testFrameworks += new TestFramework("munit.Framework") @@ -8,16 +23,12 @@ ThisBuild / testFrameworks += new TestFramework("munit.Framework") ThisBuild / crossScalaVersions := Seq("2.12.14", "2.13.8", "3.1.2") // Projects -lazy val `rediculous-concurrent` = project.in(file(".")) - .disablePlugins(MimaPlugin) - .enablePlugins(NoPublishPlugin) - .aggregate(core.jvm, core.js, examples) +lazy val `rediculous-concurrent` = tlCrossRootProject + .aggregate(core, examples) lazy val core = crossProject(JVMPlatform, JSPlatform) .crossType(CrossType.Pure) .in(file("core")) - .settings(yPartial) - .settings(yKindProjector) .settings( name := "rediculous-concurrent", libraryDependencies ++= Seq( @@ -30,10 +41,10 @@ lazy val core = crossProject(JVMPlatform, JSPlatform) "io.circe" %%% "circe-core" % circeV, "io.circe" %%% "circe-parser" % circeV, - "io.chrisdavenport" %%% "rediculous" % "0.3.0", + "io.chrisdavenport" %%% "rediculous" % "0.4.0", "io.chrisdavenport" %%% "mapref" % "0.2.1", "io.chrisdavenport" %%% "circuit" % "0.5.0", - "io.chrisdavenport" %%% "mules" % "0.5.0", + "io.chrisdavenport" %%% "mules" % "0.6.0", "io.chrisdavenport" %%% "single-fibered" % "0.1.0", // Deps we may use in the future, but don't need presently. @@ -55,8 +66,6 @@ lazy val http4s = crossProject(JVMPlatform, JSPlatform) .crossType(CrossType.Pure) .in(file("http4s")) .dependsOn(core) - .settings(yPartial) - .settings(yKindProjector) .settings( name := "rediculous-concurrent-http4s", libraryDependencies ++= Seq( @@ -77,32 +86,7 @@ lazy val examples = project.in(file("examples")) ) lazy val site = project.in(file("site")) - .disablePlugins(MimaPlugin) - .enablePlugins(NoPublishPlugin) - .enablePlugins(DavenverseMicrositePlugin) + .enablePlugins(TypelevelSitePlugin) .dependsOn(core.jvm) - .settings{ - Seq( - micrositeDescription := "Redis Concurrency Structures", - ) - } - -lazy val yPartial = - Seq( - scalacOptions ++= { - if (scalaVersion.value.startsWith("2.12")) Seq("-Ypartial-unification") - else Seq() - } - ) -lazy val yKindProjector = - Seq( - scalacOptions ++= { - if(scalaVersion.value.startsWith("3")) Seq("-Ykind-projector") - else Seq() - }, - libraryDependencies ++= { - if(scalaVersion.value.startsWith("3")) Seq() - else Seq(compilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full)) - } - ) + diff --git a/core/src/main/scala/io/chrisdavenport/rediculous/concurrent/RedisCircuit.scala b/core/src/main/scala/io/chrisdavenport/rediculous/concurrent/RedisCircuit.scala index c841ddf..c07f6ec 100644 --- a/core/src/main/scala/io/chrisdavenport/rediculous/concurrent/RedisCircuit.scala +++ b/core/src/main/scala/io/chrisdavenport/rediculous/concurrent/RedisCircuit.scala @@ -84,11 +84,11 @@ object RedisCircuit { implicit private final val finiteDurationDecoder: Decoder[FiniteDuration] = new Decoder[FiniteDuration] { def apply(c: HCursor): Decoder.Result[FiniteDuration] = for { - length <- c.downField("length").as[Long].right - unitString <- c.downField("unit").as[String].right + length <- c.downField("length").as[Long] + unitString <- c.downField("unit").as[String] unit <- (try { Right(TimeUnit.valueOf(unitString)) } catch { case _: IllegalArgumentException => Left(DecodingFailure("FiniteDuration", c.history)) - }).right + }) } yield FiniteDuration(length, unit) } diff --git a/site/docs/index.md b/docs/index.md similarity index 87% rename from site/docs/index.md rename to docs/index.md index 5f2ce3a..7f2a234 100644 --- a/site/docs/index.md +++ b/docs/index.md @@ -1,9 +1,4 @@ ---- -layout: home - ---- - -# rediculous-concurrent- Redis Concurrency Structures [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/rediculous-concurrent_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/rediculous-concurrent_2.13) ![Code of Consuct](https://img.shields.io/badge/Code%20of%20Conduct-Scala-blue.svg) +# rediculous-concurrent- Redis Concurrency Structures [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/rediculous-concurrent_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/rediculous-concurrent_2.13) ![Code of Conduct](https://img.shields.io/badge/Code%20of%20Conduct-Scala-blue.svg) ## Quick Start diff --git a/project/plugins.sbt b/project/plugins.sbt index ad5e13c..051f81b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,5 @@ -// addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.22") -addSbtPlugin("io.chrisdavenport" % "sbt-davenverse" % "0.1.4") +addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.12") +addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.12") +addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.4.12") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")