Skip to content

Commit 3119b35

Browse files
committed
Add template option for installing Java
1 parent 777f917 commit 3119b35

File tree

5 files changed

+59
-5
lines changed

5 files changed

+59
-5
lines changed

.github/workflows/__autobuild-direct-tracing-with-working-dir.yml

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__autobuild-direct-tracing.yml

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/autobuild-direct-tracing-with-working-dir.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ description: >
55
autobuild Action.
66
operatingSystems: ["ubuntu", "windows"]
77
versions: ["linked", "nightly-latest"]
8+
installJava: "true"
89
env:
910
CODEQL_ACTION_AUTOBUILD_BUILD_MODE_DIRECT_TRACING: true
1011
steps:

pr-checks/checks/autobuild-direct-tracing.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: "Autobuild direct tracing"
22
description: "An end-to-end integration test of a Java repository built using 'build-mode: autobuild', with direct tracing enabled"
33
operatingSystems: ["ubuntu", "windows"]
44
versions: ["linked", "nightly-latest"]
5+
installJava: "true"
56
env:
67
CODEQL_ACTION_AUTOBUILD_BUILD_MODE_DIRECT_TRACING: true
78
steps:
@@ -19,7 +20,7 @@ steps:
1920
db-location: "${{ runner.temp }}/customDbLocation"
2021
languages: java
2122
tools: ${{ steps.prepare-test.outputs.tools-url }}
22-
23+
2324
- name: Check that indirect tracing is disabled
2425
shell: bash
2526
run: |

pr-checks/sync.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,28 @@ def writeHeader(checkStream):
138138
}
139139
})
140140

141+
installJava = False
142+
if checkSpecification.get('installJava'):
143+
installJava = True if checkSpecification['installJava'].lower() == "true" else False
144+
145+
if installJava:
146+
baseJavaVersionExpr = '17'
147+
workflowInputs['java-version'] = {
148+
'type': 'string',
149+
'description': 'The version of Java to install',
150+
'required': False,
151+
'default': baseJavaVersionExpr,
152+
}
153+
154+
steps.append({
155+
'name': 'Install Java',
156+
'uses': 'actions/setup-java@v4',
157+
'with': {
158+
'java-version': '${{ inputs.java-version || \'' + baseJavaVersionExpr + '\' }}',
159+
'distribution': 'temurin'
160+
}
161+
})
162+
141163
# If container initialisation steps are present in the check specification,
142164
# make sure to execute them first.
143165
if 'container' in checkSpecification and 'container-init-steps' in checkSpecification:

0 commit comments

Comments
 (0)