Skip to content

Commit 4613e48

Browse files
committed
fix: CI
1 parent 3cae5f9 commit 4613e48

File tree

5 files changed

+151
-4
lines changed

5 files changed

+151
-4
lines changed

.github/workflows/auto-tag.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Auto tag - Automated semantic versioning based on conventional commits
2+
# Mirrors toon4s setup for FlowForge
3+
name: Auto tag
4+
5+
on:
6+
push:
7+
branches: [main]
8+
9+
concurrency:
10+
group: auto-tag-${{ github.ref }}
11+
cancel-in-progress: false
12+
13+
permissions:
14+
contents: write
15+
actions: write
16+
17+
jobs:
18+
auto-tag:
19+
name: Create semantic version tag
20+
runs-on: ubuntu-latest
21+
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip release]')"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Check and clean incomplete releases
31+
id: check_release
32+
uses: actions/github-script@v7
33+
with:
34+
script: |
35+
const tags = await github.rest.repos.listTags({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
per_page: 10
39+
});
40+
41+
for (const tag of tags.data) {
42+
try {
43+
await github.rest.repos.getReleaseByTag({
44+
owner: context.repo.owner,
45+
repo: context.repo.repo,
46+
tag: tag.name
47+
});
48+
console.log(`Release exists for tag ${tag.name}`);
49+
} catch (error) {
50+
if (error.status === 404) {
51+
console.log(`No release found for tag ${tag.name}, deleting tag`);
52+
await github.rest.git.deleteRef({
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
ref: `tags/${tag.name}`
56+
});
57+
console.log(`Deleted tag ${tag.name}`);
58+
}
59+
}
60+
}
61+
62+
- name: Bump version and push tag
63+
id: tag_version
64+
uses: mathieudutour/github-tag-action@v6.2
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
default_bump: patch
68+
tag_prefix: v
69+
release_branches: main
70+
custom_release_rules: |
71+
feat:minor:Features,
72+
fix:patch:Bug Fixes,
73+
docs:patch:Documentation,
74+
chore:patch:Chores,
75+
refactor:patch:Refactoring,
76+
perf:patch:Performance,
77+
test:patch:Tests,
78+
build:patch:Build System,
79+
ci:patch:CI/CD,
80+
revert:patch:Reverts
81+
82+
- name: Trigger release workflow
83+
if: steps.tag_version.outputs.new_tag != ''
84+
uses: actions/github-script@v7
85+
with:
86+
script: |
87+
await github.rest.repos.createDispatchEvent({
88+
owner: context.repo.owner,
89+
repo: context.repo.repo,
90+
event_type: 'release-tag-created',
91+
client_payload: {
92+
tag: '${{ steps.tag_version.outputs.new_tag }}'
93+
}
94+
});
95+
96+
- name: Summary
97+
if: steps.tag_version.outputs.new_tag != ''
98+
run: |
99+
echo "## Tag Created Successfully" >> $GITHUB_STEP_SUMMARY
100+
echo "" >> $GITHUB_STEP_SUMMARY
101+
echo "**New Tag**: \`${{ steps.tag_version.outputs.new_tag }}\`" >> $GITHUB_STEP_SUMMARY
102+
echo "**Previous Tag**: \`${{ steps.tag_version.outputs.previous_tag }}\`" >> $GITHUB_STEP_SUMMARY
103+
echo "**Version Bump**: \`${{ steps.tag_version.outputs.part }}\`" >> $GITHUB_STEP_SUMMARY
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
echo "**Changelog**:" >> $GITHUB_STEP_SUMMARY
106+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
107+
echo "${{ steps.tag_version.outputs.changelog }}" >> $GITHUB_STEP_SUMMARY
108+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
109+
echo "" >> $GITHUB_STEP_SUMMARY
110+
echo "🚀 Release workflow triggered via repository_dispatch" >> $GITHUB_STEP_SUMMARY
111+
112+
- name: No tag created
113+
if: steps.tag_version.outputs.new_tag == ''
114+
run: |
115+
echo "## No Tag Created" >> $GITHUB_STEP_SUMMARY
116+
echo "" >> $GITHUB_STEP_SUMMARY
117+
echo "No version bump needed based on commit messages" >> $GITHUB_STEP_SUMMARY

build.sbt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import sbt.util
22
import scoverage.ScoverageKeys._
3+
import sbtdynver.DynVerPlugin.autoImport._
34

45
import scala.collection.Seq
56
// ===== GLOBAL BUILD SETTINGS =====
67
ThisBuild / organization := "com.flowforge"
78

8-
ThisBuild / version := "0.1.0-SNAPSHOT"
9+
// Versioning: derive from git tags via sbt-dynver (v0.8.1 -> 0.8.1)
10+
ThisBuild / versionScheme := Some("early-semver")
11+
ThisBuild / dynverVTagPrefix := true
12+
ThisBuild / dynverSeparator := "-"
13+
ThisBuild / dynverSonatypeSnapshots := true
914
// Default Scala stays 2.13 for most modules; Spark/Deequ modules are handled pragmatically via deps.
1015
ThisBuild / scalaVersion := Dependencies.Versions.scala213
1116
// Cross-compile defaults: build-level + commands iterate over Scala 2.13 and 3 for speed and stability.
@@ -131,6 +136,15 @@ def moduleProject(name: String): Project =
131136
libraryDependencies ++= Dependencies.common,
132137
)
133138

