~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
54 lines · 2.6 KB Raw History
# The tests, under `just cov`'s gate: every test binary, failing under 100%
# of lines or functions. A binary the tests start (the host, the command)
# is counted as it runs, so it is told to stop rather than killed.
#
# The tests that reach the network run against the reference PDS and PLC
# (harness/pds.mjs), on the space alpha harness/alpha.sh builds. 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.
image: rust:1.100
# The shared runner host, as every workflow here.
runners: [runner.knotless.dev]
# 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
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/atproto, harness/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: harness
    with: {dir: harness, omit: dev}
  - uses: chadtmiller.com/steps/cargo-llvm-cov@1
    with: {version: 0.9.1}
  - name: spaces alpha
    run: sh harness/alpha.sh
  - name: sqlite
    run: |
      # SQLite's native module for the stock PDS, which the install above
      # skips building.
      export PATH=/opt/node/bin:$PATH
      dir="$(dirname "$(node -p "require.resolve('better-sqlite3/package.json', { paths: ['harness'] })")")"
      [ -f "$dir/build/Release/better_sqlite3.node" ] || (cd "$dir" && npm run install)
  - name: test
    run: |
      export PATH=/opt/node/bin:/opt/tools:$PATH GROUP_HOST_DEV_ENV=/opt/atproto/packages/dev-env
      # Cargo 1.100 builds test binaries under debug/build/; those the cached
      # target kept in debug/deps from before are stale, and cargo-llvm-cov,
      # walking the whole directory, would count their lines as never run.
      rm -rf target/llvm-cov-target/debug/deps
      # So are those under debug/build/ of a package Cargo.lock no longer
      # names, such as a crate taken out of the workspace.
      known=$(sed -n 's/^name = "\(.*\)"$/\1/p' Cargo.lock)
      for dir in target/llvm-cov-target/debug/build/*/; do
        echo "$known" | grep -qx "$(basename "$dir")" || rm -rf "$dir"
      done
      cargo llvm-cov --workspace --ignore-filename-regex '(tests/|harness/)' \
        --fail-under-lines 100 --fail-under-functions 100 --show-missing-lines