Skip to content

Commit

Permalink
Implement Flipt OpenFeature Provider boolean evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcardell committed Sep 6, 2024
1 parent 59fdea9 commit 458a31b
Show file tree
Hide file tree
Showing 33 changed files with 1,072 additions and 600 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -107,6 +111,10 @@ jobs:
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -211,13 +219,17 @@ 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]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
Expand All @@ -239,7 +251,7 @@ jobs:
- name: Submit Dependencies
uses: scalacenter/sbt-dependency-submission@v2
with:
modules-ignore: ff4s-open-feature-provider-flipt_native0.4_2.13 ff4s-open-feature-provider-flipt_native0.4_3 ff4s-open-feature-sdk_native0.4_2.13 ff4s-open-feature-sdk_native0.4_3 ff4s-open-feature-provider-flipt_2.13 ff4s-open-feature-provider-flipt_3 ff4s-open-feature-sdk_2.13 ff4s-open-feature-sdk_3 rootjs_2.13 rootjs_3 docs_2.13 docs_3 ff4s-open-feature-provider-flipt_sjs1_2.13 ff4s-open-feature-provider-flipt_sjs1_3 rootjvm_2.13 rootjvm_3 rootnative_2.13 rootnative_3 ff4s-open-feature-sdk_sjs1_2.13 ff4s-open-feature-sdk_sjs1_3
modules-ignore: ff4s-open-feature-provider-flipt-it_2.13 ff4s-open-feature-provider-flipt-it_3 ff4s-open-feature-provider-flipt_native0.4_2.13 ff4s-open-feature-provider-flipt_native0.4_3 ff4s-open-feature-sdk_native0.4_2.13 ff4s-open-feature-sdk_native0.4_3 ff4s-open-feature-provider-flipt_2.13 ff4s-open-feature-provider-flipt_3 ff4s-open-feature-sdk_2.13 ff4s-open-feature-sdk_3 rootjs_2.13 rootjs_3 docs_2.13 docs_3 ff4s-open-feature-provider-flipt_sjs1_2.13 ff4s-open-feature-provider-flipt_sjs1_3 rootjvm_2.13 rootjvm_3 rootnative_2.13 rootnative_3 ff4s-open-feature-sdk_sjs1_2.13 ff4s-open-feature-sdk_sjs1_3
configs-ignore: test scala-tool scala-doc-tool test-internal

site:
Expand All @@ -250,6 +262,10 @@ jobs:
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -286,7 +302,7 @@ jobs:

- 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: site/target/docs/site
Expand Down
2 changes: 2 additions & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-J-Xmx4G
-J-Xss2M
35 changes: 0 additions & 35 deletions .scalafix-base.conf

This file was deleted.

28 changes: 14 additions & 14 deletions .scalafix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ rules = [
NoValInForComprehension
# ProcedureSyntax
RedundantSyntax
# OrganizeImports
# RemoveUnused
OrganizeImports
RemoveUnused
]

# run on compile (not explicitly)
Expand All @@ -20,16 +20,16 @@ triggered.rules = [
]

# clashes with OrganizeImports
# RemoveUnused.imports = false
RemoveUnused.imports = false

# OrganizeImports {
# blankLines = Auto
# groups = [
# "re:javax?\\."
# "re:scala\\."
# "re:^(?!(io.cardell)).*$" # anything except mine
# "*"
# ]
# expandRelative = true
# removeUnused = true
# }
OrganizeImports {
blankLines = Auto
groups = [
"re:javax?\\."
"re:scala\\."
"re:^(?!(io.cardell)).*$" # anything except mine
"*"
]
expandRelative = true
removeUnused = true
}
2 changes: 2 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
version = 3.7.1
include ".scalafmt-base.conf"

runner.dialect = scala3
178 changes: 104 additions & 74 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// https://typelevel.org/sbt-typelevel/faq.html#what-is-a-base-version-anyway
ThisBuild / tlBaseVersion := "0.0" // your current series x.y

ThisBuild / organization := "io.cardell"
ThisBuild / organization := "io.cardell"
ThisBuild / organizationName := "Alex Cardell"
ThisBuild / startYear := Some(2023)
ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / startYear := Some(2023)
ThisBuild / licenses := Seq(License.Apache2)

ThisBuild / developers := List(
// your GitHub handle and name
tlGitHubDev("alexcardell", "Alex Cardell")
Expand All @@ -15,99 +16,128 @@ ThisBuild / tlSonatypeUseLegacyHost := false

// publish website from this branch
ThisBuild / tlSitePublishBranch := Some("main")
ThisBuild / tlSiteKeepFiles := false
ThisBuild / tlSiteKeepFiles := false

val Scala213 = "2.13.12"
val Scala33 = "3.3.3"
val Scala33 = "3.3.4-RC1"
ThisBuild / crossScalaVersions := Seq(Scala213, Scala33)
ThisBuild / scalaVersion := Scala213 // the default Scala
ThisBuild / scalaVersion := Scala213 // the default Scala

// hack until integration tests can run in parallel
// ThisBuild / Test / parallelExecution := false
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1)

lazy val projects = Seq(
`flipt-sdk-server`,
`flipt-sdk-server-it`,
`open-feature-sdk`,
`open-feature-provider-flipt`
`open-feature-provider-flipt`,
`open-feature-provider-flipt-it`
)

