chadtmiller.com/monolith
An atproto PDS
0
0
# The gates, as `just gates` runs them: the code gates (cargo fmt, clippy,
# cargo deny, no unsafe code, and the pages' layers, contrast and
# svelte-check), the server's own tests, and the harness runs of the server
# against the reference PDS, several at once, a short crashing run and the
# pages in Chromium among them. On every pull into main, so the merge queue
# waits on them, and on every push to main. The long crash runs and the
# performance step are nightly.yml's.
#
# Only a change to what they check runs them: the server's source and its
# build, the pages it embeds (web/), the data and lexicons it reads from
# spec/, the harness the gates run (not bench.mjs, compat.mjs or look.mjs,
# which no gate runs), and this workflow. Anything else, as the README, the
# spec's prose, bench/ and compat/, is filed as skipped, which the merge
# queue takes as passing.
#
# Node, the harness's and the pages' packages, Chromium and the libraries
# it needs, cargo-deny and the build are kept between runs.
image: rust:1.98
runners: [runner.knotless.dev]
# The two lists are the same; keep them so.
on:
push:
refs: [refs/heads/main]
paths: [crates/**, Cargo.*, deny.toml, .cargo/**, .node-version, .knotless/uses.lock, .knotless/workflows/gates.yml, web/**, spec/atproto/**, spec/data/**, spec/interop/**, spec/lexicons/**, spec/mcp/**, spec/rfc/**, spec/spaces/**, harness/checks/**, harness/lib/**, harness/spaces/**, harness/upgrade/**, harness/compare.mjs, harness/conformance.*, harness/code.mjs, harness/layers.mjs, harness/contrast.mjs, harness/gates.mjs, harness/perf.mjs, harness/perf-baseline.json, harness/package*.json]
pull:
base: [refs/heads/main]
paths: [crates/**, Cargo.*, deny.toml, .cargo/**, .node-version, .knotless/uses.lock, .knotless/workflows/gates.yml, web/**, spec/atproto/**, spec/data/**, spec/interop/**, spec/lexicons/**, spec/mcp/**, spec/rfc/**, spec/spaces/**, harness/checks/**, harness/lib/**, harness/spaces/**, harness/upgrade/**, harness/compare.mjs, harness/conformance.*, harness/code.mjs, harness/layers.mjs, harness/contrast.mjs, harness/gates.mjs, harness/perf.mjs, harness/perf-baseline.json, harness/package*.json]
cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/node, /opt/cargo-deny, /opt/browsers, /opt/chromium-debs, harness/node_modules, harness/spaces/node_modules, web/node_modules]
env:
PLAYWRIGHT_BROWSERS_PATH: /opt/browsers
steps:
- uses: chadtmiller.com/steps/node@1
with: {version: 24.22.1}
- uses: chadtmiller.com/steps/npm-ci@1
with: {dir: harness}
- uses: chadtmiller.com/steps/npm-ci@1
with: {dir: harness/spaces}
- uses: chadtmiller.com/steps/npm-ci@1
with: {dir: web}
# The pages, which pds-server embeds: built before anything compiles it.
- name: web
run: cd web && PATH=/opt/node/bin:$PATH npm run build
- name: chromium
run: |
export PATH=/opt/node/bin:$PATH
cd harness
# The browser, into /opt/browsers once for each Playwright version.
npx playwright install chromium
# The libraries it needs, which `install-deps` would fetch with apt on
# every run: their .debs are kept, fetched again only when this
# Playwright or this Debian asks for others, and installed offline.
pkgs=$(npx playwright install-deps --dry-run chromium | sed -n "s/.*--no-install-recommends \([^\"']*\).*/\1/p")
[ -n "$pkgs" ] || { echo "no packages in: $(npx playwright install-deps --dry-run chromium)"; exit 1; }
debs=/opt/chromium-debs
want="$(. /etc/os-release && echo "$VERSION_ID") $pkgs"
if [ "$(cat $debs/.want 2>/dev/null)" != "$want" ]; then
rm -rf "${debs:?}"/* && mkdir -p $debs/partial
apt-get update -qq
apt-get install -y -qq --no-install-recommends --download-only -o Dir::Cache::archives=$debs $pkgs
echo "$want" > $debs/.want
fi
dpkg -i $debs/*.deb > /dev/null
# A step at a time, each under the runner's limit on one. The tests'
# scratch directories are in memory where /dev/shm has room for them (they
# take 8 MB at most): the server's durability tests start it on its log
# cut at every byte, and each start syncs every log, which on a disk is
# most of the tests' time. The build's own temporary files stay on the
# disk.
- name: tools
run: rustup component add rustfmt clippy && (test -x /opt/cargo-deny/bin/cargo-deny || cargo install --locked --root /opt/cargo-deny cargo-deny)
- name: code
run: cd harness && PATH=/opt/cargo-deny/bin:/opt/node/bin:$PATH node gates.mjs code
- name: test
run: |
cargo test --no-run
if [ -d /dev/shm ] && [ "$(df -Pk /dev/shm | awk 'NR==2 {print $4}')" -ge 49152 ]; then
export TMPDIR=/dev/shm
echo "the tests' scratch directories are in /dev/shm"
fi
cargo test
- name: build
run: cargo build --release -p pds
# compare and commands in one step, so the short runs of each fill in
# around the longest.
- name: harness
run: cd harness && PATH=/opt/node/bin:$PATH node gates.mjs compare commands