feat: system prompt can now be a template #546
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backend | |
permissions: | |
contents: read | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/backend.yaml | |
- backend/** | |
workflow_call: | |
defaults: | |
run: | |
working-directory: backend | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-node@v5 | |
with: | |
node-version: 24.x | |
cache: 'npm' | |
cache-dependency-path: backend/package-lock.json | |
- run: npm install | |
- run: npm run build | |
check-generated-files: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: [reis, tools, executor] | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-node@v5 | |
with: | |
node-version: 24.x | |
cache: 'npm' | |
cache-dependency-path: backend/package-lock.json | |
- run: npm ci | |
- run: npm run generate-${{ matrix.service }} | |
- run: git diff --quiet # exits with exitcode != 0 if changes are detected | |
check-generated-specs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-node@v5 | |
with: | |
node-version: 24.x | |
cache: 'npm' | |
cache-dependency-path: backend/package-lock.json | |
- run: npm ci | |
- run: npm run generate-openapi-dev | |
- run: git add -N . | |
- run: git diff . | |
- run: git diff --quiet . | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-node@v5 | |
with: | |
node-version: 24.x | |
cache: 'npm' | |
cache-dependency-path: backend/package-lock.json | |
- run: npm install | |
- run: npm run lint | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:17.5 | |
env: | |
POSTGRES_USER: admin | |
POSTGRES_PASSWORD: secret | |
POSTGRES_DB: cccc | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
env: | |
BASE_URL: 'https://example.com' | |
DB_URL: postgres://admin:secret@localhost:5432/cccc | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-node@v5 | |
with: | |
node-version: 24.x | |
cache: 'npm' | |
cache-dependency-path: backend/package-lock.json | |
- run: npm install | |
- run: npm run test:cov | |
- uses: irongut/[email protected] | |
with: | |
badge: true | |
filename: backend/coverage/cobertura-coverage.xml | |
format: markdown | |
output: both | |
- run: cp code-coverage-results.md $GITHUB_STEP_SUMMARY | |
working-directory: . | |
test-migration: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:17.5 | |
env: | |
POSTGRES_USER: admin | |
POSTGRES_PASSWORD: secret | |
POSTGRES_DB: cccc | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
env: | |
BASE_URL: 'https://example.com' | |
DB_URL: postgres://admin:secret@localhost:5432/cccc | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-node@v5 | |
with: | |
node-version: 24.x | |
cache: 'npm' | |
cache-dependency-path: backend/package-lock.json | |
- run: npm install | |
- run: npm run migration:run | |
# changes the return code from 1 to 0 in case no schema was changed and vice versa | |
- run: sh -c "! npm run migration:generate --name=test" | |
run-backend-without-schema-permissions: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:17.5 | |
env: | |
POSTGRES_USER: admin | |
POSTGRES_PASSWORD: secret | |
POSTGRES_DB: cccc | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
env: | |
BASE_URL: 'https://example.com' | |
DB_URL: postgres://admin:secret@localhost:5432/cccc | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-node@v5 | |
with: | |
node-version: 24.x | |
cache: 'npm' | |
cache-dependency-path: backend/package-lock.json | |
- run: npm install | |
- run: sudo apt-get update && sudo apt-get install --yes --no-install-recommends postgresql-client | |
- name: Create event trigger to prevent schema creation | |
run: | | |
psql postgres://admin:secret@localhost:5432/cccc <<'EOF' | |
CREATE OR REPLACE FUNCTION prevent_schema_creation() | |
RETURNS event_trigger AS $function$ | |
BEGIN | |
IF current_user = 'admin' THEN | |
RAISE EXCEPTION 'Schema creation not allowed for user admin'; | |
END IF; | |
END; | |
$function$ LANGUAGE plpgsql; | |
CREATE EVENT TRIGGER prevent_schema_creation_trigger | |
ON ddl_command_start | |
WHEN TAG IN ('CREATE SCHEMA') | |
EXECUTE FUNCTION prevent_schema_creation(); | |
EOF | |
- name: Expect backend start to fail | |
run: sh -c "! npm run dev" |