Skip to content

: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.

fix(ci): share sqlx-cli cache across ci engines (#109276)

Raúl Negrón-Otero36de963a2b94
diff --git a/.depot/actions/setup-sqlx-cli/action.yml b/.depot/actions/setup-sqlx-cli/action.yml
index 0987bac2a47e..21d8425ed8ef 100644
--- a/.depot/actions/setup-sqlx-cli/action.yml
+++ b/.depot/actions/setup-sqlx-cli/action.yml
@@ -22,8 +22,10 @@ runs:
id: cache-sqlx-cli
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
- path: ${{ runner.temp }}/sqlx-cli
- key: sqlx-cli-${{ inputs.version }}-rust${{ inputs.toolchain }}-${{ runner.os }}-${{ runner.arch }}
+ # 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'
@@ -46,19 +48,19 @@ runs:
--features postgres \
--no-default-features \
--locked \
- --root "$RUNNER_TEMP/sqlx-cli"
+ --root "$HOME/.cache/sqlx-cli"
- chmod +x "$RUNNER_TEMP/sqlx-cli/bin/sqlx"
+ 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'
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
- path: ${{ runner.temp }}/sqlx-cli
- key: sqlx-cli-${{ inputs.version }}-rust${{ inputs.toolchain }}-${{ runner.os }}-${{ runner.arch }}
+ path: ~/.cache/sqlx-cli
+ key: ${{ steps.cache-sqlx-cli.outputs.cache-primary-key }}
- name: Add sqlx-cli to PATH
shell: bash
run: |
- echo "$RUNNER_TEMP/sqlx-cli/bin" >> "$GITHUB_PATH"
- "$RUNNER_TEMP/sqlx-cli/bin/sqlx" --version
+ echo "$HOME/.cache/sqlx-cli/bin" >> "$GITHUB_PATH"
+ "$HOME/.cache/sqlx-cli/bin/sqlx" --version
diff --git a/.github/actions/setup-sqlx-cli/action.yml b/.github/actions/setup-sqlx-cli/action.yml
index 0987bac2a47e..21d8425ed8ef 100644
--- a/.github/actions/setup-sqlx-cli/action.yml
+++ b/.github/actions/setup-sqlx-cli/action.yml
@@ -22,8 +22,10 @@ runs:
id: cache-sqlx-cli
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
- path: ${{ runner.temp }}/sqlx-cli
- key: sqlx-cli-${{ inputs.version }}-rust${{ inputs.toolchain }}-${{ runner.os }}-${{ runner.arch }}
+ # 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'
@@ -46,19 +48,19 @@ runs:
--features postgres \
--no-default-features \
--locked \
- --root "$RUNNER_TEMP/sqlx-cli"
+ --root "$HOME/.cache/sqlx-cli"
- chmod +x "$RUNNER_TEMP/sqlx-cli/bin/sqlx"
+ 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'
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
- path: ${{ runner.temp }}/sqlx-cli
- key: sqlx-cli-${{ inputs.version }}-rust${{ inputs.toolchain }}-${{ runner.os }}-${{ runner.arch }}
+ path: ~/.cache/sqlx-cli
+ key: ${{ steps.cache-sqlx-cli.outputs.cache-primary-key }}
- name: Add sqlx-cli to PATH
shell: bash
run: |
- echo "$RUNNER_TEMP/sqlx-cli/bin" >> "$GITHUB_PATH"
- "$RUNNER_TEMP/sqlx-cli/bin/sqlx" --version
+ echo "$HOME/.cache/sqlx-cli/bin" >> "$GITHUB_PATH"
+ "$HOME/.cache/sqlx-cli/bin/sqlx" --version