Skip to content

Commit

Permalink
[Misc] update GHA config
Browse files Browse the repository at this point in the history
Summary: as title

Testing: CI pipline

Reviewers: lei.yul, sendaoYan

Issue: #651
  • Loading branch information
Accelerator1996 committed Jul 2, 2024
1 parent cf827ca commit 605df6b
Show file tree
Hide file tree
Showing 9 changed files with 935 additions and 270 deletions.
62 changes: 62 additions & 0 deletions .github/actions/build-serverless-adapter/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#
# Copyright (c) 2024 Alibaba Group Holding Limited. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Alibaba designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#

name: 'Build serverless-adapter'
description: 'Build it using built JDK'
inputs:
java-home:
required: true

runs:
using: composite
steps:
- name: 'Checkout serverless-adapter source code'
id: serverless_adapter_checkout
uses: actions/checkout@v3
with:
repository: dragonwell-project/serverless-adapter-jdk8
ref: main
path: serverless-adapter

- name: 'Install dependencies'
id: install_dep
run: |
mkdir -p maven
wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
tar -xvf apache-maven-3.8.8-bin.tar.gz -C maven --strip-components=1
echo "maven_home=${GITHUB_WORKSPACE}/maven/bin" >> $GITHUB_OUTPUT
shell: bash

- name: 'Build serverless-adapter'
id: serverless_adapter_build
run: |
export JAVA_HOME=${{ inputs.java-home }}
export PATH=${{ inputs.java-home }}/bin:${{ steps.install_dep.outputs.maven_home }}:$PATH
mvn package
shell: bash
working-directory: serverless-adapter

- name: 'Copy serverless-adapter into boot jdk'
run: |
mkdir -p ${{ inputs.java-home }}/jre/lib/serverless
cp -f serverless-adapter/target/serverless-adapter-0.1.jar ${{ inputs.java-home }}/jre/lib/serverless/serverless-adapter.jar
cp -f serverless-adapter/output/libloadclassagent.so ${{ inputs.java-home }}/jre/lib/serverless/libloadclassagent.so
shell: bash
54 changes: 54 additions & 0 deletions .github/actions/get-bootjdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

inputs:
platform:
description: 'Platform name'
required: true
outputs:
boot_jdk:
value: ${{ steps.get_jdk.outputs.boot_jdk }}

runs:
using: composite
steps:
- name: 'Determine jdk url'
id: get_jdk_url
run: |
if [ "${{ inputs.platform }}" = "x86_64" ] ; then
echo "jdk_url= https://dragonwell.oss-cn-shanghai.aliyuncs.com/8.15.16/Alibaba_Dragonwell_Extended_8.15.16_x64_linux.tar.gz" >> $GITHUB_OUTPUT
elif [ "${{ inputs.platform }}" = "aarch64" ] ; then
echo "jdk_url= https://dragonwell.oss-cn-shanghai.aliyuncs.com/8.15.16/Alibaba_Dragonwell_Extended_8.15.16_aarch64_linux.tar.gz" >> $GITHUB_OUTPUT
fi
shell: bash

- name: 'Get jdk'
id: get_jdk
run: |
wget ${{ steps.get_jdk_url.outputs.jdk_url }} -O jdk.tar.gz
mkdir -p bootJdk
tar zxvf jdk.tar.gz -C bootJdk --strip-components=1
echo "boot_jdk=${PWD}/bootJdk" >> $GITHUB_OUTPUT
shell: bash
111 changes: 111 additions & 0 deletions .github/actions/get-bundles/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

name: 'Get bundles'
description: 'Download resulting JDK bundles'
inputs:
platform:
description: 'Platform name'
required: true
debug-suffix:
description: 'File name suffix denoting debug level, possibly empty'
required: false
bundle_id:
required: true
outputs:
jdk-path:
description: 'Path to the installed JDK bundle'
value: ${{ steps.path-name.outputs.jdk }}
symbols-path:
description: 'Path to the installed symbols bundle'
value: ${{ steps.path-name.outputs.symbols }}
tests-path:
description: 'Path to the installed tests bundle'
value: ${{ steps.path-name.outputs.tests }}

