Skip to content

Commit 1cb5412

Browse files
pixi environment caches: saved from main only (#98)
PR runs saved a pixi cache per lock file and platform (0.1-0.3 GB each), which filled the repository's 10 GB and evicted the build caches of running PRs. pixi-cache.yaml saves them from main (when pixi.toml/pixi.lock change, or by hand) on all five runner types; everything else only restores. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent bfd838b commit 1cb5412

5 files changed

Lines changed: 42 additions & 12 deletions

File tree

‎.github/workflows/automerge.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
locked: true # the lock file must match pixi.toml
3737
pixi-version: v0.81.0
38-
cache-write: false # the build jobs save the pixi environment cache
38+
cache-write: false # saved from main only (pixi-cache.yaml)
3939
# The merge has to come from the bot (or a PAT): a merge made with the
4040
# workflow's own token would not trigger the main build workflow.
4141
- name: Bot token
@@ -83,7 +83,7 @@ jobs:
8383
with:
8484
locked: true # the lock file must match pixi.toml
8585
pixi-version: v0.81.0
86-
cache-write: false # the build jobs save the pixi environment cache
86+
cache-write: false # saved from main only (pixi-cache.yaml)
8787
# removing the label with this token doesn't start the unlabeled run above, so
8888
# turn auto-merge off here as well
8989
- name: Remove the automerge label

‎.github/workflows/bot.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
with:
7575
locked: true # the lock file must match pixi.toml
7676
pixi-version: v0.81.0
77+
cache-write: false # saved from main only (pixi-cache.yaml)
7778
- id: plan
7879
env:
7980
GITHUB_TOKEN: ${{ github.token }} # GitHub API: ros/rosdistro sync tags
@@ -134,7 +135,7 @@ jobs:
134135
with:
135136
locked: true # the lock file must match pixi.toml
136137
pixi-version: v0.81.0
137-
cache-write: false # the plan job saves the pixi environment cache
138+
cache-write: false # saved from main only (pixi-cache.yaml)
138139
- name: robostack-bot ${{ matrix.command }} ${{ matrix.distro }}
139140
id: bot
140141
env:

‎.github/workflows/main.yaml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ jobs:
8888
with:
8989
locked: true # the lock file must match pixi.toml
9090
pixi-version: v0.81.0
91-
# one job saves the shared pixi environment cache (same key for all)
92-
cache-write: ${{ matrix.distro == fromJSON(needs.plan.outputs.distros)[0] && matrix.platform == 'linux-64' }}
91+
cache-write: false # saved by pixi-cache.yaml
9392
- name: Generate and push the build branch
9493
env:
9594
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/pixi-cache.yaml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# The pixi environment caches, saved from main only: pull requests restore them (a
2+
# pull request can read its base branch's caches) instead of each saving its own copy
3+
# for every lock file, which pushed the build caches out of the repository's 10 GB.
4+
name: pixi environment caches
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths: [pixi.toml, pixi.lock]
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
save:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, macos-15, windows-2022]
21+
runs-on: ${{ matrix.os }}
22+
steps:
23+
- uses: actions/checkout@v6
24+
with:
25+
persist-credentials: false
26+
- name: Disable git auto-maintenance
27+
run: git config --global maintenance.auto false && git config --global gc.auto 0 && git config --global core.longpaths true
28+
- uses: prefix-dev/setup-pixi@v0.11.0
29+
with:
30+
locked: true # the lock file must match pixi.toml
31+
pixi-version: v0.81.0
32+
cache-write: true

‎.github/workflows/testpr.yaml‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
with:
4242
locked: true # the lock file must match pixi.toml
4343
pixi-version: v0.81.0
44-
cache-write: false # the build jobs save the pixi environment cache
44+
cache-write: false # saved from main only (pixi-cache.yaml)
4545
- name: Which distributions changed
4646
id: plan
4747
env:
@@ -76,7 +76,7 @@ jobs:
7676
with:
7777
locked: true # the lock file must match pixi.toml
7878
pixi-version: v0.81.0
79-
cache-write: false # the build jobs save the pixi environment cache
79+
cache-write: false # saved from main only (pixi-cache.yaml)
8080
- name: Sanity checks (every distribution assembles, generated files up to date, sorted)
8181
run: pixi run rs check
8282
- name: Unit tests of the tooling
@@ -109,7 +109,7 @@ jobs:
109109
with:
110110
locked: true # the lock file must match pixi.toml
111111
pixi-version: v0.81.0
112-
cache-write: false # the build jobs save the pixi environment cache
112+
cache-write: false # saved from main only (pixi-cache.yaml)
113113
- name: Generate the recipes of every platform
114114
env:
115115
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -171,9 +171,7 @@ jobs:
171171
with:
172172
locked: true # the lock file must match pixi.toml
173173
pixi-version: v0.81.0
174-
# every distribution's job on a platform has the same cache key; let one
175-
# of them save it instead of all racing ("Unable to reserve cache")
176-
cache-write: ${{ matrix.distro == fromJSON(needs.plan.outputs.distros)[0] }}
174+
cache-write: false # saved from main only (pixi-cache.yaml)
177175

178176
- name: Windows workarounds (short build path, long paths, PATH and SDK clean-up)
179177
if: runner.os == 'Windows'
@@ -352,7 +350,7 @@ jobs:
352350
with:
353351
locked: true # the lock file must match pixi.toml
354352
pixi-version: v0.81.0
355-
cache-write: false # the build jobs save the pixi environment cache
353+
cache-write: false # saved from main only (pixi-cache.yaml)
356354
- uses: actions/download-artifact@v7
357355
with:
358356
pattern: abi-check-*

0 commit comments

Comments
 (0)