Skip to content

Commit

Permalink
Run Liquibase migrations blocking before startup.
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMasterK committed Aug 14, 2023
1 parent 1175a1c commit e32ffb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/docker-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
- Dockerfile.azul.ci
- Dockerfile.openj9.ci
- Dockerfile.graalvm-jvm.ci
include:
- sleep: 20
- docker-compose-file: testing/docker-compose.cockroachdb.yml
sleep: 30
- docker-compose-file: testing/docker-compose.yugabytedb.yml
sleep: 120
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -45,7 +51,7 @@ jobs:
file: ${{ matrix.dockerfile }}
tags: 1337kavin/piped:latest
- name: Start Docker-Compose services
run: docker-compose -f ${{ matrix.docker-compose-file }} up -d && sleep 20
run: docker-compose -f ${{ matrix.docker-compose-file }} up -d && sleep ${{ matrix.sleep }}
- name: Run tests
run: ./testing/api-test.sh
- name: Collect services logs
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/me/kavin/piped/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public static void main(String[] args) throws Exception {

Injector.useSpecializer();

try {
LiquibaseHelper.init();
} catch (Exception e) {
ExceptionHandler.handle(e);
System.exit(1);
}

Multithreading.runAsync(() -> new Thread(new SyncRunner(
new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build(),
MATRIX_SERVER,
Expand All @@ -69,13 +76,6 @@ public void run() {
}
}).start();

try {
LiquibaseHelper.init();
} catch (Exception e) {
ExceptionHandler.handle(e);
System.exit(1);
}

try (Session ignored = DatabaseSessionFactory.createSession()) {
System.out.println("Database connection is ready!");
} catch (Throwable t) {
Expand Down

0 comments on commit e32ffb1

Please sign in to comment.