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