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