1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-29 16:23:55 +00:00

Merge pull request #1360 from ggrossetie/publish-native-image-release

Build the native image as part of the release process
This commit is contained in:
PlantUML 2023-03-25 22:13:40 +01:00 committed by GitHub
commit 108d07971c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 96 additions and 47 deletions

View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -ex set -ex
POM_VERSION=$(gradle properties -q | grep "version:" | awk '{print $2}')
TAG="snapshot" TAG="snapshot"
DATE_TIME_UTC=$(date -u +"%F at %T (UTC)") DATE_TIME_UTC=$(date -u +"%F at %T (UTC)")
RELEASE_DIR="build/github_release" RELEASE_DIR="build/github_release"
@ -16,19 +15,20 @@ mkdir "${RELEASE_DIR}"
ln -s "../publications/maven/module.json" "${RELEASE_DIR}/plantuml-SNAPSHOT-module.json" ln -s "../publications/maven/module.json" "${RELEASE_DIR}/plantuml-SNAPSHOT-module.json"
ln -s "../publications/maven/pom-default.xml" "${RELEASE_DIR}/plantuml-SNAPSHOT.pom" ln -s "../publications/maven/pom-default.xml" "${RELEASE_DIR}/plantuml-SNAPSHOT.pom"
ln -s "../libs/plantuml-${POM_VERSION}.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT.jar" ln -s "../libs/plantuml-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT.jar"
ln -s "../libs/plantuml-${POM_VERSION}-javadoc.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT-javadoc.jar" ln -s "../libs/plantuml-${RELEASE_VERSION}-javadoc.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT-javadoc.jar"
ln -s "../libs/plantuml-${POM_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-${POM_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"
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
ln -s "../publications/maven/module.json.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-module.json.asc" ln -s "../publications/maven/module.json.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-module.json.asc"
ln -s "../publications/maven/pom-default.xml.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT.pom.asc" ln -s "../publications/maven/pom-default.xml.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT.pom.asc"
ln -s "../libs/plantuml-${POM_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT.jar.asc" ln -s "../libs/plantuml-${RELEASE_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT.jar.asc"
ln -s "../libs/plantuml-${POM_VERSION}-javadoc.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-javadoc.jar.asc" ln -s "../libs/plantuml-${RELEASE_VERSION}-javadoc.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-javadoc.jar.asc"
ln -s "../libs/plantuml-${POM_VERSION}-sources.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-sources.jar.asc" ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-sources.jar.asc"
ln -s "../libs/plantuml-pdf-${POM_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-pdf-SNAPSHOT.jar.asc" ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-pdf-SNAPSHOT.jar.asc"
fi fi
echo -n "${DATE_TIME_UTC}" > "${RELEASE_DIR}/plantuml-SNAPSHOT.timestamp" echo -n "${DATE_TIME_UTC}" > "${RELEASE_DIR}/plantuml-SNAPSHOT.timestamp"

View File

@ -1,24 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -ex set -ex
POM_VERSION=$(gradle properties -q | grep "version:" | awk '{print $2}')
RELEASE_DIR="build/github_release" RELEASE_DIR="build/github_release"
mkdir "${RELEASE_DIR}" mkdir "${RELEASE_DIR}"
ln -s "../libs/plantuml-${POM_VERSION}.jar" "${RELEASE_DIR}/plantuml.jar" ln -s "../libs/plantuml-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml.jar"
ln -s "../libs/plantuml-${POM_VERSION}.jar" "${RELEASE_DIR}/plantuml-${POM_VERSION}.jar" ln -s "../libs/plantuml-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-${RELEASE_VERSION}.jar"
ln -s "../libs/plantuml-${POM_VERSION}-javadoc.jar" "${RELEASE_DIR}/plantuml-${POM_VERSION}-javadoc.jar" ln -s "../libs/plantuml-${RELEASE_VERSION}-javadoc.jar" "${RELEASE_DIR}/plantuml-${RELEASE_VERSION}-javadoc.jar"
ln -s "../libs/plantuml-${POM_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-${POM_VERSION}-sources.jar" ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-${RELEASE_VERSION}-sources.jar"
ln -s "../libs/plantuml-pdf-${POM_VERSION}.jar" "${RELEASE_DIR}/plantuml-pdf-${POM_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}"
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
ln -s "../libs/plantuml-${POM_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml.jar.asc" ln -s "../libs/plantuml-${RELEASE_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml.jar.asc"
ln -s "../libs/plantuml-${POM_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-${POM_VERSION}.jar.asc" ln -s "../libs/plantuml-${RELEASE_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-${RELEASE_VERSION}.jar.asc"
ln -s "../libs/plantuml-${POM_VERSION}-javadoc.jar.asc" "${RELEASE_DIR}/plantuml-${POM_VERSION}-javadoc.jar.asc" ln -s "../libs/plantuml-${RELEASE_VERSION}-javadoc.jar.asc" "${RELEASE_DIR}/plantuml-${RELEASE_VERSION}-javadoc.jar.asc"
ln -s "../libs/plantuml-${POM_VERSION}-sources.jar.asc" "${RELEASE_DIR}/plantuml-${POM_VERSION}-sources.jar.asc" ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar.asc" "${RELEASE_DIR}/plantuml-${RELEASE_VERSION}-sources.jar.asc"
ln -s "../libs/plantuml-pdf-${POM_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-pdf-${POM_VERSION}.jar.asc" ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-pdf-${RELEASE_VERSION}.jar.asc"
fi fi
gh release create \ gh release create \

