Manual native build #18
This file contains 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: Manual native build | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'PlantUML version to build' | |
default: '1.2024.4' | |
required: true | |
configuration: | |
description: 'Configuration to build' | |
default: 'debug' | |
jlatexmath-version: | |
description: 'JLaTeXMath version' | |
default: '1.0.7' | |
jobs: | |
native_build: | |
name: 'Build PlantUML on ${{ matrix.os }}' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
env: | |
OS_VERSION: "${{ matrix.os }}" | |
PLANTUML_VERSION: "${{ github.event.inputs.version }}" | |
JLATEXMATH_VERSION: "${{ github.event.inputs.jlatexmath-version }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '22' | |
distribution: 'liberica' | |
java-package: 'jdk' | |
native-image-job-reports: true | |
- name: Install packages for the build | |
run: | | |
sudo apt-get -yqq update | |
sudo apt-get -yqq install libfreetype-dev graphviz curl upx | |
- name: Download assets for the build | |
uses: suisei-cn/[email protected] | |
with: | |
url: https://repo1.maven.org/maven2/net/sourceforge/plantuml/plantuml/${{ github.event.inputs.version }}/plantuml-${{ github.event.inputs.version }}.jar | |
filename: 'plantuml-${{ github.event.inputs.version }}.jar' | |
target: ./ | |
- uses: suisei-cn/[email protected] | |
with: | |
url: https://repo1.maven.org/maven2/org/scilab/forge/jlatexmath/${{ github.event.inputs.jlatexmath-version }}/jlatexmath-${{ github.event.inputs.jlatexmath-version }}.jar | |
filename: 'jlatexmath-${{ github.event.inputs.jlatexmath-version }}.jar' | |
target: ./ | |
- name: Generate build configuration | |
run: | | |
java -agentlib:native-image-agent=config-output-dir=conf/META-INF/native-image \ | |
-cp jlatexmath-${JLATEXMATH_VERSION}.jar:plantuml-${PLANTUML_VERSION}.jar \ | |
net.sourceforge.plantuml.Run -headless -o /tmp/out \ | |
./tests/*.puml || true | |
- name: Build | |
run: | | |
native-image -J-Xms6g -J-Xmx6g --auto-fallback --enable-http --enable-https \ | |
--report-unsupported-elements-at-runtime --verbose --native-image-info \ | |
-Djava.awt.headless=true \ | |
-H:+StaticExecutableWithDynamicLibC \ | |
-H:Name=plantuml-${PLANTUML_VERSION}-${OS_VERSION} \ | |
-H:Path=./out \ | |
-H:IncludeResources="stdlib/.*repx$" \ | |
-H:IncludeResources="net/sourceforge/plantuml.*(png|svg|txt)$" \ | |
-H:ConfigurationFileDirectories=conf/META-INF/native-image \ | |
-cp jlatexmath-${JLATEXMATH_VERSION}.jar:plantuml-${PLANTUML_VERSION}.jar \ | |
net.sourceforge.plantuml.Run | |
- name: Test | |
run: | | |
./out/plantuml-${PLANTUML_VERSION}-${OS_VERSION} -headless -o /tmp/out2 \ | |
./tests/*.puml || true | |
- name: Compress executable | |
run: | | |
upx -q -o ./out/plantuml-${PLANTUML_VERSION}-upx-${OS_VERSION} \ | |
./out/plantuml-${PLANTUML_VERSION}-${OS_VERSION} | |
- name: Package distribution | |
uses: a7ul/[email protected] | |
with: | |
command: 'c' | |
cwd: ./out | |
files: | | |
./plantuml-${{ github.event.inputs.version }}-${{ matrix.os }} | |
./plantuml-${{ github.event.inputs.version }}-upx-${{ matrix.os }} | |
outPath: ./puni2-${{ github.event.inputs.version }}-${{ matrix.os }}.tar.gz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: 'puni2-${{ github.event.inputs.version }}-${{ matrix.os }}' | |
path: | | |
/tmp/native-image-build-output.json | |
./conf/ | |
./out/ | |
./puni2-*.tar.gz | |
- name: Release | |
if: ${{ github.event.inputs.configuration }} == 'release' | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: '${{ github.event.inputs.version }}' | |
files: ./puni2-*.tar.gz |