Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 27 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# VisualCI's CI: lint, test (Rust with Postgres and MinIO, the Ruby client, the frontend build), then on main build and
# push the server and renderer images and deploy them by committing their digests to talira-ai/infra
# (k3s/resources/visualci/kustomization.yaml), which ArgoCD applies. That commit is the deploy; reverting it is the
# rollback.
# VisualCI's CI: lint, test (the root workspace's crates; app/ with Postgres and RustFS; the Ruby client; the frontend
# build), then on main build and push the app and renderer images and deploy them by committing their digests to
# talira-ai/infra (k3s/resources/visualci/kustomization.yaml), which ArgoCD applies. That commit is the deploy;
# reverting it is the rollback.
name: CI

on:
Expand Down Expand Up @@ -48,7 +48,8 @@ jobs:
# snapshot-diff goes on crates.io: it builds without its schemars feature too.
- run: cargo clippy --locked -p snapshot-diff --no-default-features --all-targets -- -D warnings

# The Laravel Rust app (app/, sc-8900): its own workspace until it replaces server/ at cutover. Not deployed yet.
# The app (app/, Laravel Rust): its own workspace. Its tests also render every customer email as HTML and text for
# the visual job.
app:
runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }}
environment: ${{ github.ref == 'refs/heads/main' && 'kache-write' || '' }}
Expand Down Expand Up @@ -97,9 +98,17 @@ jobs:
- run: cargo fmt --check
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo test --locked
env:
VISUALCI_EMAIL_SNAPSHOTS: ${{ github.workspace }}/tmp/email-snapshots
- uses: actions/upload-artifact@v4
with:
name: email-snapshots
path: tmp/email-snapshots
if-no-files-found: error
retention-days: 7

# The CLI changed since its last release without a version bump: the docs would describe a CLI nobody can download.
# Not needed by deploy, so it never holds back the server.
# Not needed by deploy, so it never holds back a release.
cli-version:
runs-on: ubuntu-latest
timeout-minutes: 5
Expand All @@ -119,19 +128,11 @@ jobs:
- run: python3 -c 'import yaml' 2>/dev/null || pip install pyyaml
- run: python3 scripts/ci/check_orb.py

# The root workspace's crates (crates/*: the CLI, core, renderer, snapshot-diff, wasm).
test:
runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }}
environment: ${{ github.ref == 'refs/heads/main' && 'kache-write' || '' }}
timeout-minutes: 40
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: loco
POSTGRES_PASSWORD: loco
POSTGRES_DB: visualci_server_test
ports: ["55433:5432"]
options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10
steps:
- uses: actions/checkout@v4
# Compile cache (kache, as Cargo's rustc wrapper): the R2 bucket every machine shares (KACHE_BUCKET), else the
Expand All @@ -149,25 +150,14 @@ jobs:
s3-prefix: visualci
s3-access-key-id: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_ACCESS_KEY_ID || secrets.KACHE_RO_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_SECRET_ACCESS_KEY || secrets.KACHE_RO_SECRET_ACCESS_KEY }}
# The request tests also write the MCP tools' and REST API's answers as JSON snapshots, for the visual job.
- run: cargo test --locked --workspace
env:
VISUALCI_JSON_SNAPSHOTS: ${{ github.workspace }}/tmp/json-snapshots/json
# Every customer email (server/src/notify.rs), rendered with sample data, as HTML and text.
VISUALCI_EMAIL_SNAPSHOTS: ${{ github.workspace }}/tmp/json-snapshots/emails
- uses: actions/upload-artifact@v4
with:
name: json-snapshots
path: tmp/json-snapshots
if-no-files-found: error
retention-days: 7

# VisualCI tests itself: screenshots of the landing page, docs and app (against seeded data), Vitest component
# snapshots and the JSON snapshots from `test`, sent as one build to the docspring/visualci project. A changed
# snapshots, app/'s JSON golden files and the emails from `app`, sent as one build to the docspring/visualci project. A changed
# snapshot doesn't fail this job: the GitHub check waits for review. Pull requests from forks have no token and skip
# the upload.
visual:
needs: [test]
needs: [app]
runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }}
environment: ${{ github.ref == 'refs/heads/main' && 'kache-write' || '' }}
timeout-minutes: 30
Expand Down Expand Up @@ -226,8 +216,8 @@ jobs:
- run: scripts/ci/visual.sh capture
- uses: actions/download-artifact@v4
with:
name: json-snapshots
path: tmp/json-snapshots
name: email-snapshots
path: tmp/email-snapshots
# VisualCI's own GitHub Action (clients/github-action), with the CLI this commit built.
- uses: ./clients/github-action
with:
Expand All @@ -238,8 +228,9 @@ jobs:
tmp/visual/site --prefix site/
tmp/visual/site/docs/quick-start.md --prefix site/docs/ --format text
server/frontend/src --from vitest --prefix components/
tmp/json-snapshots/json --prefix json/ --format json
tmp/json-snapshots/emails --prefix emails/ --keep-extension
app/tests/golden/api --prefix json/api/ --format json
app/tests/golden/mcp --prefix json/mcp/ --format json
tmp/email-snapshots --prefix emails/ --keep-extension
- if: failure()
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -377,7 +368,7 @@ jobs:
retention-days: 7

