From b6d401f4876cbfcfce28e23c38cdf9c0a086ec9e Mon Sep 17 00:00:00 2001 From: George Dietrich Date: Thu, 19 Oct 2023 00:07:13 -0400 Subject: [PATCH 1/5] Run PG service as part of test CI job --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c150660..3914c1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,20 @@ jobs: - name: Ameba run: ./bin/ameba test: + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_USER: blog_user + POSTGRES_PASSWORD: mYAw3s0meB!og + POSTGRES_DB: postgres + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 2s + --health-timeout 10s + --health-retries 5 strategy: fail-fast: false matrix: From afbea5013b66365296c91e300c5405b12ea6057b Mon Sep 17 00:00:00 2001 From: George Dietrich Date: Wed, 29 Nov 2023 20:43:20 -0500 Subject: [PATCH 2/5] create DB with test username --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3914c1d..8148117 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,8 +41,8 @@ jobs: postgres: image: postgres:16-alpine env: - POSTGRES_USER: blog_user - POSTGRES_PASSWORD: mYAw3s0meB!og + POSTGRES_USER: blog_test_user + POSTGRES_PASSWORD: 'mYAw3s0meB!og' POSTGRES_DB: postgres ports: - 5432:5432 From 7ef251516a4709a66b68d42786b7903a21ae7bb2 Mon Sep 17 00:00:00 2001 From: George Dietrich Date: Wed, 29 Nov 2023 20:46:29 -0500 Subject: [PATCH 3/5] Install `libsqlite3-dev` to workaround `micrate` bug --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8148117..db295b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,9 @@ jobs: image: crystallang/crystal:latest steps: - uses: actions/checkout@v3 + # Workaround https://github.com/amberframework/micrate/issues/87 + - name: Install Lib Dependencies + run: apt install libsqlite3-dev - name: Install Dependencies run: shards install - name: Ameba From e4bc54328cb2e9a0d001fda0f5e2053b484b2538 Mon Sep 17 00:00:00 2001 From: George Dietrich Date: Wed, 29 Nov 2023 20:48:55 -0500 Subject: [PATCH 4/5] Update and upgrade apt packages before installing sqlite dev --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db295b5..3417c98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: - uses: actions/checkout@v3 # Workaround https://github.com/amberframework/micrate/issues/87 - name: Install Lib Dependencies - run: apt install libsqlite3-dev + run: apt update && apt upgrade -y && apt install -y libsqlite3-dev - name: Install Dependencies run: shards install - name: Ameba From 2260f484121afe1499db7bd81e41dd42d0c2314c Mon Sep 17 00:00:00 2001 From: George Dietrich Date: Wed, 29 Nov 2023 20:53:12 -0500 Subject: [PATCH 5/5] Skip running tests on mac to keep things simple --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3417c98..52532b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,8 +59,6 @@ jobs: matrix: os: - ubuntu-latest - - macos-latest - # - windows-latest crystal: - latest - nightly