-
Notifications
You must be signed in to change notification settings - Fork 1.4k
102 lines (88 loc) 路 3.26 KB
/
Copy pathturbo-cache-warm.yml
File metadata and controls
102 lines (88 loc) 路 3.26 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Turbo Cache Warm
# Populates the Turbo and Rust caches on `main` so PR branches inherit warm
# cache. GitHub Actions caches restore only from the same branch or the
# base/default branch, so without a run on `main` every PR would start cold.
# Neither the Tests nor Code Quality workflows run on `main`, so this is that
# run.
on:
push:
branches: [main]
paths:
- .github/workflows/turbo-cache-warm.yml
- .cargo/config.toml
- packages/browseros-agent/**
schedule:
# Weekly full warm to backstop GitHub's 7-day unused-cache eviction for
# packages that rarely change (a cache read counts as access, so frequently
# depended-on packages stay warm on their own).
- cron: "0 6 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: turbo-cache-warm-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: packages/browseros-agent
jobs:
warm:
name: Warm Turbo cache
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
# Full history so Turbo's `--affected` can compute the merge base.
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: packages/browseros-agent/package.json
- name: Start Turbo remote cache (GitHub Actions cache)
uses: rharkor/caching-for-turbo@2238fae6eb9a9936f92356f54cb3660200d105e7 # v2.5.1
- name: Install dependencies
run: bun ci
- name: Create dev env file
run: cp .env.development.example .env.development
- name: Warm cache
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
# Full run: refresh every package's cached artifacts + access time.
bunx turbo run typecheck
else
# Per-merge: warm only what this merge changed.
bunx turbo run typecheck --affected
fi
warm-rust:
name: Warm Rust cache
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Rust
# Pinned to match the Tests workflow. A different toolchain hashes into
# a different cache key, which would warm a cache nothing else reads.
uses: dtolnay/rust-toolchain@1.95.0
with:
components: clippy,rustfmt
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/browseros-agent
# Must match the Tests workflow exactly. Without it the key embeds
# GITHUB_JOB and this cache would be unreadable there.
shared-key: browseros-agent
cache-directories: ~/.cargo/build/browseros
# Save even though nothing here is a pass/fail gate; warming is the
# entire point of the job.
save-if: "true"
- name: Warm Rust cache
# Mirrors what the Rust suites compile: test binaries and clippy's
# separate artifacts. -D warnings is deliberately omitted, since this
# job exists to populate a cache, not to gate on lints.
run: |
cargo test --workspace --locked --no-run
cargo clippy --workspace --all-targets --locked