Skip to content

Commit

Permalink
Merge pull request #22 from sjenna/upgrades
Browse files Browse the repository at this point in the history
Upgrade major versions, especially natchez and sbt plugins
  • Loading branch information
ChristopherDavenport authored Jun 21, 2023
2 parents 9179133 + 869fab9 commit 1777fe7
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 66 deletions.
102 changes: 50 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ name: Continuous Integration

on:
pull_request:
branches: ['**']
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**']
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

env:
Expand All @@ -28,34 +28,34 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.7, 3.1.1]
scala: [2.12.18, 2.13.11, 3.3.0]
java: [temurin@8]
project: [rootJS, rootJVM]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.sbt
Expand All @@ -67,22 +67,22 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Check that workflows are up to date
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck
run: sbt githubWorkflowCheck

- name: scalaJSLink
if: matrix.project == 'rootJS'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult

- name: Test
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 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
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
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
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand All @@ -94,7 +94,7 @@ jobs:

- 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
uses: actions/upload-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
path: targets.tar
Expand All @@ -106,33 +106,32 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.7]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.sbt
Expand All @@ -143,62 +142,62 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.12.15, rootJS)
uses: actions/download-artifact@v2
- name: Download target directories (2.12.18, rootJS)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.18-rootJS

- name: Inflate target directories (2.12.15, rootJS)
- name: Inflate target directories (2.12.18, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.15, rootJVM)
uses: actions/download-artifact@v2
- name: Download target directories (2.12.18, rootJVM)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.18-rootJVM

- name: Inflate target directories (2.12.15, rootJVM)
- name: Inflate target directories (2.12.18, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.7, rootJS)
uses: actions/download-artifact@v2
- name: Download target directories (2.13.11, rootJS)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.7-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.11-rootJS

- name: Inflate target directories (2.13.7, rootJS)
- name: Inflate target directories (2.13.11, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.7, rootJVM)
uses: actions/download-artifact@v2
- name: Download target directories (2.13.11, rootJVM)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.7-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.11-rootJVM

- name: Inflate target directories (2.13.7, rootJVM)
- name: Inflate target directories (2.13.11, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.1, rootJS)
uses: actions/download-artifact@v2
- name: Download target directories (3.3.0, rootJS)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.0-rootJS

- name: Inflate target directories (3.1.1, rootJS)
- name: Inflate target directories (3.3.0, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.1, rootJVM)
uses: actions/download-artifact@v2
- name: Download target directories (3.3.0, rootJVM)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.0-rootJVM

- name: Inflate target directories (3.1.1, rootJVM)
- name: Inflate target directories (3.3.0, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -215,40 +214,39 @@ jobs:
(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
run: sbt tlCiRelease

site:
name: Generate Site
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.7]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.sbt
Expand All @@ -260,11 +258,11 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Generate site
run: sbt '++${{ matrix.scala }}' site/tlSite
run: sbt site/tlSite

- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.8.0
uses: peaceiris/actions-gh-pages@v3.9.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site/target/docs/site
Expand Down
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / tlBaseVersion := "0.1" // your current series x.y
ThisBuild / tlBaseVersion := "0.2" // your current series x.y

ThisBuild / organization := "io.chrisdavenport"
ThisBuild / organizationName := "Christopher Davenport"
Expand All @@ -10,15 +10,15 @@ ThisBuild / tlCiReleaseBranches := Seq("main")
ThisBuild / tlSonatypeUseLegacyHost := true


val Scala213 = "2.13.7"
val Scala213 = "2.13.11"

ThisBuild / crossScalaVersions := Seq("2.12.15", Scala213, "3.1.1")
ThisBuild / crossScalaVersions := Seq("2.12.18", Scala213, "3.3.0")
ThisBuild / scalaVersion := Scala213

ThisBuild / testFrameworks += new TestFramework("munit.Framework")

val catsV = "2.7.0"
val catsEffectV = "3.3.11"
val catsV = "2.9.0"
val catsEffectV = "3.5.0"
val munitCatsEffectV = "1.0.7"


Expand All @@ -35,7 +35,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform)
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV,
"org.typelevel" %%% "cats-effect" % catsEffectV,
"org.tpolecat" %%% "natchez-core" % "0.1.6",
"org.tpolecat" %%% "natchez-core" % "0.3.2",
"io.chrisdavenport" %%% "fiberlocal" % "0.1.1",
"org.typelevel" %%% "munit-cats-effect-3" % munitCatsEffectV % Test,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.chrisdavenport.fiberlocal.FiberLocal
import natchez._
import cats.effect.kernel._
import cats.syntax.all._
import cats.~>

object TraceLocal {

Expand All @@ -12,12 +13,31 @@ object TraceLocal {
def put(fields: (String, TraceValue)*): F[Unit] =
local.get.flatMap(_.put(fields: _*))

def log(fields: (String, natchez.TraceValue)*): F[Unit] =
local.get.flatMap(_.log(fields: _*))

def log(event: String): F[Unit] =
local.get.flatMap(_.log(event))

def attachError(err: Throwable, fields: (String, natchez.TraceValue)*): F[Unit] =
local.get.flatMap(_.attachError(err, fields: _*))

def kernel: F[Kernel] =
local.get.flatMap(_.kernel)

def span[A](name: String)(k: F[A]): F[A] =
def spanR(name: String, options: Span.Options = Span.Options.Defaults): Resource[F,F ~> F] =
Resource.eval(local.get).flatMap { parent =>
parent.span(name, options).map { child =>
new (F ~> F) {
def apply[A](fa: F[A]): F[A] =
Resource.make(local.set(child))(_ => local.set(parent)).use(_ => fa)
}
}
}

def span[A](name: String, options: natchez.Span.Options = Span.Options.Defaults)(k: F[A]): F[A] =
local.get.flatMap { parent =>
parent.span(name).flatMap { child =>
parent.span(name, options).flatMap { child =>
Resource.make(local.set(child))(_ => local.set(parent))
} .use { _ => k }
}
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.6.2
sbt.version=1.9.0
10 changes: 5 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.9")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.9")
addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.4.9")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.22")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.22")
addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.4.22")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1")

0 comments on commit 1777fe7

Please sign in to comment.