Skip to content

python-uv

A tool (uv), apt packages, and input patterns.

A Python project on a plain Debian image, with uv brought as a tool and a system library installed with apt. Lint, types and tests are separate steps so they run at the same time and are reused separately.

flowchart LR
    s0["format"]
    s1["lint"]
    s2["types"]
    s3["test"]

The steps this script plans for a push about which nothing is known. An arrow is a needs.

# A Python project on a plain Debian image, with uv brought as a tool and a
# system library installed with apt. Lint, types and tests are separate steps
# so they run at the same time and are reused separately.

uv = tool(
    "uv",
    url = "https://github.com/astral-sh/uv/releases/download/0.12.1/uv-{arch}-unknown-linux-gnu.tar.gz",
    sha256 = {
        "amd64": "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb",
        "arm64": "769d373e146692c639b5fbaae33b331c297a32e03d30448772051902df52bbf4",
    },
    arch_names = {"amd64": "x86_64", "arm64": "aarch64"},
    bin = ["uv-{arch}-unknown-linux-gnu"],
)

PROJECT = ["pyproject.toml", "uv.lock"]

def py(name, command, inputs):
    return step(
        name,
        image = "debian:12-slim",
        tools = [uv],
        packages = ["ca-certificates", "libpq5"],
        run = "uv sync --frozen && uv run --no-sync " + command,
        inputs = PROJECT + inputs,
        caches = {"uv": "/root/.cache/uv"},
    )

def ci(ctx):
    return [
        py("format", "ruff format --check src tests", ["src/**/*.py", "tests/**/*.py"]),
        py("lint", "ruff check src tests", ["src/**/*.py", "tests/**/*.py"]),
        py("types", "pyright src", ["src/**/*.py"]),
        py("test", "pytest -q", ["src", "tests"]),
    ]
# Generated by `starci compile` from python-uv.ci.star. Edit that, not this.
#
# Each job is one step of the plan: the same image, command, tools and
# packages, given only the step's inputs. A job skips its work when it has
# already passed with the same inputs.
#
# What does not carry over:
#  - Passes are remembered in this repository's Actions cache, which GitHub
#    scopes by branch and evicts when old. starci's own store has neither
#    limit.

name: CI

on:
  push:
    branches: ['**']
    tags: ['**']
  pull_request:
  workflow_dispatch:

