diff --git a/.github/actions/build-graalvm/action.yml b/.github/actions/build-graalvm/action.yml new file mode 100644 index 000000000000..20513d4db79e --- /dev/null +++ b/.github/actions/build-graalvm/action.yml @@ -0,0 +1,59 @@ +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: Set up environment variables + shell: bash + 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} + - 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 + shell: bash + 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 + shell: bash + 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 db4f53f2c38b..88caa196134b 100644 --- a/.github/workflows/micronaut.yml +++ b/.github/workflows/micronaut.yml @@ -52,16 +52,10 @@ 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 + MICRONAUT_JAVA_VERSION: 21 # Enforce experimental option checking in CI (GR-47922) - NATIVE_IMAGE_EXPERIMENTAL_OPTIONS_ARE_FATAL: "true" + NATIVE_IMAGE_EXPERIMENTAL_OPTIONS_ARE_FATAL: 'true' permissions: contents: read # to fetch code (actions/checkout) @@ -76,43 +70,13 @@ jobs: 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 - mv $(${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 }}' + 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_JAVA_VERSION }}' unzip demo.zip cd demo ./gradlew nativeTest diff --git a/.github/workflows/quarkus.yml b/.github/workflows/quarkus.yml index 499f32757367..caac30d4ba92 100644 --- a/.github/workflows/quarkus.yml +++ b/.github/workflows/quarkus.yml @@ -49,19 +49,15 @@ on: - '.github/workflows/quarkus.yml' schedule: - cron: '0 3 * * *' + workflow_dispatch: env: COMMON_MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end" 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: {} @@ -80,17 +76,10 @@ jobs: uses: actions/checkout@v4 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 + - name: Build GraalVM JDK + uses: ./.github/actions/build-graalvm 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}') @@ -104,36 +93,14 @@ 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 - mv $(${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}) + run: tar -czvhf graalvm.tgz -C $(dirname ${GRAALVM_HOME}) $(basename ${GRAALVM_HOME}) - name: Persist GraalVM build uses: actions/upload-artifact@v4 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} @@ -157,6 +124,8 @@ jobs: name: Native Tests - ${{matrix.category}} needs: build-quarkus-and-graalvm runs-on: ubuntu-latest + env: + GRAALVM_HOME: ${{ github.workspace }}/graalvm # identical to the one in ./.github/actions/build-graalvm # Ignore the following YAML Schema error timeout-minutes: ${{matrix.timeout}} strategy: @@ -204,7 +173,6 @@ jobs: env: TEST_MODULES: ${{matrix.test-modules}} run: | - export GRAALVM_HOME=${{ github.workspace }}/graalvm cd ${QUARKUS_PATH} ${GRAALVM_HOME}/bin/native-image --version ./mvnw $COMMON_MAVEN_ARGS -f integration-tests -pl "$TEST_MODULES" $NATIVE_TEST_MAVEN_ARGS diff --git a/.github/workflows/spring.yml b/.github/workflows/spring.yml new file mode 100644 index 000000000000..7c6040922801 --- /dev/null +++ b/.github/workflows/spring.yml @@ -0,0 +1,84 @@ +# +# Copyright (c) 2024, 2024, 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: Nightly Spring Tests + +on: + push: + paths: + - '.github/workflows/spring.yml' + pull_request: + paths: + - '.github/workflows/spring.yml' + schedule: + - cron: '0 4 * * *' + workflow_dispatch: + +env: + SPRING_PETCLINIC_PATH: ${{ github.workspace }}/spring-petclinic + SPRING_JAVA_VERSION: 21 + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + build-graalvm-and-spring: + name: Native Tests + 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: Build GraalVM JDK + uses: ./.github/actions/build-graalvm + with: + java-version: ${{ env.SPRING_JAVA_VERSION }} + - name: Checkout spring-projects/spring-petclinic + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-petclinic + fetch-depth: 1 + path: ${{ env.SPRING_PETCLINIC_PATH }} + - name: Run nativeTest in spring-petclinic + run: | + cd ${{ env.SPRING_PETCLINIC_PATH }} + ./gradlew nativeTest