name: Native Image on: workflow_call: inputs: release-version: required: true type: string jobs: native_image_linux: runs-on: ubuntu-latest steps: - name: Checkout the repository uses: actions/checkout@v3 - uses: actions/cache/restore@v3 with: path: | build/libs build/publications key: "libs-${{ runner.os }}-${{ github.run_id }}" fail-on-cache-miss: true - name: Install system requirements run: sudo apt install build-essential libz-dev zlib1g-dev - name: Get GraalVM run: | wget "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${GRAALVM_VERSION}/graalvm-ce-java17-linux-amd64-${GRAALVM_VERSION}.tar.gz" -O graalvm-ce.tar.gz mkdir graalvm-ce tar xvzf graalvm-ce.tar.gz -C graalvm-ce --strip-components 1 ./graalvm-ce/bin/gu install native-image env: GRAALVM_VERSION: "22.3.1" - name: Generate GraalVM configuration run: | mkdir native-image-config-dir echo 'Bob->Alice: Hello' | ./graalvm-ce/bin/java -agentlib:native-image-agent=config-output-dir=./native-image-config-dir -jar "./build/libs/plantuml-${RELEASE_VERSION}.jar" -tpng -pipe > out.png env: RELEASE_VERSION: ${{ inputs.release-version }} - name: Generate native image run: | ./graalvm-ce/bin/native-image -H:ConfigurationFileDirectories=./native-image-config-dir --no-fallback --report-unsupported-elements-at-runtime -jar "./build/libs/plantuml-${RELEASE_VERSION}.jar" "./build/libs/plantuml-linux-amd64-${RELEASE_VERSION}" env: RELEASE_VERSION: ${{ inputs.release-version }} - name: Cache native image uses: actions/cache/save@v3 with: path: build/libs/plantuml-linux-amd64-* key: "native-image-linux-${{ runner.os }}-${{ github.run_id }}"