Skip to content

Commit

Permalink
Merge pull request #82 from smlambert/vendorRepos
Browse files Browse the repository at this point in the history
Add vendor parameters
  • Loading branch information
sophia-guo authored Jun 16, 2021
2 parents 67756a4 + d76bb2a commit 8914d53
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 35 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ You can also:
| target | _jdk_math |
| custom_target | |
| jdksource | upstream |
| openjdk_testRepo | openjdk-tests:master |
| openjdk_testRepo | aqa-tests:master |
| tkg_Repo | TKG:master |

### version
Expand All @@ -115,8 +115,8 @@ THe source of test against JDK. Default is `upstream`. Supported value is [`upst
- install-jdk: JDK installed by [AdoptOpenJDK/install-jdk](https://github.com/AdoptOpenJDK/install-jdk) | [actions/setup-java](https://github.com/actions/setup-java)
- github-hosted : pre-installed JDK on github-hosted environment

### openjdk_testRepo
Openjdk-tests git repo, that holds the definitions for the AQA test suite. Parameter can be set to use developer's personal repo.
### aqa_testRepo
aqa-tests git repo, that holds the definitions for the AQA test suite. Parameter can be set to use developer's personal repo.

### tkg_Repo
TKG git repo, the underlying framework for the AQA test suite. Parameter can be set to use developer's personal repo.
20 changes: 16 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: 'Running AQA test'
description: 'Running AQA test'
author: 'Sophia Guo'
inputs:
jdksource: # AdoptOpenJDK/install-jdk , github-hosted environment , upstream
jdksource: # AdoptOpenJDK/install-jdk, github-hosted environment, upstream
description: 'github-hosted default or customized'
default: 'upstream'
version: # jdk version
description: 'testing jdk version (Required when jdksource is github-hosted or install-jdk.)'
required: false
build_list: # test catagory
build_list: # test category
description:
default: 'openjdk'
target: # test
Expand All @@ -18,9 +18,9 @@ inputs:
description:
required: false
openjdk_testRepo:
description: 'openjdk Repo'
description: 'aqa-tests Repo'
required: false
default: 'openjdk-tests:master'
default: 'aqa-tests:master'
openj9_repo:
description: 'openj9 Repo'
required: false
Expand All @@ -29,6 +29,18 @@ inputs:
description: 'TKG Repo'
required: false
default: 'TKG:master'
vendor_testRepos:
description: 'Comma-separated list of vendor repositories'
required: false
vendor_testBranches:
description: 'Comma-separated list of vendor branches'
required: false
vendor_testDirs:
description: 'Comma-separated list of vendor directories'
required: false
vendor_testShas:
description: 'Comma-separated list of vendor SHAs'
required: false
runs:
using: 'node12'
main: 'dist/index.js'
41 changes: 29 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,11 @@ function run() {
const openjdktestRepo = core.getInput('openjdk_testRepo', { required: false });
const openj9Repo = core.getInput('openj9_repo', { required: false });
const tkgRepo = core.getInput('tkg_Repo', { required: false });
const vendorTestRepos = core.getInput('vendor_testRepos', { required: false });
const vendorTestBranches = core.getInput('vendor_testBranches', { required: false });
const vendorTestDirs = core.getInput('vendor_testDirs', { required: false });
const vendorTestShas = core.getInput('vendor_testShas', { required: false });
let vendorTestParams = '';
// let arch = core.getInput("architecture", { required: false })
if (jdksource !== 'upstream' &&
jdksource !== 'github-hosted' &&
Expand All @@ -2972,7 +2977,19 @@ function run() {
if (jdksource !== 'upstream' && version.length === 0) {
core.setFailed('Please provide jdkversion if jdksource is github-hosted installed or AdoptOpenJKD/install-jdk installed.');
}
yield runaqa.runaqaTest(version, jdksource, buildList, target, customTarget, openjdktestRepo, openj9Repo, tkgRepo);
if (vendorTestRepos !== '') {
vendorTestParams = `--vendor_repos ${vendorTestRepos}`;
}
if (vendorTestBranches !== '') {
vendorTestParams += ` --vendor_branches ${vendorTestBranches}`;
}
if (vendorTestDirs !== '') {
vendorTestParams += ` --vendor_dirs ${vendorTestDirs}`;
}
if (vendorTestShas !== '') {
vendorTestParams += ` --vendor_shas ${vendorTestShas}`;
}
yield runaqa.runaqaTest(version, jdksource, buildList, target, customTarget, openjdktestRepo, openj9Repo, tkgRepo, vendorTestParams);
}
catch (error) {
core.setFailed(error.message);
Expand Down Expand Up @@ -3374,25 +3391,25 @@ if (!tempDirectory) {
}
tempDirectory = path.join(baseLocation, 'actions', 'temp');
}
function runaqaTest(version, jdksource, buildList, target, customTarget, openjdktestRepo, openj9Repo, tkgRepo) {
function runaqaTest(version, jdksource, buildList, target, customTarget, openjdktestRepo, openj9Repo, tkgRepo, vendorTestParams) {
return __awaiter(this, void 0, void 0, function* () {
yield installDependencyAndSetup();
setSpec();
process.env.BUILD_LIST = buildList;
if (!('TEST_JDK_HOME' in process.env))
process.env.TEST_JDK_HOME = getTestJdkHome(version, jdksource);
yield getOpenjdkTestRepo(openjdktestRepo);
yield runGetSh(tkgRepo, openj9Repo);
yield runGetSh(tkgRepo, openj9Repo, vendorTestParams);
//Get Dependencies, using /*zip*/dependents.zip to avoid loop every available files
let dependents = yield tc.downloadTool('https://ci.adoptopenjdk.net/view/all/job/test.getDependency/lastSuccessfulBuild/artifact//*zip*/dependents.zip');
// Test.dependency only has one level of archive directory, none of actions toolkit support mv files by regex. Using 7zip discards the directory directly
yield exec.exec(`7z e ${dependents} -o${process.env.GITHUB_WORKSPACE}/openjdk-tests/TKG/lib`);
yield exec.exec(`7z e ${dependents} -o${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/lib`);
if (buildList.includes('system')) {
dependents = yield tc.downloadTool('https://ci.adoptopenjdk.net/view/all/job/systemtest.getDependency/lastSuccessfulBuild/artifact/*zip*/dependents.zip');
// System.dependency has different levels of archive structures archive/systemtest_prereqs/*.*
// None of io.mv, io.cp and exec.exec can mv directories as expected (mv archive/ ./). Move subfolder systemtest_prereqs instead.
const dependentPath = yield tc.extractZip(dependents, `${process.env.GITHUB_WORKSPACE}/openjdk-tests`);
yield io.mv(`${dependentPath}/archive/systemtest_prereqs`, `${process.env.GITHUB_WORKSPACE}/openjdk-tests`);
const dependentPath = yield tc.extractZip(dependents, `${process.env.GITHUB_WORKSPACE}/`);
yield io.mv(`${dependentPath}/archive/systemtest_prereqs`, `${process.env.GITHUB_WORKSPACE}/aqa-tests`);
yield io.rmRF(`${dependentPath}/archive`);
}
const options = {};
Expand Down Expand Up @@ -3500,15 +3517,15 @@ function setSpec() {
}
function getOpenjdkTestRepo(openjdktestRepo) {
return __awaiter(this, void 0, void 0, function* () {
let repoBranch = ['AdoptOpenJDK/openjdk-tests', 'master'];
if (openjdktestRepo !== 'openjdk-tests:master') {
let repoBranch = ['adoptium/aqa-tests', 'master'];
if (openjdktestRepo !== 'aqa-tests:master') {
repoBranch = parseRepoBranch(openjdktestRepo);
}
yield exec.exec(`git clone --depth 1 -b ${repoBranch[1]} https://github.com/${repoBranch[0]}.git`);
process.chdir('openjdk-tests');
process.chdir('aqa-tests');
});
}
function runGetSh(tkgRepo, openj9Repo) {
function runGetSh(tkgRepo, openj9Repo, vendorTestParams) {
return __awaiter(this, void 0, void 0, function* () {
let parameters = '';
if (tkgRepo !== 'TKG:master') {
Expand All @@ -3520,10 +3537,10 @@ function runGetSh(tkgRepo, openj9Repo) {
parameters += ` --openj9_branch ${repoBranch[1]} --openj9_repo https://github.com/${repoBranch[0]}.git`;
}
if (IS_WINDOWS) {
yield exec.exec(`bash ./get.sh ${parameters}`);
yield exec.exec(`bash ./get.sh ${parameters} ${vendorTestParams}`);
}
else {
yield exec.exec(`./get.sh ${parameters}`);
yield exec.exec(`./get.sh ${parameters} ${vendorTestParams}`);
}
});
}
Expand Down
12 changes: 9 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions src/aqa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ async function run(): Promise<void> {
const openjdktestRepo = core.getInput('openjdk_testRepo', {required: false})
const openj9Repo = core.getInput('openj9_repo', {required: false})
const tkgRepo = core.getInput('tkg_Repo', {required: false})
const vendorTestRepos = core.getInput('vendor_testRepos', {required: false})
const vendorTestBranches = core.getInput('vendor_testBranches', {required: false})
const vendorTestDirs = core.getInput('vendor_testDirs', {required: false})
const vendorTestShas = core.getInput('vendor_testShas', {required: false})

let vendorTestParams = ''
// let arch = core.getInput("architecture", { required: false })
if (
jdksource !== 'upstream' &&
Expand Down Expand Up @@ -39,7 +44,18 @@ async function run(): Promise<void> {
'Please provide jdkversion if jdksource is github-hosted installed or AdoptOpenJKD/install-jdk installed.'
)
}

if (vendorTestRepos !== '') {
vendorTestParams = `--vendor_repos ${vendorTestRepos}`
}
if (vendorTestBranches !== '') {
vendorTestParams += ` --vendor_branches ${vendorTestBranches}`
}
if (vendorTestDirs !== '') {
vendorTestParams += ` --vendor_dirs ${vendorTestDirs}`
}
if (vendorTestShas !== '') {
vendorTestParams += ` --vendor_shas ${vendorTestShas}`
}
await runaqa.runaqaTest(
version,
jdksource,
Expand All @@ -48,7 +64,8 @@ async function run(): Promise<void> {
customTarget,
openjdktestRepo,
openj9Repo,
tkgRepo
tkgRepo,
vendorTestParams
)
} catch (error) {
core.setFailed(error.message)
Expand Down
23 changes: 12 additions & 11 deletions src/runaqa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export async function runaqaTest(
customTarget: string,
openjdktestRepo: string,
openj9Repo: string,
tkgRepo: string
tkgRepo: string,
vendorTestParams: string
): Promise<void> {
await installDependencyAndSetup()
setSpec()
Expand All @@ -40,15 +41,15 @@ export async function runaqaTest(
process.env.TEST_JDK_HOME = getTestJdkHome(version, jdksource)

await getOpenjdkTestRepo(openjdktestRepo)
await runGetSh(tkgRepo, openj9Repo)
await runGetSh(tkgRepo, openj9Repo, vendorTestParams)

//Get Dependencies, using /*zip*/dependents.zip to avoid loop every available files
let dependents = await tc.downloadTool(
'https://ci.adoptopenjdk.net/view/all/job/test.getDependency/lastSuccessfulBuild/artifact//*zip*/dependents.zip'
)
// Test.dependency only has one level of archive directory, none of actions toolkit support mv files by regex. Using 7zip discards the directory directly
await exec.exec(
`7z e ${dependents} -o${process.env.GITHUB_WORKSPACE}/openjdk-tests/TKG/lib`
`7z e ${dependents} -o${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/lib`
)

if (buildList.includes('system')) {
Expand All @@ -59,11 +60,11 @@ export async function runaqaTest(
// None of io.mv, io.cp and exec.exec can mv directories as expected (mv archive/ ./). Move subfolder systemtest_prereqs instead.
const dependentPath = await tc.extractZip(
dependents,
`${process.env.GITHUB_WORKSPACE}/openjdk-tests`
`${process.env.GITHUB_WORKSPACE}/`
)
await io.mv(
`${dependentPath}/archive/systemtest_prereqs`,
`${process.env.GITHUB_WORKSPACE}/openjdk-tests`
`${process.env.GITHUB_WORKSPACE}/aqa-tests`
)
await io.rmRF(`${dependentPath}/archive`)
}
Expand Down Expand Up @@ -176,17 +177,17 @@ function setSpec(): void {
}

async function getOpenjdkTestRepo(openjdktestRepo: string): Promise<void> {
let repoBranch = ['AdoptOpenJDK/openjdk-tests', 'master']
if (openjdktestRepo !== 'openjdk-tests:master') {
let repoBranch = ['adoptium/aqa-tests', 'master']
if (openjdktestRepo !== 'aqa-tests:master') {
repoBranch = parseRepoBranch(openjdktestRepo)
}
await exec.exec(
`git clone --depth 1 -b ${repoBranch[1]} https://github.com/${repoBranch[0]}.git`
)
process.chdir('openjdk-tests')
process.chdir('aqa-tests')
}

async function runGetSh(tkgRepo: string, openj9Repo: string): Promise<void> {
async function runGetSh(tkgRepo: string, openj9Repo: string, vendorTestParams: string): Promise<void> {
let parameters = ''
if (tkgRepo !== 'TKG:master') {
const repoBranch = parseRepoBranch(tkgRepo)
Expand All @@ -199,9 +200,9 @@ async function runGetSh(tkgRepo: string, openj9Repo: string): Promise<void> {
}

if (IS_WINDOWS) {
await exec.exec(`bash ./get.sh ${parameters}`)
await exec.exec(`bash ./get.sh ${parameters} ${vendorTestParams}`)
} else {
await exec.exec(`./get.sh ${parameters}`)
await exec.exec(`./get.sh ${parameters} ${vendorTestParams}`)
}
}

Expand Down

0 comments on commit 8914d53

Please sign in to comment.