1+ #
2+ # Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
3+ # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ #
5+ # The Universal Permissive License (UPL), Version 1.0
6+ #
7+ # Subject to the condition set forth below, permission is hereby granted to any
8+ # person obtaining a copy of this software, associated documentation and/or
9+ # data (collectively the "Software"), free of charge and under any and all
10+ # copyright rights in the Software, and any and all patent rights owned or
11+ # freely licensable by each licensor hereunder covering either (i) the
12+ # unmodified Software as contributed to or provided by such licensor, or (ii)
13+ # the Larger Works (as defined below), to deal in both
14+ #
15+ # (a) the Software, and
16+ #
17+ # (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
18+ # one is included with the Software each a "Larger Work" to which the Software
19+ # is contributed by such licensors),
20+ #
21+ # without restriction, including without limitation the rights to copy, create
22+ # derivative works of, display, perform, and distribute the Software and make,
23+ # use, sell, offer for sale, import, export, have made, and have sold the
24+ # Software and the Larger Work(s), and to sublicense the foregoing rights on
25+ # either these or other terms.
26+ #
27+ # This license is subject to the following condition:
28+ #
29+ # The above copyright notice and either this complete permission notice or at a
30+ # minimum a reference to the UPL must be included in all copies or substantial
31+ # portions of the Software.
32+ #
33+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39+ # SOFTWARE.
40+ #
41+
42+ name : Build GraalVM JDK
43+ description : ' Build GraalVM JDK and set up environment for testing'
44+
45+ on :
46+ workflow_call :
47+ inputs :
48+ env :
49+ description : ' Internal env name for build'
50+ required : false
51+ type : string
52+ dynamic-imports :
53+ default : ' /substratevm'
54+ description : ' Internal dynamic imports for build'
55+ required : false
56+ type : string
57+ native-images :
58+ default : ' native-image'
59+ description : ' Internal GraalVM native images to build'
60+ required : false
61+ type : string
62+ components :
63+ default : ' Native Image'
64+ description : ' Internal GraalVM components to build'
65+ required : false
66+ type : string
67+ java-version :
68+ default : ' '
69+ description : ' Java version to use'
70+ required : false
71+ type : string
72+ # Enable manual dispatch of the workflow
73+ # see https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
74+ workflow_dispatch :
75+
76+ jobs :
77+ build_from_source :
78+ runs-on : ubuntu-22.04
79+ steps :
80+ - name : Set up environment variables
81+ shell : bash
82+ run : |
83+ echo "GRAALVM_HOME=${{ github.workspace }}/graalvm" >> ${GITHUB_ENV}
84+ echo "JAVA_HOME=${{ github.workspace }}/labsjdk" >> ${GITHUB_ENV}
85+ echo "MX_GIT_CACHE=refcache" >> ${GITHUB_ENV}
86+ echo "MX_PATH=${{ github.workspace }}/mx" >> ${GITHUB_ENV}
87+ echo "MX_PYTHON=python3.8" >> ${GITHUB_ENV}
88+ echo "MX_VERSION=$(jq -r '.mx_version' common.json)" >> ${GITHUB_ENV}
89+ # Workaround testsuite locale issue
90+ echo "LANG=en_US.UTF-8" >> ${GITHUB_ENV}
91+ - name : Checkout graalvm/mx
92+ uses : actions/checkout@v6
93+ with :
94+ repository : graalvm/mx
95+ ref : ${{ env.MX_VERSION }}
96+ path : ${{ env.MX_PATH }}
97+ - name : Set up Python
98+ uses : actions/setup-python@v6
99+ with :
100+ python-version : ' 3.8'
101+ - name : Fetch LabsJDK
102+ shell : bash
103+ run : |
104+ mkdir jdk-dl
105+ ${MX_PATH}/mx --java-home= fetch-jdk --jdk-id labsjdk-ce-latest --to jdk-dl --alias ${JAVA_HOME}
106+ - name : Build GraalVM JDK
107+ shell : bash
108+ run : |
109+ cd vm
110+ if [ -n "${{ inputs.env }}" ]; then
111+ MX_ARGS='--java-home="${JAVA_HOME}" --env="${{ inputs.env }}"'
112+ else
113+ MX_ARGS='--java-home="${JAVA_HOME}" --dy="${{ inputs.dynamic-imports }}" --native-images="${{ inputs.native-images }}" --components="${{ inputs.components }}"'
114+ fi
115+ ${MX_PATH}/mx $MX_ARGS build
116+ ln -s $(${MX_PATH}/mx $MX_ARGS graalvm-home) ${GRAALVM_HOME}
117+ - name : Show GraalVM JDK version info
118+ shell : bash
119+ run : |
120+ echo "= 'java --version' ============"
121+ ${GRAALVM_HOME}/bin/java --version
122+ echo "==============================="
123+
124+ if [ -f "${GRAALVM_HOME}/bin/native-image" ]; then
125+ echo "= 'native-image --version' ===="
126+ ${GRAALVM_HOME}/bin/native-image --version
127+ echo "==============================="
128+ fi
129+ - name : Tar GraalVM JDK
130+ shell : bash
131+ run : tar -czvhf graalvm-jdk.tgz -C $(dirname ${GRAALVM_HOME}) $(basename ${GRAALVM_HOME})
132+ - name : Upload GraalVM JDK build as artifact
133+ uses : actions/upload-artifact@v4
134+ with :
135+ name : graalvm-jdk
136+ path : graalvm-jdk.tgz
137+
0 commit comments