Skip to content

Support 4-digit mx versions #549

Support 4-digit mx versions

Support 4-digit mx versions #549

Workflow file for this run

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
PYTHONIOENCODING: utf-8
# 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/24.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
- name: Checkout MX
run: |
VERSION=$(jq -r .mx_version ${MANDREL_REPO}/common.json)
git clone ${GITHUB_SERVER_URL}/graalvm/mx --depth 1 --branch ${VERSION} ${MX_HOME}
./mx/mx --version
- 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 23 with static libs
run: |
curl -sL https://api.adoptium.net/v3/binary/latest/23/ea/linux/x64/jdk/hotspot/normal/eclipse -o jdk.tar.gz
curl -sL https://api.adoptium.net/v3/binary/latest/23/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: Use python 3.10
# The minimum supported version is 3.9 see https://github.com/graalvm/mx/issues/249
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build Mandrel JDK
run: |
${JAVA_HOME}/bin/java -ea build.java --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-java23-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz"
mv ${ARCHIVE_NAME} mandrel-java23-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-java23-${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
rm -f java.txt native.txt
${MANDREL_HOME}/bin/native-image --macro:native-image-launcher
${MANDREL_HOME}/bin/native-image --version
echo "
void main() {
System.out.println(\"Implicitly declared classes.\");
}
" > ImplicitClass.java
${MANDREL_HOME}/bin/javac --enable-preview --release 23 ImplicitClass.java
${MANDREL_HOME}/bin/java --enable-preview ImplicitClass | tee java.txt
${MANDREL_HOME}/bin/native-image --enable-preview ImplicitClass
./implicitclass | tee native.txt
diff java.txt native.txt
- name: Upload Mandrel build
uses: actions/upload-artifact@v3
with:
name: mandrel-java23-linux-amd64-test-build
path: mandrel-java23-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-java23-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tarxz"
mv ${ARCHIVE_NAME} mandrel-java23-linux-amd64.tarxz
- name: Upload tarxz Mandrel build
uses: actions/upload-artifact@v3
with:
name: mandrel-java23-linux-amd64-test-build-tarxz
path: mandrel-java23-linux-amd64.tarxz
build-and-test-on-mac:
name: ${{ matrix.os }} Build and test ${{ matrix.mandrel-ref }} branch/tag
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, macos-13]
mandrel-ref: [mandrel/24.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: master
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 runner architecture
id: arch
run: |
export ARCH=$(echo ${{ runner.arch }} | tr '[:upper:]' '[:lower:]' | sed 's/arm64/aarch64/')
echo "ARCH=${ARCH}"
echo "ARCH=${ARCH}" >> "$GITHUB_OUTPUT"
- name: Get latest OpenJDK 23 with static libs
env:
ARCH: ${{ steps.arch.outputs.ARCH }}
run: |
curl -sL https://api.adoptium.net/v3/binary/latest/23/ea/mac/${ARCH}/jdk/hotspot/normal/eclipse -o jdk.tar.gz
curl -sL https://api.adoptium.net/v3/binary/latest/23/ea/mac/${ARCH}/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
# work-around for https://github.com/adoptium/temurin-build/issues/3602
pushd ${MAC_JAVA_HOME}
if [[ -e lib/static/darwin-arm64 ]]; then
if [[ "$ARCH" == "x64" ]]; then
mv lib/static/darwin-arm64 lib/static/darwin-amd64
else
mv lib/static/darwin-arm64 lib/static/darwin-${ARCH}
fi
fi
popd
echo ${MAC_JAVA_HOME}
${MAC_JAVA_HOME}/bin/java --version
- name: Use python 3.10
# mx uses distutils which is no longer available in python 3.12 which is the default in macos-latest
# use 3.10 instead (the minimum supported version is 3.9) see https://github.com/graalvm/mx/issues/249
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build Mandrel JDK
id: build
env:
ARCH: ${{ steps.arch.outputs.ARCH }}
run: |
export JAVA_HOME=${MAC_JAVA_HOME}
${MAC_JAVA_HOME}/bin/java -ea build.java --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 ARCH=$( echo ${ARCH} | sed 's/x64/amd64/' )
export ARCHIVE_NAME="mandrel-java23-darwin-${ARCH}-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz"
mv ${ARCHIVE_NAME} mandrel-java23-darwin-${ARCH}.tar.gz
echo "ARCH=${ARCH}" >> "$GITHUB_OUTPUT"
- name: Smoke tests
run: |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export MANDREL_HOME=${PWD}/mandrel-java23-${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
rm -f java.txt native.txt
${MANDREL_HOME}/bin/native-image --macro:native-image-launcher
${MANDREL_HOME}/bin/native-image --version
echo "
void main() {
System.out.println(\"Implicitly declared classes.\");
}
" > ImplicitClass.java
${MANDREL_HOME}/bin/javac --enable-preview --release 23 ImplicitClass.java
${MANDREL_HOME}/bin/java --enable-preview ImplicitClass | tee java.txt
${MANDREL_HOME}/bin/native-image --enable-preview ImplicitClass
./implicitclass | tee native.txt
diff java.txt native.txt
- name: Upload Mandrel build
uses: actions/upload-artifact@v3
env:
ARCH: ${{ steps.build.outputs.ARCH }}
with:
name: mandrel-java23-darwin-${ARCH}-test-build
path: mandrel-java23-darwin-${ARCH}.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/24.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
- name: Checkout MX
shell: bash
run: |
VERSION=$(jq -r .mx_version ${MANDREL_REPO}/common.json)
git clone ${GITHUB_SERVER_URL}/graalvm/mx --depth 1 --branch ${VERSION} ${MX_HOME}
./mx/mx --version
- 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 23 with static libs
run: |
$wc = New-Object System.Net.WebClient
$wc.DownloadFile("https://api.adoptium.net/v3/binary/latest/23/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/23/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: Use python 3.10
# The minimum supported version is 3.9 see https://github.com/graalvm/mx/issues/249
uses: actions/setup-python@v4
with:
python-version: '3.10'
- 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 `
--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-java23-$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
}
& Remove-Item -Path java.txt -Force
& Remove-Item -Path native.txt -Force
& ${MANDREL_HOME}/bin/native-image.cmd --macro:native-image-launcher
Set-Content -Path 'ImplicitClass.java' -Value "
void main() {
System.out.println(`"Implicitly declared classes.`");
}
"
& $MANDREL_HOME\bin\javac --enable-preview --release 23 ImplicitClass.java
& $MANDREL_HOME\bin\java --enable-preview ImplicitClass | Set-Content java.txt
& $MANDREL_HOME\bin\native-image.cmd --enable-preview ImplicitClass
& ./implicitclass | 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
}
- name: Rename mandrel archive
shell: bash
run: |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export ARCHIVE_NAME="mandrel-java23-windows-amd64-${MANDREL_VERSION_UNTIL_SPACE}.zip"
mv ${ARCHIVE_NAME} mandrel-java23-windows-amd64.zip
- name: Upload Mandrel build
uses: actions/upload-artifact@v3
with:
name: mandrel-java23-windows-amd64-test-build
path: mandrel-java23-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/24.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
- name: Checkout MX
run: |
VERSION=$(jq -r .mx_version ${MANDREL_REPO}/common.json)
git clone ${GITHUB_SERVER_URL}/graalvm/mx --depth 1 --branch ${VERSION} ${MX_HOME}
./mx/mx --version
- 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 23 with static libs
run: |
curl -sL https://api.adoptium.net/v3/binary/latest/23/ea/linux/x64/jdk/hotspot/normal/eclipse -o jdk.tar.gz
curl -sL https://api.adoptium.net/v3/binary/latest/23/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: Use python 3.10
# The minimum supported version is 3.9 see https://github.com/graalvm/mx/issues/249
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build Mandrel JDK
run: |
# Build the Java bits
${JAVA_HOME}/bin/java -ea build.java \
--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 \
--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-java23-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz"
mv ${ARCHIVE_NAME} mandrel-java23-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-java23-${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
rm -f java.txt native.txt
${MANDREL_HOME}/bin/native-image --macro:native-image-launcher
${MANDREL_HOME}/bin/native-image --version
echo "
void main() {
System.out.println(\"Implicitly declared classes.\");
}
" > ImplicitClass.java
${MANDREL_HOME}/bin/javac --enable-preview --release 23 ImplicitClass.java
${MANDREL_HOME}/bin/java --enable-preview ImplicitClass | tee java.txt
${MANDREL_HOME}/bin/native-image --enable-preview ImplicitClass
./implicitclass | tee native.txt
diff java.txt native.txt
- name: Upload Mandrel build
uses: actions/upload-artifact@v3
with:
name: mandrel-java23-linux-amd64-2step-test-build
path: mandrel-java23-linux-amd64.tar.gz