Manual native build #19
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 | |
jobs: | |
native_build: | |
env: | |
PLANTUML_VERSION: "${{ github.event.inputs.version }}" | |
JLATEXMATH_VERSION: 1.0.7 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '21' | |
distribution: 'liberica' | |
- name: Install packages for the build | |
run: | | |
sudo apt-get -yqq update | |
sudo apt-get -yqq install libfreetype-dev graphviz curl upx | |
curl -sS -L -o plantuml-${PLANTUML_VERSION}.jar \ | |
https://repo1.maven.org/maven2/net/sourceforge/plantuml/plantuml/${PLANTUML_VERSION}/plantuml-${PLANTUML_VERSION}.jar | |
curl -sS -L -o jlatexmath-${JLATEXMATH_VERSION}.jar \ | |
https://repo1.maven.org/maven2/org/scilab/forge/jlatexmath/${JLATEXMATH_VERSION}/jlatexmath-${JLATEXMATH_VERSION}.jar | |
curl -sS -L -o - https://github.com/coni2k/PlantUML/archive/refs/heads/master.tar.gz | tar -zxf - | |
- 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 \ | |
./PlantUML-master/*/*.puml ./tests/*.puml || true | |
- name: Build | |
run: | | |
native-image -J-Xms6g -J-Xmx6g --auto-fallback --enable-http --enable-https \ | |
--report-unsupported-elements-at-runtime \ | |
-H:+StaticExecutableWithDynamicLibC \ | |
-H:Name=plantuml-${PLANTUML_VERSION}-glibc-x86_64 \ | |
-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}-glibc-x86_64 -headless -o /tmp/out2 \ | |
PlantUML-master/*/*.puml ./tests/*.puml || true | |
- name: Compress executable | |
run: | | |
upx -q -o ./out/plantuml-${PLANTUML_VERSION}-upx-x86_64 ./out/plantuml-${PLANTUML_VERSION}-glibc-x86_64 | |
- name: Package distribution | |
run: | | |
mv ./out ./puni2-${PLANTUML_VERSION} | |
tar cvfz ./puni2-${PLANTUML_VERSION}.tar.gz ./puni2-${PLANTUML_VERSION} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: "${{ github.event.inputs.version }}" | |
files: | | |
./puni2-*.tar.gz |