Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prebuild container as test environments #245

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@ on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
openjdk: # make sure build/ci work properly
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: AQA
uses: ./
with:
version: '11'
jdksource: 'github-hosted'
build_list: 'openjdk'
target: '_jdk_custom'
openjdk_disto: # make sure build/ci work properly with other distros
runs-on: ubuntu-latest
container:
Expand All @@ -38,3 +23,25 @@ jobs:
jdksource: 'github-hosted'
build_list: 'openjdk'
target: '_jdk_custom'
test_container: # make sure build/ci work properly with other distros
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image: ['ghcr.io/adoptium/test-containers:ubuntu2204']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
java-version: '17'
distribution: 'temurin'
- name: AQA
uses: ./
with:
version: '17'
jdksource: 'install-jdk'
build_list: 'openjdk'
target: '_jdk_custom'
prebuildContainer: 'true'
33 changes: 17 additions & 16 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function run() {
const vendorTestShas = core.getInput('vendor_testShas', { required: false });
const runParallel = core.getInput('run_parallel', { required: false });
const numMachines = core.getInput('num_machines', { required: false });
let prebuildContainer = core.getInput('prebuildContainer', { required: false });
let vendorTestParams = '';
// let arch = core.getInput("architecture", { required: false })
if (jdksource !== 'upstream' &&
Expand Down Expand Up @@ -112,11 +113,14 @@ function run() {
if (sdkdir === '') {
sdkdir = process.cwd();
}
if (prebuildContainer === '') {
prebuildContainer = 'false';
}
if (runParallel === 'true' && numMachines != '1') {
yield runaqa.setupParallelEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, numMachines);
yield runaqa.setupParallelEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, numMachines, prebuildContainer);
}
else {
yield runaqa.runaqaTest(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, customTarget, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo);
yield runaqa.runaqaTest(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, customTarget, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, prebuildContainer);
}
}
catch (error) {
Expand Down Expand Up @@ -221,11 +225,12 @@ if (!tempDirectory) {
* @param {[string]} tkgRepo Alternative TKG repo
* @param {[string]} vendorTestParams Vendor provided test parameters
* @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo
* @param {[string]} prebuildContainer if environment need to update
* @return {[null]} null
*/
function runaqaTest(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, customTarget, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo) {
function runaqaTest(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, customTarget, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, prebuildContainer) {
return __awaiter(this, void 0, void 0, function* () {
yield setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo);
yield setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, prebuildContainer);
const options = {};
let myOutput = '';
options.listeners = {
Expand Down Expand Up @@ -363,15 +368,13 @@ function installPlatformDependencies() {
else if (fs.existsSync('/usr/bin/yum')) {
// RPM Based
yield exec.exec('sudo yum update -y');
yield exec.exec('sudo yum install p7zip -y');
const antContribFile = yield tc.downloadTool(`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`);
yield tc.extractZip(`${antContribFile}`, `${tempDirectory}`);
yield io.cp(`${tempDirectory}/ant-contrib/lib/ant-contrib.jar`, `${process.env.ANT_HOME}\\lib`);
}
else if (fs.existsSync('/sbin/apk')) {
// Alpine Based
yield exec.exec('apk update');
yield exec.exec('apk add p7zip');
const antContribFile = yield tc.downloadTool(`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`);
yield tc.extractZip(`${antContribFile}`, `${tempDirectory}`);
yield io.cp(`${tempDirectory}/ant-contrib/lib/ant-contrib.jar`, `${process.env.ANT_HOME}\\lib`);
Expand Down Expand Up @@ -503,11 +506,12 @@ function runGetSh(tkgRepo, openj9Repo, vendorTestParams, jdksource, customizedSd
* @param {[string]} tkgRepo Alternative TKG repo
* @param {[string]} vendorTestParams Vendor provided test parameters
* @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo
* @param {[string]} prebuildContainer if environment need to update
* @return {[null]} null
*/
function setupParallelEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, numMachines) {
function setupParallelEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, numMachines, prebuildContainer) {
return __awaiter(this, void 0, void 0, function* () {
yield setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo);
yield setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, prebuildContainer);
process.chdir('TKG');
process.env.PARALLEL_OPTIONS = `PARALLEL_OPTIONS=TEST=${target} TEST_TIME= NUM_MACHINES=${numMachines}`;
yield exec.exec(`make genParallelList ${process.env.PARALLEL_OPTIONS}`);
Expand Down Expand Up @@ -548,9 +552,11 @@ function setupEnvVariables(version, jdksource, buildList, sdkdir) {
* @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo
* @return {null} null
*/
function setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo) {
function setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, prebuildContainer) {
return __awaiter(this, void 0, void 0, function* () {
yield installPlatformDependencies();
if (prebuildContainer == "false") {
yield installPlatformDependencies();
}
setupEnvVariables(version, jdksource, buildList, sdkdir);
yield getAqaTestsRepo(aqatestsRepo, version, buildList);
yield runGetSh(tkgRepo, openj9Repo, vendorTestParams, jdksource, customizedSdkUrl, sdkdir);
Expand All @@ -561,12 +567,7 @@ function setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, t
}
// 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');
let sevenzexe = '7z';
if (fs.existsSync('/usr/bin/yum')) {
sevenzexe = '7za';
}
// 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(`${sevenzexe} e -y ${dependents} -o${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/lib`);
yield exec.exec(`unzip -j ${dependents} -d ${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/lib`);
if (buildList.includes('system')) {
if (aqasystemtestsRepo && aqasystemtestsRepo.length !== 0) {
getAqaSystemTestsRepo(aqasystemtestsRepo);
Expand Down
10 changes: 8 additions & 2 deletions src/aqa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ async function run(): Promise<void> {
const vendorTestShas = core.getInput('vendor_testShas', {required: false})
const runParallel = core.getInput('run_parallel', {required: false})
const numMachines = core.getInput('num_machines', {required: false})
let prebuildContainer = core.getInput('prebuildContainer', {required: false})
let vendorTestParams = ''
// let arch = core.getInput("architecture", { required: false })
if (
Expand Down Expand Up @@ -74,6 +75,9 @@ async function run(): Promise<void> {
if (sdkdir === '') {
sdkdir = process.cwd()
}
if (prebuildContainer === '') {
prebuildContainer = 'false'
}
if(runParallel === 'true' && numMachines != '1') {

await runaqa.setupParallelEnv(
Expand All @@ -88,7 +92,8 @@ async function run(): Promise<void> {
tkgRepo,
vendorTestParams,
aqasystemtestsRepo,
numMachines
numMachines,
prebuildContainer
)
}
else {
Expand All @@ -104,7 +109,8 @@ async function run(): Promise<void> {
openj9Repo,
tkgRepo,
vendorTestParams,
aqasystemtestsRepo
aqasystemtestsRepo,
prebuildContainer
)
}
} catch (error) {
Expand Down
30 changes: 15 additions & 15 deletions src/runaqa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ if (!tempDirectory) {
* @param {[string]} tkgRepo Alternative TKG repo
* @param {[string]} vendorTestParams Vendor provided test parameters
* @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo
* @param {[string]} prebuildContainer if environment need to update
* @return {[null]} null
*/
export async function runaqaTest(
Expand All @@ -52,7 +53,8 @@ export async function runaqaTest(
openj9Repo: string,
tkgRepo: string,
vendorTestParams: string,
aqasystemtestsRepo: string
aqasystemtestsRepo: string,
prebuildContainer: string
): Promise<void> {

await setupTestEnv(
Expand All @@ -66,7 +68,8 @@ export async function runaqaTest(
openj9Repo,
tkgRepo,
vendorTestParams,
aqasystemtestsRepo
aqasystemtestsRepo,
prebuildContainer
);

const options: ExecOptions = {}
Expand Down Expand Up @@ -211,7 +214,6 @@ async function installPlatformDependencies(): Promise<void> {
} else if (fs.existsSync('/usr/bin/yum')) {
// RPM Based
await exec.exec('sudo yum update -y')
await exec.exec('sudo yum install p7zip -y')
const antContribFile = await tc.downloadTool(
`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`
)
Expand All @@ -223,7 +225,6 @@ async function installPlatformDependencies(): Promise<void> {
} else if (fs.existsSync('/sbin/apk')) {
// Alpine Based
await exec.exec('apk update')
await exec.exec('apk add p7zip')
const antContribFile = await tc.downloadTool(
`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`
)
Expand Down Expand Up @@ -367,6 +368,7 @@ async function runGetSh(
* @param {[string]} tkgRepo Alternative TKG repo
* @param {[string]} vendorTestParams Vendor provided test parameters
* @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo
* @param {[string]} prebuildContainer if environment need to update
* @return {[null]} null
*/
export async function setupParallelEnv(
Expand All @@ -381,10 +383,11 @@ export async function setupParallelEnv(
tkgRepo: string,
vendorTestParams: string,
aqasystemtestsRepo: string,
numMachines: string
numMachines: string,
prebuildContainer: string
): Promise<void> {

await setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo);
await setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, prebuildContainer);
process.chdir('TKG');
process.env.PARALLEL_OPTIONS = `PARALLEL_OPTIONS=TEST=${target} TEST_TIME= NUM_MACHINES=${numMachines}`;
await exec.exec(`make genParallelList ${process.env.PARALLEL_OPTIONS}`);
Expand Down Expand Up @@ -438,9 +441,12 @@ async function setupTestEnv(
openj9Repo: string,
tkgRepo: string,
vendorTestParams: string,
aqasystemtestsRepo: string
aqasystemtestsRepo: string,
prebuildContainer: string
): Promise<void> {
await installPlatformDependencies();
if (prebuildContainer == "false") {
await installPlatformDependencies();
}
setupEnvVariables(version, jdksource, buildList, sdkdir);
await getAqaTestsRepo(aqatestsRepo, version, buildList);
await runGetSh(tkgRepo, openj9Repo, vendorTestParams, jdksource, customizedSdkUrl, sdkdir);
Expand All @@ -453,13 +459,7 @@ async function setupTestEnv(

// 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');
let sevenzexe = '7z';
if (fs.existsSync('/usr/bin/yum')) {
sevenzexe = '7za';
}

// 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(`${sevenzexe} e -y ${dependents} -o${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/lib`);
await exec.exec(`unzip -j ${dependents} -d ${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/lib`);
if (buildList.includes('system')) {
if (aqasystemtestsRepo && aqasystemtestsRepo.length !== 0) {
getAqaSystemTestsRepo(aqasystemtestsRepo);
Expand Down
Loading