Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
- Latest Scala 3 LTS
- Creative Scala Theme 0.3 ❤
- Various other plugins updated
- Corresponding changes to the build
  • Loading branch information
noelwelsh committed Jan 17, 2025
1 parent d894439 commit 5a932cd
Show file tree
Hide file tree
Showing 26 changed files with 137 additions and 538 deletions.
96 changes: 54 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ concurrency:

jobs:
build:
name: Build and Test
name: Test
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-22.04]
scala: [3]
java: [temurin@8]
java: [temurin@11]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
Expand All @@ -38,35 +38,38 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v3
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

- name: Check headers and formatting
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Test
run: sbt '++ ${{ matrix.scala }}' test

- name: Check binary compatibility
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
run: sbt '++ ${{ matrix.scala }}' doc

- name: Make target directories
Expand All @@ -79,7 +82,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@v3
uses: actions/upload-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
path: targets.tar
Expand All @@ -90,30 +93,33 @@ jobs:
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@8]
os: [ubuntu-22.04]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v3
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Download target directories (3)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3

Expand All @@ -127,15 +133,15 @@ jobs:
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: echo $PGP_SECRET | base64 -di | gpg --import
run: echo $PGP_SECRET | base64 -d -i - | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: |
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
echo "$PGP_SECRET" | base64 -d -i - > /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)
Expand All @@ -148,29 +154,32 @@ jobs:

dependency-submission:
name: Submit Dependencies
if: github.event_name != 'pull_request'
if: github.event.repository.fork == false && github.event_name != 'pull_request'
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@8]
os: [ubuntu-22.04]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v3
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Submit Dependencies
Expand All @@ -183,34 +192,37 @@ jobs:
name: Generate Site
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@8]
os: [ubuntu-22.04]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v3
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Generate site
run: sbt docs/tlSite

- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.9.3
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/target/docs/site
Expand Down
78 changes: 43 additions & 35 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
* limitations under the License.
*/
import scala.sys.process.*
import laika.rewrite.link.LinkConfig
import laika.rewrite.link.ApiLinks
import laika.config.LinkConfig
import laika.config.ApiLinks
import laika.theme.Theme
import laika.helium.config.TextLink

Global / onChangedBuildSource := ReloadOnSourceChanges

Expand All @@ -31,34 +32,34 @@ ThisBuild / developers := List(
tlGitHubDev("noelwelsh", "Noel Welsh")
)

// true by default, set to false to publish to s01.oss.sonatype.org
ThisBuild / tlSonatypeUseLegacyHost := true
ThisBuild / sonatypeCredentialHost := xerial.sbt.Sonatype.sonatypeLegacy

lazy val scala3 = "3.3.3"
lazy val scala3 = "3.3.4"

ThisBuild / crossScalaVersions := List(scala3)
ThisBuild / githubWorkflowJavaVersions := List(JavaSpec.temurin("11"))
ThisBuild / scalaVersion := crossScalaVersions.value.head
ThisBuild / useSuperShell := false
ThisBuild / useSuperShell := true
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
ThisBuild / tlSitePublishBranch := Some("main")

// Run this (build) to do everything involved in building the project
commands += Command.command("build") { state =>
"dependencyUpdates" ::
"clean" ::
"clean" ::
"compile" ::
"test" ::
"docs / tlSite" ::
"headerCreateAll" ::
"scalafixAll" ::
"scalafmtAll" ::
"scalafmtSbt" ::
"headerCreateAll" ::
"githubWorkflowGenerate" ::
"dependencyUpdates" ::
"reload plugins; dependencyUpdates; reload return" ::
"docs / tlSite" ::
state
}

lazy val css = taskKey[Unit]("Build the CSS")

