Skip to content

Commit 11834bf

Browse files
authored
refactor(ci): move to server-side bindings (#1365)
Part of #1318.
1 parent d2fa8a1 commit 11834bf

20 files changed

+100
-124
lines changed

.github/workflows/_used-actions.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/actions-versions.main.kts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
#!/usr/bin/env kotlin
2+
@file:Repository("https://repo1.maven.org/maven2/")
23
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.13.0")
4+
5+
@file:Repository("https://github-workflows-kt-bindings.colman.com.br/binding/")
6+
@file:DependsOn("actions:checkout:v4")
7+
@file:DependsOn("gradle:actions__setup-gradle:v3")
8+
@file:DependsOn("peter-evans:create-issue-from-file:v5")
9+
310
@file:Import("_shared.main.kts")
411
@file:Import("setup-java.main.kts")
5-
@file:Import("generated/actions/checkout.kt")
6-
@file:Import("generated/gradle/actions/setup-gradle.kt")
7-
@file:Import("generated/peter-evans/create-issue-from-file.kt")
812

9-
import io.github.typesafegithub.workflows.annotations.ExperimentalClientSideBindings
13+
import io.github.typesafegithub.workflows.actions.actions.Checkout
14+
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
15+
import io.github.typesafegithub.workflows.actions.peterevans.CreateIssueFromFile
1016
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
1117
import io.github.typesafegithub.workflows.domain.triggers.Cron
1218
import io.github.typesafegithub.workflows.domain.triggers.Schedule
@@ -15,7 +21,6 @@ import io.github.typesafegithub.workflows.dsl.expressions.expr
1521
import io.github.typesafegithub.workflows.dsl.workflow
1622
import io.github.typesafegithub.workflows.yaml.writeToFile
1723

18-
@OptIn(ExperimentalClientSideBindings::class)
1924
workflow(
2025
name = "Updates available",
2126
on = listOf(
@@ -48,4 +53,4 @@ workflow(
4853
)
4954
)
5055
}
51-
}.writeToFile(generateActionBindings = true)
56+
}.writeToFile()

.github/workflows/actions-versions.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ jobs:
1717
name: 'Check out'
1818
uses: 'actions/checkout@v4'
1919
- id: 'step-1'
20-
name: 'Generate action bindings'
21-
run: '.github/workflows/generate-action-bindings.main.kts "actions-versions.yaml"'
22-
- id: 'step-2'
2320
name: 'Execute script'
2421
run: 'rm ''.github/workflows/actions-versions.yaml'' && ''.github/workflows/actions-versions.main.kts'''
25-
- id: 'step-3'
22+
- id: 'step-2'
2623
name: 'Consistency check'
2724
run: 'git diff --exit-code ''.github/workflows/actions-versions.yaml'''
2825
updates-available:

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/usr/bin/env kotlin
2+
@file:Repository("https://repo1.maven.org/maven2/")
23
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.13.0")
34

