diff --git a/.github/workflows/__autobuild-direct-tracing-with-working-dir.yml b/.github/workflows/__autobuild-direct-tracing-with-working-dir.yml index 325d8c2d97..2cff8956e7 100644 --- a/.github/workflows/__autobuild-direct-tracing-with-working-dir.yml +++ b/.github/workflows/__autobuild-direct-tracing-with-working-dir.yml @@ -21,9 +21,19 @@ on: schedule: - cron: '0 5 * * *' workflow_dispatch: - inputs: {} + inputs: + java-version: + type: string + description: The version of Java to install + required: false + default: '17' workflow_call: - inputs: {} + inputs: + java-version: + type: string + description: The version of Java to install + required: false + default: '17' jobs: autobuild-direct-tracing-with-working-dir: strategy: @@ -54,6 +64,11 @@ jobs: version: ${{ matrix.version }} use-all-platform-bundle: 'false' setup-kotlin: 'true' + - name: Install Java + uses: actions/setup-java@v4 + with: + java-version: ${{ inputs.java-version || '17' }} + distribution: temurin - name: Test setup shell: bash run: | diff --git a/.github/workflows/__autobuild-direct-tracing.yml b/.github/workflows/__autobuild-direct-tracing.yml index 882174eab5..58273261f2 100644 --- a/.github/workflows/__autobuild-direct-tracing.yml +++ b/.github/workflows/__autobuild-direct-tracing.yml @@ -21,9 +21,19 @@ on: schedule: - cron: '0 5 * * *' workflow_dispatch: - inputs: {} + inputs: + java-version: + type: string + description: The version of Java to install + required: false + default: '17' workflow_call: - inputs: {} + inputs: + java-version: + type: string + description: The version of Java to install + required: false + default: '17' jobs: autobuild-direct-tracing: strategy: @@ -54,6 +64,11 @@ jobs: version: ${{ matrix.version }} use-all-platform-bundle: 'false' setup-kotlin: 'true' + - name: Install Java + uses: actions/setup-java@v4 + with: + java-version: ${{ inputs.java-version || '17' }} + distribution: temurin - name: Set up Java test repo configuration shell: bash run: | diff --git a/pr-checks/checks/autobuild-direct-tracing-with-working-dir.yml b/pr-checks/checks/autobuild-direct-tracing-with-working-dir.yml index e6ba989176..2cfab107c5 100644 --- a/pr-checks/checks/autobuild-direct-tracing-with-working-dir.yml +++ b/pr-checks/checks/autobuild-direct-tracing-with-working-dir.yml @@ -5,6 +5,7 @@ description: > autobuild Action. operatingSystems: ["ubuntu", "windows"] versions: ["linked", "nightly-latest"] +installJava: "true" env: CODEQL_ACTION_AUTOBUILD_BUILD_MODE_DIRECT_TRACING: true steps: diff --git a/pr-checks/checks/autobuild-direct-tracing.yml b/pr-checks/checks/autobuild-direct-tracing.yml index edc6122f13..9eb404459f 100644 --- a/pr-checks/checks/autobuild-direct-tracing.yml +++ b/pr-checks/checks/autobuild-direct-tracing.yml @@ -2,6 +2,7 @@ name: "Autobuild direct tracing" description: "An end-to-end integration test of a Java repository built using 'build-mode: autobuild', with direct tracing enabled" operatingSystems: ["ubuntu", "windows"] versions: ["linked", "nightly-latest"] +installJava: "true" env: CODEQL_ACTION_AUTOBUILD_BUILD_MODE_DIRECT_TRACING: true steps: @@ -19,7 +20,7 @@ steps: db-location: "${{ runner.temp }}/customDbLocation" languages: java tools: ${{ steps.prepare-test.outputs.tools-url }} - + - name: Check that indirect tracing is disabled shell: bash run: | diff --git a/pr-checks/sync.py b/pr-checks/sync.py index b937e43bb1..dafb7f5216 100755 --- a/pr-checks/sync.py +++ b/pr-checks/sync.py @@ -114,9 +114,7 @@ def writeHeader(checkStream): }, ] - installGo = False - if checkSpecification.get('installGo'): - installGo = True if checkSpecification['installGo'].lower() == "true" else False + installGo = checkSpecification.get('installGo', '').lower() == 'true' if installGo: baseGoVersionExpr = '>=1.21.0' @@ -138,6 +136,26 @@ def writeHeader(checkStream): } }) + installJava = checkSpecification.get('installJava', '').lower() == 'true' + + if installJava: + baseJavaVersionExpr = '17' + workflowInputs['java-version'] = { + 'type': 'string', + 'description': 'The version of Java to install', + 'required': False, + 'default': baseJavaVersionExpr, + } + + steps.append({ + 'name': 'Install Java', + 'uses': 'actions/setup-java@v4', + 'with': { + 'java-version': '${{ inputs.java-version || \'' + baseJavaVersionExpr + '\' }}', + 'distribution': 'temurin' + } + }) + # If container initialisation steps are present in the check specification, # make sure to execute them first. if 'container' in checkSpecification and 'container-init-steps' in checkSpecification: