| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # GraalVM native image validation + benchmark. |
| # |
| # This workflow is INTENTIONALLY SEPARATE from build-and-publish.yml because: |
| # - native tests are slow (minutes per run) |
| # - nativeCompile is RAM-hungry |
| # - Failures in native should not block JVM-path merges |
| # |
| # Triggers: |
| # - Manual (workflow_dispatch) |
| # - PRs that touch native-related files |
| # |
| # Jobs: |
| # - native-test: ./gradlew nativeTest against Solr via Testcontainers |
| # - native-image: build the native Docker image + run dockerIntegrationTest |
| # (matrix over profile=[stdio, http] so both native variants are covered) |
| # - benchmark: compare JVM vs native image size / startup / RSS |
| |
| name: Native Image |
| |
| on: |
| workflow_dispatch: |
| pull_request: |
| paths: |
| - 'build.gradle.kts' |
| - 'gradle/libs.versions.toml' |
| - 'scripts/benchmark-native.sh' |
| - '.github/workflows/native.yml' |
| - 'src/main/java/**/*NativeHints*.java' |
| - 'src/main/resources/META-INF/native-image/**' |
| |
| jobs: |
| native-test: |
| name: nativeTest |
| runs-on: ubuntu-latest |
| timeout-minutes: 45 |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v4 |
| |
| - name: Set up GraalVM JDK 25 |
| uses: graalvm/setup-graalvm@329c42c5f4c343bceb505f0b28cc8499bc2bf174 # v1.5.4 (ASF-allow-listed, no expiry) |
| with: |
| java-version: '25' |
| distribution: 'graalvm' |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| cache: 'gradle' |
| |
| - name: Grant execute permission for gradlew |
| run: chmod +x gradlew |
| |
| # nativeTest compiles the test suite into a native image and runs |
| # it. Slow — expect 10+ minutes per compile. JUnit assertions that |
| # rely on Mockito proxies can fail under native; keep an eye on |
| # the output and file focused hints in SolrNativeHints as needed. |
| - name: Run native tests |
| run: ./gradlew nativeTest -Pnative --no-daemon |
| |
| native-image: |
| name: native Docker image (${{ matrix.profile }}) + integration |
| runs-on: ubuntu-latest |
| timeout-minutes: 60 |
| strategy: |
| fail-fast: false |
| matrix: |
| profile: [stdio, http] |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v4 |
| |
| - name: Set up GraalVM JDK 25 |
| uses: graalvm/setup-graalvm@329c42c5f4c343bceb505f0b28cc8499bc2bf174 # v1.5.4 (ASF-allow-listed, no expiry) |
| with: |
| java-version: '25' |
| distribution: 'graalvm' |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| cache: 'gradle' |
| |
| - name: Grant execute permission for gradlew |
| run: chmod +x gradlew |
| |
| - name: Build native Docker image (${{ matrix.profile }}) |
| run: ./gradlew bootBuildImage -Pnative -Pprofile=${{ matrix.profile }} --no-daemon |
| |
| - name: Run integration tests against native ${{ matrix.profile }} image |
| run: ./gradlew dockerIntegrationTest -Pnative -Pprofile=${{ matrix.profile }} --no-daemon |
| |
| - name: Upload integration test results |
| if: always() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: native-integration-results-${{ matrix.profile }} |
| path: build/reports/dockerIntegrationTest |
| retention-days: 7 |
| |
| benchmark: |
| name: JVM vs native benchmark |
| runs-on: ubuntu-latest |
| needs: native-image |
| timeout-minutes: 60 |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v4 |
| |
| - name: Set up GraalVM JDK 25 |
| uses: graalvm/setup-graalvm@329c42c5f4c343bceb505f0b28cc8499bc2bf174 # v1.5.4 (ASF-allow-listed, no expiry) |
| with: |
| java-version: '25' |
| distribution: 'graalvm' |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| cache: 'gradle' |
| |
| - name: Grant execute permission for scripts |
| run: | |
| chmod +x gradlew scripts/benchmark-native.sh |
| |
| - name: Run benchmark |
| run: ./scripts/benchmark-native.sh |
| |
| - name: Upload benchmark results |
| uses: actions/upload-artifact@v4 |
| with: |
| name: native-benchmark-results |
| path: docs/specs/benchmark-results.md |
| retention-days: 30 |