Files
Tachidesk/.github/workflows/build_pull_request.yml
Mitchell Syer dc79b4c90a Support PostgreSQL Databases (#1617)
* Support PostgreSQL Databases

* Set the database Schema

* See if we can test postgres

* Another test

* Disable node container

* Update database when changed

* Simplify test workflow

* Only exit on failed migrations

* Run the first databaseUp sync

* Map the port

* Use absolute path for LD_PRELOAD

* Timeout after 1m

* Open the server in both database configurations

* Only exit on migration failed in ci

* Lint

* Use new ServerConfig configuration
2025-09-02 12:29:09 -04:00

97 lines
3.0 KiB
YAML

name: CI Pull Request
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_wrapper:
name: Validate Gradle Wrapper
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v5
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
build:
name: Build pull request
needs: check_wrapper
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout pull request
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
path: master
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Copy CI gradle.properties
run: |
cd master
mkdir -p ~/.gradle
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
- name: Build And Run Jar
working-directory: master
run: |
./gradlew ktlintCheck :server:shadowJar --stacktrace
gcc -fPIC -I$JAVA_HOME/include -I$JAVA_HOME/include/linux -shared scripts/resources/catch_abort.c -lpthread -o scripts/resources/catch_abort.so
export LD_PRELOAD="$(pwd)/scripts/resources/catch_abort.so"
JAR=$(ls ./server/build/*.jar| head -1)
set +e
timeout 30s java -DcrashOnFailedMigration=true \
-Dsuwayomi.tachidesk.config.server.systemTrayEnabled=false \
-Dsuwayomi.tachidesk.config.server.initialOpenInBrowserEnabled=false \
-Dsuwayomi.tachidesk.config.server.databaseType=POSTGRESQL \
-Dsuwayomi.tachidesk.config.server.databaseUrl=postgresql://localhost:5432/postgres \
-Dsuwayomi.tachidesk.config.server.databaseUsername=postgres \
-Dsuwayomi.tachidesk.config.server.databasePassword=postgres \
-jar "$JAR"
ecode="$?"
# if exit code is not 124 or 125, then error
if ! [ "$ecode" -eq 124 -o "$ecode" -eq 125 ]; then
printf "exit code '%s' - exiting.\n" "$ecode"
exit "$ecode"
fi
timeout 30s java -DcrashOnFailedMigration=true \
-Dsuwayomi.tachidesk.config.server.systemTrayEnabled=false \
-Dsuwayomi.tachidesk.config.server.initialOpenInBrowserEnabled=false \
-jar "$JAR"
ecode="$?"
# if exit code is not 124 or 125, then error
if ! [ "$ecode" -eq 124 -o "$ecode" -eq 125 ]; then
printf "exit code '%s' - exiting.\n" "$ecode"
exit "$ecode"
fi
exit 0