Skip to content

Merge of #588

Merge of #588 #1267

Workflow file for this run

name: Build
on: push
env:
GRAALVM_VERSION: 22.1.0.1-Final
JAVA_VERSION: java17
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
# fetch unshallow to enable blame for Sonar
fetch-depth: 0
- name: Set up GraalVM
uses: gluonhq/setup-graalvm@3a9b11a45ef0ecad69107f5884b5dbbb7b806e1c
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
graalvm: ${{ env.GRAALVM_VERSION }}
jdk: ${{ env.JAVA_VERSION }}
- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository/
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Cache Sonar
uses: actions/cache@v4
with:
path: ~/.sonar/cache/
key: ${{ runner.os }}-sonar
- name: Install PDF Clown
run: |
./scripts/install-deps.sh
- name: Maven verify
run: |
./mvnw -B verify -Pcoverage
- name: Run Sonar analysis
# see https://github.com/dependabot/dependabot-core/issues/3253#issuecomment-852541544
if: ${{ github.actor != 'dependabot[bot]' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
./mvnw -B sonar:sonar
- name: Upload JAR
uses: actions/upload-artifact@v4
with:
name: artifacts-jar
path: ./target/pdfzoomwizard-*.jar
- name: Extract version
id: extract-version
run: >
echo "version=$(./mvnw help:evaluate -q -Dexpression=project.version -DforceStdout)" >> $GITHUB_OUTPUT
native-linux:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up GraalVM
uses: gluonhq/setup-graalvm@3a9b11a45ef0ecad69107f5884b5dbbb7b806e1c
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
graalvm: ${{ env.GRAALVM_VERSION }}
jdk: ${{ env.JAVA_VERSION }}
- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository/
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Install libraries
run: >
sudo apt-get update && sudo apt-get install
libasound2-dev
libavcodec-dev
libavformat-dev
libavutil-dev
libgl-dev
libgtk-3-dev
libpango1.0-dev
libxtst-dev
- name: Install PDF Clown
run: |
./scripts/install-deps.sh
- name: Maven compile and link
run: |
./mvnw -B gluonfx:build
- name: Prepare native image for upload
run: |
cp "./target/gluonfx/x86_64-linux/PDF Zoom Wizard" ./pdfzoomwizard
tar --create --gzip --file "./pdfzoomwizard-linux-${{needs.build.outputs.version}}.tar.gz" ./pdfzoomwizard
- name: Upload native image
uses: actions/upload-artifact@v4
with:
name: artifacts-linux
path: ./pdfzoomwizard-linux-*.tar.gz
native-macos:
needs: build
runs-on: macos-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up GraalVM
uses: gluonhq/setup-graalvm@3a9b11a45ef0ecad69107f5884b5dbbb7b806e1c
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
graalvm: ${{ env.GRAALVM_VERSION }}
jdk: ${{ env.JAVA_VERSION }}
- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository/
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Install PDF Clown
run: |
./scripts/install-deps.sh
- name: Maven compile and link
run: |
./mvnw -B gluonfx:build
- name: Prepare native image for upload
run: |
cp "./target/gluonfx/x86_64-darwin/PDF Zoom Wizard" ./pdfzoomwizard
tar --create --gzip --file "./pdfzoomwizard-macos-${{needs.build.outputs.version}}.tar.gz" ./pdfzoomwizard
- name: Upload native image
uses: actions/upload-artifact@v4
with:
name: artifacts-macos
path: ./pdfzoomwizard-macos-*.tar.gz
native-windows:
needs: build
runs-on: windows-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v2
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
- name: Set up GraalVM
uses: gluonhq/setup-graalvm@3a9b11a45ef0ecad69107f5884b5dbbb7b806e1c
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
graalvm: ${{ env.GRAALVM_VERSION }}
jdk: ${{ env.JAVA_VERSION }}
- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository/
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Install PDF Clown
run: |
bash ./scripts/install-deps.sh
- name: Maven compile and link
run: |
./mvnw -B gluonfx:build
- name: Prepare native image for upload
run: |
cp ".\target\gluonfx\x86_64-windows\PDF Zoom Wizard.exe" .\pdfzoomwizard.exe
Compress-Archive -Path .\pdfzoomwizard.exe -DestinationPath ".\pdfzoomwizard-windows-${{needs.build.outputs.version}}.zip"
- name: Upload native image
uses: actions/upload-artifact@v4
with:
name: artifacts-windows
path: ./pdfzoomwizard-windows-*.zip
release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: [ native-linux, native-macos, native-windows ]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
merge-multiple: true
- name: Create GitHub release
uses: softprops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
generate_release_notes: true
files: |
./pdfzoomwizard-linux-*.tar.gz
./pdfzoomwizard-macos-*.tar.gz
./pdfzoomwizard-windows-*.zip
./pdfzoomwizard-*.jar