Skip to content

Commit

Permalink
Merge branch 'master' into update/testcontainers-scala-core-0.41.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sideeffffect authored Oct 14, 2024
2 parents b614379 + f0e12ee commit 6db985c
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
auto-approve:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: hmarr/[email protected]
if: github.actor == 'scala-steward' || github.actor == 'renovate[bot]'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ on:
pull_request:
jobs:
ciJvms:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '17', '21' ]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 100
- name: Fetch tags
run: git fetch --depth=100 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-java@v4.2.1
- uses: actions/setup-java@v4.4.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
Expand All @@ -24,7 +24,7 @@ jobs:

ci:
if: always()
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [ ciJvms ]
steps:
- uses: re-actors/alls-green@release/v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependency-graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
name: Update Dependency Graph
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: scalacenter/sbt-dependency-submission@v3.0.1
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: scalacenter/sbt-dependency-submission@v3.1.0
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
update_release_draft:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: release-drafter/release-drafter@v6
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
types: [ published ]
jobs:
release:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- uses: actions/setup-java@v4.2.1
- uses: actions/setup-java@v4.4.0
with:
distribution: 'temurin'
java-version: 8
Expand Down
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "3.8.1"
version = "3.8.3"
runner.dialect = scala213
maxColumn = 120
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.0
sbt.version=1.10.2
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("com.github.sideeffffect" % "sbt-decent-scala" % "1.0.27-1-d4333dfd")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.8.0")
addSbtPlugin("com.github.sideeffffect" % "sbt-decent-scala" % "1.0.57-2-c02df126")
9 changes: 8 additions & 1 deletion src/main/scala/zio/testcontainers/ZIOTestcontainers.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package zio.testcontainers

import com.dimafeng.testcontainers.{DockerComposeContainer, SingleContainer}
import org.testcontainers.containers.{GenericContainer => JavaGenericContainer}
import org.testcontainers.containers.{ComposeContainer, GenericContainer => JavaGenericContainer}
import org.testcontainers.lifecycle.Startable
import zio.{Scope, Tag, UIO, ULayer, URIO, ZIO, ZLayer}

object ZIOTestcontainers {

def getHostAndPort(
container: ComposeContainer
)(serviceName: String)(servicePort: Int): UIO[(String, Int)] = for {
host <- ZIO.succeed(container.getServiceHost(serviceName, servicePort))
port <- ZIO.succeed(container.getServicePort(serviceName, servicePort))
} yield (host, port)

def getHostAndPort(
container: DockerComposeContainer
)(serviceName: String)(servicePort: Int): UIO[(String, Int)] = for {
Expand Down
9 changes: 8 additions & 1 deletion src/main/scala/zio/testcontainers/package.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package zio

import com.dimafeng.testcontainers.{DockerComposeContainer, SingleContainer}
import org.testcontainers.containers.{GenericContainer => JavaGenericContainer}
import org.testcontainers.containers.{ComposeContainer, GenericContainer => JavaGenericContainer}
import org.testcontainers.lifecycle.Startable

package object testcontainers {

implicit final class ComposeContainerOps(private val container: ComposeContainer) extends AnyVal {

def getHostAndPort(serviceName: String)(servicePort: Int): UIO[(String, Int)] =
ZIOTestcontainers.getHostAndPort(container)(serviceName)(servicePort)

}

implicit final class DockerComposeContainerOps(private val container: DockerComposeContainer) extends AnyVal {

def getHostAndPort(serviceName: String)(servicePort: Int): UIO[(String, Int)] =
Expand Down

0 comments on commit 6db985c

Please sign in to comment.