Skip to content

Commit

Permalink
support custom_target
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophia Guo committed May 12, 2020
1 parent 0aaf44c commit 79a6303
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "build-test"
on: # rebuild any PRs and main branch changes
push:
branches:
- feature
branches-ignore:
- '**'

jobs:
build: # make sure build/ci work properly
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/testcustom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "build-test"
on: # rebuild any PRs and main branch changes
push:

jobs:
build: # make sure build/ci work properly
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v1
- uses: AdoptOpenJDK/install-jdk@v1
with:
version: '11'
targets: 'JDK_11'
- name: AQA
uses: ./
with:
version: '11'
jdksource: 'install-jdk'
build_list: 'openjdk'
target: '_jdk_custom'
custom_target: 'test/jdk/java/math/BigInteger/BigIntegerTest.java'
24 changes: 24 additions & 0 deletions .github/workflows/testexample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "build-test"
on: # rebuild any PRs and main branch changes
push:

jobs:
build: # make sure build/ci work properly
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] #[ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v1
- uses: AdoptOpenJDK/install-jdk@v1
with:
version: '11'
targets: 'JDK_11'
- name: AQA
uses: ./
with:
version: '11'
jdksource: 'install-jdk'
build_list: 'openjdk'
target: '_jdk_custom'
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>run-aqa</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ inputs:
default: 'openjdk'
target: # test
description:
default: '_jdk_custom'
default: '_jdk_math'
custom_target:
description:
required: false
runs:
using: 'node12'
main: 'dist/index.js'
11 changes: 8 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2890,6 +2890,7 @@ function run() {
const version = core.getInput('version', { required: false });
const buildList = core.getInput('build_list', { required: false });
const target = core.getInput('target', { required: false });
const customTarget = core.getInput('custom_target', { required: false });
// let arch = core.getInput("architecture", { required: false })
if (jdksource !== 'upstream' &&
jdksource !== 'github-hosted' &&
Expand All @@ -2906,7 +2907,7 @@ 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);
yield runaqa.runaqaTest(version, jdksource, buildList, target, customTarget);
}
catch (error) {
core.setFailed(error.message);
Expand Down Expand Up @@ -3237,9 +3238,13 @@ const io = __importStar(__webpack_require__(1));
const tc = __importStar(__webpack_require__(533));
const path = __importStar(__webpack_require__(622));
const isWindows = process.platform === 'win32';
function runaqaTest(version, jdksource, buildList, target) {
function runaqaTest(version, jdksource, buildList, target, customTarget) {
return __awaiter(this, void 0, void 0, function* () {
yield installDependency();
let customOption = '';
if (target.includes('custom') && customTarget !== '') {
customOption = `${target.toUpperCase()}_TARGET=${customTarget}`;
}
process.env.BUILD_LIST = buildList;
if (!('TEST_JDK_HOME' in process.env))
process.env.TEST_JDK_HOME = getTestJdkHome(version, jdksource);
Expand All @@ -3260,7 +3265,7 @@ function runaqaTest(version, jdksource, buildList, target) {
process.chdir('TKG');
try {
yield exec.exec('make compile');
yield exec.exec('make', [`${target}`], options);
yield exec.exec('make', [`${target} ${customOption}`], options);
}
catch (error) {
core.setFailed(error.message);
Expand Down
3 changes: 2 additions & 1 deletion src/aqa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ async function run(): Promise<void> {
const version = core.getInput('version', {required: false})
const buildList = core.getInput('build_list', {required: false})
const target = core.getInput('target', {required: false})
const customTarget = core.getInput('custom_target',{required: false})
// let arch = core.getInput("architecture", { required: false })
if (
jdksource !== 'upstream' &&
Expand Down Expand Up @@ -35,7 +36,7 @@ async function run(): Promise<void> {
)
}

await runaqa.runaqaTest(version, jdksource, buildList, target)
await runaqa.runaqaTest(version, jdksource, buildList, target, customTarget)
} catch (error) {
core.setFailed(error.message)
}
Expand Down
9 changes: 7 additions & 2 deletions src/runaqa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ export async function runaqaTest(
version: string,
jdksource: string,
buildList: string,
target: string
target: string,
customTarget: string
): Promise<void> {
await installDependency()
let customOption = ''
if (target.includes('custom') && customTarget !== '') {
customOption = `${target.toUpperCase()}_TARGET=${customTarget}`
}
process.env.BUILD_LIST = buildList
if (!('TEST_JDK_HOME' in process.env)) process.env.TEST_JDK_HOME = getTestJdkHome(version, jdksource)

Expand All @@ -36,7 +41,7 @@ export async function runaqaTest(
process.chdir('TKG')
try {
await exec.exec('make compile')
await exec.exec('make', [`${target}`], options)
await exec.exec('make', [`${target} ${customOption}`], options)
} catch (error) {
core.setFailed(error.message)
}
Expand Down

0 comments on commit 79a6303

Please sign in to comment.