Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Support Scala Native #239

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
373062a
Update Mill to 0.11.2
lolgab Sep 15, 2023
75daa59
Update build to support Scala Native
lolgab Sep 15, 2023
e80d433
Update CI script to run tests with new structure
lolgab Sep 15, 2023
6af9155
Update some dependencies to be platformed
lolgab Sep 15, 2023
94369f0
Add Scala.js to the build
lolgab Sep 15, 2023
44f8000
Upgraded to the jdk client version 0.9.1
domaspoliakas Jun 8, 2022
93c1c98
Merge branch 'main' into jdk-0.7.0
Nov 24, 2023
deb35e0
Merge branch 'main' into jdk-0.7.0
Nov 24, 2023
af38312
add fs2 as an explicit dependency, bump version
Nov 24, 2023
6a8cbd5
simplify watch tests a bit
yurique Nov 24, 2023
046d32d
Merge branch 'main' into jdk-0.7.0
yurique Nov 24, 2023
f46000e
Merge branch 'main' into jdk-0.7.0
yurique Nov 25, 2023
4da98ab
ws client: handle io errors (connection closed), tweak the return typ…
yurique Nov 25, 2023
e796748
Merge branch 'main' into scala-native
yurique Nov 25, 2023
5e94c72
Update build to reflect main
lolgab Nov 25, 2023
fedd234
Separate platform specific code
lolgab Nov 25, 2023
68ee313
Update Mill to 0.11.6
lolgab Nov 25, 2023
1a0aa91
cross-platforming wip
yurique Nov 25, 2023
6d2132b
js tls context wip
yurique Nov 26, 2023
2b87fd5
fixing some tests wip
yurique Nov 26, 2023
12c3894
Merge branch 'jdk-0.7.0'
yurique Nov 26, 2023
32f41f0
ember client on jvm (not used), mill.style
yurique Nov 26, 2023
65ae9b6
fix another intercept, jvm tests are passing
yurique Nov 26, 2023
b0e14f8
native compiles, no idea so far if it works
yurique Nov 26, 2023
1812b0c
get rid of instant
yurique Nov 26, 2023
e4ec0b8
fix native s2n builder
yurique Nov 26, 2023
44d18a5
trying tls1.3
yurique Nov 26, 2023
3af1fd3
implement parseTimestamp
yurique Nov 26, 2023
50f2855
bump http4s snapshot, style
yurique Nov 26, 2023
00c2fd9
exposed platform-specific tls configuration via env vars, fixed http4…
yurique Nov 27, 2023
7c64b8b
cruft
yurique Nov 27, 2023
7083096
fs2-snapshot with clientside mtls
yurique Nov 27, 2023
e22a737
scalafmt override for build files
yurique Nov 27, 2023
e5558c9
fixing lints
yurique Nov 27, 2023
d793135
fixing lints
yurique Nov 27, 2023
9618c88
fix `mill all`
yurique Nov 27, 2023
0bb7308
trigger ci
yurique Nov 27, 2023
d112280
ci matrix wip
yurique Nov 27, 2023
e868a9f
scala 2.13.12, ci update
yurique Nov 27, 2023
714804f
scalac options for scala 2.13.12
yurique Nov 27, 2023
b3b209d
job name
yurique Nov 27, 2023
16c16f5
reverse k8s versions in matrix
yurique Nov 27, 2023
1f7277b
fixing...
yurique Nov 28, 2023
a44f8c6
add jdk ember
yurique Nov 28, 2023
165f1f3
ci matrix
yurique Nov 28, 2023
74ae39f
still figuring out the matrix
yurique Nov 28, 2023
eac5afd
make jvm ember tests actually use ember not jdk
yurique Nov 28, 2023
b39ac81
shared ember clients builder
yurique Nov 28, 2023
0101e0e
smaller matrix?
yurique Nov 28, 2023
734769a
style, matrix order
yurique Nov 28, 2023
df5a25c
allow adapting http clients
yurique Nov 28, 2023
6ebbdc1
fs2 bump
Jan 20, 2024
a080375
Merge branch 'main' into scala-native
Jan 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 34 additions & 92 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,116 +23,58 @@ jobs:
java-version: 11.0.x
distribution: zulu
- name: Style checks
run: ./mill all __.checkStyle __.docJar
run: ./mill __.checkStyle + __.docJar