jobs:
  format:
    name: "format"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          sparse-checkout-cone-mode: false
          sparse-checkout: |
            /pyproject.toml
            /src/**/*.py
            /tests/**/*.py
            /uv.lock
      - name: Has this already passed with these inputs?
        id: passed
        uses: actions/cache@v4
        with:
          path: ${{ runner.temp }}/starci-passed
          key: starci-passed-format-9c753dc6e2fbc8d7-${{ hashFiles('pyproject.toml', 'pyproject.toml/**', 'src/**/*.py', 'tests/**/*.py', 'uv.lock', 'uv.lock/**') }}
      - name: "Tool: uv"
        if: steps.passed.outputs.cache-hit != 'true'
        run: |
          mkdir -p "$RUNNER_TEMP/starci-tools/uv"
          curl -fsSL 'https://github.com/astral-sh/uv/releases/download/0.12.1/uv-x86_64-unknown-linux-gnu.tar.gz' -o "$RUNNER_TEMP/uv.download"
          echo "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb  $RUNNER_TEMP/uv.download" | sha256sum -c -
          tar -xf "$RUNNER_TEMP/uv.download" -C "$RUNNER_TEMP/starci-tools/uv"
      - name: Image with ca-certificates, libpq5
        if: steps.passed.outputs.cache-hit != 'true'
        run: |
          docker build -q -t starci-env-format - <<'DOCKERFILE'
          FROM debian:12-slim
          RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
          DOCKERFILE
      - name: "Cache: uv"
        if: steps.passed.outputs.cache-hit != 'true'
        uses: actions/cache@v4
        with:
          path: ${{ runner.temp }}/starci-cache/uv
          key: starci-cache-uv-${{ github.run_id }}
          restore-keys: starci-cache-uv-
      - name: "format"
        if: steps.passed.outputs.cache-hit != 'true'
        env:
          STARCI_RUN: |-
            uv sync --frozen && uv run --no-sync ruff format --check src tests
        run: |
          image_path=$(docker image inspect starci-env-format --format '{{range .Config.Env}}{{println .}}{{end}}' | sed -n 's/^PATH=//p')
          docker run --rm \
            -v "$PWD:/workspace" \
            -w /workspace \
            -v "$RUNNER_TEMP/starci-tools/uv:/opt/starci/tools/uv:ro" \
            -v "$RUNNER_TEMP/starci-cache/uv:/root/.cache/uv" \
            -e "PATH=/opt/starci/tools/uv/uv-x86_64-unknown-linux-gnu:$image_path" \
            starci-env-format sh -c "$STARCI_RUN"
      - name: Remember this pass
        if: steps.passed.outputs.cache-hit != 'true'
        run: mkdir -p "$RUNNER_TEMP/starci-passed" && date > "$RUNNER_TEMP/starci-passed/at"

  lint:
    name: "lint"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          sparse-checkout-cone-mode: false
          sparse-checkout: |
            /pyproject.toml
            /src/**/*.py
            /tests/**/*.py
            /uv.lock
      - name: Has this already passed with these inputs?
        id: passed
        uses: actions/cache@v4
        with:
          path: ${{ runner.temp }}/starci-passed
          key: starci-passed-lint-cf540252b81cbb62-${{ hashFiles('pyproject.toml', 'pyproject.toml/**', 'src/**/*.py', 'tests/**/*.py', 'uv.lock', 'uv.lock/**') }}
      - name: "Tool: uv"
        if: steps.passed.outputs.cache-hit != 'true'
        run: |
          mkdir -p "$RUNNER_TEMP/starci-tools/uv"
          curl -fsSL 'https://github.com/astral-sh/uv/releases/download/0.12.1/uv-x86_64-unknown-linux-gnu.tar.gz' -o "$RUNNER_TEMP/uv.download"
          echo "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb  $RUNNER_TEMP/uv.download" | sha256sum -c -
          tar -xf "$RUNNER_TEMP/uv.download" -C "$RUNNER_TEMP/starci-tools/uv"
      - name: Image with ca-certificates, libpq5
        if: steps.passed.outputs.cache-hit != 'true'
        run: |
          docker build -q -t starci-env-lint - <<'DOCKERFILE'
          FROM debian:12-slim
          RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
          DOCKERFILE
      - name: "Cache: uv"
        if: steps.passed.outputs.cache-hit != 'true'
        uses: actions/cache@v4
        with:
          path: ${{ runner.temp }}/starci-cache/uv
          key: starci-cache-uv-${{ github.run_id }}
          restore-keys: starci-cache-uv-
      - name: "lint"
        if: steps.passed.outputs.cache-hit != 'true'
        env:
          STARCI_RUN: |-
            uv sync --frozen && uv run --no-sync ruff check src tests
        run: |
          image_path=$(docker image inspect starci-env-lint --format '{{range .Config.Env}}{{println .}}{{end}}' | sed -n 's/^PATH=//p')
          docker run --rm \
            -v "$PWD:/workspace" \
            -w /workspace \
            -v "$RUNNER_TEMP/starci-tools/uv:/opt/starci/tools/uv:ro" \
            -v "$RUNNER_TEMP/starci-cache/uv:/root/.cache/uv" \
            -e "PATH=/opt/starci/tools/uv/uv-x86_64-unknown-linux-gnu:$image_path" \
            starci-env-lint sh -c "$STARCI_RUN"
      - name: Remember this pass
        if: steps.passed.outputs.cache-hit != 'true'
        run: mkdir -p "$RUNNER_TEMP/starci-passed" && date > "$RUNNER_TEMP/starci-passed/at"

  types:
    name: "types"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          sparse-checkout-cone-mode: false
          sparse-checkout: |
            /pyproject.toml
            /src/**/*.py
            /uv.lock
      - name: Has this already passed with these inputs?
        id: passed
        uses: actions/cache@v4
        with:
          path: ${{ runner.temp }}/starci-passed
          key: starci-passed-types-79b1b2507054dbe7-${{ hashFiles('pyproject.toml', 'pyproject.toml/**', 'src/**/*.py', 'uv.lock', 'uv.lock/**') }}
      - name: "Tool: uv"
        if: steps.passed.outputs.cache-hit != 'true'
        run: |
          mkdir -p "$RUNNER_TEMP/starci-tools/uv"
          curl -fsSL 'https://github.com/astral-sh/uv/releases/download/0.12.1/uv-x86_64-unknown-linux-gnu.tar.gz' -o "$RUNNER_TEMP/uv.download"
          echo "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb  $RUNNER_TEMP/uv.download" | sha256sum -c -
          tar -xf "$RUNNER_TEMP/uv.download" -C "$RUNNER_TEMP/starci-tools/uv"
      - name: Image with ca-certificates, libpq5
        if: steps.passed.outputs.cache-hit != 'true'
        run: |
          docker build -q -t starci-env-types - <<'DOCKERFILE'
          FROM debian:12-slim
          RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
          DOCKERFILE
      - name: "Cache: uv"
        if: steps.passed.outputs.cache-hit != 'true'
        uses: actions/cache@v4
        with:
          path: ${{ runner.temp }}/starci-cache/uv
          key: starci-cache-uv-${{ github.run_id }}
          restore-keys: starci-cache-uv-
      - name: "types"
        if: steps.passed.outputs.cache-hit != 'true'
        env:
          STARCI_RUN: |-
            uv sync --frozen && uv run --no-sync pyright src
        run: |
          image_path=$(docker image inspect starci-env-types --format '{{range .Config.Env}}{{println .}}{{end}}' | sed -n 's/^PATH=//p')
          docker run --rm \
            -v "$PWD:/workspace" \
            -w /workspace \
            -v "$RUNNER_TEMP/starci-tools/uv:/opt/starci/tools/uv:ro" \
            -v "$RUNNER_TEMP/starci-cache/uv:/root/.cache/uv" \
            -e "PATH=/opt/starci/tools/uv/uv-x86_64-unknown-linux-gnu:$image_path" \
            starci-env-types sh -c "$STARCI_RUN"
      - name: Remember this pass
        if: steps.passed.outputs.cache-hit != 'true'
        run: mkdir -p "$RUNNER_TEMP/starci-passed" && date > "$RUNNER_TEMP/starci-passed/at"

  test:
    name: "test"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          sparse-checkout-cone-mode: false
          sparse-checkout: |
            /pyproject.toml
            /src
            /tests
            /uv.lock
      - name: Has this already passed with these inputs?
        id: passed
        uses: actions/cache@v4
        with:
          path: ${{ runner.temp }}/starci-passed
          key: starci-passed-test-0789cd34dab1fbed-${{ hashFiles('pyproject.toml', 'pyproject.toml/**', 'src', 'src/**', 'tests', 'tests/**', 'uv.lock', 'uv.lock/**') }}
      - name: "Tool: uv"
        if: steps.passed.outputs.cache-hit != 'true'
        run: |
          mkdir -p "$RUNNER_TEMP/starci-tools/uv"
          curl -fsSL 'https://github.com/astral-sh/uv/releases/download/0.12.1/uv-x86_64-unknown-linux-gnu.tar.gz' -o "$RUNNER_TEMP/uv.download"
          echo "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb  $RUNNER_TEMP/uv.download" | sha256sum -c -
          tar -xf "$RUNNER_TEMP/uv.download" -C "$RUNNER_TEMP/starci-tools/uv"
      - name: Image with ca-certificates, libpq5
        if: steps.passed.outputs.cache-hit != 'true'
        run: |
          docker build -q -t starci-env-test - <<'DOCKERFILE'
          FROM debian:12-slim
          RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
          DOCKERFILE
      - name: "Cache: uv"
        if: steps.passed.outputs.cache-hit != 'true'
        uses: actions/cache@v4
        with:
          path: ${{ runner.temp }}/starci-cache/uv
          key: starci-cache-uv-${{ github.run_id }}
          restore-keys: starci-cache-uv-
      - name: "test"
        if: steps.passed.outputs.cache-hit != 'true'
        env:
          STARCI_RUN: |-
            uv sync --frozen && uv run --no-sync pytest -q
        run: |
          image_path=$(docker image inspect starci-env-test --format '{{range .Config.Env}}{{println .}}{{end}}' | sed -n 's/^PATH=//p')
          docker run --rm \
            -v "$PWD:/workspace" \
            -w /workspace \
            -v "$RUNNER_TEMP/starci-tools/uv:/opt/starci/tools/uv:ro" \
            -v "$RUNNER_TEMP/starci-cache/uv:/root/.cache/uv" \
            -e "PATH=/opt/starci/tools/uv/uv-x86_64-unknown-linux-gnu:$image_path" \
            starci-env-test sh -c "$STARCI_RUN"
      - name: Remember this pass
        if: steps.passed.outputs.cache-hit != 'true'
        run: mkdir -p "$RUNNER_TEMP/starci-passed" && date > "$RUNNER_TEMP/starci-passed/at"
