Set MaxRAM and MaxRAMPercentage in launcher for native-image driver #410
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
paths: | |
- 'build.java' | |
- '.github/workflows/buildJDK.yml' | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
paths: | |
- 'build.java' | |
- '.github/workflows/buildJDK.yml' | |
env: | |
MX_GIT_CACHE: refcache | |
JAVA_HOME: ${{ github.workspace }}/jdk | |
MAC_JAVA_HOME: ${{ github.workspace }}/jdk/Contents/Home | |
MANDREL_REPO: ${{ github.workspace }}/mandrel | |
MX_HOME: ${{ github.workspace }}/mx | |
# This ought to be a valid version parseable by Version.parse() | |
MANDREL_VERSION: 10.9.8.7-dev | |
MX_PYTHON: python3 | |
# The following aims to reduce CI CPU cycles by: | |
# 1. Cancelling any previous builds of this PR when pushing new changes to it | |
# 2. Cancelling any previous builds of a branch when pushing new changes to it in a fork | |
# 3. Cancelling any pending builds, but not active ones, when pushing to a branch in the main | |
# repository. This prevents us from constantly cancelling CI runs, while being able to skip | |
# intermediate builds. E.g., if we perform two pushes the first one will start a CI job and | |
# the second one will add another one to the queue; if we perform a third push while the | |
# first CI job is still running the previously queued CI job (for the second push) will be | |
# cancelled and a new CI job will be queued for the latest (third) push. | |
concurrency: | |
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}" | |
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'graalvm/mandrel-packaging' }} | |
jobs: | |
build-and-test: | |
name: Linux Build and test ${{ matrix.mandrel-ref }} branch/tag | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
mandrel-ref: [mandrel/23.1] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: graalvm/mandrel.git | |
fetch-depth: 1 | |
ref: ${{ matrix.mandrel-ref }} | |
path: ${{ github.workspace }}/mandrel | |
- uses: actions/checkout@v3 | |
with: | |
repository: graalvm/mx.git | |
fetch-depth: 1 | |
ref: 6.45.0 | |
path: ${{ github.workspace }}/mx | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.mx | |
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} | |
restore-keys: | | |
${{ runner.os }}-mx- | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.quarkus-name }}-maven- | |
- name: Get latest OpenJDK 21 with static libs | |
run: | | |
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/linux/x64/jdk/hotspot/normal/eclipse -o jdk.tar.gz | |
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/linux/x64/staticlibs/hotspot/normal/eclipse -o jdk-static-libs.tar.gz | |
mkdir -p ${JAVA_HOME} | |
tar xf jdk.tar.gz -C ${JAVA_HOME} --strip-components=1 | |
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1 | |
echo ${JAVA_HOME} | |
${JAVA_HOME}/bin/java --version | |
- name: Build Mandrel JDK | |
run: | | |
${JAVA_HOME}/bin/java -ea build.java --verbose --mx-home ${MX_HOME} --mandrel-repo ${MANDREL_REPO} --mandrel-version "${MANDREL_VERSION}" --archive-suffix tar.gz | |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )" | |
export ARCHIVE_NAME="mandrel-java21-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz" | |
mv ${ARCHIVE_NAME} mandrel-java21-linux-amd64.tar.gz | |
- name: Smoke tests | |
run: | | |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )" | |
export MANDREL_HOME=${PWD}/mandrel-java21-${MANDREL_VERSION_UNTIL_SPACE} | |
${MANDREL_HOME}/bin/native-image --version | |
${MANDREL_HOME}/bin/native-image --version | grep "${MANDREL_VERSION}" | |
echo " | |
public class HelloStrict { | |
public static void main(String[] args) { | |
System.out.printf( | |
\"Hello %1$,.12f %2$,.12f %3$,.12f %n\" | |
, StrictMath.cos(0.0) | |
, StrictMath.IEEEremainder(3.0, 5.0) | |
, StrictMath.IEEEremainder(-16.3, 4.1) | |
); | |
} | |
} | |
" > HelloStrict.java | |
${MANDREL_HOME}/bin/javac HelloStrict.java | |
${MANDREL_HOME}/bin/java HelloStrict | tee java.txt | |
${MANDREL_HOME}/bin/native-image HelloStrict | |
./hellostrict | tee native.txt | |
diff java.txt native.txt | |
${MANDREL_HOME}/bin/native-image --macro:native-image-launcher | |
${MANDREL_HOME}/bin/native-image --version | |
- name: Upload Mandrel build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mandrel-java21-linux-amd64-test-build | |
path: mandrel-java21-linux-amd64.tar.gz | |
- name: Build Mandrel JDK with tarxz suffix | |
run: | | |
${JAVA_HOME}/bin/java -ea build.java --mx-home ${MX_HOME} --mandrel-repo ${MANDREL_REPO} --mandrel-version "${MANDREL_VERSION}" --archive-suffix tarxz --skip-clean --skip-java --skip-native | |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )" | |
export ARCHIVE_NAME="mandrel-java21-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tarxz" | |
mv ${ARCHIVE_NAME} mandrel-java21-linux-amd64.tarxz | |
- name: Upload tarxz Mandrel build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mandrel-java21-linux-amd64-test-build-tarxz | |
path: mandrel-java21-linux-amd64.tarxz | |
build-and-test-on-mac: | |
name: MacOS Build and test ${{ matrix.mandrel-ref }} branch/tag | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
mandrel-ref: [mandrel/23.1] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: graalvm/mandrel.git | |
fetch-depth: 1 | |
ref: ${{ matrix.mandrel-ref }} | |
path: ${{ github.workspace }}/mandrel | |
- uses: actions/checkout@v3 | |
with: | |
repository: graalvm/mx.git | |
fetch-depth: 1 | |
ref: 6.45.0 | |
path: ${{ github.workspace }}/mx | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.mx | |
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} | |
restore-keys: | | |
${{ runner.os }}-mx- | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.quarkus-name }}-maven- | |
- name: Get latest OpenJDK 21 with static libs | |
run: | | |
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/mac/x64/jdk/hotspot/normal/eclipse -o jdk.tar.gz | |
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/mac/x64/staticlibs/hotspot/normal/eclipse -o jdk-static-libs.tar.gz | |
mkdir -p ${JAVA_HOME} | |
tar xf jdk.tar.gz -C ${JAVA_HOME} --strip-components=1 | |
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1 | |
echo ${MAC_JAVA_HOME} | |
${MAC_JAVA_HOME}/bin/java --version | |
- name: Build Mandrel JDK | |
run: | | |
export JAVA_HOME=${MAC_JAVA_HOME} | |
${MAC_JAVA_HOME}/bin/java -ea build.java --verbose --mx-home ${MX_HOME} --mandrel-repo ${MANDREL_REPO} --mandrel-version "${MANDREL_VERSION}" --archive-suffix tar.gz | |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )" | |
export ARCHIVE_NAME="mandrel-java21-darwin-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz" | |
mv ${ARCHIVE_NAME} mandrel-java21-darwin-amd64.tar.gz | |
- name: Smoke tests | |
run: | | |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )" | |
export MANDREL_HOME=${PWD}/mandrel-java21-${MANDREL_VERSION_UNTIL_SPACE}/Contents/Home | |
${MANDREL_HOME}/bin/native-image --version | |
${MANDREL_HOME}/bin/native-image --version | grep "${MANDREL_VERSION}" | |
echo " | |
public class HelloStrict { | |
public static void main(String[] args) { | |
System.out.printf( | |
\"Hello %1$,.12f %2$,.12f %3$,.12f %n\" | |
, StrictMath.cos(0.0) | |
, StrictMath.IEEEremainder(3.0, 5.0) | |
, StrictMath.IEEEremainder(-16.3, 4.1) | |
); | |
} | |
} | |
" > HelloStrict.java | |
${MANDREL_HOME}/bin/javac HelloStrict.java | |
${MANDREL_HOME}/bin/java HelloStrict | tee java.txt | |
${MANDREL_HOME}/bin/native-image HelloStrict | |
./hellostrict | tee native.txt | |
diff java.txt native.txt | |
${MANDREL_HOME}/bin/native-image --macro:native-image-launcher | |
${MANDREL_HOME}/bin/native-image --version | |
- name: Upload Mandrel build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mandrel-java21-darwin-amd64-test-build | |
path: mandrel-java21-darwin-amd64.tar.gz | |
build-and-test-on-windows: | |
name: Windows Build and test ${{ matrix.mandrel-ref }} branch/tag | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false | |
matrix: | |
mandrel-ref: [mandrel/23.1] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: graalvm/mandrel.git | |
fetch-depth: 1 | |
ref: ${{ matrix.mandrel-ref }} | |
path: ${{ github.workspace }}/mandrel | |
- uses: actions/checkout@v3 | |
with: | |
repository: graalvm/mx.git | |
fetch-depth: 1 | |
ref: 6.45.0 | |
path: ${{ github.workspace }}/mx | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.mx | |
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} | |
restore-keys: | | |
${{ runner.os }}-mx- | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.quarkus-name }}-maven- | |
- name: Get latest OpenJDK 21 with static libs | |
run: | | |
$wc = New-Object System.Net.WebClient | |
$wc.DownloadFile("https://api.adoptium.net/v3/binary/latest/21/ea/windows/x64/jdk/hotspot/normal/eclipse", "$Env:temp\jdk.zip") | |
Expand-Archive "$Env:temp\jdk.zip" -DestinationPath "$Env:temp" | |
Move-Item -Path "$Env:temp\jdk-*" -Destination $Env:JAVA_HOME | |
$wc.DownloadFile("https://api.adoptium.net/v3/binary/latest/21/ea/windows/x64/staticlibs/hotspot/normal/eclipse", "$Env:temp\jdk-staticlibs.zip") | |
Expand-Archive "$Env:temp\jdk-staticlibs.zip" -DestinationPath "$Env:temp" | |
Move-Item -Path "$Env:temp\jdk-*\lib\static" -Destination $Env:JAVA_HOME\lib\ | |
Remove-Item -Recurse "$Env:temp\jdk-*" | |
& $Env:JAVA_HOME\bin\java -version | |
- name: Build Mandrel | |
run: | | |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt" | |
Get-Content "$Env:temp\vcvars64.txt" | Foreach-Object { | |
if ($_ -match "^(.*?)=(.*)$") { | |
Set-Content "Env:\$($matches[1])" $matches[2] | |
} | |
} | |
& $Env:JAVA_HOME\bin\java -ea build.java ` | |
--verbose ` | |
--mx-home $Env:MX_HOME ` | |
--mandrel-version $Env:MANDREL_VERSION ` | |
--mandrel-repo $Env:MANDREL_REPO ` | |
--archive-suffix zip | |
- name: Smoke tests | |
run: | | |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt" | |
Get-Content "$Env:temp\vcvars64.txt" | Foreach-Object { | |
if ($_ -match "^(.*?)=(.*)$") { | |
Set-Content "Env:\$($matches[1])" $matches[2] | |
} | |
} | |
$MANDREL_VERSION_UNTIL_SPACE=$Env:MANDREL_VERSION -replace "^(.*?) .*$","`$1" | |
$MANDREL_HOME=".\mandrel-java21-$MANDREL_VERSION_UNTIL_SPACE" | |
$VERSION=(& $MANDREL_HOME\bin\native-image.cmd --version) | |
Write-Host $VERSION | |
if ("$VERSION" -NotMatch "$Env:MANDREL_VERSION") { | |
exit 1 | |
} | |
Set-Content -Path 'HelloStrict.java' -Value " | |
public class HelloStrict { | |
public static void main(String[] args) { | |
System.out.printf( | |
`"Hello %1$,.12f %2$,.12f %3$,.12f %n`" | |
, StrictMath.cos(0.0) | |
, StrictMath.IEEEremainder(3.0, 5.0) | |
, StrictMath.IEEEremainder(-16.3, 4.1) | |
); | |
} | |
} | |
" | |
& $MANDREL_HOME\bin\javac HelloStrict.java | |
& $MANDREL_HOME\bin\java HelloStrict | Set-Content java.txt | |
& $MANDREL_HOME\bin\native-image.cmd HelloStrict | |
& ./hellostrict | Set-Content native.txt | |
$DIFF=(Compare-Object -CaseSensitive (Get-Content java.txt) (Get-Content native.txt)) | |
if ($DIFF -ne $null) { | |
Write-Host $DIFF | |
exit 1 | |
} | |
& ${MANDREL_HOME}/bin/native-image.cmd --macro:native-image-launcher | |
- name: Rename mandrel archive | |
shell: bash | |
run: | | |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )" | |
export ARCHIVE_NAME="mandrel-java21-windows-amd64-${MANDREL_VERSION_UNTIL_SPACE}.zip" | |
mv ${ARCHIVE_NAME} mandrel-java21-windows-amd64.zip | |
- name: Upload Mandrel build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mandrel-java21-windows-amd64-test-build | |
path: mandrel-java21-windows-amd64.zip | |
build-and-test-2-step: | |
name: 2-step Linux Build and test ${{ matrix.mandrel-ref }} branch/tag | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
mandrel-ref: [mandrel/23.1] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: graalvm/mandrel.git | |
fetch-depth: 1 | |
ref: ${{ matrix.mandrel-ref }} | |
path: ${{ github.workspace }}/mandrel | |
- uses: actions/checkout@v3 | |
with: | |
repository: graalvm/mx.git | |
fetch-depth: 1 | |
ref: 6.45.0 | |
path: ${{ github.workspace }}/mx | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.mx | |
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} | |
restore-keys: | | |
${{ runner.os }}-mx- | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.quarkus-name }}-maven- | |
- name: Get latest OpenJDK 21 with static libs | |
run: | | |
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/linux/x64/jdk/hotspot/normal/eclipse -o jdk.tar.gz | |
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/linux/x64/staticlibs/hotspot/normal/eclipse -o jdk-static-libs.tar.gz | |
mkdir -p ${JAVA_HOME} | |
tar xf jdk.tar.gz -C ${JAVA_HOME} --strip-components=1 | |
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1 | |
echo ${JAVA_HOME} | |
${JAVA_HOME}/bin/java --version | |
- name: Build Mandrel JDK | |
run: | | |
# Build the Java bits | |
${JAVA_HOME}/bin/java -ea build.java \ | |
--verbose \ | |
--mx-home ${MX_HOME} \ | |
--mandrel-repo ${MANDREL_REPO} \ | |
--mandrel-version "${MANDREL_VERSION}" \ | |
--skip-native \ | |
--maven-install \ | |
--maven-deploy \ | |
--maven-version "${MANDREL_VERSION}-mysuffix0001" \ | |
--maven-repo-id myRepo \ | |
--maven-url "file:///tmp/myRepo" \ | |
--mandrel-home temp-build | |
# Build the native bits | |
./temp-build/bin/java -ea build.java \ | |
--verbose \ | |
--mx-home ${MX_HOME} \ | |
--mandrel-repo ${MANDREL_REPO} \ | |
--mandrel-version "${MANDREL_VERSION}" \ | |
--skip-java \ | |
--archive-suffix tar.gz | |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )" | |
export ARCHIVE_NAME="mandrel-java21-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz" | |
mv ${ARCHIVE_NAME} mandrel-java21-linux-amd64.tar.gz | |
- name: Smoke tests | |
run: | | |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )" | |
export MANDREL_HOME=${PWD}/mandrel-java21-${MANDREL_VERSION_UNTIL_SPACE} | |
${MANDREL_HOME}/bin/native-image --version | |
${MANDREL_HOME}/bin/native-image --version | grep "${MANDREL_VERSION}" | |
echo " | |
public class HelloStrict { | |
public static void main(String[] args) { | |
System.out.printf( | |
\"Hello %1$,.12f %2$,.12f %3$,.12f %n\" | |
, StrictMath.cos(0.0) | |
, StrictMath.IEEEremainder(3.0, 5.0) | |
, StrictMath.IEEEremainder(-16.3, 4.1) | |
); | |
} | |
} | |
" > HelloStrict.java | |
${MANDREL_HOME}/bin/javac HelloStrict.java | |
${MANDREL_HOME}/bin/java HelloStrict | tee java.txt | |
${MANDREL_HOME}/bin/native-image HelloStrict | |
./hellostrict | tee native.txt | |
diff java.txt native.txt | |
${MANDREL_HOME}/bin/native-image --macro:native-image-launcher | |
${MANDREL_HOME}/bin/native-image --version | |
- name: Upload Mandrel build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mandrel-java21-linux-amd64-2step-test-build | |
path: mandrel-java21-linux-amd64.tar.gz |