-
Notifications
You must be signed in to change notification settings - Fork 65
198 lines (173 loc) · 8.38 KB
/
build-with-bal-test-graalvm-template.yml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Build with bal test graalvm
on:
workflow_call:
inputs:
lang_tag:
description: Branch/Release Tag of the Ballerina Lang
type: string
required: false
default: master
lang_version:
description: Ballerina Lang Version (If given ballerina lang buid will be skipped)
type: string
required: false
default: ''
native_image_options:
description: Default native-image options
type: string
required: false
default: ''
additional_ubuntu_build_flags:
required: false
type: string
default: ''
additional_windows_build_flags:
required: false
type: string
default: ''
java_tool_options:
required: false
type: string
default: ''
jobs:
ubuntu-build-with-bal-test-graalvm:
name: Build with bal test graalvm on Ubuntu
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'Skip GraalVM Check')
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Checkout Ballerina Lang Repository
if: ${{ inputs.lang_version == '' }}
uses: actions/checkout@v3
with:
repository: 'ballerina-platform/ballerina-lang'
ref: ${{ inputs.lang_tag || 'master' }}
- name: Set Ballerina Lang version
run: |
if ${{ inputs.lang_version != ''}}; then
LANG_VERSION=${{ inputs.lang_version }}
else
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
LANG_VERSION=$VERSION-NATIVE
fi
echo "BALLERINA_LANG_VERSION=$LANG_VERSION" >> $GITHUB_ENV
echo "BALLERINA_LANG_VERSION: $LANG_VERSION"
- name: Build Ballerina Lang
if: ${{ inputs.lang_version == '' }}
run: |
perl -pi -e "s/^\s*version=.*/version=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties
./gradlew build -x test publishToMavenLocal --scan --no-daemon
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
set-java-home: 'false'
- name: Check GraalVM installation
run: |
echo "GRAALVM_HOME: ${{ env.GRAALVM_HOME }}"
echo "JAVA_HOME: ${{ env.JAVA_HOME }}"
native-image --version
- name: Checkout Module Repository
uses: actions/checkout@v3
- name: Set default native-image options
if: ${{ inputs.native_image_options != '' }}
run: |
CURRENT_DIR=$(pwd)
echo "NativeImageArgs = ${{ inputs.native_image_options }}" > default_native.properties
echo "NATIVE_IMAGE_CONFIG_FILE=$CURRENT_DIR/default_native.properties" >> $GITHUB_ENV
echo "NATIVE_IMAGE_CONFIG_FILE: $CURRENT_DIR/default_native.properties"
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
run: |
perl -pi -e "s/^\s*ballerinaLangVersion=.*/ballerinaLangVersion=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties
./gradlew build -PbalGraalVMTest ${{ inputs.additional_ubuntu_build_flags }}
windows-build-with-bal-test-graalvm:
name: Build with bal test graalvm on Windows
runs-on: windows-latest
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'Skip GraalVM Check')
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Git configure long path
run: git config --global core.longpaths true
- name: Checkout Ballerina Lang Repository
if: ${{ inputs.lang_version == '' }}
uses: actions/checkout@v3
with:
repository: 'ballerina-platform/ballerina-lang'
ref: ${{ inputs.lang_tag || 'master' }}
- name: Set Ballerina Lang version
run: |
if ("${{ inputs.lang_version }}" -eq "") {
$properties = convertfrom-stringdata (get-content ./gradle.properties -raw)
$LANG_VERSION = $properties.'version'.split("-",2)[0] + "-NATIVE"
} else {
$LANG_VERSION = "${{ inputs.lang_version }}"
}
"BALLERINA_LANG_VERSION=$LANG_VERSION" >> $env:GITHUB_ENV
Write-Output "BALLERINA_LANG_VERSION: $LANG_VERSION"
- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@v1.3
with:
minimum-size: 10GB
maximum-size: 16GB
- name: Get configured pagefile base size
run: (Get-CimInstance Win32_PageFileUsage).AllocatedBaseSize
- name: Build Ballerina Lang
if: ${{ inputs.lang_version == '' }}
run: |
perl -pi -e "s/^\s*version=.*/version=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties
./gradlew.bat build -x test publishToMavenLocal --continue -x javadoc --stacktrace -scan --console=plain --no-daemon --no-parallel
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
set-java-home: 'false'
- name: Check GraalVM installation
run: |
Write-Output GRAALVM_HOME: "${{ env.GRAALVM_HOME }}"
Write-Output JAVA_HOME: "${{ env.JAVA_HOME }}"
native-image --version
git config --system core.longpaths true
- name: Checkout Module Repository
uses: actions/checkout@v3
- name: Set default native-image options
if: ${{ inputs.native_image_options != '' }}
run: |
$CURRENT_DIR = (Get-Location).tostring()
$DEFAULT_PROPS = $CURRENT_DIR + "\" + "default_native.properties"
$create_file = New-Item $DEFAULT_PROPS
Set-Content $DEFAULT_PROPS "NativeImageArgs = ${{ inputs.native_image_options }}"
"NATIVE_IMAGE_CONFIG_FILE=$DEFAULT_PROPS" >> $env:GITHUB_ENV
Write-Output "NATIVE_IMAGE_CONFIG_FILE: $DEFAULT_PROPS"
- name: Set JAVA tool options
if: ${{ inputs.java_tool_options != '' }}
run: |
"JAVA_TOOL_OPTIONS=${{ inputs.java_tool_options }}" >> $env:GITHUB_ENV
Write-Output "JAVA_TOOL_OPTIONS=${{ inputs.java_tool_options }}"
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
run: |
perl -pi -e "s/^\s*ballerinaLangVersion=.*/ballerinaLangVersion=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties
./gradlew.bat build -PbalGraalVMTest ${{ inputs.additional_windows_build_flags }}