# visualci.com is a Cloudflare Worker with static assets (server/frontend/site/wrangler.jsonc), deployed on main
# before the server, so the apex never points at a server that no longer serves it. Needs the repo secret
# before the app, so the apex never points at an app that no longer serves it. Needs the repo secret
# CLOUDFLARE_API_TOKEN (Workers Scripts on the DocSpring Products account, Workers Routes on visualci.com) and the
# repo variable CLOUDFLARE_ACCOUNT_ID; without them it warns and skips.
site:
Expand Down Expand Up @@ -408,15 +399,14 @@ jobs:
npx --yes wrangler@4.168.0 deploy

images:
needs: [lint, test, clients]
needs: [lint, test, app, clients]
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }}
timeout-minutes: 60
permissions:
contents: read
packages: write
outputs:
server: ${{ steps.server.outputs.digest }}
app: ${{ steps.app.outputs.digest }}
renderer: ${{ steps.renderer.outputs.digest }}
steps:
Expand All @@ -429,21 +419,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: server
uses: docker/build-push-action@v6
with:
context: .
file: docker/server.Dockerfile
push: true
build-args: |
BUILD_SHA=${{ github.sha }}
RENDERER_VERSION=${{ steps.version.outputs.renderer }}
VISUALCI_ANALYTICS=1
tags: ghcr.io/docspring/visualci-server:${{ github.sha }}
cache-from: type=gha,scope=server
cache-to: type=gha,mode=max,scope=server
# VisualCI on Laravel Rust (app/, sc-8900): built on main so the cutover has an image ready, deployed only at
# cutover (talira-ai/infra k3s/resources/visualci/laravel)
# The app (app/), which serves the API, the web app, MCP and the site's pages on its hosts
- id: app
uses: docker/build-push-action@v6
with:
Expand All @@ -458,7 +434,7 @@ jobs:
cache-from: type=gha,scope=app
cache-to: type=gha,mode=max,scope=app
# The renderer is rebuilt only when its inputs change, so its digest (and the running renderers) stay put
# through deploys that only touch the server. Rebuilding an unchanged renderer would give a new digest and roll
# through deploys that only touch the app. Rebuilding an unchanged renderer would give a new digest and roll
# the renderers mid-build for nothing.
- id: renderer_inputs
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ target/
.env
server/frontend/dist
server/frontend/dist-site
server/.github/
.dev-host
11 changes: 7 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ design is in `docs/design.md`; read it before changing the architecture, and upd
nobody can download.
- Fixtures are test data only: synthetic values, or blank template PDFs someone has checked. Never commit a real
customer's document or data.
- Build Rust in CI or on a build machine (docspring-dev), not on small agent VMs. Server tests need docspring-dev's
test database: `scripts/on-dev test` (and a `run` with `DATABASE_URL`) leases docspring-dev itself, never the pool's
rented box, which has no Postgres. Point them at a database of your own, `visualci_server_test_<story>`.
- VisualCI dev ports on docspring-dev: Rust 5250 (the development default), Vite 5173, previews 5180–5199. 5150 is
- Build Rust in CI or on a build machine (docspring-dev), not on small agent VMs. The server is app/ (Laravel Rust,
its own workspace); the root workspace holds the CLI and its crates, whose tests need no database. app/'s tests
need docspring-dev's Postgres: a `scripts/on-dev run` naming `DATABASE_URL` (such as
`VISUALCI_APP_TEST_DATABASE_URL=...`) leases docspring-dev itself, never the pool's rented box, which has no Postgres.
Point them at a database of your own, `visualci_app_test_<story>`.
- VisualCI dev ports on docspring-dev: the app 5250 (`SERVER_PORT=5250`, which the Vite proxy defaults to), Vite 5173,
previews 5180–5199. 5150 is
Talira's dev server: never use it (on 1 Dec 2026 a VisualCI dev server took it, and Talira's localhost and MCP
reached VisualCI instead). Production listens on 5150 inside its cluster, which is separate.
- Any UI design (the landing page, the review UI, emails): load the `hallmark` skill and the frontend design skills
Expand Down
Loading
Loading