Random improvements #78
Workflow file for this run
This file contains hidden or 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
| name: Native Support | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| native-build-and-test: | |
| permissions: | |
| contents: read | |
| name: Native (${{ matrix.os }}, Java ${{ matrix.mandrel.java }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| mandrel: | |
| - java: '21' | |
| version: '23.1.10.0-Final' | |
| - java: '25' | |
| version: '25.0.2.0-Final' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Cache Maven repository | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Cache Mandrel Archive | |
| uses: actions/cache@v5 | |
| with: | |
| path: _mandrel_cache | |
| key: mandrel-archive-${{ runner.os }}-java${{ matrix.mandrel.java }}-${{ matrix.mandrel.version }} | |
| - name: Download and Setup Mandrel (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| mkdir -p _mandrel_cache | |
| ARCHIVE="_mandrel_cache/mandrel.tar.gz" | |
| if [ ! -f "$ARCHIVE" ]; then | |
| echo "Cache miss: Downloading Mandrel..." | |
| curl -L -o "$ARCHIVE" "https://github.com/graalvm/mandrel/releases/download/mandrel-${{ matrix.mandrel.version }}/mandrel-java${{ matrix.mandrel.java }}-linux-amd64-${{ matrix.mandrel.version }}.tar.gz" | |
| else | |
| echo "Cache hit: Using existing Mandrel archive..." | |
| fi | |
| tar -xzf "$ARCHIVE" | |
| echo "GRAALVM_HOME=$GITHUB_WORKSPACE/mandrel-java${{ matrix.mandrel.java }}-${{ matrix.mandrel.version }}" >> $GITHUB_ENV | |
| echo "JAVA_HOME=$GITHUB_WORKSPACE/mandrel-java${{ matrix.mandrel.java }}-${{ matrix.mandrel.version }}" >> $GITHUB_ENV | |
| echo "$GITHUB_WORKSPACE/mandrel-java${{ matrix.mandrel.java }}-${{ matrix.mandrel.version }}/bin" >> $GITHUB_PATH | |
| - name: Download and Setup Mandrel (Windows) | |
| if: runner.os == 'Windows' | |
| shell: powershell | |
| run: | | |
| New-Item -ItemType Directory -Force -Path _mandrel_cache | Out-Null | |
| $archive = "_mandrel_cache\mandrel.zip" | |
| if (-Not (Test-Path $archive)) { | |
| Write-Host "Cache miss: Downloading Mandrel..." | |
| $url = "https://github.com/graalvm/mandrel/releases/download/mandrel-${{ matrix.mandrel.version }}/mandrel-java${{ matrix.mandrel.java }}-windows-amd64-${{ matrix.mandrel.version }}.zip" | |
| $wc = New-Object System.Net.WebClient | |
| $wc.DownloadFile($url, $archive) | |
| } else { | |
| Write-Host "Cache hit: Using existing Mandrel archive..." | |
| } | |
| Expand-Archive $archive -DestinationPath "${{ github.workspace }}" -Force | |
| Move-Item (Get-ChildItem mandrel-java*).name ${{ github.workspace }}\${{ matrix.mandrel.java }}-${{ matrix.mandrel.version }} | |
| echo "GRAALVM_HOME=${{ github.workspace }}\${{ matrix.mandrel.java }}-${{ matrix.mandrel.version }}" >> $env:GITHUB_ENV | |
| echo "JAVA_HOME=${{ github.workspace }}\${{ matrix.mandrel.java }}-${{ matrix.mandrel.version }}" >> $env:GITHUB_ENV | |
| - name: Build and Test Native (Windows) | |
| if: runner.os == 'Windows' | |
| shell: cmd | |
| env: | |
| MAVEN_OPTS: -Xmx1g | |
| # Headless CI, on Windows, JLine keeps looking for a real terminal and takes ages. | |
| JAVA_TOOL_OPTIONS: "-Dorg.jline.terminal.dumb=true -Dorg.jline.terminal.exec=false" | |
| run: | | |
| set PATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\;%PATH% | |
| call vcvars64 || exit 1 | |
| set "PATH=%JAVA_HOME%\bin;%PATH%" | |
| if not exist "%GRAALVM_HOME%\bin\native-image.cmd" ( echo "Cannot find native-image tool. Quitting..." & exit 1 ) | |
| cmd /C native-image --version | |
| cmd /C mvn clean verify --batch-mode -Pnative | |
| - name: Build and Test Native (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| native-image --version | |
| ./mvnw clean verify -B -Pnative |