Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 24 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
name: Compile
name: CI

on:
pull_request:
push:
branches:
- master
- ciris-1.x

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: olafurpg/setup-scala@v10
- name: Compile
run: sbt +compile
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "temurin"
cache: sbt

- uses: sbt/setup-sbt@v1

- name: Check formatting
run: sbt scalafmtCheckAll scalafmtSbtCheck

- name: Compile
run: sbt +compile

- name: Test
run: sbt +test
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.6.1"
version = "3.8.6"
runner.dialect = scala213
style = default
maxColumn = 100
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ lazy val metadataSettings = Seq(
)

lazy val scalaSettings = Seq(
scalaVersion := "2.13.10",
crossScalaVersions := Seq(scalaVersion.value, "2.12.17"),
scalaVersion := "2.13.16",
crossScalaVersions := Seq(scalaVersion.value, "2.12.20"),
scalacOptions ++= {
val commonScalacOptions =
Seq(
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.6.2
sbt.version = 1.10.11
3 changes: 2 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4")
48 changes: 48 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,54 @@ object Main extends IOApp {

### Development

#### Running Tests

Unit tests can be run without any external dependencies:

```bash
sbt +test
```

#### Running Integration Tests

The integration tests are marked as ignored by default because they require a running Kubernetes cluster. To run them locally:

1. **Start a local Kubernetes cluster** (e.g., using [Colima](https://github.com/abiosoft/colima)):

```bash
colima start --kubernetes
```

2. **Create the test fixtures**:

```bash
# Create namespaces
kubectl create namespace secrets-test
kubectl create namespace pizza

# Create secrets for the secrets test
kubectl create secret generic apikey --from-literal=apikey=dummykey -n secrets-test
kubectl create secret generic username --from-literal=username=dummyuser -n secrets-test
kubectl create secret generic defaults --from-literal=timeout=10 -n secrets-test
kubectl create secret generic secrets-test --from-literal=somekey=somevalue -n secrets-test

# Create configmaps for the configmaps test
kubectl create configmap pizzabrand --from-literal=pizzabrand=domino -n pizza
kubectl create configmap delivery --from-literal=radius=5 --from-literal=charge=true -n pizza
```

3. **Enable the integration tests** by removing `.ignore` from the test names in the test file, then run:

```bash
sbt +test
```

4. **Clean up** when done:

```bash
kubectl delete namespace secrets-test pizza
```

#### Publishing
In order to publish a new release, Artifactory credentials must be provided. We publish using the rac team account, which results in the artifact being released to the [public repo](https://kaluza.jfrog.io/artifactory/maven/com/ovoenergy/ciris-kubernetes_2.13).

Expand Down
14 changes: 8 additions & 6 deletions src/test/scala/ciris/packageTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import munit.CatsEffectSuite
import cats.effect.Blocker

class packageTest extends CatsEffectSuite {
test("secrets") {
// Note: These tests require a running Kubernetes cluster with specific secrets/configmaps
// They are integration tests and should be run manually or in a K8s-enabled CI environment
test("secrets".ignore) {

final case class Config(
appName: String,
Expand Down Expand Up @@ -38,7 +40,7 @@ class packageTest extends CatsEffectSuite {
}
}
}
test("configmaps") {
test("configmaps".ignore) {
final case class Config(
appName: String,
pizzaBrand: String,
Expand Down Expand Up @@ -69,7 +71,7 @@ class packageTest extends CatsEffectSuite {
}
}
}
test("missing secret") {
test("missing secret".ignore) {
val namespace = "secrets-test"
val secretName = "missing"
intercept[ConfigException] {
Expand All @@ -85,7 +87,7 @@ class packageTest extends CatsEffectSuite {
}
}

test("missing secret key") {
test("missing secret key".ignore) {
val namespace = "secrets-test"
val secretName = "secrets-test"
val secretKey = "missing-key"
Expand All @@ -103,7 +105,7 @@ class packageTest extends CatsEffectSuite {
}
}

test("missing configmap") {
test("missing configmap".ignore) {
val namespace = "pizza"
val configMapName = "missingmissing"

Expand All @@ -119,7 +121,7 @@ class packageTest extends CatsEffectSuite {
.unsafeRunSync()
}
}
test("missing configmap key") {
test("missing configmap key".ignore) {
val namespace = "pizza"
val configMapName = "delivery"
val configMapKey = "missing-key"
Expand Down