lazy val commonDependencies = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % "2.10.0",
"org.typelevel" %%% "cats-effect" % "3.5.3",
"org.scalameta" %%% "munit" % "1.0.0-RC1" % Test,
"org.typelevel" %%% "munit-cats-effect" % "2.0.0-M5" % Test
"org.typelevel" %%% "cats-core" % "2.10.0",
"org.typelevel" %%% "cats-effect" % "3.5.3",
"org.scalameta" %%% "munit" % "1.0.0-RC1" % Test,
"org.typelevel" %%% "munit-cats-effect" % "2.0.0-M5" % Test
)
)

lazy val root = tlCrossRootProject.aggregate(projects: _*)

lazy val `flipt-sdk-server` =
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Full)
.in(file("flipt/sdk-server"))
.settings(commonDependencies)
.settings(
name := "ff4s-flipt-sdk-server",
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-client" % "0.23.26",
"org.http4s" %%% "http4s-ember-client" % "0.23.26",
"org.http4s" %%% "http4s-circe" % "0.23.26",
"io.circe" %%% "circe-core" % "0.14.7",
"io.circe" %%% "circe-parser" % "0.14.7",
"io.circe" %%% "circe-generic" % "0.14.7"
)
lazy val `flipt-sdk-server` = crossProject(
JVMPlatform,
JSPlatform,
NativePlatform
)
.crossType(CrossType.Full)
.in(file("flipt/sdk-server"))
.settings(commonDependencies)
.settings(
name := "ff4s-flipt-sdk-server",
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-client" % "0.23.26",
"org.http4s" %%% "http4s-ember-client" % "0.23.26",
"org.http4s" %%% "http4s-circe" % "0.23.26",
"io.circe" %%% "circe-core" % "0.14.7",
"io.circe" %%% "circe-parser" % "0.14.7",
"io.circe" %%% "circe-generic" % "0.14.7"
)
)

lazy val `flipt-sdk-server-it` =
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("flipt/sdk-server-it"))
.dependsOn(`flipt-sdk-server`)
.settings(commonDependencies)
.settings(
libraryDependencies ++= Seq(
"com.dimafeng" %% "testcontainers-scala-munit" % "0.41.3" % Test
)
lazy val `flipt-sdk-server-it` = crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("flipt/sdk-server-it"))
.settings(commonDependencies)
.settings(
libraryDependencies ++= Seq(
"com.dimafeng" %% "testcontainers-scala-munit" % "0.41.3" % Test
)
)
.dependsOn(`flipt-sdk-server`)

lazy val `open-feature-sdk` =
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("open-feature/sdk"))
.enablePlugins(NoPublishPlugin)
.settings(commonDependencies)
.settings(
name := "ff4s-open-feature-sdk",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-generic" % "0.14.7"
)
lazy val `open-feature-sdk` = crossProject(
JVMPlatform,
JSPlatform,
NativePlatform
)
.crossType(CrossType.Pure)
.in(file("open-feature/sdk"))
.enablePlugins(NoPublishPlugin)
.settings(commonDependencies)
.settings(
name := "ff4s-open-feature-sdk",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-generic" % "0.14.7"
)
)

lazy val `open-feature-provider-flipt` =
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("open-feature/provider-flipt"))
.enablePlugins(NoPublishPlugin)
.settings(commonDependencies)
.settings(
name := "ff4s-open-feature-provider-flipt"
)
.dependsOn(
`open-feature-sdk`,
`flipt-sdk-server`
)
lazy val `open-feature-provider-flipt` = crossProject(
JVMPlatform,
JSPlatform,
NativePlatform
)
.crossType(CrossType.Pure)
.in(file("open-feature/provider-flipt"))
.enablePlugins(NoPublishPlugin)
.settings(commonDependencies)
.settings(
name := "ff4s-open-feature-provider-flipt"
)
.dependsOn(
`open-feature-sdk`,
`flipt-sdk-server`
)

lazy val docs =
project
.in(file("site"))
.enablePlugins(TypelevelSitePlugin)
.settings(
tlSiteHelium := {
import laika.helium.config.IconLink
import laika.helium.config.HeliumIcon
import laika.ast.Path.Root
tlSiteHelium.value.site.topNavigationBar(
homeLink = IconLink.internal(Root / "index.md", HeliumIcon.home)
)
}
lazy val `open-feature-provider-flipt-it` = crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("open-feature/provider-flipt-it"))
.enablePlugins(NoPublishPlugin)
.settings(commonDependencies)
.settings(
name := "ff4s-open-feature-provider-flipt-it",
libraryDependencies ++= Seq(
"com.dimafeng" %% "testcontainers-scala-munit" % "0.41.3" % Test
)
.dependsOn(`flipt-sdk-server`.jvm)
)
.dependsOn(
`open-feature-provider-flipt`
)

lazy val docs = project
.in(file("site"))
.enablePlugins(TypelevelSitePlugin)
.settings(
tlSiteHelium := {
import laika.helium.config.IconLink
import laika.helium.config.HeliumIcon
import laika.ast.Path.Root
tlSiteHelium.value.site.topNavigationBar(
homeLink = IconLink.internal(Root / "index.md", HeliumIcon.home)
)
}
)
.dependsOn(`flipt-sdk-server`.jvm)

addCommandAlias("fix", "headerCreateAll;scalafixAll;scalafmtAll;scalafmtSbt")
Loading

0 comments on commit 458a31b

Please sign in to comment.