Skip to content

Commit

Permalink
Merge branch '0.23' into 0.23-to-0.23-scala3
Browse files Browse the repository at this point in the history
  • Loading branch information
froth committed Aug 7, 2023
2 parents f419e8a + 3074d74 commit 5832e2a
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 40 deletions.
87 changes: 77 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,82 @@ jobs:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.14]
java: [adopt@1.8, adopt@1.11, [email protected]]
os: [ubuntu-latest, macos-latest]
scala: [2.12.18]
java: [temurin@8, temurin@11, temurin@17, graalvm@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v2
with:
java-version: ${{ matrix.java }}
distribution: temurin
java-version: 8

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

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

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

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

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

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

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

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

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

- name: Test generated template
run: sbt ++${{ matrix.scala }} g8Test
run: sbt '++ ${{ matrix.scala }}' g8Test

- name: Build native assembly
if: startsWith(matrix.java, 'graalvm')
run: |
cd target/sbt-test/http4s-g8/scripted
sbt assembly
gu install native-image
cat native-image-readme.md | grep 'native-image -H*' | sh
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ is a much more limited scope.
This template is licensed under CC1.0 license, so please add your name to the bottom of the contributors list in the license file. Opening a pull request signifies your consent to license your contributions under the CC1.0 license.


[contributors' guide]: http://http4s.org/contributing/
[contributors' guide]: https://http4s.org/contributing/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ This template is fixed on `cats.effect.IO`. For a final tagless version, see [h

## Instructions

Generate an http4s service on the blaze backend with Circe.
Generate an http4s service on the ember backend with Circe.

1. [Install sbt](http://www.scala-sbt.org/1.0/docs/Setup.html)
1. [Install sbt](https://www.scala-sbt.org/1.x/docs/Setup.html)
2. Create your project:
- Scala 2: `sbt new http4s/http4s-io.g8`
- Scala 2: `sbt new http4s/http4s-io.g8`
- Scala 3: `sbt new http4s/http4s-io.g8 --branch 0.23-scala3`
3. `cd quickstart`
4. `sbt run`
5. `curl http://localhost:8080/hello/$USER`
6. [Learn more](http://http4s.org/)
6. [Learn more](https://http4s.org/)
41 changes: 38 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,19 +1,54 @@
// This build is for this Giter8 template.
// To test the template run `g8` or `g8Test` from the sbt session.
// See http://www.foundweekends.org/giter8/testing.html#Using+the+Giter8Plugin for more details.
// See https://www.foundweekends.org/giter8/testing.html#Using+the+Giter8Plugin for more details.

ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(
List("g8Test"),
name = Some("Test generated template")
),
WorkflowStep.Run(
List(
"cd target/sbt-test/http4s-g8/scripted",
"sbt assembly",
"gu install native-image",
"cat native-image-readme.md | grep 'native-image -H*' | sh"
),
cond = Some("startsWith(matrix.java, 'graalvm')"),
name = Some("Build native assembly")
)
)
ThisBuild / githubWorkflowJavaVersions := Seq("[email protected]", "[email protected]", "[email protected]")

val PrimaryOS = "ubuntu-latest"
val MacOS = "macos-latest"
ThisBuild / githubWorkflowOSes := Seq(PrimaryOS, MacOS)
ThisBuild / githubWorkflowJavaVersions := Seq(
JavaSpec.temurin("8"),
JavaSpec.temurin("11"),
JavaSpec.temurin("17"),
JavaSpec.graalvm("17")
)
ThisBuild / githubWorkflowPublishTargetBranches := Seq.empty

val Http4sVersion = "0.23.23"
val CirceVersion = "0.14.5"
val MunitVersion = "0.7.29"
val LogbackVersion = "1.4.9"
val MunitCatsEffectVersion = "1.0.7"

lazy val root = project.in(file("."))
.settings(
name := "http4s-io-g8",
name := "http4s-g8",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-ember-server" % Http4sVersion,
"org.http4s" %% "http4s-ember-client" % Http4sVersion,
"org.http4s" %% "http4s-circe" % Http4sVersion,
"org.http4s" %% "http4s-dsl" % Http4sVersion,
"io.circe" %% "circe-generic" % CirceVersion,
"org.scalameta" %% "munit" % MunitVersion % Test,
"org.typelevel" %% "munit-cats-effect-3" % MunitCatsEffectVersion % Test,
"ch.qos.logback" % "logback-classic" % LogbackVersion % Runtime,
),
Test / test := {
val _ = (Test / g8Test).toTask("").value
},
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.5
sbt.version=1.9.3
5 changes: 3 additions & 2 deletions project/plugin.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8" % "0.13.1")
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0")
addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8" % "0.16.2")
addSbtPlugin("org.typelevel" % "sbt-typelevel-github-actions" % "0.4.22")

14 changes: 9 additions & 5 deletions src/main/g8/build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
val Http4sVersion = "$http4s_version$"
val MunitVersion = "$munit_version$"
val LogbackVersion = "$logback_version$"
val MunitCatsEffectVersion = "$munit_cats_effect_version$"
val Http4sVersion = "0.23.23"
val CirceVersion = "0.14.5"
val MunitVersion = "0.7.29"
val LogbackVersion = "1.4.9"
val MunitCatsEffectVersion = "1.0.7"

lazy val root = (project in file("."))
.settings(
Expand All @@ -18,5 +19,8 @@ lazy val root = (project in file("."))
"org.typelevel" %% "munit-cats-effect-3" % MunitCatsEffectVersion % Test,
"ch.qos.logback" % "logback-classic" % LogbackVersion,
),
testFrameworks += new TestFramework("munit.Framework")
assembly / assemblyMergeStrategy := {
case "module-info.class" => MergeStrategy.discard
case x => (assembly / assemblyMergeStrategy).value.apply(x)
}
)
12 changes: 0 additions & 12 deletions src/main/g8/default.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
name = quickstart
organization = com.example
package = $organization$.$name;format="norm,word"$

# Use these after https://github.com/sbt/sbt-giter8-resolver/pull/8
#scala_version = maven(org.scala-lang, scala-library, stable)
#sbt_version = maven(org.scala-sbt, sbt, stable)
#http4s_version = maven(org.http4s, http4s-blaze-server_2.12, stable)
#logback_version = maven(ch.qos.logback, logback-classic, stable)

sbt_version = 1.9.0
http4s_version = 0.23.20
logback_version = 1.4.8
munit_version = 0.7.29
munit_cats_effect_version = 1.0.7
2 changes: 1 addition & 1 deletion src/main/g8/project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=$sbt_version$
sbt.version=1.9.3

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object $name;format="Camel"$Server:

// Combine Service Routes into an HttpApp.
// Can also be done via a Router if you
// want to extract a segments not checked
// want to extract segments not checked
// in the underlying routes.
httpApp = (
$name;format="Camel"$Routes.helloWorldRoutes(helloWorldAlg) <+>
Expand Down

0 comments on commit 5832e2a

Please sign in to comment.