# Generated by `starci compile --target circleci` from python-uv.ci.star. Edit that, not this.
#
# Each job is one step of the plan: the same image, command, tools and
# packages, given only the step's inputs. A job skips its work when it has
# already passed with the same inputs.
#
# What does not carry over:
#  - Passes are remembered in this project's CircleCI cache, which expires.
#    starci's own store does not.

version: 2.1

jobs:
  format:
    machine:
      image: ubuntu-2404:current
    resource_class: medium
    steps:
      - checkout
      - run:
          name: "Keep only this step's inputs"
          command: |
            git sparse-checkout set --no-cone '/pyproject.toml' '/src/**/*.py' '/tests/**/*.py' '/uv.lock'
      - run:
          name: "Identify the inputs"
          command: |
            git ls-files -s -- ':(top,literal)pyproject.toml' ':(top,glob)src/**/*.py' ':(top,glob)tests/**/*.py' ':(top,literal)uv.lock' > /tmp/starci-inputs
      - restore_cache:
          name: Has this already passed with these inputs?
          keys:
            - starci-passed-format-9c753dc6e2fbc8d7-{{ checksum "/tmp/starci-inputs" }}
      - run:
          name: "Stop here if it has"
          command: |
            if [ -e ~/starci-passed/at ]; then
              echo "Passed before with the same inputs, on $(cat ~/starci-passed/at). Nothing to do."
              circleci-agent step halt
            fi
      - run:
          name: "Tool: uv"
          command: |
            mkdir -p "$HOME/starci-tools/uv"
            curl -fsSL 'https://github.com/astral-sh/uv/releases/download/0.12.1/uv-x86_64-unknown-linux-gnu.tar.gz' -o /tmp/uv.download
            echo "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb  /tmp/uv.download" | sha256sum -c -
            tar -xf "/tmp/uv.download" -C "$HOME/starci-tools/uv"
      - run:
          name: "Image with ca-certificates, libpq5"
          command: |
            docker build -q -t starci-env-format - \<<'DOCKERFILE'
            FROM debian:12-slim
            RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
            DOCKERFILE
      - restore_cache:
          name: "Cache: uv"
          keys:
            - starci-cache-uv-
      - run:
          name: "format"
          environment:
            STARCI_RUN: |-
              uv sync --frozen && uv run --no-sync ruff format --check src tests
          command: |
            image_path=$(docker image inspect starci-env-format --format '{{range .Config.Env}}{{println .}}{{end}}' | sed -n 's/^PATH=//p')
            docker run --rm \
              -v "$PWD:/workspace" \
              -w /workspace \
              -v "$HOME/starci-tools/uv:/opt/starci/tools/uv:ro" \
              -v "$HOME/starci-cache/uv:/root/.cache/uv" \
              -e "PATH=/opt/starci/tools/uv/uv-x86_64-unknown-linux-gnu:$image_path" \
              starci-env-format sh -c "$STARCI_RUN"
      - save_cache:
          name: "Save cache: uv"
          key: starci-cache-uv-{{ .Revision }}
          paths:
            - ~/starci-cache/uv
      - run:
          name: "Remember this pass"
          command: |
            mkdir -p ~/starci-passed && date > ~/starci-passed/at
      - save_cache:
          key: starci-passed-format-9c753dc6e2fbc8d7-{{ checksum "/tmp/starci-inputs" }}
          paths:
            - ~/starci-passed

  lint:
    machine:
      image: ubuntu-2404:current
    resource_class: medium
    steps:
      - checkout
      - run:
          name: "Keep only this step's inputs"
          command: |
            git sparse-checkout set --no-cone '/pyproject.toml' '/src/**/*.py' '/tests/**/*.py' '/uv.lock'
      - run:
          name: "Identify the inputs"
          command: |
            git ls-files -s -- ':(top,literal)pyproject.toml' ':(top,glob)src/**/*.py' ':(top,glob)tests/**/*.py' ':(top,literal)uv.lock' > /tmp/starci-inputs
      - restore_cache:
          name: Has this already passed with these inputs?
          keys:
            - starci-passed-lint-cf540252b81cbb62-{{ checksum "/tmp/starci-inputs" }}
      - run:
          name: "Stop here if it has"
          command: |
            if [ -e ~/starci-passed/at ]; then
              echo "Passed before with the same inputs, on $(cat ~/starci-passed/at). Nothing to do."
              circleci-agent step halt
            fi
      - run:
          name: "Tool: uv"
          command: |
            mkdir -p "$HOME/starci-tools/uv"
            curl -fsSL 'https://github.com/astral-sh/uv/releases/download/0.12.1/uv-x86_64-unknown-linux-gnu.tar.gz' -o /tmp/uv.download
            echo "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb  /tmp/uv.download" | sha256sum -c -
            tar -xf "/tmp/uv.download" -C "$HOME/starci-tools/uv"
      - run:
          name: "Image with ca-certificates, libpq5"
          command: |
            docker build -q -t starci-env-lint - \<<'DOCKERFILE'
            FROM debian:12-slim
            RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
            DOCKERFILE
      - restore_cache:
          name: "Cache: uv"
          keys:
            - starci-cache-uv-
      - run:
          name: "lint"
          environment:
            STARCI_RUN: |-
              uv sync --frozen && uv run --no-sync ruff check src tests
          command: |
            image_path=$(docker image inspect starci-env-lint --format '{{range .Config.Env}}{{println .}}{{end}}' | sed -n 's/^PATH=//p')
            docker run --rm \
              -v "$PWD:/workspace" \
              -w /workspace \
              -v "$HOME/starci-tools/uv:/opt/starci/tools/uv:ro" \
              -v "$HOME/starci-cache/uv:/root/.cache/uv" \
              -e "PATH=/opt/starci/tools/uv/uv-x86_64-unknown-linux-gnu:$image_path" \
              starci-env-lint sh -c "$STARCI_RUN"
      - save_cache:
          name: "Save cache: uv"
          key: starci-cache-uv-{{ .Revision }}
          paths:
            - ~/starci-cache/uv
      - run:
          name: "Remember this pass"
          command: |
            mkdir -p ~/starci-passed && date > ~/starci-passed/at
      - save_cache:
          key: starci-passed-lint-cf540252b81cbb62-{{ checksum "/tmp/starci-inputs" }}
          paths:
            - ~/starci-passed

  types:
    machine:
      image: ubuntu-2404:current
    resource_class: medium
    steps:
      - checkout
      - run:
          name: "Keep only this step's inputs"
          command: |
            git sparse-checkout set --no-cone '/pyproject.toml' '/src/**/*.py' '/uv.lock'
      - run:
          name: "Identify the inputs"
          command: |
            git ls-files -s -- ':(top,literal)pyproject.toml' ':(top,glob)src/**/*.py' ':(top,literal)uv.lock' > /tmp/starci-inputs
      - restore_cache:
          name: Has this already passed with these inputs?
          keys:
            - starci-passed-types-79b1b2507054dbe7-{{ checksum "/tmp/starci-inputs" }}
      - run:
          name: "Stop here if it has"
          command: |
            if [ -e ~/starci-passed/at ]; then
              echo "Passed before with the same inputs, on $(cat ~/starci-passed/at). Nothing to do."
              circleci-agent step halt
            fi
      - run:
          name: "Tool: uv"
          command: |
            mkdir -p "$HOME/starci-tools/uv"
            curl -fsSL 'https://github.com/astral-sh/uv/releases/download/0.12.1/uv-x86_64-unknown-linux-gnu.tar.gz' -o /tmp/uv.download
            echo "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb  /tmp/uv.download" | sha256sum -c -
            tar -xf "/tmp/uv.download" -C "$HOME/starci-tools/uv"
      - run:
          name: "Image with ca-certificates, libpq5"
          command: |
            docker build -q -t starci-env-types - \<<'DOCKERFILE'
            FROM debian:12-slim
            RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
            DOCKERFILE
      - restore_cache:
          name: "Cache: uv"
          keys:
            - starci-cache-uv-
      - run:
          name: "types"
          environment:
            STARCI_RUN: |-
              uv sync --frozen && uv run --no-sync pyright src
          command: |
            image_path=$(docker image inspect starci-env-types --format '{{range .Config.Env}}{{println .}}{{end}}' | sed -n 's/^PATH=//p')
            docker run --rm \
              -v "$PWD:/workspace" \
              -w /workspace \
              -v "$HOME/starci-tools/uv:/opt/starci/tools/uv:ro" \
              -v "$HOME/starci-cache/uv:/root/.cache/uv" \
              -e "PATH=/opt/starci/tools/uv/uv-x86_64-unknown-linux-gnu:$image_path" \
              starci-env-types sh -c "$STARCI_RUN"
      - save_cache:
          name: "Save cache: uv"
          key: starci-cache-uv-{{ .Revision }}
          paths:
            - ~/starci-cache/uv
      - run:
          name: "Remember this pass"
          command: |
            mkdir -p ~/starci-passed && date > ~/starci-passed/at
      - save_cache:
          key: starci-passed-types-79b1b2507054dbe7-{{ checksum "/tmp/starci-inputs" }}
          paths:
            - ~/starci-passed

  test:
    machine:
      image: ubuntu-2404:current
    resource_class: medium
    steps:
      - checkout
      - run:
          name: "Keep only this step's inputs"
          command: |
            git sparse-checkout set --no-cone '/pyproject.toml' '/src' '/tests' '/uv.lock'
      - run:
          name: "Identify the inputs"
          command: |
            git ls-files -s -- ':(top,literal)pyproject.toml' ':(top,literal)src' ':(top,literal)tests' ':(top,literal)uv.lock' > /tmp/starci-inputs
      - restore_cache:
          name: Has this already passed with these inputs?
          keys:
            - starci-passed-test-0789cd34dab1fbed-{{ checksum "/tmp/starci-inputs" }}
      - run:
          name: "Stop here if it has"
          command: |
            if [ -e ~/starci-passed/at ]; then
              echo "Passed before with the same inputs, on $(cat ~/starci-passed/at). Nothing to do."
              circleci-agent step halt
            fi
      - run:
          name: "Tool: uv"
          command: |
            mkdir -p "$HOME/starci-tools/uv"
            curl -fsSL 'https://github.com/astral-sh/uv/releases/download/0.12.1/uv-x86_64-unknown-linux-gnu.tar.gz' -o /tmp/uv.download
            echo "90b2f223fb69d19db49e117da601f64978593417988530aa733d456141b4bcbb  /tmp/uv.download" | sha256sum -c -
            tar -xf "/tmp/uv.download" -C "$HOME/starci-tools/uv"
      - run:
          name: "Image with ca-certificates, libpq5"
          command: |
            docker build -q -t starci-env-test - \<<'DOCKERFILE'
            FROM debian:12-slim
            RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libpq5 && rm -rf /var/lib/apt/lists/*
            DOCKERFILE
      - restore_cache:
          name: "Cache: uv"
          keys:
            - starci-cache-uv-
      - run:
          name: "test"
          environment:
            STARCI_RUN: |-
              uv sync --frozen && uv run --no-sync pytest -q
          command: |
            image_path=$(docker image inspect starci-env-test --format '{{range .Config.Env}}{{println .}}{{end}}' | sed -n 's/^PATH=//p')
            docker run --rm \
              -v "$PWD:/workspace" \
              -w /workspace \
              -v "$HOME/starci-tools/uv:/opt/starci/tools/uv:ro" \
              -v "$HOME/starci-cache/uv:/root/.cache/uv" \
              -e "PATH=/opt/starci/tools/uv/uv-x86_64-unknown-linux-gnu:$image_path" \
              starci-env-test sh -c "$STARCI_RUN"
      - save_cache:
          name: "Save cache: uv"
          key: starci-cache-uv-{{ .Revision }}
          paths:
            - ~/starci-cache/uv
      - run:
          name: "Remember this pass"
          command: |
            mkdir -p ~/starci-passed && date > ~/starci-passed/at
      - save_cache:
          key: starci-passed-test-0789cd34dab1fbed-{{ checksum "/tmp/starci-inputs" }}
          paths:
            - ~/starci-passed

workflows:
  ci:
    jobs:
      - format
      - lint
      - types
      - test

Download: python-uv.ci.star, GitHub Actions, CircleCI