mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 18:44:05 +02:00
94 lines
3.5 KiB
YAML
94 lines
3.5 KiB
YAML
name: DB migration smoke test
|
|
|
|
# Boots the current Stirling-PDF JAR against H2 fixtures captured from past
|
|
# releases (v2.0.0 / v2.5.0 / v2.10.0) and verifies admin login still works.
|
|
# Catches schema changes that would break existing user databases under
|
|
# Hibernate's `ddl-auto=update` upgrade path.
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
pick:
|
|
uses: ./.github/workflows/_runner-pick.yml
|
|
|
|
migration-test:
|
|
needs: pick
|
|
runs-on: ${{ needs.pick.outputs.is_fork == 'true' && 'ubuntu-latest' || 'depot-ubuntu-24.04-8' }}
|
|
timeout-minutes: 30
|
|
env:
|
|
DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Set up JDK 25
|
|
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
|
|
with:
|
|
java-version: 25
|
|
distribution: temurin
|
|
|
|
- name: Cache Gradle dependency artifacts
|
|
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
path: |
|
|
~/.gradle/wrapper
|
|
~/.gradle/caches/modules-2/files-2.1
|
|
~/.gradle/caches/modules-2/metadata-2.*
|
|
key: gradle-deps-${{ runner.os }}-jdk-25-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties', '**/*.gradle', '**/*.gradle.kts', 'settings.gradle', 'settings.gradle.kts', 'gradle/libs.versions.toml') }}
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
|
|
with:
|
|
gradle-version: 9.3.1
|
|
cache-disabled: true
|
|
|
|
# No `-PnoSpotless` here yet because the upstream cache layer matches the
|
|
# backend build's; reuse keeps cold-cache cost identical.
|
|
- name: Build Stirling-PDF JAR
|
|
env:
|
|
MAVEN_USER: ${{ secrets.MAVEN_USER }}
|
|
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
|
MAVEN_PUBLIC_URL: ${{ secrets.MAVEN_PUBLIC_URL }}
|
|
run: ./gradlew :stirling-pdf:bootJar -PnoSpotless --no-daemon
|
|
|
|
- name: Locate built JAR
|
|
id: jar
|
|
run: |
|
|
jar=$(find app/core/build/libs -maxdepth 1 -name 'Stirling-PDF*.jar' -o -name 'stirling-pdf*.jar' 2>/dev/null \
|
|
| grep -vE '(-plain|-sources)\.jar$' | head -n 1)
|
|
if [[ -z "$jar" ]]; then
|
|
echo "::error::No JAR under app/core/build/libs"
|
|
ls -lah app/core/build/libs || true
|
|
exit 1
|
|
fi
|
|
# Absolute path - the migration script pushd's into a temp workdir
|
|
# before invoking java, which would dangle a relative path.
|
|
jar=$(realpath "$jar")
|
|
echo "path=$jar" >> "$GITHUB_OUTPUT"
|
|
echo "Built JAR: $jar"
|
|
|
|
- name: Run migration smoke test
|
|
env:
|
|
STIRLING_JAR: ${{ steps.jar.outputs.path }}
|
|
run: bash scripts/db-migration/run-migration-test.sh
|
|
|
|
- name: Upload app logs on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: db-migration-app-logs
|
|
# Path matches the preserved workdir in run-migration-test.sh -
|
|
# only failing fixtures leave a directory behind.
|
|
path: /tmp/stirling-migration-failed-*/app.log
|
|
retention-days: 7
|
|
if-no-files-found: warn
|