139+
// Binary compatibility: previous version can be supplied via env MIMA_PREVIOUS_VERSION
140+
def mimaSettings(module: String): Seq[Setting[_]] =
141+
Seq(
142+
mimaPreviousArtifacts := sys.env
143+
.get("MIMA_PREVIOUS_VERSION")
144+
.map(v => Set(organization.value %% s"flowforge-$module" % v))
145+
.getOrElse(Set.empty),
146+
)
147+
134148
// ===== ROOT PROJECT =====
135149
lazy val root = (project in file("."))
136150
.aggregate(
@@ -170,6 +184,7 @@ lazy val infrastructure = moduleProject("infrastructure")
170184
"com.flowforge.infrastructure.DistributedTracing",
171185
).mkString(";"),
172186
)
187+
.settings(mimaSettings("infrastructure"): _*)
173188

174189
// ===== CORE MODULES =====
175190
lazy val core = moduleProject("core")
@@ -225,6 +240,7 @@ lazy val core = moduleProject("core")
225240
}
226241
},
227242
)
243+
.settings(mimaSettings("core"): _*)
228244

229245
lazy val contracts = moduleProject("contracts")
230246
.dependsOn(core)
@@ -236,6 +252,7 @@ lazy val contracts = moduleProject("contracts")
236252
coverageMinimumBranchTotal := 85,
237253
coverageFailOnMinimum := enforceCoverageThreshold,
238254
)
255+
.settings(mimaSettings("contracts"): _*)
239256

240257
// Sample "contract SDK" to demonstrate typed endpoints without local codegen
241258

@@ -253,13 +270,15 @@ lazy val connectors = moduleProject("connectors")
253270
".*CloudStorageConnector.scala",
254271
).mkString(";"),
255272
)
273+
.settings(mimaSettings("connectors"): _*)
256274

257275
lazy val connectorsGcs = moduleProject("connectors-gcs")
258276
.dependsOn(connectors)
259277
.settings(
260278
description := "Google Cloud Storage connector",
261279
libraryDependencies ++= Dependencies.forModule("connectors-gcs"),
262280
)
281+
.settings(mimaSettings("connectors-gcs"): _*)
263282

264283
lazy val connectorsJdbc = moduleProject("connectors-jdbc")
265284
.dependsOn(core, connectors, enginesSpark % "test->compile")
@@ -268,6 +287,7 @@ lazy val connectorsJdbc = moduleProject("connectors-jdbc")
268287
libraryDependencies ++= Dependencies.forModule("connectors-jdbc"),
269288
Test / fork := true,
270289
)
290+
.settings(mimaSettings("connectors-jdbc"): _*)
271291

272292
// ===== ENGINE MODULES =====
273293

@@ -277,6 +297,7 @@ lazy val enginesSpark = moduleProject("engines-spark")
277297
description := "Apache Spark execution engine",
278298
libraryDependencies ++= Dependencies.forModule("engines-spark"),
279299
)
300+
.settings(mimaSettings("engines-spark"): _*)
280301

281302
// typed-spark merged into engines-spark under com.flowforge.engines.spark.typed
282303

@@ -288,6 +309,7 @@ lazy val enginesFlink = moduleProject("engines-flink")
288309
crossScalaVersions := Seq(Dependencies.Versions.scala212),
289310
libraryDependencies ++= Dependencies.forModule("engines-flink"),
290311
)
312+
.settings(mimaSettings("engines-flink"): _*)
291313

292314
// ===== QUALITY MODULES =====
293315
// Removed empty quality module shell per v1.0-2 plan requirements
@@ -310,6 +332,7 @@ lazy val qualityDeequ = moduleProject("quality-deequ")
310332
// Make it runnable for ffCheck command
311333
Compile / mainClass := Some("com.flowforge.quality.deequ.ContractToDeltaExample"),
312334
)
335+
.settings(mimaSettings("quality-deequ"): _*)
313336

314337
// ===== SUPPORT MODULES =====
315338

@@ -477,6 +500,7 @@ lazy val contractsSdk = moduleProject("contracts-sdk")
477500
generated
478501
}.taskValue,
479502
)
503+
.settings(mimaSettings("contracts-sdk"): _*)
480504
// Experimental Scala 3 module for capture checking demos (opt-in)
481505
lazy val experimental = moduleProject("experimental")
482506
.settings(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name=flowforge-sample
22
description=Minimal FlowForge project
33
organization=com.example
4-
version=0.1.0-SNAPSHOT
4+
version=0.8.1
55
scalaVersion=2.13.16
66
cloud_provider=local
7-
flowforgeVersion=0.1.0-SNAPSHOT
7+
flowforgeVersion=0.8.1

flowforge.g8/src/main/g8/src/main/scala/com/flowforge/sample/advanced/FlinkStreamingExample.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ object FlinkStreamingExample {
477477
userId = random.nextLong(1000) + 1,
478478
eventType = eventTypes(random.nextInt(eventTypes.length)),
479479
timestamp = baseTime + (i * 1000) + random.nextInt(5000),
480-
sessionId = s"session_"+random.nextInt(100)},
480+
sessionId = s"session_"+random.nextInt(100),
481481
properties = Map(
482482
"page" -> s"page_"+random.nextInt(10),
483483
"source" -> List("web", "mobile", "api")(random.nextInt(3))

project/plugins.sbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.0")
1313
// Fat JAR assembly
1414
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.0.0")
1515

16+
// Publishing: Maven Central via sbt-ci-release (includes dynver/pgp/sonatype)
17+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.0")
18+
19+
// Binary compatibility checks (planned/optional gates)
20+
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")
21+
1622
// Unified Scaladoc (optional): generate a single aggregated API across modules
1723
// Note: org changed to com.github.sbt in 0.5.0
1824
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")

0 commit comments

Comments
 (0)