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

zat.dev/zat

atproto utils for zig · mirror of https://tangled.org/zat.dev/zat

0
0
72 lines · 2.2 KB Raw History
# a push or pull request that only changes docs, the site or the devlog skips
# this run; deploy-website.yml and publish-standard-records.yml cover those.
when:
  - event: ["push", "pull_request"]
    branch: main
    paths: ["src/**", "scripts/**", "pbt/**", "examples/**", build.zig, build.zig.zon, justfile, .tangled/workflows/ci.yml]

engine: nixery

dependencies:
  nixpkgs:
    - coreutils
    - curl
    - gnutar
    - xz
    - git
    - bash
    # saving the cache below needs zstd in the image
    - zstd

environment:
  ZIG_GLOBAL_CACHE_DIR: /tangled/workspace/.ci-cache/global

# the pinned compiler and zig's package cache persist between runs, so a run
# neither downloads the compiler nor refetches dependencies from tangled.org.
# the compiled build cache is left out: zig 0.17 rebuilds it after a restore.
cache:
  - key: zig
    hash:
      - build.zig.zon
      - scripts/ci-zig.sh
    fallback: true
    compression-level: 1
    when: always
    paths:
      - .zig
      - .ci-cache/global/p

steps:
  - name: install pinned zig
    command: scripts/ci-zig.sh /tangled/workspace/.zig

  - name: fetch dependencies
    command: |
      # tangled.org rate-limits archive downloads; three workflows fetching at
      # once on every push has tripped it. retry with backoff before building.
      ok=0
      for attempt in 1 2 3 4 5; do
        if /tangled/workspace/.zig/zig build --fetch; then ok=1; break; fi
        echo "dependency fetch attempt $attempt failed; retrying" >&2
        sleep $((attempt * 15))
      done
      [ "$ok" = 1 ]

  - name: check formatting and import paths
    command: |
      /tangled/workspace/.zig/zig build check

  - name: run tests
    command: |
      /tangled/workspace/.zig/zig build test --summary all

  - name: compile tests for 32-bit arm (no 64-bit atomics)
    command: |
      /tangled/workspace/.zig/zig build test -Dtarget=arm-linux-musleabihf -Dcpu=arm1176jzf_s --summary all

  - name: property campaigns with reach checks
    command: |
      export PATH="/tangled/workspace/.zig:$PATH"
      for name in mst codecs runtime xrpc identity firehose oauth permissions; do
        scripts/campaign run "$name" --out "/tmp/zat-$name" || { tail -n 40 /tmp/zat-$name/*.stderr.log; exit 1; }
      done