Skip to content

Commit 1476a6f

Browse files
authored
Merge pull request #175 from Icohedron/build-jdk
Run AQA Workflow: Implement build-jdk sdk_resource, Remove redundant checkouts
2 parents 32303ce + d39cb9d commit 1476a6f

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

.github/workflows/runAqa.yml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,15 @@ jobs:
1717
echo ::set-output name=url::$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
1818
echo ::set-output name=id::$GITHUB_RUN_ID
1919
id: workflow_run_info
20-
# Checkout current repo to access the repo-specific config file `.github/workflows/runAqaConfig.json`
20+
# Checkout current (TKG) repo to access the repo-specific config file `.github/workflows/runAqaConfig.json` and the shared script `scripts/testRepo/runAqaArgParse.py`
2121
- name: Checkout current repo
2222
uses: actions/checkout@v2
2323
with:
2424
path: 'main'
25-
# Checkout the main TKG repo to access the shared script `scripts/testRepo/runAqaArgParse.py`
26-
- name: Checkout main TKG repo
27-
uses: actions/checkout@v2
28-
with:
29-
repository: 'adoptium/TKG.git'
30-
ref: 'master'
31-
path: 'TKG'
3225
- name: Parse parameters
3326
env:
3427
args: ${{ github.event.comment.body }}
35-
run: python3 TKG/scripts/testBot/runAqaArgParse.py $args 2> log.txt
28+
run: python3 main/scripts/testBot/runAqaArgParse.py $args 2> log.txt
3629
id: argparse
3730
- name: Output log
3831
if: failure()
@@ -76,6 +69,7 @@ jobs:
7669
comment_body = `
7770
@${{ github.actor }} Build(s) started with the following parameters:
7871
- sdk_resource: ${{ steps.argparse.outputs.sdk_resource }}
72+
- build_repo: ${{ steps.argparse.outputs.build_repo }}
7973
- customized_sdk_url: ${{ steps.argparse.outputs.customized_sdk_url }}
8074
- archive_extension: ${{ steps.argparse.outputs.archive_extension }}
8175
- build_list: ${{ steps.argparse.outputs.build_list }}
@@ -93,18 +87,9 @@ jobs:
9387
repo: context.repo.repo,
9488
body: comment_body
9589
})
96-
- name: Echo parameters
90+
- name: Echo all parameters
9791
run: |
98-
echo build_parameters: ${{ steps.argparse.outputs.build_parameters }}
99-
echo sdk_resource: ${{ steps.argparse.outputs.sdk_resource }}
100-
echo customized_sdk_url: ${{ steps.argparse.outputs.customized_sdk_url }}
101-
echo archive_extension: ${{ steps.argparse.outputs.archive_extension }}
102-
echo build_list: ${{ steps.argparse.outputs.build_list }}
103-
echo target: ${{ steps.argparse.outputs.target }}
104-
echo platform: ${{ steps.argparse.outputs.platform }}
105-
echo jdk_version: ${{ steps.argparse.outputs.jdk_version }}
106-
echo jdk_impl: ${{ steps.argparse.outputs.jdk_impl }}
107-
echo openjdk_testrepo: ${{ steps.argparse.outputs.openjdk_testrepo }}
92+
echo ${{ steps.argparse.outputs.build_parameters }}
10893
10994
runBuild:
11095
runs-on: ${{ matrix.platform }}
@@ -114,12 +99,25 @@ jobs:
11499
matrix: ${{ fromJson(needs.parseComment.outputs.build_parameters) }}
115100
steps:
116101
- uses: AdoptOpenJDK/install-jdk@v1
117-
if: matrix.sdk_resource != 'customized'
102+
if: matrix.sdk_resource == 'nightly' || matrix.sdk_resource == 'releases'
118103
with:
119104
version: ${{ matrix.jdk_version }}
120105
source: ${{ matrix.sdk_resource }}
121106
sourceType: 'buildType'
122107
impl: ${{ matrix.jdk_impl }}
108+
- name: Checkout PR Ref
109+
uses: actions/checkout@v2
110+
if: matrix.sdk_resource == 'build-jdk'
111+
with:
112+
repository: ${{ matrix.build_repo_branch.repo }}
113+
ref: ${{ matrix.build_repo_branch.branch }}
114+
path: 'openjdk-build'
115+
- uses: AdoptOpenJDK/build-jdk@v1
116+
if: matrix.sdk_resource == 'build-jdk'
117+
with:
118+
javaToBuild: jdk${{ matrix.jdk_version }}u
119+
impl: ${{ matrix.jdk_impl }}
120+
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
123121
- uses: AdoptOpenJDK/install-jdk@v1
124122
if: matrix.sdk_resource == 'customized'
125123
with:

scripts/testBot/runAqaArgParse.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def main():
4646
parser = argparse.ArgumentParser(prog=keyword, add_help=False)
4747
# Improvement: Automatically resolve the valid choices for each argument populate them below, rather than hard-coding choices.
4848
parser.add_argument('--help', '-h', action='store_true')
49-
parser.add_argument('--sdk_resource', default=['nightly'], choices=['nightly', 'releases', 'customized'], nargs='+')
49+
parser.add_argument('--sdk_resource', default=['nightly'], choices=['nightly', 'releases', 'customized', 'build-jdk'], nargs='+')
50+
parser.add_argument('--build_repo', default=['AdoptOpenJDK/openjdk-build:master'], nargs='+')
5051
parser.add_argument('--customized_sdk_url', default=['None'], nargs='+')
5152
parser.add_argument('--archive_extension', default=['.tar'], choices=['.zip', '.tar', '.7z'], nargs='+')
5253
parser.add_argument('--build_list', default=['openjdk'], choices=['openjdk', 'functional', 'system', 'perf', 'external'], nargs='+')
@@ -88,6 +89,20 @@ def main():
8889
# Underscore the targets if necessary
8990
args['target'] = underscore_targets(args['target'])
9091

92+
# Split repo and branch from the `build_repo` arg since it is not handled by the AdoptOpenJDK/build-jdk action.
93+
build_repo_branch = []
94+
for br in args['build_repo']:
95+
spl = br.split(':')
96+
if len(spl) != 2:
97+
err_msg = 'Invalid repo+branch suppplied to argument --build_repo. Expecting format <repository>:<branch>'
98+
print('::error ::{}'.format(err_msg))
99+
sys.stderr.write(err_msg)
100+
exit(2)
101+
repo, branch = spl
102+
entry = {'repo': repo, 'branch': branch}
103+
build_repo_branch.append(entry)
104+
args['build_repo_branch'] = build_repo_branch
105+
91106
# If 'customized' sdk_resource, then customized_sdk_url and archive_extension must be present.
92107
if 'customized' in args['sdk_resource'] and args['customized_sdk_url'] == ['None']:
93108
err_msg = '--customized_sdk_url must be provided if sdk_resource is set to customized.'

0 commit comments

Comments
 (0)