View File

@ -105,33 +105,31 @@ jobs:
name: ${{ github.run_number }}-${{ matrix.os }}-java-${{ matrix.java_version }}-test-reports name: ${{ github.run_number }}-${{ matrix.os }}-java-${{ matrix.java_version }}-test-reports
path: build/reports/tests/ path: build/reports/tests/
upload: build_artifacts:
needs: [ workflow_config, test ] needs: [ workflow_config, test ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.version.outputs.release_version }}
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Set up java - name: Set up java
uses: actions/setup-java@v3.5.0 uses: actions/setup-java@v3.10.0
with: with:
java-version: 17 java-version: 17
distribution: temurin distribution: temurin
cache: gradle cache: gradle
- name: Set version from tag - name: Set version from tag
if: env.POM_VERSION if: env.POM_VERSION
env: env:
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }} POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
run: sed -i "s/version = .*/version = $POM_VERSION/" gradle.properties run: sed -i "s/version = .*/version = $POM_VERSION/" gradle.properties
- name: Build artifacts - name: Build artifacts
run: | run: |
gradle -q clean build \ gradle -q clean build \
pdfJar \ pdfJar \
generateMetadataFileForMavenPublication generatePomFileForMavenPublication \ generateMetadataFileForMavenPublication generatePomFileForMavenPublication \
-x test -x test
- name: Sign artifacts - name: Sign artifacts
if: env.ORG_GRADLE_PROJECT_signingKey if: env.ORG_GRADLE_PROJECT_signingKey
env: env:
@ -139,6 +137,51 @@ jobs:
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ARTIFACT_SIGNING_PASSPHRASE }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ARTIFACT_SIGNING_PASSPHRASE }}
run: | run: |
gradle -i signMavenPublication signPdfJar gradle -i signMavenPublication signPdfJar
- name: Get release version
id: version
run: |
echo "release_version=$(gradle properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: Cache libs
uses: actions/cache/save@v3
with:
path: |
build/libs
build/publications
key: "libs-${{ runner.os }}-${{ github.run_id }}"
native_images:
needs: build_artifacts
uses: ./.github/workflows/native-image.yml
with:
release-version: ${{ needs.build_artifacts.outputs.release_version }}
upload:
needs: [ workflow_config, build_artifacts, native_images]
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up java
uses: actions/setup-java@v3.10.0
with:
java-version: 17
distribution: temurin
cache: gradle
- uses: actions/cache/restore@v3
with:
path: |
build/libs
build/publications
key: "libs-${{ runner.os }}-${{ github.run_id }}"
fail-on-cache-miss: true
- uses: actions/cache/restore@v3
with:
path: build/libs/plantuml-linux-amd64-*
key: "native-image-linux-${{ runner.os }}-${{ github.run_id }}"
fail-on-cache-miss: true
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@ -152,6 +195,7 @@ jobs:
- name: Create snapshot release - name: Create snapshot release
if: needs.workflow_config.outputs.do_snapshot_release == 'true' if: needs.workflow_config.outputs.do_snapshot_release == 'true'
env: env:
RELEASE_VERSION: ${{ needs.build_artifacts.outputs.RELEASE_VERSION }}
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
@ -165,6 +209,7 @@ jobs:
- name: Create release in GitHub - name: Create release in GitHub
if: needs.workflow_config.outputs.do_release == 'true' if: needs.workflow_config.outputs.do_release == 'true'
env: env:
RELEASE_VERSION: ${{ needs.build_artifacts.outputs.RELEASE_VERSION }}
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
TAG: ${{ github.event.ref }} TAG: ${{ github.event.ref }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
@ -177,7 +222,7 @@ jobs:
gradle publish gradle publish
push_to_registry: push_to_registry:
needs: [ workflow_config, test, upload ] needs: [ workflow_config, upload ]
if: needs.workflow_config.outputs.do_release == 'true' if: needs.workflow_config.outputs.do_release == 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View File

@ -1,26 +1,26 @@
name: Native Image name: Native Image
on: on:
push: workflow_call:
branches: inputs:
- native-image release-version:
required: true
defaults: type: string
run:
shell: bash
jobs: jobs:
workflow_config: native_image_linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Get jar - uses: actions/cache/restore@v3
run: | with:
wget "https://github.com/plantuml/plantuml/releases/download/${PLANTUML_VERSION}/plantuml-${PLANTUML_VERSION#?}.jar" -O plantuml.jar path: |
env: build/libs
PLANTUML_VERSION: "v1.2023.4" build/publications
key: "libs-${{ runner.os }}-${{ github.run_id }}"
fail-on-cache-miss: true
- name: Install system requirements - name: Install system requirements
run: sudo apt install build-essential libz-dev zlib1g-dev run: sudo apt install build-essential libz-dev zlib1g-dev
@ -37,14 +37,18 @@ jobs:
- 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 plantuml.jar -tpng -pipe > out.png 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 - 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 plantuml.jar ./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: Upload native-image as artifact - name: Cache native image
uses: actions/upload-artifact@v3 uses: actions/cache/save@v3
with: with:
name: linux-native-image path: build/libs/plantuml-linux-amd64-*
path: plantuml key: "native-image-linux-${{ runner.os }}-${{ github.run_id }}"