# The tests, under `just cov`'s gate: every test binary against the # spaces alpha, and those that reach what a PDS without spaces does # against the npm reference PDS too, failing under 100% of lines or # functions, a pull's run as the merge queue's batch. Then that every # XRPC answer they received is as its lexicon says. # # Node, the harness's packages, the alpha's build, cargo-llvm-cov and the # build are kept between runs; each is made again only when what it is # made from changes. So are the test runs that passed, in /opt/testcache: # a test binary the same byte for byte as one that passed, against the # same harness, is not run again, and its profile counts (harness/cov.mjs). image: rust:1.98 # A pre-flight, as check is: the merge queue takes a pull into a batch only # once this has passed at its head, so one whose tests fail on their own, # or that misses a line, costs no batch and no halving. The runner host's # run of the pull counts; with none, the runner landing the queue runs it. queue: first # Pushes to main, and pulls into it or a feature/ branch, at their heads # merged with their base. on: push: {refs: [refs/heads/main]} pull: {base: [refs/heads/main, refs/heads/feature/*]} cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/node, /opt/tools, /opt/atproto, harness/node_modules, /opt/testcache] env: # The spaces alpha the tests run against, as KNOTLESS_DEV_ENV names a # checkout of it locally. ATPROTO_COMMIT: 11c5d98cd50261c5e1201fedc5c6c05a7b8d1ccf # Bumped when the steps that build the alpha change, to build it again. ALPHA_BUILD: "2" steps: # Node into /opt/node, the harness's packages when their lockfile # changes, and cargo-llvm-cov into /opt/tools, each kept in the cache. - uses: chadtmiller.com/steps/node@1 with: {version: 24.22.1} - uses: chadtmiller.com/steps/npm-ci@1 name: harness with: {dir: harness, omit: dev} - uses: chadtmiller.com/steps/cargo-llvm-cov@1 with: {version: 0.9.1} - name: spaces alpha run: | [ "$(cat /opt/atproto/.built 2>/dev/null)" = "$ATPROTO_COMMIT $ALPHA_BUILD" ] && exit 0 export PATH=/opt/node/bin:$PATH COREPACK_ENABLE_DOWNLOAD_PROMPT=0 COREPACK_HOME=/opt/atproto/.corepack find /opt/atproto -mindepth 1 -delete cd /opt/atproto git init -q . && git fetch -q --depth 1 https://github.com/bluesky-social/atproto.git "$ATPROTO_COMMIT" && git checkout -q FETCH_HEAD mkdir .bin && corepack enable --install-directory /opt/atproto/.bin export PATH=/opt/atproto/.bin:$PATH pnpm install --frozen-lockfile --ignore-scripts pnpm run build:tooling --force pnpm --filter '@atproto/dev-env^...' --filter @atproto/dev-env run --if-present prebuild pnpm exec tsc --build packages/dev-env/tsconfig.build.json # The PDS serves the OAuth sign-in pages from this bundle. pnpm --filter @atproto/oauth-provider-ui run build:ui echo "$ATPROTO_COMMIT $ALPHA_BUILD" > /opt/atproto/.built - name: sqlite run: | # The one install script the PDS needs, which the install above # skips: SQLite's native module, as better-sqlite3's own script builds # it (a prebuilt one where there is one). export PATH=/opt/node/bin:$PATH cd "$(dirname "$(node -p "require.resolve('better-sqlite3/package.json', { paths: ['/opt/atproto/packages/pds'] })")")" [ -f build/Release/better_sqlite3.node ] && exit 0 npm run install - name: test run: | export PATH=/opt/node/bin:/opt/tools:$PATH # Every branch shares this target, but the report reads only the # binaries this build made, so another branch's never count as code # never run, and nothing need be cleaned first. # Half the host's cores, as two test runs go side by side, over two # PDSes of each net, as one PDS is one node process. # A pull's run, its pre-flight, goes against both nets at once, as # the batch's does: one against the stock PDS first fell short of the # gate in every pull that changed a test binary, then ran the alpha # after it, which cost a minute more than running both side by side. # The alpha is the stock PDS with spaces added: against the stock PDS # too go only the binaries whose tests reach knotless's handling of # a PDS without spaces, which the alpha never answers as. Every # binary against both took 40% longer and reached nothing more; a # line that falls short of the gate without one names it. COV_STOCK=gateway,pages,cli,spaces,oauth COV_STORE=/opt/testcache COV_JOBS=$(( $(nproc) / 2 )) COV_HARNESSES=2 COV_TOOLCHAIN=$(rustup show active-toolchain | cut -d' ' -f1) \ node harness/cov.mjs /opt/atproto/packages/dev-env - name: answers run: | # Every XRPC answer knotless-serve's tests received, fresh or kept # with a stored run, as its lexicon says: the pages' types are made # from the lexicons, so this is what holds the server to them. export PATH=/opt/node/bin:$PATH node harness/answers.mjs target/llvm-cov-target/cov-report/answers - name: plans run: | # No query the tests ran scans a table that grows with the network, # as SQLite would plan it at prod's size, unless its SQL says so. export PATH=/opt/node/bin:$PATH node harness/plans.mjs target/llvm-cov-target/cov-report/plans