Skip to content

Commit fab70ca

Browse files
authored
feat(ci): enable bindings server fallback for several workflows (#1771)
Part of #1765.
1 parent b209c85 commit fab70ca

6 files changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/bindings-server.main.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import io.github.typesafegithub.workflows.dsl.JobBuilder
1919
import io.github.typesafegithub.workflows.dsl.expressions.Contexts
2020
import io.github.typesafegithub.workflows.dsl.expressions.expr
2121
import io.github.typesafegithub.workflows.dsl.workflow
22+
import io.github.typesafegithub.workflows.yaml.DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG
2223
import java.net.URI
2324
import java.net.ConnectException
2425
import java.net.http.HttpClient
@@ -41,6 +42,9 @@ workflow(
4142
Schedule(triggers = listOf(Cron(minute = "0", hour = "0", dayWeek = "SUN"))),
4243
WorkflowDispatch(),
4344
),
45+
consistencyCheckJobConfig = DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG.copy(
46+
useLocalBindingsServerAsFallback = true,
47+
),
4448
sourceFile = __FILE__,
4549
) {
4650
val endToEndTest = job(

.github/workflows/bindings-server.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,25 @@ jobs:
2121
uses: 'actions/checkout@v4'
2222
- id: 'step-1'
2323
name: 'Execute script'
24+
continue-on-error: true
2425
run: 'rm ''.github/workflows/bindings-server.yaml'' && ''.github/workflows/bindings-server.main.kts'''
2526
- id: 'step-2'
27+
name: '[Fallback] Start the local server'
28+
run: 'docker run -p 8080:8080 krzema12/github-workflows-kt-jit-binding-server &'
29+
if: '${{ steps.step-1.outcome != ''success'' }}'
30+
- id: 'step-3'
31+
name: '[Fallback] Wait for the server'
32+
run: 'curl --head -X GET --retry 60 --retry-all-errors --retry-delay 1 http://localhost:8080/status'
33+
if: '${{ steps.step-1.outcome != ''success'' }}'
34+
- id: 'step-4'
35+
name: '[Fallback] Replace server URL in script'
36+
run: 'sed -i -e ''s/https:\/\/bindings.krzeminski.it/http:\/\/localhost:8080/g'' .github/workflows/bindings-server.main.kts'
37+
if: '${{ steps.step-1.outcome != ''success'' }}'
38+
- id: 'step-5'
39+
name: '[Fallback] Execute script again'
40+
run: 'rm -f ''.github/workflows/bindings-server.yaml'' && ''.github/workflows/bindings-server.main.kts'''
41+
if: '${{ steps.step-1.outcome != ''success'' }}'
42+
- id: 'step-6'
2643
name: 'Consistency check'
2744
run: 'git diff --exit-code ''.github/workflows/bindings-server.yaml'''
2845
end-to-end-test:

.github/workflows/build.main.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import io.github.typesafegithub.workflows.domain.triggers.Push
2323
import io.github.typesafegithub.workflows.dsl.expressions.Contexts
2424
import io.github.typesafegithub.workflows.dsl.expressions.expr
2525
import io.github.typesafegithub.workflows.dsl.workflow
26+
import io.github.typesafegithub.workflows.yaml.DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG
2627

2728
val GRADLE_ENCRYPTION_KEY by Contexts.secrets
2829

@@ -32,6 +33,9 @@ workflow(
3233
Push(branches = listOf("main")),
3334
PullRequest(),
3435
),
36+
consistencyCheckJobConfig = DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG.copy(
37+
useLocalBindingsServerAsFallback = true,
38+
),
3539
sourceFile = __FILE__,
3640
) {
3741
listOf(UbuntuLatest, Windows2022).forEach { runnerType ->

.github/workflows/build.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,25 @@ jobs:
1818
uses: 'actions/checkout@v4'
1919
- id: 'step-1'
2020
name: 'Execute script'
21+
continue-on-error: true
2122
run: 'rm ''.github/workflows/build.yaml'' && ''.github/workflows/build.main.kts'''
2223
- id: 'step-2'
24+
name: '[Fallback] Start the local server'
25+
run: 'docker run -p 8080:8080 krzema12/github-workflows-kt-jit-binding-server &'
26+
if: '${{ steps.step-1.outcome != ''success'' }}'
27+
- id: 'step-3'
28+
name: '[Fallback] Wait for the server'
29+
run: 'curl --head -X GET --retry 60 --retry-all-errors --retry-delay 1 http://localhost:8080/status'
30+
if: '${{ steps.step-1.outcome != ''success'' }}'
31+
- id: 'step-4'
32+
name: '[Fallback] Replace server URL in script'
33+
run: 'sed -i -e ''s/https:\/\/bindings.krzeminski.it/http:\/\/localhost:8080/g'' .github/workflows/build.main.kts'
34+
if: '${{ steps.step-1.outcome != ''success'' }}'
35+
- id: 'step-5'
36+
name: '[Fallback] Execute script again'
37+
run: 'rm -f ''.github/workflows/build.yaml'' && ''.github/workflows/build.main.kts'''
38+
if: '${{ steps.step-1.outcome != ''success'' }}'
39+
- id: 'step-6'
2340
name: 'Consistency check'
2441
run: 'git diff --exit-code ''.github/workflows/build.yaml'''
2542
build-for-UbuntuLatest:

.github/workflows/release.main.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ import io.github.typesafegithub.workflows.domain.triggers.Push
1919
import io.github.typesafegithub.workflows.dsl.JobBuilder
2020
import io.github.typesafegithub.workflows.dsl.expressions.expr
2121
import io.github.typesafegithub.workflows.dsl.workflow
22+
import io.github.typesafegithub.workflows.yaml.DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG
2223

2324
workflow(
2425
name = "Release",
2526
on = listOf(Push(tags = listOf("v*.*.*"))),
27+
consistencyCheckJobConfig = DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG.copy(
28+
useLocalBindingsServerAsFallback = true,
29+
),
2630
sourceFile = __FILE__,
2731
env = mapOf(
2832
"SIGNING_KEY" to expr("secrets.SIGNING_KEY"),

.github/workflows/release.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,25 @@ jobs:
2222
uses: 'actions/checkout@v4'
2323
- id: 'step-1'
2424
name: 'Execute script'
25+
continue-on-error: true
2526
run: 'rm ''.github/workflows/release.yaml'' && ''.github/workflows/release.main.kts'''
2627
- id: 'step-2'
28+
name: '[Fallback] Start the local server'
29+
run: 'docker run -p 8080:8080 krzema12/github-workflows-kt-jit-binding-server &'
30+
if: '${{ steps.step-1.outcome != ''success'' }}'
31+
- id: 'step-3'
32+
name: '[Fallback] Wait for the server'
33+
run: 'curl --head -X GET --retry 60 --retry-all-errors --retry-delay 1 http://localhost:8080/status'
34+
if: '${{ steps.step-1.outcome != ''success'' }}'
35+
- id: 'step-4'
36+
name: '[Fallback] Replace server URL in script'
37+
run: 'sed -i -e ''s/https:\/\/bindings.krzeminski.it/http:\/\/localhost:8080/g'' .github/workflows/release.main.kts'
38+
if: '${{ steps.step-1.outcome != ''success'' }}'
39+
- id: 'step-5'
40+
name: '[Fallback] Execute script again'
41+
run: 'rm -f ''.github/workflows/release.yaml'' && ''.github/workflows/release.main.kts'''
42+
if: '${{ steps.step-1.outcome != ''success'' }}'
43+
- id: 'step-6'
2744
name: 'Consistency check'
2845
run: 'git diff --exit-code ''.github/workflows/release.yaml'''
2946
release:

0 commit comments

Comments
 (0)