Skip to content

2.21.1

2.21.1 #18

Workflow file for this run

name: test
on: [ push, pull_request ]
jobs:
test:
name: Node v${{ matrix.node }} on PostgreSQL v${{ matrix.postgres }}
strategy:
fail-fast: false
matrix:
node: [ '16', '18', '20' ]
postgres: [ '14', '16' ]
runs-on: ubuntu-latest
services:
postgres:
image: postgres:${{ matrix.postgres }}
env:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5433:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PostgreSQL
run: |
date
sudo apt purge postgresql-14
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install "postgresql-${{ matrix.postgres }}"
sudo cp ./test/_support/pg_hba.conf /etc/postgresql/${{ matrix.postgres }}/main/pg_hba.conf
sudo cat /etc/postgresql/${{ matrix.postgres }}/main/pg_hba.conf
sudo sed -i 's/.*wal_level.*/wal_level = logical/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
sudo sed -i 's/.*max_prepared_transactions.*/max_prepared_transactions = 100/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
sudo sed -i 's/.*ssl = .*/ssl = on/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
openssl req -new -x509 -nodes -days 365 -text -subj "/CN=localhost" -extensions v3_req -config <(cat /etc/ssl/openssl.cnf <(printf "\n[v3_req]\nbasicConstraints=critical,CA:TRUE\nkeyUsage=nonRepudiation,digitalSignature,keyEncipherment\nsubjectAltName=DNS:localhost")) -keyout server.key -out server.crt
sudo cp server.key /etc/postgresql/${{ matrix.postgres }}/main/server.key
sudo cp server.crt /etc/postgresql/${{ matrix.postgres }}/main/server.crt
sudo chmod og-rwx /etc/postgresql/${{ matrix.postgres }}/main/server.key
sudo systemctl start postgresql.service
sudo systemctl status postgresql.service
pg_isready
- name: Configure database environment
run: |
sudo -u postgres dropdb postgrejs_test --if-exists
sudo -u postgres psql -c "alter system set ssl=on;"
sudo -u postgres psql -c "drop user if exists postgrejs_test;"
sudo -u postgres psql -c "create user postgrejs_test;"
sudo -u postgres psql -c "alter system set password_encryption=md5;"
sudo -u postgres psql -c "select pg_reload_conf();"
sudo -u postgres psql -c "drop user if exists postgrejs_test_md5;"
sudo -u postgres psql -c "create user postgrejs_test_md5 with password 'postgrejs_test_md5'"
sudo -u postgres psql -c "alter system set password_encryption='scram-sha-256';"
sudo -u postgres psql -c "select pg_reload_conf();"
sudo -u postgres psql -c "drop user if exists postgrejs_test_scram;"
sudo -u postgres psql -c "create user postgrejs_test_scram with password 'postgrejs_test_scram'"
sudo -u postgres createdb postgrejs_test
sudo -u postgres psql -c "grant all on database postgrejs_test to postgrejs_test;"
sudo -u postgres psql -c "alter database postgrejs_test owner to postgrejs_test;"
# - uses: denoland/setup-deno@v1
# with:
# deno-version: v1.x
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install NodeJS dependencies
run: npm install
- name: Run lint
run: npm run lint
- name: Check for circular imports
run: npm run check
- name: Run tests
run: npm run citest
env:
NODE_TLS_REJECT_UNAUTHORIZED: 0
PGUSER: postgres
PGSOCKET: /var/run/postgresql
PGDATABASE: postgrejs_test
INIT_PG: true
LOGIN_MD5: postgrejs_test_md5
LOGIN_SCRAM: postgrejs_test_scram
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}