Skip to content

Commit 25e12d0

Browse files
authored
chore(ci): enable fallback to local server for end-to-end tests (#2177)
Mitigation for #2167.
1 parent cbac979 commit 25e12d0

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

.github/workflows/end-to-end-tests-2nd-workflow.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,25 @@ jobs:
3030
run: './gradlew publishToMavenLocal'
3131
- id: 'step-4'
3232
name: 'Execute script'
33+
continue-on-error: true
3334
run: 'rm ''.github/workflows/end-to-end-tests-2nd-workflow.yaml'' && ''.github/workflows/end-to-end-tests.main.kts'''
3435
- id: 'step-5'
36+
name: '[Fallback] Start the local server'
37+
run: 'docker run -p 8080:8080 krzema12/github-workflows-kt-jit-binding-server &'
38+
if: '${{ steps.step-4.outcome != ''success'' }}'
39+
- id: 'step-6'
40+
name: '[Fallback] Wait for the server'
41+
run: 'curl --head -X GET --retry 60 --retry-all-errors --retry-delay 1 http://localhost:8080/status'
42+
if: '${{ steps.step-4.outcome != ''success'' }}'
43+
- id: 'step-7'
44+
name: '[Fallback] Replace server URL in script'
45+
run: 'sed -i -e ''s/https:\/\/bindings.krzeminski.it/http:\/\/localhost:8080/g'' .github/workflows/end-to-end-tests.main.kts'
46+
if: '${{ steps.step-4.outcome != ''success'' }}'
47+
- id: 'step-8'
48+
name: '[Fallback] Execute script again'
49+
run: 'rm -f ''.github/workflows/end-to-end-tests-2nd-workflow.yaml'' && ''.github/workflows/end-to-end-tests.main.kts'''
50+
if: '${{ steps.step-4.outcome != ''success'' }}'
51+
- id: 'step-9'
3552
name: 'Consistency check'
3653
run: 'git diff --exit-code ''.github/workflows/end-to-end-tests-2nd-workflow.yaml'''
3754
another_job:

.github/workflows/end-to-end-tests.main.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ workflow(
4949
PullRequest(),
5050
),
5151
consistencyCheckJobConfig = DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG.copy(
52+
useLocalBindingsServerAsFallback = true,
5253
env = mapOf(
5354
"GITHUB_TOKEN" to expr("secrets.GITHUB_TOKEN")
5455
),
@@ -292,6 +293,7 @@ workflow(
292293
PullRequest(),
293294
),
294295
consistencyCheckJobConfig = DEFAULT_CONSISTENCY_CHECK_JOB_CONFIG.copy(
296+
useLocalBindingsServerAsFallback = true,
295297
checkoutActionVersion = CheckoutActionVersionSource.InferFromClasspath(),
296298
additionalSteps = {
297299
publishToMavenLocal()

.github/workflows/end-to-end-tests.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,25 @@ jobs:
3232
run: './gradlew publishToMavenLocal'
3333
- id: 'step-4'
3434
name: 'Execute script'
35+
continue-on-error: true
3536
run: 'rm ''.github/workflows/end-to-end-tests.yaml'' && ''.github/workflows/end-to-end-tests.main.kts'''
3637
- id: 'step-5'
38+
name: '[Fallback] Start the local server'
39+
run: 'docker run -p 8080:8080 krzema12/github-workflows-kt-jit-binding-server &'
40+
if: '${{ steps.step-4.outcome != ''success'' }}'
41+
- id: 'step-6'
42+
name: '[Fallback] Wait for the server'
43+
run: 'curl --head -X GET --retry 60 --retry-all-errors --retry-delay 1 http://localhost:8080/status'
44+
if: '${{ steps.step-4.outcome != ''success'' }}'
45+
- id: 'step-7'
46+
name: '[Fallback] Replace server URL in script'
47+
run: 'sed -i -e ''s/https:\/\/bindings.krzeminski.it/http:\/\/localhost:8080/g'' .github/workflows/end-to-end-tests.main.kts'
48+
if: '${{ steps.step-4.outcome != ''success'' }}'
49+
- id: 'step-8'
50+
name: '[Fallback] Execute script again'
51+
run: 'rm -f ''.github/workflows/end-to-end-tests.yaml'' && ''.github/workflows/end-to-end-tests.main.kts'''
52+
if: '${{ steps.step-4.outcome != ''success'' }}'
53+
- id: 'step-9'
3754
name: 'Consistency check'
3855
run: 'git diff --exit-code ''.github/workflows/end-to-end-tests.yaml'''
3956
test_job_1:

0 commit comments

Comments
 (0)