Files
CollabTable/.github/workflows/tests.yml
T
Gabriel20xx 1719b3c23b
Tests / Dashboard checks (push) Successful in 51s
Tests / Go backend (push) Failing after 34s
ci: pin PostgreSQL test service to port 5432
2026-10-21 08:30:30 +00:00

95 lines
2.1 KiB
YAML

name: Tests
on:
push:
branches:
- "**"
paths:
- 'backend/**'
- 'frontend/**'
- '.github/workflows/tests.yml'
pull_request:
branches:
- main
- master
paths:
- 'backend/**'
- 'frontend/**'
- '.github/workflows/tests.yml'
workflow_dispatch: {}
jobs:
backend:
name: Go backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
permissions:
contents: read
# A throwaway database for the handler and sync tests. They create their own
# schema in it and drop it again, and are skipped when TEST_DATABASE_URL is unset.
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: collabtable_test
ports:
- "5432:5432"
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache: true
- name: Test
run: go test ./...
env:
TEST_DATABASE_URL: "postgres://postgres:postgres@localhost:5432/collabtable_test?sslmode=disable"
frontend:
name: Dashboard checks
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: |
npm ci --prefix ../shared --ignore-scripts --no-audit --no-fund
npm run build --prefix ../shared
npm ci
- name: Check dashboard
run: npm run check
- name: Unit tests
run: npm test