:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
# Depot mirror of .github/actions/setup-sqlx-cli. Only the cache restore differs. It sets
# timeout-minutes, which GitHub Actions rejects in a composite step.
name: Setup sqlx-cli
description: |
Installs sqlx-cli and adds it to PATH.
Uses actions/cache to avoid recompiling from source on every run.
The binary is pinned to a specific version for reproducibility.
Installs the Rust toolchain itself on a cache miss, so callers do not need to.
inputs:
version:
description: 'sqlx-cli version to install (e.g. 0.8.0)'
required: false
default: '0.8.0'
toolchain:
description: 'Rust toolchain used to build sqlx-cli on a cache miss'
required: false
default: '1.91.1'
runs:
using: composite
steps:
- name: Restore sqlx-cli binary from cache
id: cache-sqlx-cli
timeout-minutes: 2
continue-on-error: true
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
# The cache version hashes this path string, and runner.temp differs between
# GitHub Actions and Depot CI. A literal path lets both engines restore the entry master saves.
path: ~/.cache/sqlx-cli
key: sqlx-cli-home-${{ inputs.version }}-rust${{ inputs.toolchain }}-${{ runner.os }}-${{ runner.arch }}
- name: Install Rust to build sqlx-cli
if: steps.cache-sqlx-cli.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: ${{ inputs.toolchain }}
components: cargo
- name: Build sqlx-cli on cache miss
if: steps.cache-sqlx-cli.outputs.cache-hit != 'true'
shell: bash
env:
SQLX_CLI_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
echo "Cache miss — building sqlx-cli v$SQLX_CLI_VERSION from source"
cargo install sqlx-cli \
--version "$SQLX_CLI_VERSION" \
--features postgres \
--no-default-features \
--locked \
--root "$HOME/.cache/sqlx-cli"
chmod +x "$HOME/.cache/sqlx-cli/bin/sqlx"
- name: Save sqlx-cli binary to cache
if: steps.cache-sqlx-cli.outputs.cache-hit != 'true' && github.ref == 'refs/heads/master' && github.event_name != 'api'
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: ~/.cache/sqlx-cli
key: ${{ steps.cache-sqlx-cli.outputs.cache-primary-key }}
- name: Add sqlx-cli to PATH
shell: bash
run: |
echo "$HOME/.cache/sqlx-cli/bin" >> "$GITHUB_PATH"
"$HOME/.cache/sqlx-cli/bin/sqlx" --version