# The tests, as `just check` and `just lex` run them: every crate's under # `just cov`'s gate, failing under 100% of lines or functions, then every # XRPC answer hud-server's tests received, held to its method's lexicon # (harness/answers.mjs), as the workspace's types are made from them, and # the views and app files held to the JSON Schemas HUD publishes # (harness/schemas.mjs). hud-server embeds the built pages, so they are # built first. # # The build, the toolchain, cargo-llvm-cov, Node, the pages' packages, # @atproto/lexicon and ajv are kept between runs. image: rust:1.100 # A pre-flight, as check is: the merge queue takes a pull into a batch only # once this has passed at its head. queue: first runners: [runner.knotless.dev] on: push: {refs: [refs/heads/main]} pull: {base: [refs/heads/main, refs/heads/feature/*]} cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/tools, /opt/node, /opt/lexicon, /opt/ajv, web/node_modules] env: # The image's toolchain, over the cached rustup's default (check.yml). RUSTUP_TOOLCHAIN: "1.100.0" steps: - uses: chadtmiller.com/steps/node@1 with: {version: 24.22.1} - uses: chadtmiller.com/steps/npm-ci@1 name: pages' packages with: {dir: web} - uses: chadtmiller.com/steps/cargo-llvm-cov@1 with: {version: 0.9.1} - name: pages run: cd web && npm run build - name: test run: | # As `just cov`, with its ignore. cargo-llvm-cov first removes the # workspace's own old artifacts from target/llvm-cov-target, so # another branch's binaries in the shared cache never count. rm -rf target/answers HUD_ANSWERS="$PWD/target/answers" cargo llvm-cov --workspace --locked \ --ignore-filename-regex '(tests/|tests\.rs|harness/|examples/|rustlib/)' \ --fail-under-lines 100 --fail-under-functions 100 --show-missing-lines - name: answers run: | # With the harness's @atproto/lexicon alone, rather than all of its # packages (a PDS among them). v=$(node -p "require('./harness/package.json').dependencies['@atproto/lexicon']") [ -d "/opt/lexicon/$v/node_modules/@atproto/lexicon" ] || npm install --prefix "/opt/lexicon/$v" --no-audit --no-fund "@atproto/lexicon@$v" NODE_PATH="/opt/lexicon/$v/node_modules" node harness/answers.mjs target/answers - name: schemas run: | v=$(node -p "require('./harness/package.json').dependencies.ajv") [ -d "/opt/ajv/$v/node_modules/ajv" ] || npm install --prefix "/opt/ajv/$v" --no-audit --no-fund "ajv@$v" NODE_PATH="/opt/ajv/$v/node_modules" node harness/schemas.mjs