1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-25 22:37:33 +00:00

Merge pull request #1362 from ggrossetie/native-images-macos-win

Build macOS and Windows native images
This commit is contained in:
PlantUML 2023-03-26 18:18:29 +02:00 committed by GitHub
commit fd587ce66f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 27 deletions

View File

@ -20,6 +20,8 @@ ln -s "../libs/plantuml-${RELEASE_VERSION}-javadoc.jar" "${RELEASE_DIR}
ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT-sources.jar" ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT-sources.jar"
ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-pdf-SNAPSHOT.jar" ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-pdf-SNAPSHOT.jar"
ln -s "../libs/plantuml-linux-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-linux-amd64-SNAPSHOT" ln -s "../libs/plantuml-linux-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-linux-amd64-SNAPSHOT"
ln -s "../libs/plantuml-darwin-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-darwin-amd64-SNAPSHOT"
ln -s "../libs/plantuml-win-amd64-${RELEASE_VERSION}.exe" "${RELEASE_DIR}/plantuml-win-amd64-SNAPSHOT.exe"
if [[ -e "build/publications/maven/module.json.asc" ]]; then if [[ -e "build/publications/maven/module.json.asc" ]]; then
# signatures are optional so that forked repos can release snapshots without needing a gpg signing key # signatures are optional so that forked repos can release snapshots without needing a gpg signing key

View File

@ -11,6 +11,9 @@ ln -s "../libs/plantuml-${RELEASE_VERSION}-javadoc.jar" "${RELEASE_DIR}
ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-${RELEASE_VERSION}-sources.jar" ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-${RELEASE_VERSION}-sources.jar"
ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-pdf-${RELEASE_VERSION}.jar" ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-pdf-${RELEASE_VERSION}.jar"
ln -s "../libs/plantuml-linux-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-linux-amd64-${RELEASE_VERSION}" ln -s "../libs/plantuml-linux-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-linux-amd64-${RELEASE_VERSION}"
ln -s "../libs/plantuml-darwin-amd64-${RELEASE_VERSION}" "${RELEASE_DIR}/plantuml-darwin-amd64-${RELEASE_VERSION}"
ln -s "../libs/plantuml-win-amd64-${RELEASE_VERSION}.exe" "${RELEASE_DIR}/plantuml-win-amd64-${RELEASE_VERSION}.exe"
if [[ -e "build/publications/maven/module.json.asc" ]]; then if [[ -e "build/publications/maven/module.json.asc" ]]; then
# signatures are optional so that forked repos can release snapshots without needing a gpg signing key # signatures are optional so that forked repos can release snapshots without needing a gpg signing key

View File

@ -147,7 +147,8 @@ jobs:
path: | path: |
build/libs build/libs
build/publications build/publications
key: "libs-${{ runner.os }}-${{ github.run_id }}" key: "libs-${{ github.run_id }}"
enableCrossOsArchive: true
native_images: native_images:
needs: build_artifacts needs: build_artifacts
@ -174,14 +175,30 @@ jobs:
path: | path: |
build/libs build/libs
build/publications build/publications
key: "libs-${{ runner.os }}-${{ github.run_id }}" key: "libs-${{ github.run_id }}"
fail-on-cache-miss: true fail-on-cache-miss: true
enableCrossOsArchive: true
- uses: actions/cache/restore@v3 - uses: actions/cache/restore@v3
with: with:
path: build/libs/plantuml-linux-amd64-* path: "build/libs/plantuml-darwin-amd64-*"
key: "native-image-linux-${{ runner.os }}-${{ github.run_id }}" key: "native-image-darwin-amd64-${{ github.run_id }}"
fail-on-cache-miss: true fail-on-cache-miss: true
enableCrossOsArchive: true
- uses: actions/cache/restore@v3
with:
path: "build/libs/plantuml-win-amd64-*"
key: "native-image-win-amd64-${{ github.run_id }}"
fail-on-cache-miss: true
enableCrossOsArchive: true
- uses: actions/cache/restore@v3
with:
path: "build/libs/plantuml-linux-amd64-*"
key: "native-image-linux-amd64-${{ github.run_id }}"
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

@ -8,47 +8,51 @@ on:
type: string type: string
jobs: jobs:
native_image_linux: build_non_win_images:
runs-on: ubuntu-latest name: 'Build Native Image ${{ matrix.platform }}'
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
include:
- os: 'ubuntu-latest'
platform: 'linux-amd64'
- os: 'macos-latest'
platform: 'darwin-amd64'
- os: 'windows-latest'
platform: 'win-amd64'
runs-on: ${{matrix.os}}
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.1'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache/restore@v3 - uses: actions/cache/restore@v3
with: with:
path: | path: |
build/libs build/libs
build/publications build/publications
key: "libs-${{ runner.os }}-${{ github.run_id }}" key: "libs-${{ github.run_id }}"
fail-on-cache-miss: true fail-on-cache-miss: true
enableCrossOsArchive: 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 - name: Generate GraalVM configuration
run: | run: |
mkdir native-image-config-dir 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 echo 'Bob->Alice: Hello' | java -agentlib:native-image-agent=config-output-dir=native-image-config-dir -jar "./build/libs/plantuml-${{ inputs.release-version }}.jar" -tpng -pipe > out.png
env:
RELEASE_VERSION: ${{ inputs.release-version }}
- name: Generate native image - name: Generate native image
run: | 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}" native-image -H:ConfigurationFileDirectories=native-image-config-dir --no-fallback --report-unsupported-elements-at-runtime -jar "build/libs/plantuml-${{ inputs.release-version }}.jar" -H:Path="build/libs" -H:Name="plantuml-${{ matrix.platform }}-${{ inputs.release-version }}"
env:
RELEASE_VERSION: ${{ inputs.release-version }}
- name: Cache native image - name: Cache native image
uses: actions/cache/save@v3 uses: actions/cache/save@v3
with: with:
path: build/libs/plantuml-linux-amd64-* path: "build/libs/plantuml-${{ matrix.platform }}-*"
key: "native-image-linux-${{ runner.os }}-${{ github.run_id }}" key: "native-image-${{ matrix.platform }}-${{ github.run_id }}"
enableCrossOsArchive: true