4-
import io.github.typesafegithub.workflows.actions.actions.CheckoutV4
5-
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradleV3
5+
@file:Repository("https://github-workflows-kt-bindings.colman.com.br/binding/")
6+
@file:DependsOn("actions:checkout:v4")
7+
@file:DependsOn("gradle:actions__setup-gradle:v3")
8+
9+
import io.github.typesafegithub.workflows.actions.actions.Checkout
10+
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
611
import io.github.typesafegithub.workflows.annotations.ExperimentalKotlinLogicStep
712
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
813
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
@@ -37,9 +42,8 @@ workflow(
3742
name = "End-to-end test",
3843
runsOn = UbuntuLatest,
3944
) {
40-
// Using bundled bindings to avoid generating them here.
41-
uses(action = CheckoutV4())
42-
uses(action = ActionsSetupGradleV3())
45+
uses(action = Checkout())
46+
uses(action = ActionsSetupGradle())
4347

4448
run(
4549
name = "Start the server",
@@ -91,8 +95,8 @@ workflow(
9195
"environment" to "DockerHub",
9296
)
9397
) {
94-
uses(action = CheckoutV4())
95-
uses(action = ActionsSetupGradleV3())
98+
uses(action = Checkout())
99+
uses(action = ActionsSetupGradle())
96100
run(
97101
name = "Build and publish image",
98102
command = "./gradlew :jit-binding-server:publishImage",

.github/workflows/build.main.kts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
#!/usr/bin/env kotlin
2+
@file:Repository("https://repo1.maven.org/maven2/")
23
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.13.0")
4+
5+
@file:Repository("https://github-workflows-kt-bindings.colman.com.br/binding/")
6+
@file:DependsOn("actions:checkout:v4")
7+
@file:DependsOn("actions:setup-java:v4")
8+
@file:DependsOn("gradle:actions__setup-gradle:v3")
9+
310
@file:Import("_shared.main.kts")
411
@file:Import("setup-java.main.kts")
512
@file:Import("setup-python.main.kts")
6-
@file:Import("generated/actions/checkout.kt")
7-
@file:Import("generated/actions/setup-java.kt")
8-
@file:Import("generated/gradle/actions/setup-gradle.kt")
913

10-
import io.github.typesafegithub.workflows.annotations.ExperimentalClientSideBindings
14+
import io.github.typesafegithub.workflows.actions.actions.Checkout
15+
import io.github.typesafegithub.workflows.actions.actions.SetupJava
16+
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
1117
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
1218
import io.github.typesafegithub.workflows.domain.RunnerType.Windows2022
1319
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
@@ -19,7 +25,6 @@ import io.github.typesafegithub.workflows.yaml.writeToFile
1925

2026
val GRADLE_ENCRYPTION_KEY by Contexts.secrets
2127

22-
@OptIn(ExperimentalClientSideBindings::class)
2328
workflow(
2429
name = "Build",
2530
on = listOf(
@@ -91,10 +96,6 @@ workflow(
9196
runsOn = UbuntuLatest,
9297
) {
9398
uses(action = Checkout())
94-
run(
95-
name = "Generate action bindings",
96-
command = ".github/workflows/generate-action-bindings.main.kts",
97-
)
9899
run(
99100
command = """
100101
find -name *.main.kts -print0 | while read -d ${'$'}'\0' file
@@ -121,10 +122,6 @@ workflow(
121122
),
122123
)
123124
run(command = "cd .github/workflows")
124-
run(
125-
name = "Generate action bindings",
126-
command = ".github/workflows/generate-action-bindings.main.kts",
127-
)
128125
run(
129126
name = "Regenerate all workflow YAMLs",
130127
command = """
@@ -142,4 +139,4 @@ workflow(
142139
command = "git diff --exit-code .",
143140
)
144141
}
145-
}.writeToFile(generateActionBindings = true)
142+
}.writeToFile()

.github/workflows/build.yaml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ jobs:
1717
name: 'Check out'
1818
uses: 'actions/checkout@v4'
1919
- id: 'step-1'
20-
name: 'Generate action bindings'
21-
run: '.github/workflows/generate-action-bindings.main.kts "build.yaml"'
22-
- id: 'step-2'
2320
name: 'Execute script'
2421
run: 'rm ''.github/workflows/build.yaml'' && ''.github/workflows/build.main.kts'''
25-
- id: 'step-3'
22+
- id: 'step-2'
2623
name: 'Consistency check'
2724
run: 'git diff --exit-code ''.github/workflows/build.yaml'''
2825
build-for-UbuntuLatest:
@@ -127,9 +124,6 @@ jobs:
127124
- id: 'step-0'
128125
uses: 'actions/checkout@v4'
129126
- id: 'step-1'
130-
name: 'Generate action bindings'
131-
run: '.github/workflows/generate-action-bindings.main.kts'
132-
- id: 'step-2'
133127
run: |-
134128
find -name *.main.kts -print0 | while read -d $'\0' file
135129
do
@@ -154,9 +148,6 @@ jobs:
154148
- id: 'step-2'
155149
run: 'cd .github/workflows'
156150
- id: 'step-3'
157-
name: 'Generate action bindings'
158-
run: '.github/workflows/generate-action-bindings.main.kts'
159-
- id: 'step-4'
160151
name: 'Regenerate all workflow YAMLs'
161152
run: |-
162153
find -name "*.main.kts" -print0 | while read -d $'\0' file
@@ -166,6 +157,6 @@ jobs:
166157
($file)
167158
fi
168159
done
169-
- id: 'step-5'
160+
- id: 'step-4'
170161
name: 'Check if some file is different after regeneration'
171162
run: 'git diff --exit-code .'

.github/workflows/check-if-action-bindings-up-to-date.main.kts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#!/usr/bin/env kotlin
2+
@file:Repository("https://repo1.maven.org/maven2/")
23
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.13.0")
4+
5+
@file:Repository("https://github-workflows-kt-bindings.colman.com.br/binding/")
6+
@file:DependsOn("actions:checkout:v4")
7+
@file:DependsOn("gradle:actions__setup-gradle:v3")
8+
39
@file:Import("setup-java.main.kts")
4-
@file:Import("generated/actions/checkout.kt")
5-
@file:Import("generated/gradle/actions/setup-gradle.kt")
610

7-
import io.github.typesafegithub.workflows.annotations.ExperimentalClientSideBindings
11+
import io.github.typesafegithub.workflows.actions.actions.Checkout
12+
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
813
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
914
import io.github.typesafegithub.workflows.domain.RunnerType.Windows2022
1015
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
@@ -13,7 +18,6 @@ import io.github.typesafegithub.workflows.domain.triggers.WorkflowDispatch
1318
import io.github.typesafegithub.workflows.dsl.workflow
1419
import io.github.typesafegithub.workflows.yaml.writeToFile
1520

16-
@OptIn(ExperimentalClientSideBindings::class)
1721
workflow(
1822
name = "Check if action bindings up to date",
1923
on = listOf(
@@ -41,4 +45,4 @@ workflow(
4145
)
4246
}
4347
}
44-
}.writeToFile(generateActionBindings = true)
48+
}.writeToFile()

.github/workflows/check-if-action-bindings-up-to-date.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@ jobs:
1818
name: 'Check out'
1919
uses: 'actions/checkout@v4'
2020
- id: 'step-1'
21-
name: 'Generate action bindings'
22-
run: '.github/workflows/generate-action-bindings.main.kts "check-if-action-bindings-up-to-date.yaml"'
23-
- id: 'step-2'
2421
name: 'Execute script'
2522
run: 'rm ''.github/workflows/check-if-action-bindings-up-to-date.yaml'' && ''.github/workflows/check-if-action-bindings-up-to-date.main.kts'''
26-
- id: 'step-3'
23+
- id: 'step-2'
2724
name: 'Consistency check'
2825
run: 'git diff --exit-code ''.github/workflows/check-if-action-bindings-up-to-date.yaml'''
2926
check-on-UbuntuLatest:

.github/workflows/create-action-update-prs.main.kts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/usr/bin/env kotlin
2+
@file:Repository("https://repo1.maven.org/maven2/")
23
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.13.0")
4+
5+
@file:Repository("https://github-workflows-kt-bindings.colman.com.br/binding/")
6+
@file:DependsOn("actions:checkout:v4")
7+
@file:DependsOn("gradle:actions__setup-gradle:v3")
8+
39
@file:Import("_shared.main.kts")
410
@file:Import("setup-java.main.kts")
5-
@file:Import("generated/actions/checkout.kt")
6-
@file:Import("generated/gradle/actions/setup-gradle.kt")
711

8-
import io.github.typesafegithub.workflows.annotations.ExperimentalClientSideBindings
12+
import io.github.typesafegithub.workflows.actions.actions.Checkout
13+
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
914
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
1015
import io.github.typesafegithub.workflows.domain.triggers.Cron
1116
import io.github.typesafegithub.workflows.domain.triggers.Schedule
@@ -14,7 +19,6 @@ import io.github.typesafegithub.workflows.dsl.expressions.expr
1419
import io.github.typesafegithub.workflows.dsl.workflow
1520
import io.github.typesafegithub.workflows.yaml.writeToFile
1621

17-
@OptIn(ExperimentalClientSideBindings::class)
1822
workflow(
1923
name = "Create action update PRs",
2024
on = listOf(
@@ -40,4 +44,4 @@ workflow(
4044
command = "./gradlew createActionUpdatePRs",
4145
)
4246
}
43-
}.writeToFile(generateActionBindings = true)
47+
}.writeToFile()

.github/workflows/create-action-update-prs.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ jobs:
1717
name: 'Check out'
1818
uses: 'actions/checkout@v4'
1919
- id: 'step-1'
20-
name: 'Generate action bindings'
21-
run: '.github/workflows/generate-action-bindings.main.kts "create-action-update-prs.yaml"'
22-
- id: 'step-2'
2320
name: 'Execute script'
2421
run: 'rm ''.github/workflows/create-action-update-prs.yaml'' && ''.github/workflows/create-action-update-prs.main.kts'''
25-
- id: 'step-3'
22+
- id: 'step-2'
2623
name: 'Consistency check'
2724
run: 'git diff --exit-code ''.github/workflows/create-action-update-prs.yaml'''
2825
check-updates-and-create-prs:

0 commit comments

Comments
 (0)