Files
PolyMPR/.gitea/workflows/test.yml
T
djalim ae5d5b64ac
Tests / Unit tests (pull_request) Successful in 11s
Tests / Integration tests (pull_request) Failing after 56s
debug(ci): add connection diagnostics before migrate
2026-04-26 00:54:11 +02:00

81 lines
2.1 KiB
YAML

name: "Tests"
on:
pull_request:
branches:
- main
- develop
push:
branches:
- develop
jobs:
unit:
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Install dependencies
run: deno install
- name: Run unit tests
run: deno task test:unit
integration:
name: "Integration tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Start postgres
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq postgresql > /dev/null
PG_VER=$(ls /etc/postgresql/)
sudo pg_ctlcluster $PG_VER main start
sudo -u postgres psql -c "CREATE USER test WITH PASSWORD 'test';"
sudo -u postgres psql -c "CREATE DATABASE polympr_test OWNER test;"
sudo -u postgres psql -d polympr_test -c "GRANT ALL ON SCHEMA public TO test;"
- name: Install dependencies
run: npm install --ignore-scripts && deno install
- name: Debug connection
run: |
echo "--- pg_hba.conf ---"
sudo cat /etc/postgresql/*/main/pg_hba.conf | grep -v "^#" | grep -v "^$"
echo "--- listening ports ---"
sudo ss -tlnp | grep 5432 || echo "nothing on 5432"
echo "--- test connection ---"
PGPASSWORD=test psql -h localhost -U test -d polympr_test -c "SELECT 1" || echo "connection failed"
- name: Apply migrations
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: test
POSTGRES_PASS: test
POSTGRES_DB: polympr_test
run: node_modules/.bin/drizzle-kit migrate
- name: Run integration tests
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: test
POSTGRES_PASS: test
POSTGRES_DB: polympr_test
run: deno task test:integration