Lint / Lint (push) Successful in 1m29s
Security / Secrets (gitleaks) (push) Successful in 1m11s
Security / Dependencies (Trivy) (push) Successful in 1m59s
Tests / Dashboard checks (push) Successful in 1m49s
Security / Code (Semgrep) (push) Successful in 3m8s
Tests / Go backend (push) Successful in 2m50s
Docker / Docker Build & Push (push) Successful in 8m42s
- Target API 37 and use build-tools 37 for release signature checks - Adjust list pagination spacing and clarify shared backend docs
133 lines
3.7 KiB
YAML
133 lines
3.7 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
paths:
|
|
- '.changeset/**'
|
|
- '.github/workflows/**'
|
|
- 'backend/**'
|
|
- 'packages/**'
|
|
- 'scripts/**'
|
|
- 'package.json'
|
|
- 'package-lock.json'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
paths:
|
|
- '.changeset/**'
|
|
- '.github/workflows/**'
|
|
- 'backend/**'
|
|
- 'packages/**'
|
|
- 'scripts/**'
|
|
- 'package.json'
|
|
- 'package-lock.json'
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
node:
|
|
name: Test (Node/Svelte)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Build and test Node/Svelte packages
|
|
run: npm test
|
|
|
|
go:
|
|
name: Test (Go)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
# A throwaway PostgreSQL for the tests that need a real database (the auth store, the
|
|
# platform-user SQL, the media routes and the migrate package). Without these two
|
|
# variables those tests skip themselves.
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: scratch
|
|
ports:
|
|
- 5432/tcp
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
env:
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports['5432'] }}/scratch?sslmode=disable
|
|
SHARED_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports['5432'] }}/scratch?sslmode=disable
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: backend/go.mod
|
|
cache: true
|
|
# -p 1 runs one package at a time, because the database tests share one scratch database.
|
|
- name: Run Go tests
|
|
shell: bash
|
|
run: |
|
|
# Gitea Actions runs jobs in a container, where the service is reached by its label.
|
|
if [ "${GITEA_ACTIONS:-}" = "true" ]; then
|
|
export DATABASE_URL="postgres://postgres:postgres@postgres:5432/scratch?sslmode=disable"
|
|
export SHARED_TEST_DATABASE_URL="postgres://postgres:postgres@postgres:5432/scratch?sslmode=disable"
|
|
fi
|
|
go test -p 1 ./...
|
|
|
|
python:
|
|
name: Test (Python)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Install package
|
|
run: python -m pip install --upgrade pip -e "packages/python-backend[fastapi,test]"
|
|
- name: Run Python tests
|
|
run: python -m unittest discover -s packages/python-backend/tests -p 'test_*.py'
|
|
|
|
java:
|
|
name: Test (Java)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: packages/java-backend
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '17'
|
|
cache: maven
|
|
cache-dependency-path: packages/java-backend/pom.xml
|
|
- name: Run Java tests
|
|
run: mvn -B test
|