Skip to content

Commit bf00ff4

Browse files
authored
Merge pull request #1234 from ably/integration/split-3-release-tooling
[Split 3/3] Lockstep release pre-flight, dry-run CI job, README note
2 parents 486efbf + 35fd6c3 commit bf00ff4

4 files changed

Lines changed: 93 additions & 0 deletions

File tree

‎.github/workflows/check.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,23 @@ jobs:
2424
- name: Set up Gradle
2525
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3
2626
- run: ./gradlew checkWithCodenarc checkstyleMain checkstyleTest runUnitTests runLiveObjectsUnitTests :uts:runUtsUnitTests
27+
28+
# Continuously proves the release pre-flight and that every published module
29+
# builds a publishable artifact set, so version/coordinate regressions surface
30+
# on PRs rather than on release day.
31+
release-dry-run:
32+
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
35+
steps:
36+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
37+
with:
38+
persist-credentials: false
39+
- name: Set up the JDK
40+
uses: actions/setup-java@17f84c3641ba7b8f6deff6309fc4c864478f5d62 # v3
41+
with:
42+
java-version: '17'
43+
distribution: 'temurin'
44+
- name: Set up Gradle
45+
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3
46+
- run: ./gradlew verifyReleaseArtifacts publishToMavenLocal

‎.github/workflows/release.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ jobs:
4646
- name: Set up Gradle
4747
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3
4848

49+
# Fails before anything is uploaded if the artifact set, group or lockstep
50+
# version drifts (core, core-android, device and server release
51+
# together on the same version; partial release must be impossible).
52+
- name: Release pre-flight
53+
run: ./gradlew verifyReleaseArtifacts
54+
4955
- name: Publish and release to Maven Central
5056
run: ./gradlew publishAndReleaseToMavenCentral
5157
env:

‎README.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ Find out more:
1515

1616
---
1717

18+
> [!NOTE]
19+
> **This branch carries the in-development 2.0 device/server package split.** The SDK is being
20+
> restructured into new artifacts that declare which side of the network they run on, so that
21+
> traffic classifies correctly on MAU-priced accounts:
22+
>
23+
> | Artifact | For | Entry point |
24+
> |----------|-----|-------------|
25+
> | `io.ably.pubsub:device` (aar) | Devices: Android apps and other end-user runtimes | `PubSubDevice.clientBuilder(...)` |
26+
> | `io.ably.pubsub:server` (jar) | Servers and other trusted backend environments | `PubSubServer.httpClientBuilder(...)` / `PubSubServer.realtimeClientBuilder(...)` |
27+
> | `io.ably.pubsub:core`, `io.ably.pubsub:core-android` | Internal implementation artifacts — do not depend on these directly | — |
28+
>
29+
> Nothing from this branch is published yet. The `io.ably:ably-java` and `io.ably:ably-android`
30+
> 1.x artifacts continue to work and will receive security and critical fixes from a maintenance
31+
> branch for one year after the 2.0 release. The installation instructions below still describe 1.x.
32+
33+
---
34+
1835
## Getting started
1936

2037
Everything you need to get started with Ably:

‎build.gradle.kts‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,56 @@ subprojects {
3131
}
3232
}
3333

34+
/*
35+
* Release pre-flight: the split ships core, core-android, device and server in lockstep
36+
* (one version, one run), so the set of published artifacts and their
37+
* coordinates are asserted here and the release workflow fails before anything is
38+
* uploaded if they drift. If you add or remove a published module, update this list
39+
* deliberately.
40+
*/
41+
val expectedReleaseArtifacts = sortedSetOf(
42+
"io.ably.pubsub:core:jar",
43+
"io.ably.pubsub:core-android:aar",
44+
"io.ably.pubsub:device:jar",
45+
"io.ably.pubsub:server:jar",
46+
"io.ably.pubsub:liveobjects:jar",
47+
"io.ably.pubsub:pubsub-adapter:jar",
48+
"io.ably.pubsub:network-client-core:jar",
49+
"io.ably.pubsub:network-client-default:jar",
50+
"io.ably.pubsub:network-client-okhttp:jar",
51+
)
52+
53+
tasks.register("verifyReleaseArtifacts") {
54+
description = "Asserts the published artifact set, group and lockstep version before a release."
55+
doLast {
56+
val rootVersion = project.property("VERSION_NAME") as String
57+
val actual = sortedSetOf<String>()
58+
subprojects.filter { it.pluginManager.hasPlugin("com.vanniktech.maven.publish") }.forEach { p ->
59+
val artifactId = p.findProperty("POM_ARTIFACT_ID")
60+
?: error("${p.path} applies maven-publish but has no POM_ARTIFACT_ID")
61+
val packaging = p.findProperty("POM_PACKAGING") ?: "jar"
62+
// The version each module publishes at comes from its effective VERSION_NAME
63+
// (a module-local gradle.properties can override the root's — exactly the
64+
// lockstep drift this guards against).
65+
val moduleVersion = p.findProperty("VERSION_NAME")
66+
if (moduleVersion != rootVersion) {
67+
error("Lockstep violation: ${p.path} has VERSION_NAME $moduleVersion, expected $rootVersion")
68+
}
69+
val group = p.findProperty("GROUP")
70+
actual.add("$group:$artifactId:$packaging")
71+
}
72+
if (actual != expectedReleaseArtifacts) {
73+
error(
74+
"Published artifact set does not match the expected release set.\n" +
75+
" expected: $expectedReleaseArtifacts\n" +
76+
" actual: $actual\n" +
77+
"If this change is deliberate, update expectedReleaseArtifacts in build.gradle.kts."
78+
)
79+
}
80+
logger.lifecycle("Release pre-flight OK: ${actual.size} artifacts at $rootVersion: $actual")
81+
}
82+
}
83+
3484
configure(subprojects) {
3585
pluginManager.withPlugin("com.vanniktech.maven.publish") {
3686
extensions.configure<MavenPublishBaseExtension> {

0 commit comments

Comments
 (0)