diff --git a/.github/actions/build-graalvm/action.yml b/.github/actions/build-graalvm/action.yml new file mode 100644 index 000000000000..276fbb0d2b67 --- /dev/null +++ b/.github/actions/build-graalvm/action.yml @@ -0,0 +1,62 @@ +name: Build GraalVM JDK +description: 'Build GraalVM JDK and set up environment for testing' + +inputs: + java-version: + description: 'Java version to use' + required: false + default: '' + +runs: + using: 'composite' + steps: + - name: Checkout oracle/graal + uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Set up environment variables + run: | + echo "GRAALVM_HOME=${{ github.workspace }}/graalvm" >> ${GITHUB_ENV} + echo "LABSJDK_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} + # Enforce experimental option checking in CI (GR-47922) + echo "NATIVE_IMAGE_EXPERIMENTAL_OPTIONS_ARE_FATAL=true" >> ${GITHUB_ENV} + - name: Checkout graalvm/mx + uses: actions/checkout@v4 + with: + repository: graalvm/mx + fetch-depth: 1 + ref: ${{ env.MX_VERSION }} + path: ${{ env.MX_PATH }} + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.8' + - name: Update mx cache + uses: actions/cache@v4 + with: + path: ~/.mx + key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} + restore-keys: ${{ runner.os }}-mx- + - name: Fetch LabsJDK + run: | + mkdir jdk-dl + ${MX_PATH}/mx --java-home= fetch-jdk --jdk-id labsjdk-ce-latest --to jdk-dl --alias ${LABSJDK_HOME} + - name: Build GraalVM JDK + run: | + cd substratevm + ${MX_PATH}/mx --java-home=${LABSJDK_HOME} --native=native-image --components="Native Image" build + ln -s $(${MX_PATH}/mx --java-home=${LABSJDK_HOME} --native=native-image --components="Native Image" graalvm-home) ${GRAALVM_HOME} + ${GRAALVM_HOME}/bin/native-image --version + - name: Set up JAVA_HOME + if: ${{ inputs.java-version }} != '' + uses: actions/setup-java@v4 + with: + distribution: 'oracle' + java-version: '${{ inputs.java-version }}' + \ No newline at end of file diff --git a/.github/workflows/micronaut.yml b/.github/workflows/micronaut.yml index 2c18c36ff7d8..0fc569581349 100644 --- a/.github/workflows/micronaut.yml +++ b/.github/workflows/micronaut.yml @@ -52,16 +52,8 @@ on: workflow_dispatch: env: - GRAALVM_HOME: ${{ github.workspace }}/graalvm - JAVA_HOME: ${{ github.workspace }}/labsjdk - LANG: en_US.UTF-8 MICRONAUT_CORE_PATH: ${{ github.workspace }}/micronaut-core - MICRONAUT_JDK_VERSION: 21 - MX_GIT_CACHE: refcache - MX_PATH: ${{ github.workspace }}/mx - MX_PYTHON: python3.8 - # Enforce experimental option checking in CI (GR-47922) - NATIVE_IMAGE_EXPERIMENTAL_OPTIONS_ARE_FATAL: "true" + MICRONAUT_JAVA_VERSION: 21 permissions: contents: read # to fetch code (actions/checkout) @@ -72,44 +64,10 @@ jobs: runs-on: ubuntu-20.04 if: (github.event_name == 'schedule' && github.repository == 'oracle/graal') || (github.event_name != 'schedule') steps: - - name: Checkout oracle/graal - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Determine mx version - run: echo "MX_VERSION=$(jq -r '.mx_version' common.json)" >> ${GITHUB_ENV} - - name: Checkout graalvm/mx - uses: actions/checkout@v4 - with: - repository: graalvm/mx - fetch-depth: 1 - ref: ${{ env.MX_VERSION }} - path: ${{ env.MX_PATH }} - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.8' - - name: Update mx cache - uses: actions/cache@v4 - with: - path: ~/.mx - key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} - restore-keys: ${{ runner.os }}-mx- - - name: Fetch LabsJDK - 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 JDK - run: | - cd substratevm - ${MX_PATH}/mx --native=native-image --components="Native Image" build - ln -s $(${MX_PATH}/mx --native=native-image --components="Native Image" graalvm-home) ${GRAALVM_HOME} - ${GRAALVM_HOME}/bin/native-image --version - - name: Reconfigure JAVA_HOME for Micronaut - uses: actions/setup-java@v4 + uses: ./.github/actions/build-graalvm with: - distribution: 'oracle' - java-version: '${{ env.MICRONAUT_JDK_VERSION }}' + java-version: ${{ env.MICRONAUT_JAVA_VERSION }} - name: Run nativeTest in Micronaut launch project run: | curl --fail --silent --location --retry 3 --max-time 10 --output demo.zip --request GET 'https://launch.micronaut.io/create/default/com.example.demo?lang=JAVA&build=GRADLE&test=JUNIT&javaVersion=JDK_${{ env.MICRONAUT_JDK_VERSION }}' diff --git a/.github/workflows/quarkus.yml b/.github/workflows/quarkus.yml index e3fc7d9b56a3..ec642bc16397 100644 --- a/.github/workflows/quarkus.yml +++ b/.github/workflows/quarkus.yml @@ -56,13 +56,8 @@ env: DB_NAME: hibernate_orm_test DB_PASSWORD: hibernate_orm_test DB_USER: hibernate_orm_test - GRAALVM_HOME: ${{ github.workspace }}/graalvm - LABSJDK_HOME: ${{ github.workspace }}/jdk - LANG: en_US.UTF-8 # Workaround testsuite locale issue - MX_GIT_CACHE: refcache - MX_PATH: ${{ github.workspace }}/mx - MX_PYTHON: python3.8 NATIVE_TEST_MAVEN_ARGS: "-Dtest-containers -Dstart-containers -Dquarkus.native.native-image-xmx=5g -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests install -DskipDocs -Dquarkus.native.container-build=false" + QUARKUS_JAVA_VERSION: 17 # Use Java 17 to build Quarkus as that's the lowest supported JDK version currently QUARKUS_PATH: ${{ github.workspace }}/quarkus permissions: {} @@ -77,21 +72,10 @@ jobs: outputs: matrix: ${{ steps.read.outputs.matrix }} steps: - - name: Checkout oracle/graal - uses: actions/checkout@v4 + - name: Build GraalVM JDK + uses: ./.github/actions/build-graalvm with: - fetch-depth: 1 - - name: Checkout graalvm/mx - uses: actions/checkout@v4 - with: - repository: graalvm/mx.git - fetch-depth: 1 - ref: master - path: ${{ env.MX_PATH }} - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.8' + java-version: ${{ env.QUARKUS_JAVA_VERSION }} - name: Get latest Quarkus release run: | export QUARKUS_VERSION=main #$(curl https://repo1.maven.org/maven2/io/quarkus/quarkus-bom/maven-metadata.xml | awk -F"[<>]" '/latest/ {print $3}') @@ -105,23 +89,6 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - uses: actions/cache@v4 - with: - path: ~/.mx - key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} - restore-keys: | - ${{ runner.os }}-mx- - - name: Fetch LabsJDK - run: | - mkdir jdk-dl - ${MX_PATH}/mx --java-home= fetch-jdk --jdk-id labsjdk-ce-latest --to jdk-dl --alias ${LABSJDK_HOME} - - name: Build graalvm native-image - run: | - export JAVA_HOME=${LABSJDK_HOME} - cd substratevm - ${MX_PATH}/mx --native=native-image,lib:jvmcicompiler --components="Native Image,LibGraal" build - ln -s $(${MX_PATH}/mx --native=native-image,lib:jvmcicompiler --components="Native Image,LibGraal" graalvm-home) ${GRAALVM_HOME} - ${GRAALVM_HOME}/bin/native-image --version - name: Tar GraalVM shell: bash run: tar -czvf graalvm.tgz -C $(dirname ${GRAALVM_HOME}) $(basename ${GRAALVM_HOME}) @@ -130,11 +97,6 @@ jobs: with: name: graalvm path: graalvm.tgz - # Use Java 17 to build Quarkus as that's the lowest supported JDK version currently - - uses: actions/setup-java@v4 - with: - distribution: 'oracle' - java-version: '17' - name: Build Quarkus run: | cd ${QUARKUS_PATH}