integration-kubernetes-v1-25:
integration-kubernetes:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
client: [ ember, jdk ]
platform: [ jvm, js, native ]
k8s: [ v1.28.4, v1.27.8, v1.26.11, v1.25.3, v1.24.7, v1.23.13, v1.22.15, v1.21.14 ]
scala: [ 3.3.1, 2.13.12 ] # 2.12.17
exclude:
- platform: js
client: jdk
- platform: native
client: jdk
- k8s: v1.27.8
scala: 2.13.12
- k8s: v1.26.11
scala: 2.13.12
- k8s: v1.25.3
scala: 2.13.12
- k8s: v1.24.7
scala: 2.13.12
- k8s: v1.23.13
scala: 2.13.12
- k8s: v1.22.15
scala: 2.13.12
- k8s: v1.21.14
name: k8s ${{ matrix.k8s }} - ${{ matrix.scala }} / ${{ matrix.platform }} / ${{ matrix.client }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Minikube and start Kubernetes
uses: medyagh/[email protected].8
uses: medyagh/[email protected].14
with:
minikube-version: 1.28.0
kubernetes-version: v1.25.3
minikube-version: 1.32.0
kubernetes-version: ${{ matrix.k8s }}
- name: Setup Java 11
uses: actions/setup-java@v3
with:
java-version: 11.0.x
distribution: zulu
- name: Test against Kubernetes v1.25
run: ./mill __[3.3.1].test

integration-kubernetes-v1-24:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Minikube and start Kubernetes
uses: medyagh/[email protected]
with:
minikube-version: 1.28.0
kubernetes-version: v1.24.7
- name: Setup Java 11
uses: actions/setup-java@v3
with:
java-version: 11.0.x
distribution: zulu
- name: Test against Kubernetes v1.24
run: ./mill __[3.3.1].test

integration-kubernetes-v1-23:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Minikube and start Kubernetes
uses: medyagh/[email protected]
with:
minikube-version: 1.28.0
kubernetes-version: v1.23.13
- name: Setup Java 11
uses: actions/setup-java@v3
with:
java-version: 11.0.x
distribution: zulu
- name: Test against Kubernetes v1.23
run: ./mill __[3.3.1].test

integration-kubernetes-v1-22:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Minikube and start Kubernetes
uses: medyagh/[email protected]
with:
minikube-version: 1.28.0
kubernetes-version: v1.22.15
- name: Setup Java 11
uses: actions/setup-java@v3
with:
java-version: 11.0.x
distribution: zulu
- name: Test against Kubernetes v1.22
run: ./mill __[3.3.1].test

integration-kubernetes-v1-21:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Minikube and start Kubernetes
uses: medyagh/[email protected]
with:
minikube-version: 1.28.0
kubernetes-version: v1.21.14
- name: Setup Java 11
uses: actions/setup-java@v3
with:
java-version: 11.0.x
distribution: zulu
- name: Test against Kubernetes v1.21
run: ./mill __[3.3.1].test
- name: Test against Kubernetes ${{ matrix.k8s }} ${{ matrix.scala }} ${{ matrix.platform }} ${{ matrix.client }}
env:
KUBE_CLIENT_IMPLEMENTATION: ${{ matrix.client }}
run: ./mill _[${{ matrix.scala }}].${{ matrix.platform }}.test

publish:
needs:
- checks
- integration-kubernetes-v1-25
- integration-kubernetes-v1-24
- integration-kubernetes-v1-23
- integration-kubernetes-v1-22
- integration-kubernetes-v1-21
- integration-kubernetes
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.10.15
0.11.6
10 changes: 10 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ rewrite.redundantBraces.stringInterpolation = true
rewrite.imports.sort = original
rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = oldSyntaxToo
fileOverride {
"glob:project/**.*" {
runner.dialect = "scala213"
rewrite.scala3.convertToNewSyntax = false
}
"glob:**.sc" {
runner.dialect = "scala213"
rewrite.scala3.convertToNewSyntax = false
}
}
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,9 @@ A specific test:
Check and fix formatting:

```shell
./mill __.style
./mill __.checkStyle + __.docJar
```




## Related projects

* [Skuber](https://github.com/doriordan/skuber)
Expand Down
116 changes: 78 additions & 38 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,93 @@ import $ivy.`org.typelevel::scalac-options:0.1.4`

import $file.project.Dependencies
import Dependencies.Dependencies._
import $file.project.SwaggerModelGenerator
import SwaggerModelGenerator.SwaggerModelGenerator
import $file.project.{SwaggerModelGenerator => SwaggerModelGeneratorFile}
import SwaggerModelGeneratorFile.SwaggerModelGenerator
import com.goyeau.mill.git.{GitVersionModule, GitVersionedPublishModule}
import com.goyeau.mill.scalafix.StyleModule
import mill._
import mill.scalalib.TestModule.Munit
import mill.scalalib._
import mill.scalajslib._
import mill.scalanativelib._
import mill.scalajslib.api.ModuleKind
import mill.scalalib.api.ZincWorkerUtil.isScala3
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
import org.typelevel.scalacoptions.ScalacOptions.{advancedOption, fatalWarningOptions, release, source3}
import org.typelevel.scalacoptions.{ScalaVersion, ScalacOptions}
import coursier.maven.MavenRepository

object `kubernetes-client` extends Cross[KubernetesClientModule]("3.3.1", "2.13.12" /* "2.12.17" */ )
trait KubernetesClientModule extends Cross.Module[String] {
trait Shared
extends CrossScalaModule
with CrossValue
with PlatformScalaModule
with StyleModule
with GitVersionedPublishModule
with SwaggerModelGenerator {

lazy val jvmVersion = "11"

override def repositoriesTask = T.task {
super.repositoriesTask() ++ Seq(
coursier.Repositories.sonatype("snapshots"),
coursier.Repositories.sonatypeS01("snapshots")
)
}

override def javacOptions = super.javacOptions() ++ Seq("-source", jvmVersion, "-target", jvmVersion)
override def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion(
scalaVersion() match {
case "3.3.1" => ScalaVersion.V3_3_1
case "2.13.12" => ScalaVersion.V2_13_9
case "2.12.17" => ScalaVersion.V2_12_13
},
ScalacOptions.default + release(jvmVersion) + source3 +
advancedOption("max-inlines", List("50"), _.isAtLeast(ScalaVersion.V3_0_0)) // ++ fatalWarningOptions
)

override def ivyDeps =
super.ivyDeps() ++ fs2 ++ http4s.core ++ circe ++ circeYaml ++ bouncycastle ++ collectionCompat ++ log4cats.core // ++ java8compat

override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++
(if (isScala3(scalaVersion())) Agg.empty else Agg(ivy"org.typelevel:::kind-projector:0.13.2"))

override def publishVersion = GitVersionModule.version(withSnapshotSuffix = true)
def pomSettings = PomSettings(
description = "A Kubernetes client for Scala",
organization = "com.goyeau",
url = "https://github.com/joan38/kubernetes-client",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl.github("joan38", "kubernetes-client"),
developers = Seq(Developer("joan38", "Joan Goyeau", "https://github.com/joan38"))
)

object `kubernetes-client` extends Cross[KubernetesClientModule]("3.3.1", "2.13.10", "2.12.17")
class KubernetesClientModule(val crossScalaVersion: String)
extends CrossScalaModule
with StyleModule
with GitVersionedPublishModule
with SwaggerModelGenerator {
lazy val jvmVersion = "11"
override def javacOptions = super.javacOptions() ++ Seq("-source", jvmVersion, "-target", jvmVersion)
override def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion(
scalaVersion() match {
case "3.3.1" => ScalaVersion.V3_3_1
case "2.13.10" => ScalaVersion.V2_13_9
case "2.12.17" => ScalaVersion.V2_12_13
},
ScalacOptions.default + release(jvmVersion) + source3 +
advancedOption("max-inlines", List("50"), _.isAtLeast(ScalaVersion.V3_0_0)) // ++ fatalWarningOptions
)

override def ivyDeps =
super.ivyDeps() ++ http4s ++ circe ++ circeYaml ++ bouncycastle ++ collectionCompat ++ logging ++ java8compat
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++
(if (isScala3(scalaVersion())) Agg.empty else Agg(ivy"org.typelevel:::kind-projector:0.13.2"))

object test extends Tests with Munit {
override def forkArgs = super.forkArgs() :+ "-Djdk.tls.client.protocols=TLSv1.2"
override def ivyDeps = super.ivyDeps() ++ tests ++ logback
}

override def publishVersion = GitVersionModule.version(withSnapshotSuffix = true)
def pomSettings = PomSettings(
description = "A Kubernetes client for Scala",
organization = "com.goyeau",
url = "https://github.com/joan38/kubernetes-client",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl.github("joan38", "kubernetes-client"),
developers = Seq(Developer("joan38", "Joan Goyeau", "https://github.com/joan38"))
)
trait SharedTestModule extends ScalaModule with TestModule.Munit {
override def forkArgs = T(super.forkArgs() :+ "-Djdk.tls.client.protocols=TLSv1.2")
override def ivyDeps = super.ivyDeps() ++ tests
}

object jvm extends Shared {
override def ivyDeps = super.ivyDeps() ++ fs2 ++ http4s.jdkClient ++ http4s.emberClient
object test extends ScalaTests with SharedTestModule {
override def ivyDeps = super.ivyDeps() ++ tests ++ log4cats.logback
}
}

object js extends Shared with ScalaJSModule {
def scalaJSVersion = "1.14.0"
override def ivyDeps = super.ivyDeps() ++ fs2 ++ http4s.emberClient
object test extends ScalaJSTests with SharedTestModule {
override def ivyDeps = super.ivyDeps() ++ tests ++ log4cats.jsConsole
override def moduleKind = ModuleKind.CommonJSModule
}
}

object native extends Shared with ScalaNativeModule {
def scalaNativeVersion = "0.4.16"
override def ivyDeps = super.ivyDeps() ++ http4s.emberClient
object test extends ScalaNativeTests with SharedTestModule
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.goyeau.kubernetes.client

trait PlatformSpecific {}

private object PlatformSpecific {}
Loading
Loading