94 lines
3.1 KiB
YAML
94 lines
3.1 KiB
YAML
# Unfortunately, writing to the Github Actions cache from a merge queue doesn't work correctly.
|
|
# The `merge_group` event runs on a temporary branch, which prevents it from being used from
|
|
# any other branches: https://github.com/orgs/community/discussions/47349
|
|
#
|
|
# The hacky solution is to re-run certain workflows on pushes to `main`,
|
|
# as caches written from `main` are accessible from all other branches.
|
|
#
|
|
# To avoid wasting money, we should only use the standard (free) Github Actions runners.
|
|
name: Caching Hack (re-runs actions on 'main' to update the cache)
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
|
|
permissions:
|
|
contents: read # Required for checkout or repository metadata reads.
|
|
actions: read # Required to read workflow run, cache, or artifact metadata.
|
|
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
check-python-client-build:
|
|
if: github.repository == 'tensorzero/tensorzero'
|
|
uses: ./.github/workflows/python-client-build.yml
|
|
|
|
build-gateway:
|
|
name: build-gateway
|
|
if: github.repository == 'tensorzero/tensorzero'
|
|
strategy:
|
|
matrix:
|
|
runner:
|
|
- ubuntu-latest
|
|
- windows-latest
|
|
runs-on: ${{ matrix.runner }}
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Cleanup disk space
|
|
if: runner.os == 'Linux'
|
|
run: bash ci/free-disk-space.sh
|
|
- name: Install Rust (from rust-toolchain.toml)
|
|
working-directory: crates
|
|
run: |
|
|
for attempt in 1 2 3; do
|
|
if timeout 5m rustup show; then
|
|
break
|
|
fi
|
|
if [ $attempt -eq 3 ]; then
|
|
echo "Failed to install Rust toolchain after 3 attempts"
|
|
exit 1
|
|
fi
|
|
sleep $((10 * attempt))
|
|
done
|
|
shell: bash
|
|
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
|
|
with:
|
|
# We use this cache key from other jobs that need to build the gateway
|
|
shared-key: "build-gateway-cache"
|
|
workspaces: "crates -> target"
|
|
- name: Install uv
|
|
if: runner.os == 'windows'
|
|
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
|
with:
|
|
version: "0.9.27"
|
|
|
|
- name: Install Python 3.10
|
|
if: runner.os == 'windows'
|
|
run: |
|
|
for attempt in 1 2 3; do
|
|
if timeout 5m uv python install 3.10; then
|
|
break
|
|
fi
|
|
if [ $attempt -eq 3 ]; then
|
|
echo "Failed to install Python 3.10 after 3 attempts"
|
|
exit 1
|
|
fi
|
|
sleep $((10 * attempt))
|
|
done
|
|
echo "PYO3_PYTHON=$(uv python find python3.10)" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- working-directory: crates
|
|
run: |
|
|
# Run both of these, as they build dependencies with different features
|
|
cargo build --features e2e_tests --tests
|
|
cargo build-e2e
|