Skip to content

Remove tools.jar dependency from TKG #1009

Remove tools.jar dependency from TKG

Remove tools.jar dependency from TKG #1009

Workflow file for this run

name: "PR Comment Build Action for TKG"
on:
issue_comment:
types: [created]
jobs:
parseComment:
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, 'run aqa') && github.event.issue.pull_request
outputs:
workflow_url: ${{ steps.workflow_run_info.outputs.url }}
workflow_id: ${{ steps.workflow_run_info.outputs.id }}
build_parameters: ${{ steps.argparse.outputs.build_parameters }}
failed: ${{ steps.failure_report.outputs.failed }} # For reportStatus to check if parseComment has already reported a failure (in parsing).
steps:
- name: Get workflow run info
run: |
echo ::set-output name=url::$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
echo ::set-output name=id::$GITHUB_RUN_ID
id: workflow_run_info
# Checkout current (TKG) repo to access the repo-specific config file `.github/workflows/runAqaConfig.json` and the shared script `scripts/testRepo/runAqaArgParse.py`
- name: Checkout current repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'main'
- name: Parse parameters
env:
args: ${{ github.event.comment.body }}
run: python3 main/scripts/testBot/runAqaArgParse.py $args 2> log.txt
id: argparse
- name: Output log
if: failure()
# Store the contents of log.txt into an environment variable and escape characters to preserve newlines and other symbols.
run: |
log=$(cat log.txt)
log="${log//'%'/'%25'}"
log="${log//$'\n'/'%0A'}"
log="${log//$'\r'/'%0D'}"
log="${log/$'`'/'\`'}"
echo ::set-output name=log::$log
id: output_log
- name: Create error comment
if: failure()
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }}
\`\`\`
${{ steps.output_log.outputs.log }}
\`\`\`
No builds were started.
`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
- name: Failure report
if: failure()
run: echo ::set-output name=failed::true
id: failure_report
- name: Create success comment
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) started with the following parameters:
- sdk_resource: ${{ steps.argparse.outputs.sdk_resource }}
- build_repo: ${{ steps.argparse.outputs.build_repo }}
- customized_sdk_url: ${{ steps.argparse.outputs.customized_sdk_url }}
- archive_extension: ${{ steps.argparse.outputs.archive_extension }}
- build_list: ${{ steps.argparse.outputs.build_list }}
- target: ${{ steps.argparse.outputs.target }}
- platform: ${{ steps.argparse.outputs.platform }}
- jdk_version: ${{ steps.argparse.outputs.jdk_version }}
- jdk_impl: ${{ steps.argparse.outputs.jdk_impl }}
- openjdk_testrepo: ${{ steps.argparse.outputs.openjdk_testrepo }}
- openj9_repo: ${{ steps.argparse.outputs.openj9_repo }}
Workflow Run ID: [${{ steps.workflow_run_info.outputs.id }}](${{ steps.workflow_run_info.outputs.url }})
`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
- name: Echo all parameters
run: |
echo ${{ steps.argparse.outputs.build_parameters }}
runBuild:
runs-on: ${{ matrix.platform }}
needs: parseComment
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parseComment.outputs.build_parameters) }}
steps:
- uses: AdoptOpenJDK/install-jdk@v1
if: matrix.sdk_resource == 'nightly' || matrix.sdk_resource == 'releases'
with:
version: ${{ matrix.jdk_version }}
source: ${{ matrix.sdk_resource }}
sourceType: 'buildType'
impl: ${{ matrix.jdk_impl }}
- name: Checkout PR Ref
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: matrix.sdk_resource == 'build-jdk'
with:
repository: ${{ matrix.build_repo_branch.repo }}
ref: ${{ matrix.build_repo_branch.branch }}
path: 'openjdk-build'
- uses: AdoptOpenJDK/build-jdk@v1
if: matrix.sdk_resource == 'build-jdk'
id: buildJDK
with:
javaToBuild: jdk${{ matrix.jdk_version }}u
impl: ${{ matrix.jdk_impl }}
usePRRef: true # usePRRef=true will cause build-jdk to use the existing openjdk-build/ directory > See https://github.com/AdoptOpenJDK/build-jdk/issues/24#issuecomment-816322945
- uses: AdoptOpenJDK/install-jdk@v1
if: matrix.sdk_resource == 'customized'
with:
version: ${{ matrix.jdk_version }}
source: ${{ matrix.customized_sdk_url }}
archiveExtension: ${{ matrix.archive_extension }}
sourceType: 'url'
impl: ${{ matrix.jdk_impl }}
# get-pr step by @Simran-B https://github.com/actions/checkout/issues/331#issuecomment-707103442
- uses: actions/[email protected]
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: AQA with install-jdk
uses: adoptium/run-aqa@v2
if: matrix.sdk_resource != 'build-jdk'
with:
build_list: ${{ matrix.build_list }}
target: ${{ matrix.target }}
jdksource: 'install-jdk'
version: ${{ matrix.jdk_version }}
openjdk_testRepo: ${{ matrix.openjdk_testrepo }}
openj9_repo: ${{ matrix.openj9_repo }}
tkg_Repo: '${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}:${{ fromJSON(steps.get-pr.outputs.result).head.ref }}'
- name: AQA with build-jdk
uses: adoptium/run-aqa@v2
if: matrix.sdk_resource == 'build-jdk'
env:
TEST_JDK_HOME: ${{ steps.buildJDK.outputs.BuildJDKDir }}
with:
build_list: ${{ matrix.build_list }}
target: ${{ matrix.target }}
version: ${{ matrix.jdk_version }}
openjdk_testRepo: ${{ matrix.openjdk_testrepo }}
openj9_repo: ${{ matrix.openj9_repo }}
tkg_Repo: '${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}:${{ fromJSON(steps.get-pr.outputs.result).head.ref }}'
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: failure()
with:
name: test_output
path: ./**/output_*/
reportFailure:
runs-on: ubuntu-latest
needs: [parseComment, runBuild]
if: failure() && !needs.parseComment.outputs.failed
steps:
- name: Create comment
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) failed.
Workflow Run ID: [${{ needs.parseComment.outputs.workflow_id }}](${{ needs.parseComment.outputs.workflow_url }})
`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
reportCancelled:
runs-on: ubuntu-latest
needs: [parseComment, runBuild]
if: cancelled()
steps:
- name: Create comment
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) cancelled.
Workflow Run ID: [${{ needs.parseComment.outputs.workflow_id }}](${{ needs.parseComment.outputs.workflow_url }})
`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
reportSuccess:
runs-on: ubuntu-latest
needs: [parseComment, runBuild]
if: success()
steps:
- name: Create comment
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) successful.
Workflow Run ID: [${{ needs.parseComment.outputs.workflow_id }}](${{ needs.parseComment.outputs.workflow_url }})
`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})