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

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
81 lines · 2.7 KB Raw History
# a push that only changes docs, the changelog or agent files skips the
# build and the deploy; anything the build, checks or deploy read runs it.
when:
  - event: ["push"]
    branch: "**"
    paths: ["src/**", "tools/**", "bench/**", "config/**", "scripts/**", "dev/**", build.zig, build.zig.zon, "Dockerfile*", .dockerignore, fly.toml, justfile, .tangled/workflows/ci.yml]
  - event: ["pull_request", "manual"]
    branch: "**"

engine: nixery

dependencies:
  nixpkgs:
    - coreutils
    - util-linux
    - curl
    - git
    - bash
    - gnutar
    - gnugrep
    - gnused
    - sqlite
    - xz
    - uv
    # the interpreter uv runs tools/*.py on; nothing calls it directly
    - python3
    - jq
    - flyctl
    - openssl
    - zstd
    - nodejs_22
    - pnpm

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

# the pinned compiler and zig's package cache. zig's build cache cannot be
# carried over: restoring .zig-cache or zig-pkg gives their files new inodes,
# and zig 0.17 recompiles everything that reads them, so the release compile
# runs beside the checks instead (tools/ci-checks.sh). heavypad's spindle restores
# this before the first step and saves it after every run (needs
# SPINDLE_CACHE_BACKEND there and zstd here).
cache:
  - key: zig
    hash:
      - build.zig.zon
      - tools/ci-zig.sh
    fallback: true
    compression-level: 1
    when: always
    paths:
      - .ci-cache

steps:
  - name: install Zig 0.17.0
    command: tools/ci-zig.sh
  - name: fetch dependencies
    command: tools/ci-fetch.sh
  - name: formatting
    command: .ci-cache/zig/zig fmt --check build.zig build.zig.zon src bench tools
  # the checks and the x86_64 release compile, overlapped in one step because
  # each step gets a fresh container. the ARMv6 check is armv6.yml and the
  # property campaigns are campaigns.yml.
  - name: unit tests and smoke beside the release build
    command: ZIG="$PWD/.ci-cache/zig/zig" tools/ci-checks.sh
  # Steps are sequential; a failed check prevents deployment. Separate
  # workflows run in parallel and cannot provide this gate.
  - name: deploy main to Fly
    command: |
      set -eu
      if [ "${TANGLED_PIPELINE_KIND:-}" = push ] && [ "${TANGLED_REF:-}" = refs/heads/main ]; then
        ca_dir=$(mktemp -d)
        trap 'rm -rf "$ca_dir"' EXIT
        uv run tools/ci-public-ca.py "${SSL_CERT_FILE:-/etc/ssl/certs/ca-bundle.crt}" "$ca_dir/ca-certificates.crt"
        export SSL_CERT_FILE="$ca_dir/ca-certificates.crt" SSL_CERT_DIR="$ca_dir" CURL_CA_BUNDLE="$ca_dir/ca-certificates.crt"
        test -n "$FLY_API_TOKEN"
        ZDS_PREBUILT=.ci-release tools/fly-deploy.sh
      else
        echo "Deployment only runs for pushes to main."
      fi