runs:
using: composite
steps:
- name: 'Download bundles artifact'
id: download-bundles
uses: actions/download-artifact@v3
with:
name: ${{ inputs.platform }}-${{ matrix.debug-suffix }}-image-${{ inputs.bundle_id }}
path: bundles
continue-on-error: true

- name: 'Download bundles artifact (retry)'
uses: actions/download-artifact@v3
with:
name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }}
path: bundles
if: steps.download-bundles.outcome == 'failure'

- name: 'Unpack bundles'
run: |
if [[ -e bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip ]]; then
echo 'Unpacking jdk bundle...'
mkdir -p bundles/jdk
unzip -q bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip -d bundles/jdk
fi
if [[ -e bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then
echo 'Unpacking jdk bundle...'
mkdir -p bundles/jdk
tar -xf bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/jdk --strip-components=1
fi
if [[ -e bundles/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then
echo 'Unpacking symbols bundle...'
mkdir -p bundles/symbols
tar -xf bundles/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/symbols --strip-components=1
fi
if [[ -e bundles/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then
echo 'Unpacking tests bundle...'
mkdir -p bundles/tests
tar -xf bundles/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/tests --strip-components=1
fi
shell: bash

- name: 'Export paths to where bundles are installed'
id: path-name
run: |
# Export the paths
jdk_dir="$GITHUB_WORKSPACE/$(dirname $(find bundles/jdk -name bin -type d))"
symbols_dir="$GITHUB_WORKSPACE/$(dirname $(find bundles/symbols -name bin -type d))"
tests_dir="$GITHUB_WORKSPACE/bundles/tests"
if [[ '${{ runner.os }}' == 'Windows' ]]; then
jdk_dir="$(cygpath $jdk_dir)"
symbols_dir="$(cygpath $symbols_dir)"
tests_dir="$(cygpath $tests_dir)"
fi
echo "jdk=$jdk_dir" >> $GITHUB_OUTPUT
echo "symbols=$symbols_dir" >> $GITHUB_OUTPUT
echo "tests=$tests_dir" >> $GITHUB_OUTPUT
shell: bash
68 changes: 68 additions & 0 deletions .github/actions/get-jtreg/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

name: 'Get JTReg'
description: 'Download JTReg from cache or source location'
outputs:
path:
description: 'Path to the installed JTReg'
value: ${{ steps.path-name.outputs.path }}

runs:
using: composite
steps:
- name: 'Get JTReg version configuration'
id: version
run: |
jtreg_version=`grep -h 'JTREG_VERSION' make/conf/test-dependencies | cut -d '=' -f 2`
echo "value=${jtreg_version}" >> $GITHUB_OUTPUT
shell: bash

- name: 'Checkout the JTReg source'
uses: actions/checkout@v4
with:
repository: openjdk/jtreg
ref: jtreg${{ steps.version.outputs.value }}-b01
path: jtreg/src
if: steps.get-cached-jtreg.outputs.cache-hit != 'true'

- name: 'Build JTReg'
run: |
# Build JTReg and move files to the proper locations
jdkPath="$(which java)"
javaHome=${jdkPath%%'/bin'*}
bash make/build.sh --jdk "$javaHome"
mkdir ../installed
mv build/images/jtreg/* ../installed
working-directory: jtreg/src
shell: bash
if: steps.get-cached-jtreg.outputs.cache-hit != 'true'

- name: 'Export path to where JTReg is installed'
id: path-name
run: |
# Export the path
echo 'path=jtreg/installed' >> $GITHUB_OUTPUT
shell: bash
Loading

0 comments on commit 605df6b

Please sign in to comment.