Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/actions/save-build-caches/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Save completed build work
description: Preserve compiler objects and uv wheels when later tests fail, including PR runs.
inputs:
rust-key:
description: Boxington primary key, empty when Rust caching is disabled.
default: ''
uv-key:
description: setup-uv primary key, empty when uv caching is disabled.
default: ''
runs:
using: composite
steps:
# The upstream action saves successful default-branch pushes. Preserve
# completed objects for failed jobs and PRs as well; GitHub scopes PR
# caches to the PR merge ref, so they cannot populate the trunk cache.
- name: Export completed Rust builds
id: rust
if: inputs.rust-key != '' && (github.event_name != 'push' || failure())
shell: bash
run: |
archive="$(mbx cache dir)/github-actions-cache-v1.tar"
if mbx cache export --group "$MBX_CACHE_EXPORT_GROUP" "$archive" > "$RUNNER_TEMP/mbx-export.log" 2>&1; then
echo "archive=$archive" >> "$GITHUB_OUTPUT"
elif grep -q 'no completed mbx builds are recorded for export group' "$RUNNER_TEMP/mbx-export.log"; then
cat "$RUNNER_TEMP/mbx-export.log"
else
cat "$RUNNER_TEMP/mbx-export.log" >&2
exit 1
fi

- uses: actions/cache/save@v4
if: ${{ !cancelled() && steps.rust.outputs.archive != '' }}
with:
path: ${{ steps.rust.outputs.archive }}
key: ${{ inputs.rust-key }}-${{ github.sha }}

# setup-uv saves successful jobs itself, but its post step skips failures.
- name: Prune uv cache after failure
if: inputs.uv-key != '' && failure()
shell: bash
run: uv cache prune --ci

- uses: actions/cache/save@v4
if: inputs.uv-key != '' && failure()
with:
path: ${{ runner.temp }}/uv-cache
key: ${{ inputs.uv-key }}
66 changes: 66 additions & 0 deletions .github/actions/setup-rust-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Cache Rust compilation
description: Share completed compiler objects across Cargo, uv, maturin, and Make builds.
inputs:
suffix:
description: Job and matrix partition for the compiler cache.
required: true
outputs:
key:
description: Key used by the Boxington action.
value: ${{ steps.cache.outputs.cache-primary-key }}
runs:
using: composite
steps:
# Upstream 1.11.0 publishes ARM macOS binaries, but no Intel macOS binary.
# Bootstrap that host once, then reuse the pinned executable across jobs.
- uses: actions/cache/restore@v4
if: runner.os == 'macOS' && runner.arch == 'X64'
id: intel
with:
path: ${{ runner.temp }}/mbx-intel/bin/mbx
key: mbx-1.11.0-macos-x64-v1

- name: Build Boxington for Intel macOS
if: runner.os == 'macOS' && runner.arch == 'X64' && steps.intel.outputs.cache-hit != 'true'
shell: bash
run: cargo install --git https://github.com/jdx/mr-boxington --rev 4ebd2af1eb7e70fee37ec8678c30c0619f5ed5af --locked --root "$RUNNER_TEMP/mbx-intel" mbx

- uses: actions/cache/save@v4
if: runner.os == 'macOS' && runner.arch == 'X64' && steps.intel.outputs.cache-hit != 'true'
with:
path: ${{ runner.temp }}/mbx-intel/bin/mbx
key: mbx-1.11.0-macos-x64-v1

- name: Enable pinned Intel Boxington
if: runner.os == 'macOS' && runner.arch == 'X64'
shell: bash
run: |
test "$("$RUNNER_TEMP/mbx-intel/bin/mbx" --version)" = 'mbx 1.11.0'
echo "$RUNNER_TEMP/mbx-intel/bin" >> "$GITHUB_PATH"

- uses: jdx/mr-boxington-action@a20e1ffcd962370fb2b6045c13b7b349f7b03386
id: cache
env:
MBX_CACHE_DIR: ${{ github.workspace }}/.ci-mbx
MBX_TARGET_VIEWS: '0'
with:
version: ${{ (runner.os != 'macOS' || runner.arch != 'X64') && '1.11.0' || '' }}
github-cache-mode: objects
cache-generation: sidemantic-v1-${{ inputs.suffix }}

- name: Enable Cargo subprocess caching
shell: bash
run: |
# mbx dispatches as a Cargo shim when invoked under Cargo's filename.
# Keep the shim in the workspace so maturin's workspace mount can use it too.
shim_dir="$GITHUB_WORKSPACE/.ci-cache-bin"
mkdir -p "$shim_dir"
if [ "$RUNNER_OS" = Windows ]; then
cp "$(command -v mbx)" "$shim_dir/cargo.exe"
else
cp "$(command -v mbx)" "$shim_dir/cargo"
chmod +x "$shim_dir/cargo"
fi
echo "$shim_dir" >> "$GITHUB_PATH"
echo "MBX_CACHE_DIR=$GITHUB_WORKSPACE/.ci-mbx" >> "$GITHUB_ENV"
echo "MBX_TARGET_VIEWS=0" >> "$GITHUB_ENV"
41 changes: 41 additions & 0 deletions .github/actions/setup-uv/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Set up uv with native source caching
description: Cache downloaded dependencies and built wheels, including their Rust build inputs.
inputs:
enable-cache:
description: Disable in production release jobs.
default: 'true'
suffix:
description: Job and matrix partition for the dependency cache.
required: true
outputs:
cache-key:
description: Key used by setup-uv.
value: ${{ steps.uv.outputs.cache-key }}
runs:
using: composite
steps:
- uses: astral-sh/setup-uv@v7
id: uv
with:
version: '0.12.14'
enable-cache: ${{ inputs.enable-cache }}
cache-local-path: ${{ runner.temp }}/uv-cache
cache-suffix: ${{ inputs.suffix }}
cache-dependency-glob: |
uv.lock
pyproject.toml
sidemantic-rs/pyproject.toml
crates/dax-pyo3/pyproject.toml
crates/dax-pyo3/README.md
.cargo/config.toml
rust-toolchain*
Cargo.lock
Cargo.toml
sidemantic-rs/Cargo.toml
sidemantic-rs/build.rs
sidemantic-rs/src/**
crates/*/Cargo.toml
crates/*/src/**
crates/dax-pyo3/python/**/*.py
crates/dax-pyo3/python/**/*.pyi
crates/dax-pyo3/python/**/py.typed
Loading
Loading