lazy val commonSettings = Seq(
libraryDependencies ++= Seq(
Dependencies.munitCats.value,
Expand Down Expand Up @@ -98,49 +99,56 @@ lazy val docs =
project
.in(file("docs"))
.settings(
tlSiteApiUrl := Some(
sbt.url(
"https://javadoc.io/doc/org.creativescala/krop-docs_3/latest/"
)
),
laikaConfig := laikaConfig.value.withConfigValue(
LinkConfig(apiLinks =
Seq(
LinkConfig.empty
.addApiLinks(
ApiLinks(baseUri =
"https://javadoc.io/doc/org.creativescala/krop-docs_3/latest/"
)
)
)
),
mdocIn := file("docs/src/pages"),
mdocVariables := {
mdocVariables.value ++ Map(
)
},
css := {
val src = file("docs/src/css")
val dest1 = mdocOut.value
val dest2 = (laikaSite / target).value
val cmd1 =
s"npx tailwindcss -i ${src.toString}/creative-scala.css -o ${dest1.toString}/creative-scala.css"
val cmd2 =
s"npx tailwindcss -i ${src.toString}/creative-scala.css -o ${dest2.toString}/creative-scala.css"
cmd1 !

cmd2 !
mdocVariables.value ++ Map()
},
Laika / sourceDirectories ++=
Seq(
file("docs/src/templates")
// (examples.js / Compile / fastOptJS / artifactPath).value
// .getParentFile() / s"${(examples.js / moduleName).value}-fastopt"
),
laikaTheme := Theme.empty,
laikaTheme := CreativeScalaTheme.empty
.withHome(
TextLink.internal(laika.ast.Path.Root / "README.md", "Krop")
)
.withCommunity(
TextLink.external("https://discord.gg/rRhcFbJxVG", "Community")
)
.withApi(
TextLink.external(
"https://javadoc.io/doc/org.creativescala/krop-docs_3/latest",
"API"
)
)
.withSource(
TextLink.external(
"https://github.com/creativescala/krop",
"Source"
)
)
.build,
laikaExtensions ++= Seq(
laika.markdown.github.GitHubFlavor,
laika.parse.code.SyntaxHighlighting,
CreativeScalaDirectives
laika.format.Markdown.GitHubFlavor,
laika.config.SyntaxHighlighting
),
tlSite := Def
.sequential(
// (examples.js / Compile / fastLinkJS),
mdoc.toTask(""),
css,
laikaSite
)
.value
Expand Down
2 changes: 1 addition & 1 deletion core/jvm/src/main/scala/krop/ServerBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package krop
import cats.effect.IO
import com.comcast.ip4s.Host
import com.comcast.ip4s.Port
import org.http4s.ember.server.*
import org.http4s.ember.server._
import org.typelevel.log4cats.LoggerFactory
import org.typelevel.log4cats.slf4j.Slf4jFactory

Expand Down
2 changes: 1 addition & 1 deletion core/jvm/src/test/scala/krop/route/PathParseSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package krop.route

import munit.FunSuite
import org.http4s.Uri
import org.http4s.implicits.*
import org.http4s.implicits._

class PathParseSuite extends FunSuite {
val nonCapturingPath = Path / "user" / "create"
Expand Down
1 change: 0 additions & 1 deletion core/jvm/src/test/scala/krop/route/PathUnparseSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package krop.route

import munit.FunSuite
import org.http4s.Uri
import org.http4s.implicits.*

class PathUnparseSuite extends FunSuite {
val rootPath = Path.root
Expand Down
6 changes: 3 additions & 3 deletions core/jvm/src/test/scala/krop/route/RequestEntitySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import krop.raise.Raise
import munit.CatsEffectSuite
import org.http4s.Method
import org.http4s.Uri
import org.http4s.implicits.*
import org.http4s.{Entity as Http4sEntity}
import org.http4s.{Request as Http4sRequest}
import org.http4s.implicits._
import org.http4s.{Entity => Http4sEntity}
import org.http4s.{Request => Http4sRequest}

class RequestEntitySuite extends CatsEffectSuite {
val unitRequest = Request.get(Path.root).withEntity(Entity.unit)
Expand Down
Loading

0 comments on commit 5a932cd

Please sign in to comment.