Fix DB connection pooling #744
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Agrammon backend and models | |
on: | |
push: | |
branches: | |
- '*' | |
tags-ignore: | |
- '*' | |
pull_request: | |
jobs: | |
raku: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- ubuntu-latest | |
raku-version: | |
- '2023.02' | |
runs-on: ${{ matrix.os }} | |
services: | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: agrammon_test | |
ports: | |
- 5432:5432 | |
options: | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Install LaTeX | |
run: | | |
sudo apt update | |
sudo apt-get install texlive texlive-luatex texlive-latex-recommended texlive-latex-extra texlive-science | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Setup raku | |
uses: Raku/setup-raku@v1 | |
with: | |
raku-version: ${{ matrix.raku-version }} | |
- name: Setup Raku cache | |
uses: actions/cache@v2 | |
id: rakuCache | |
with: | |
path: .raku | |
key: ${{ runner.os }}-${{ matrix.raku-version }}-${{ hashFiles('./dev/META6.json') }} | |
- name: Install Raku modules | |
if: steps.rakuCache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p $GITHUB_WORKSPACE/.raku | |
zef --install-to=inst#$GITHUB_WORKSPACE/.raku --debug --deps-only --/test --test-depends install . | |
- name: Checksum model dir | |
run: | | |
find t/test-data/Models/hr-inclNOx* -type f -print0 | sort -z | xargs -0 shasum > ./MODEL_MD5 | |
cat ./MODEL_MD5 | |
mkdir -p $HOME/.agrammon | |
- name: Setup model cache | |
uses: actions/cache@v2 | |
id: modelCache | |
with: | |
path: $HOME/.agrammon | |
key: AgrammonModels-${{ hashFiles('./MODEL_MD5') }} | |
- name: Load test database | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: agrammon_test | |
PGPASSFILE: ./dev/pgpass | |
AGRAMMON_DUMP: ./t/test-data/agrammon_test.dump.sql | |
run: | | |
chmod 0600 $PGPASSFILE | |
psql -U postgres -h localhost -c "CREATE USER agrammon PASSWORD 'agrammonATwork'" > /dev/null | |
psql -U postgres -h localhost -c "CREATE GROUP agrammon_user USER agrammon" > /dev/null | |
psql -U postgres -h localhost -c "GRANT ALL ON SCHEMA public TO agrammon_user" > /dev/null | |
psql -U postgres -h localhost -c "CREATE EXTENSION pgcrypto" agrammon_test > /dev/null | |
psql -U postgres -h localhost --file=$AGRAMMON_DUMP $POSTGRES_DB > /dev/null | |
- name: Run backend tests | |
run: | | |
RAKULIB=inst#$GITHUB_WORKSPACE/.raku $GITHUB_WORKSPACE/.raku/bin/prove6 -l -v t |