Skip to content

Commit

Permalink
Merge branch 'zio:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayhul-Jindal authored Oct 20, 2023
2 parents 41317a2 + ff8563a commit 587604b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.12.18, 2.13.10, 3.3.0]
java: [graal_21.1.0@11, temurin@8]
java: [graal_graalvm@17, temurin@8]
runs-on: ${{ matrix.os }}
timeout-minutes: 60

Expand All @@ -35,12 +35,12 @@ jobs:
with:
fetch-depth: 0

- name: Setup GraalVM (graal_21.1.0@11)
if: matrix.java == 'graal_21.1.0@11'
- name: Setup GraalVM (graal_graalvm@17)
if: matrix.java == 'graal_graalvm@17'
uses: graalvm/setup-graalvm@v1
with:
version: 21.1.0
java-version: 11
java-version: 17
distribution: graalvm
components: native-image
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: sbt
Expand Down Expand Up @@ -90,20 +90,20 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [graal_21.1.0@11]
java: [graal_graalvm@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup GraalVM (graal_21.1.0@11)
if: matrix.java == 'graal_21.1.0@11'
- name: Setup GraalVM (graal_graalvm@17)
if: matrix.java == 'graal_graalvm@17'
uses: graalvm/setup-graalvm@v1
with:
version: 21.1.0
java-version: 11
java-version: 17
distribution: graalvm
components: native-image
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: sbt
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Delete artifacts
shell: bash {0}
run: |
# Customize those three lines with your repository and credentials:
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
Expand All @@ -25,7 +26,7 @@ jobs:
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
# A temporary file which receives HTTP response headers.
TMPFILE=/tmp/tmp.$$
TMPFILE=$(mktemp)
# An associative array, key: artifact name, value: number of artifacts of that name.
declare -A ARTCOUNT
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ThisBuild / resolvers +=
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

// CI Configuration
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.graalvm("21.1.0", "11"), JavaSpec.temurin("8"))
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.graalvm(Graalvm.Distribution("graalvm"), "17"), JavaSpec.temurin("8"))
ThisBuild / githubWorkflowPREventTypes := Seq(
PREventType.Opened,
PREventType.Synchronize,
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sbt.Keys.scalaVersion

object Dependencies {
val JwtCoreVersion = "9.1.1"
val NettyVersion = "4.1.99.Final"
val NettyVersion = "4.1.100.Final"
val NettyIncubatorVersion = "0.0.20.Final"
val ScalaCompactCollectionVersion = "2.11.0"
val ZioVersion = "2.0.18"
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.17.0")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.18.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.10")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ object AuthSpec extends ZIOHttpSpec with HttpAppTestExtensions {
} @@ basicAuthContextM).merge.mapZIO(_.body.asString)
assertZIO(app.runZIO(Request.get(URL.empty).copy(headers = successBasicHeader)))(equalTo("user"))
},
test("Extract username via context with Routes") {
val app = {
Routes(
Method.GET / "context" -> basicAuthContextM ->
Handler.fromFunction[(AuthContext, Request)] { case (c: AuthContext, _) => Response.text(c.value) },
)
}.toHttpApp
assertZIO(
app
.runZIO(Request.get(URL.root / "context").copy(headers = successBasicHeader))
.flatMap(_.body.asString),
)(equalTo("user"))
},
),
suite("basicAuthZIO")(
test("HttpApp is accepted if the basic authentication succeeds") {
Expand Down

0 comments on commit 587604b

Please sign in to comment.