Files
selfphoneng/.github/workflows/ci.yml
T
iamdoubz 164a5f0990
ci / check (push) Successful in 54s
ci / images (push) Successful in 20s
backups: daily backup, Back up now, download, restore.sh
A backup is data/backups/selfphoneng-YYYYMMDD-HHMM.tar.gz (mode 0600):
pg_dump, voicemail, custom sounds, music on hold, recordings if asked,
and a manifest. No generated Asterisk config: it holds plaintext
passwords and comes back from the database. The api makes one a day after
backup.time (once-a-minute check, one try a day) and the dashboard warns
when today's is missing. Settings -> Backups sets the schedule, lists them
for download and has Back up now.

scripts/restore.sh <file> refuses a backup made under another APP_SECRET
(the manifest carries a fingerprint, not the secret), asks for yes, then
replaces the database and the folders the backup has.

Tested on two throwaway servers (docker:dind running the real images):
back up on one, restore on the other. That found the api image crashing
on start since M1: tsc doesn't copy auth/common-passwords.txt into dist.
The Dockerfile copies it now and CI loads the app inside the image.

Task: M11-T3
2026-10-19 17:07:58 -05:00

43 lines
1.6 KiB
YAML

# SPDX-License-Identifier: AGPL-3.0-or-later
# Runs on GitHub Actions and Gitea/Forgejo Actions (both read .github/workflows).
name: ci
on:
push:
pull_request:
jobs:
check:
runs-on: ubuntu-latest
# Run in a container so the service is reachable by its name ("postgres") on every runner:
# GitHub's hosted runners only give services a DNS name inside container jobs.
container: node:24
services:
postgres:
image: postgres:18-alpine
env:
POSTGRES_USER: selfphoneng
POSTGRES_PASSWORD: ci
POSTGRES_DB: selfphoneng
options: >-
--health-cmd "pg_isready -U selfphoneng" --health-interval 5s --health-retries 20
env:
TEST_DATABASE_URL: postgres://selfphoneng:ci@postgres:5432/selfphoneng
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6 # version comes from package.json "packageManager"
# Sound and greeting tests convert real audio (skipped without ffmpeg).
- run: apt-get update -qq && apt-get install -y -qq --no-install-recommends ffmpeg
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm test
images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: docker build -f apps/api/Dockerfile -t selfphoneng-api:ci .
# Loads every module the way the container does: catches files tsc doesn't copy into dist.
- run: docker run --rm --entrypoint node selfphoneng-api:ci --input-type=module -e "await import('/app/dist/app.js')"
- run: docker build -t selfphoneng-asterisk:ci asterisk