: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
perf(ci): let setup-sqlx-cli own its rust toolchain (#94388)
Raúl Negrón-Otero310bc5c6b8eb
diff --git a/.depot/actions/setup-sqlx-cli/action.yml b/.depot/actions/setup-sqlx-cli/action.ymlindex 6834ce95e689..0987bac2a47e 100644--- a/.depot/actions/setup-sqlx-cli/action.yml+++ b/.depot/actions/setup-sqlx-cli/action.yml@@ -3,12 +3,17 @@ 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: falsedefault: '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@@ -18,7 +23,14 @@ runs:uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1with:path: ${{ runner.temp }}/sqlx-cli- key: sqlx-cli-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}+ key: sqlx-cli-${{ 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 missif: steps.cache-sqlx-cli.outputs.cache-hit != 'true'@@ -43,7 +55,7 @@ runs:uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1with:path: ${{ runner.temp }}/sqlx-cli- key: sqlx-cli-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}+ key: sqlx-cli-${{ inputs.version }}-rust${{ inputs.toolchain }}-${{ runner.os }}-${{ runner.arch }}- name: Add sqlx-cli to PATHshell: bashdiff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.ymlindex 786a3a8c1859..d7ff8c01475f 100644--- a/.depot/workflows/ci-backend.yml+++ b/.depot/workflows/ci-backend.yml@@ -878,11 +878,6 @@ jobs:with:python-version: 3.13.13token: ${{ secrets.POSTHOG_BOT_PAT }}- - name: Install Rust- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9- with:- toolchain: 1.91.1- components: cargo# Needs pnpm from the block above, so it cannot run inside it.- name: Install turbouses: ./.github/actions/setup-turbo@@ -1256,11 +1251,6 @@ jobs:sudo rm -f /etc/apt/sources.list.d/*twingate*sudo apt-get updatesudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl- - name: Install Rust- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9- with:- toolchain: 1.91.1- components: cargo- name: Install sqlx-cliuses: ./.depot/actions/setup-sqlx-cli# First running migrations from master, to simulate the real-world scenario@@ -1951,6 +1941,8 @@ jobs:uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0with:python-version: ${{ matrix.python-version }}+ # setup-sqlx-cli resolves from the PR head ref here, so an unrebased branch+ # gets a version that installs no Rust. Delete once open branches rebase.- name: Install Rustif: needs.changes.outputs.backend == 'true'uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9diff --git a/.github/actions/setup-sqlx-cli/action.yml b/.github/actions/setup-sqlx-cli/action.ymlindex 6834ce95e689..0987bac2a47e 100644--- a/.github/actions/setup-sqlx-cli/action.yml+++ b/.github/actions/setup-sqlx-cli/action.yml@@ -3,12 +3,17 @@ 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: falsedefault: '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@@ -18,7 +23,14 @@ runs:uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1with:path: ${{ runner.temp }}/sqlx-cli- key: sqlx-cli-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}+ key: sqlx-cli-${{ 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 missif: steps.cache-sqlx-cli.outputs.cache-hit != 'true'@@ -43,7 +55,7 @@ runs:uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1with:path: ${{ runner.temp }}/sqlx-cli- key: sqlx-cli-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}+ key: sqlx-cli-${{ inputs.version }}-rust${{ inputs.toolchain }}-${{ runner.os }}-${{ runner.arch }}- name: Add sqlx-cli to PATHshell: bashdiff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.ymlindex 89262048a8a5..4772de492d6d 100644--- a/.github/workflows/ci-backend.yml+++ b/.github/workflows/ci-backend.yml@@ -836,12 +836,6 @@ jobs:python-version: 3.13.13token: ${{ steps.setup-gh-token.outputs.token || github.token }}- - name: Install Rust- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9- with:- toolchain: 1.91.1- components: cargo-# Needs pnpm from the block above, so it cannot run inside it.- name: Install turbouses: ./.github/actions/setup-turbo@@ -1539,11 +1533,6 @@ jobs:sudo rm -f /etc/apt/sources.list.d/*twingate*sudo apt-get updatesudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl- - name: Install Rust- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9- with:- toolchain: 1.91.1- components: cargo- name: Install sqlx-cliuses: ./.github/actions/setup-sqlx-cli@@ -2906,6 +2895,8 @@ jobs:python-version: ${{ matrix.python-version }}token: ${{ steps.setup-gh-token.outputs.token || github.token }}+ # setup-sqlx-cli resolves from the PR head ref here, so an unrebased branch+ # gets a version that installs no Rust. Delete once open branches rebase.- name: Install Rustif: needs.changes.outputs.backend == 'true'uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.ymlindex 74159e686cb3..cfa314c5bb84 100644--- a/.github/workflows/ci-python.yml+++ b/.github/workflows/ci-python.yml@@ -162,10 +162,8 @@ jobs:name: Python code quality (depot-ubuntu-24.04)runs-on: depot-ubuntu-24.04- # Read by the per-tool guards on the pytest steps below. These sit inside a- # `parallel:` block, where step-level `if:` has no exercised precedent in this- # repo — the one existing case can never be false — so the guard is a shell test- # on a job-level env var, which behaves the same either way.+ # Read by shell guards on the pytest steps below. Those steps sit in a+ # `parallel:` block, where step-level `if:` is untested in this repo.env:RUN_HOGLI: ${{ needs.changes.outputs.hogli }}RUN_OWNERS: ${{ needs.changes.outputs.owners }}