Skip to content

Commit 8f16be4

Browse files
authored
test: clean Maven Local before compiling scripts in server tests (#1595)
1 parent fbb1aa3 commit 8f16be4

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import io.github.typesafegithub.workflows.actions.actions.Checkout
1010
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
1111
import io.github.typesafegithub.workflows.annotations.ExperimentalKotlinLogicStep
1212
import io.github.typesafegithub.workflows.domain.Environment
13+
import io.github.typesafegithub.workflows.domain.JobOutputs
1314
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
1415
import io.github.typesafegithub.workflows.domain.triggers.*
16+
import io.github.typesafegithub.workflows.dsl.JobBuilder
1517
import io.github.typesafegithub.workflows.dsl.expressions.Contexts
1618
import io.github.typesafegithub.workflows.dsl.expressions.expr
1719
import io.github.typesafegithub.workflows.dsl.workflow
@@ -77,6 +79,8 @@ workflow(
7779
}
7880
}
7981

82+
cleanMavenLocal()
83+
8084
run(
8185
name = "Execute the script using the bindings from the serve - with /binding",
8286
command = """
@@ -85,6 +89,8 @@ workflow(
8589
""".trimIndent(),
8690
)
8791

92+
cleanMavenLocal()
93+
8894
run(
8995
name = "Execute the script using the bindings from the server",
9096
command = """
@@ -93,10 +99,7 @@ workflow(
9399
""".trimIndent(),
94100
)
95101

96-
run(
97-
name = "Clean Maven Local to fetch required POMs again",
98-
command = "rm -rf ~/.m2/repository/"
99-
)
102+
cleanMavenLocal()
100103

101104
run(
102105
name = "Execute the script using bindings but without dependency on library",
@@ -149,3 +152,10 @@ workflow(
149152
)
150153
}
151154
}
155+
156+
fun JobBuilder<JobOutputs.EMPTY>.cleanMavenLocal() {
157+
run(
158+
name = "Clean Maven Local to fetch required POMs again",
159+
command = "rm -rf ~/.m2/repository/"
160+
)
161+
}

.github/workflows/bindings-server.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,33 +46,39 @@ jobs:
4646
GHWKT_GITHUB_CONTEXT_JSON: '${{ toJSON(github) }}'
4747
run: 'GHWKT_RUN_STEP=''end-to-end-test:step-3'' ''.github/workflows/bindings-server.main.kts'''
4848
- id: 'step-4'
49+
name: 'Clean Maven Local to fetch required POMs again'
50+
run: 'rm -rf ~/.m2/repository/'
51+
- id: 'step-5'
4952
name: 'Execute the script using the bindings from the serve - with /binding'
5053
run: |-
5154
mv .github/workflows/test-script-consuming-jit-bindings-old.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-old.main.kts
5255
.github/workflows/test-script-consuming-jit-bindings-old.main.kts
53-
- id: 'step-5'
56+
- id: 'step-6'
57+
name: 'Clean Maven Local to fetch required POMs again'
58+
run: 'rm -rf ~/.m2/repository/'
59+
- id: 'step-7'
5460
name: 'Execute the script using the bindings from the server'
5561
run: |-
5662
mv .github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings.main.kts
5763
.github/workflows/test-script-consuming-jit-bindings.main.kts
58-
- id: 'step-6'
64+
- id: 'step-8'
5965
name: 'Clean Maven Local to fetch required POMs again'
6066
run: 'rm -rf ~/.m2/repository/'
61-
- id: 'step-7'
67+
- id: 'step-9'
6268
name: 'Execute the script using bindings but without dependency on library'
6369
run: |-
6470
mv .github/workflows/test-served-bindings-depend-on-library.main.do-not-compile.kts .github/workflows/test-served-bindings-depend-on-library.main.kts
6571
.github/workflows/test-served-bindings-depend-on-library.main.kts
66-
- id: 'step-8'
72+
- id: 'step-10'
6773
name: 'Fetch maven-metadata.xml for top-level action - with /binding'
6874
run: 'curl --fail http://localhost:8080/binding/actions/checkout/maven-metadata.xml | grep ''<version>v4</version>'''
69-
- id: 'step-9'
75+
- id: 'step-11'
7076
name: 'Fetch maven-metadata.xml for nested action - with /binding'
7177
run: 'curl --fail http://localhost:8080/binding/actions/cache__save/maven-metadata.xml | grep ''<version>v4</version>'''
72-
- id: 'step-10'
78+
- id: 'step-12'
7379
name: 'Fetch maven-metadata.xml for top-level action'
7480
run: 'curl --fail http://localhost:8080/actions/checkout/maven-metadata.xml | grep ''<version>v4</version>'''
75-
- id: 'step-11'
81+
- id: 'step-13'
7682
name: 'Fetch maven-metadata.xml for nested action'
7783
run: 'curl --fail http://localhost:8080/actions/cache__save/maven-metadata.xml | grep ''<version>v4</version>'''
7884
deploy:

0 commit comments

Comments
 (0)