forked from tensorzero/tensorzero
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.88 KB
/
caching-hack.yml
File metadata and controls
55 lines (51 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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
actions: read
jobs:
check-python-client-build:
if: github.repository == 'tensorzero/tensorzero'
uses: ./.github/workflows/python-client-build.yml
build-gateway:
if: github.repository == 'tensorzero/tensorzero'
strategy:
matrix:
runner:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install stable && rustup default stable; 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
with:
cache-provider: "buildjet"
# We use this cache key from other jobs that need to build the gateway
shared-key: "build-gateway-cache"
- run: |
# Run both of these, as they build dependencies with different features
cargo build --features e2e_tests --tests
cargo build-e2e