docs: server-side crypto invariants, nonce lifecycle, treasury/wallet components and hooks reference #413
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 CI | |
| on: | |
| push: | |
| paths: | |
| - 'apps/backend/**' | |
| - '.github/workflows/backend-ci.yml' | |
| pull_request: | |
| paths: | |
| - 'apps/backend/**' | |
| - '.github/workflows/backend-ci.yml' | |
| jobs: | |
| check: | |
| name: Format · Lint · Test | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 5s | |
| --health-timeout 3s | |
| --health-retries 5 | |
| # The `Run migrations` step below targets DATABASE_URL, so the database | |
| # it points at has to actually exist. Credentials/db name must match the | |
| # DATABASE_URL declared under `env`. | |
| postgres: | |
| image: postgres:16-alpine | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| POSTGRES_DB: clicked | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 3s | |
| --health-retries 10 | |
| defaults: | |
| run: | |
| working-directory: apps/backend | |
| env: | |
| DATABASE_URL: postgres://postgres:password@localhost:5432/clicked | |
| REDIS_URL: redis://localhost:6379 | |
| OBJECT_STORE_ENDPOINT: http://localhost:9000 | |
| OBJECT_STORE_BUCKET: clicked | |
| OBJECT_STORE_ACCESS_KEY: clicked | |
| OBJECT_STORE_SECRET_KEY: clickedsecret | |
| OBJECT_STORE_REGION: us-east-1 | |
| OBJECT_STORE_FORCE_PATH_STYLE: 'true' | |
| JWT_SECRET: ci-test-secret | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| working-directory: . | |
| - name: Start MinIO | |
| run: | | |
| docker run -d \ | |
| --name clicked-minio-ci \ | |
| -p 9000:9000 \ | |
| -p 9001:9001 \ | |
| -e MINIO_ROOT_USER="$OBJECT_STORE_ACCESS_KEY" \ | |
| -e MINIO_ROOT_PASSWORD="$OBJECT_STORE_SECRET_KEY" \ | |
| minio/minio:RELEASE.2025-04-22T22-12-26Z \ | |
| server /data --console-address ":9001" | |
| - name: Wait for MinIO | |
| run: | | |
| for _ in $(seq 1 30); do | |
| curl -fsS http://localhost:9000/minio/health/ready && exit 0 | |
| sleep 2 | |
| done | |
| exit 1 | |
| - name: Seed MinIO bucket | |
| run: | | |
| node --input-type=module <<'NODE' | |
| import { CreateBucketCommand, S3Client } from '@aws-sdk/client-s3'; | |
| const client = new S3Client({ | |
| endpoint: process.env.OBJECT_STORE_ENDPOINT, | |
| region: process.env.OBJECT_STORE_REGION, | |
| credentials: { | |
| accessKeyId: process.env.OBJECT_STORE_ACCESS_KEY, | |
| secretAccessKey: process.env.OBJECT_STORE_SECRET_KEY, | |
| }, | |
| forcePathStyle: true, | |
| }); | |
| try { | |
| await client.send(new CreateBucketCommand({ Bucket: process.env.OBJECT_STORE_BUCKET })); | |
| } catch (error) { | |
| if ( | |
| error?.name !== 'BucketAlreadyOwnedByYou' && | |
| error?.name !== 'BucketAlreadyExists' | |
| ) { | |
| throw error; | |
| } | |
| } | |
| NODE | |
| - name: Run migrations | |
| run: pnpm db:migrate | |
| - name: Format check | |
| run: pnpm format:check | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Tests | |
| run: pnpm test |