Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ jobs:
- name: Compile the openai-java-core project
run: ./gradlew :openai-java-core:compileJava :openai-java-core:compileTestJava -x test

- name: Stop pre-GraalVM Gradle daemon
run: ./gradlew --stop

- name: Run the mock server
run: ./scripts/mock --daemon

Expand Down Expand Up @@ -462,6 +465,7 @@ jobs:
./gradlew publishAndReleaseToMavenCentral \
"${publish_exclusions[@]}" \
--stacktrace \
--no-parallel \
--no-configuration-cache

- name: Verify attested Maven artifacts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,27 @@ class GradleCacheTrustPolicyTest {
assertPublishingCachePolicy(workflow)
}

@Test
fun `publishing releases obsolete daemons and serializes documentation generation`() {
val workflow = Path.of("../.github/workflows/create-releases.yml").readText()
assertPublishingRunnerStabilityPolicy(workflow)

listOf(
workflow.replaceFirst(
" - name: Stop pre-GraalVM Gradle daemon\n" +
" run: ./gradlew --stop\n\n",
"",
),
workflow.replaceFirst(" --no-parallel \\\n", ""),
)
.forEach { poisonedWorkflow ->
assertTrue(poisonedWorkflow != workflow)
assertFailsWith<AssertionError> {
assertPublishingRunnerStabilityPolicy(poisonedWorkflow)
}
}
}

@Test
fun `publishing attests every released artifact before exposing signing secrets`() {
val workflow = Path.of("../.github/workflows/create-releases.yml").readText()
Expand Down Expand Up @@ -935,6 +956,33 @@ class GradleCacheTrustPolicyTest {
assertPublishingProvenancePolicy(workflow)
}

private fun assertPublishingRunnerStabilityPolicy(workflow: String) {
val publishSteps = parseWorkflow(workflow).job("publish").steps
val compilation =
publishSteps.indexOfFirst { it.name == "Compile the openai-java-core project" }
val daemonStop = publishSteps.indexOfFirst { it.name == "Stop pre-GraalVM Gradle daemon" }
val graalVm = publishSteps.indexOfFirst { it.name == "Set up GraalVM" }

assertTrue(
compilation >= 0 && daemonStop > compilation && graalVm > daemonStop,
"Stop the build-JDK Gradle daemon before switching to GraalVM.",
)
assertEquals("./gradlew --stop", publishSteps[daemonStop].run)

val publication =
requireNotNull(publishSteps.single { it.name == "Publish to Maven Central" }.run)
val serializedInvocation =
"./gradlew publishAndReleaseToMavenCentral \\\n" +
" \"\${publish_exclusions[@]}\" \\\n" +
" --stacktrace \\\n" +
" --no-parallel \\\n" +
" --no-configuration-cache"
assertTrue(
publication.contains(serializedInvocation),
"Serialize Dokka publication tasks to keep the standard runner within memory limits.",
)
}

private fun assertPublishingProvenancePolicy(workflow: String) {
val parsedWorkflow = parseWorkflow(workflow)
val publishJob = parsedWorkflow.job("publish")
Expand Down
Loading