Skip to content

Add PDFOptimize Kotlin sample #52

Add PDFOptimize Kotlin sample

Add PDFOptimize Kotlin sample #52

name: test-kotlin-samples
on:
pull_request:
push:
branches: [ develop ]
env:
JAVA_VERSION: '11'
jobs:
run-samples:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
dir: ['TextExtract', 'FlattenTransparency', 'SplitPDF', 'ConvertToOffice', 'MergePDF', 'ListWords', 'PDFOptimize']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: Clean target folder
working-directory: ${{ matrix.dir }}
run: mvn -e clean
- name: Unpack APDFL from Maven Central
working-directory: ${{ matrix.dir }}
run: mvn -e process-resources
- name: Compile and assemble sample JAR files with dependencies
working-directory: ${{ matrix.dir }}
run: mvn -e package
- name: Set up Windows system PATH
working-directory: ${{ matrix.dir }}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
echo "${{ github.workspace }}\${{ matrix.dir }}\target\lib" >> $GITHUB_PATH
fi
- name: Run samples
working-directory: ${{ matrix.dir }}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
java -Djava.library.path="$PATH" -Dfile.encoding=UTF-8 -jar target/${{ matrix.dir }}-1.0-SNAPSHOT-jar-with-dependencies.jar
elif [ "$RUNNER_OS" == "Linux" ]; then
java -Djava.library.path=./target/lib -Dfile.encoding=UTF-8 -jar target/${{ matrix.dir }}-1.0-SNAPSHOT-jar-with-dependencies.jar
fi
- name: List files
run: |
ls ${{matrix.dir}}
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: sample-output-${{ runner.os }}-${{matrix.dir}}
path: |
${{matrix.dir}}/*.txt
${{matrix.dir}}/*.pdf
${{matrix.dir}}/*.docx
${{matrix.dir}}/*.xlsx
${{matrix.dir}}/*.pptx