~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
107 lines · 4.2 KB Raw History
mod bench

# run the local test suite
test:
    uv run tools/test-smoke-runner.py
    zig build test

# scroll every web page under both skins at phone and desktop size and fail on
# a frame-time, scroll-tracking, legibility or toolbar regression (needs a GPU)
ui-gate *args:
    cd tools/ui-gate && pnpm install --frozen-lockfile --silent
    node tools/ui-gate.mjs {{args}}

# bump, promote the changelog and tag a release from main; refuses unless the ui gate passes
release version:
    #!/usr/bin/env bash
    set -euo pipefail
    v="{{version}}"; v="${v#v}"
    [ "$(git branch --show-current)" = main ] || { echo "release from main"; exit 1; }
    [ -z "$(git status --porcelain --untracked-files=no)" ] || { echo "working tree has changes"; exit 1; }
    grep -q '^## unreleased$' CHANGELOG.md || { echo "CHANGELOG.md has no ## unreleased section"; exit 1; }
    just ui-gate || { echo "ui gate failed; not tagging v$v"; exit 1; }
    sed -i.bak -E '3s/\.version = "[^"]+"/.version = "'"$v"'"/' build.zig.zon && rm build.zig.zon.bak
    sed -i.bak "s/^## unreleased$/## $v — $(date +%F)/" CHANGELOG.md && rm CHANGELOG.md.bak
    git commit -q -m "release: v$v" CHANGELOG.md build.zig.zon
    git tag -a "v$v" -m "v$v"
    echo "tagged v$v; push with: git push origin main v$v"

# run the local endpoint smoke test
smoke:
    tools/smoke.sh

# run the experimental permissioned-data endpoint smoke test
smoke-permissioned:
    tools/smoke-permissioned.sh

# stream a local zds to an S3 stand-in with Litestream and restore it
smoke-backups:
    tools/smoke-backups.sh

# mirror blobs to an S3 stand-in that checks signatures, and fetch them back
smoke-blob-mirror:
    zig build
    tools/smoke-blob-mirror.py

# restore the configured Litestream replica into a scratch directory and check it
restore-drill:
    tools/restore-drill.sh

# run both HTTP suites concurrently after one focused build
smoke-all:
    tools/smoke-all.sh

# run the permissioned suite with the pinned @atproto/space SDK checking ZDS
smoke-space-sdk:
    cd tools/space-sdk && pnpm install --frozen-lockfile
    ZDS_SPACE_SDK_DIR="$PWD/tools/space-sdk" tools/smoke-permissioned.sh

# run the interop lane: zds, the reference PDS and indigo's relay core, judged
# by indigo's sync 1.1 checks, goat and a response diff (needs go, node, pnpm)
interop:
    tools/interop/run.sh

# mint an invite code with the configured admin token
invite pds="https://pds.zat.dev" use_count="1" for_account="":
    #!/usr/bin/env bash
    set -euo pipefail
    : "${ZDS_ADMIN_TOKEN:?set ZDS_ADMIN_TOKEN to the configured PDS admin token}"
    if [[ -n "{{for_account}}" ]]; then
      body="$(jq -nc --argjson useCount "{{use_count}}" --arg forAccount "{{for_account}}" '{useCount:$useCount,forAccount:$forAccount}')"
    else
      body="$(jq -nc --argjson useCount "{{use_count}}" '{useCount:$useCount}')"
    fi
    curl -fsS "{{pds}}/xrpc/com.atproto.server.createInviteCode" \
      -H "authorization: Bearer $ZDS_ADMIN_TOKEN" \
      -H 'content-type: application/json' \
      --data "$body" |
    jq -r '.code'

# repair an existing account's PLC rotation set from the local database
plc-repair did:
    zig build plc-repair -- {{did}}

# build the container image locally
docker-build tag="latest" platform="linux/amd64" arch="amd64":
    DOCKER_BUILDKIT=1 docker build --platform {{platform}} --build-arg TARGETARCH={{arch}} --build-arg ZDS_VERSION={{tag}} -t zds:{{tag}} .

# publish the container image to atcr.io
docker-publish tag="latest" platform="linux/amd64" arch="amd64":
    DOCKER_BUILDKIT=1 docker build --platform {{platform}} --build-arg TARGETARCH={{arch}} --build-arg ZDS_VERSION={{tag}} -t zds:{{tag}} .
    docker tag zds:{{tag}} atcr.io/zat.dev/zds:{{tag}}
    docker push atcr.io/zat.dev/zds:{{tag}}

# publish latest plus the current git commit tag
docker-publish-current:
    just docker-publish latest
    just docker-publish $(git rev-parse --short=12 HEAD)

# publish latest, a semver tag, and the current git commit tag
docker-publish-release version:
    just docker-publish {{version}}
    just docker-publish latest
    just docker-publish $(git rev-parse --short=12 HEAD)

# verify and cache per-slot drawings before building or deploying
drawings config="config/drawings.json":
    zig build drawings -- "{{config}}"