Skip to content

Commit 8547955

Browse files
committed
Document cache layer locations and make CI smarter
1 parent 254adac commit 8547955

File tree

2 files changed

+112
-3
lines changed

2 files changed

+112
-3
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Appose CI Build
2+
#
3+
# Caching Strategy:
4+
# 1. Maven dependencies (via setup-java cache: 'maven')
5+
# 2. Appose environments and tool binaries (~/.local/share/appose)
6+
# - Includes pixi, uv, and micromamba executables
7+
# - Includes built environments
8+
# 3. Pixi package cache (~/.cache/rattler on Linux, ~/Library/Caches/rattler on macOS)
9+
# 4. UV package cache (~/.cache/uv on Linux, ~/Library/Caches/uv on macOS)
10+
# 5. Micromamba package cache (~/micromamba/pkgs and ~/.conda/pkgs)
11+
#
12+
# Cache keys are based on:
13+
# - pom.xml hash (dependencies change)
14+
# - Builder source files (tool versions change)
15+
#
16+
# This prevents redundant downloads of ~100MB+ tool binaries and packages on every CI run.
17+
118
name: build
219

320
on:
@@ -34,14 +51,45 @@ jobs:
3451
with:
3552
python-version: '3.10'
3653

37-
- name: Cache Appose environments
54+
- name: Cache Appose environments and tools
3855
id: cache-appose
3956
uses: actions/cache@v4
4057
with:
4158
path: ~/.local/share/appose
42-
key: ${{ runner.os }}-build-appose-${{ hashFiles('*') }}
59+
key: ${{ runner.os }}-appose-${{ hashFiles('pom.xml') }}-${{ hashFiles('src/main/java/org/apposed/appose/builder/Pixi.java', 'src/main/java/org/apposed/appose/builder/Uv.java', 'src/main/java/org/apposed/appose/builder/Mamba.java') }}
60+
restore-keys: |
61+
${{ runner.os }}-appose-${{ hashFiles('pom.xml') }}-
62+
${{ runner.os }}-appose-
63+
64+
- name: Cache Pixi packages (Rattler cache)
65+
uses: actions/cache@v4
66+
with:
67+
path: |
68+
~/.cache/rattler
69+
~/Library/Caches/rattler
70+
key: ${{ runner.os }}-pixi-pkgs-${{ hashFiles('pom.xml') }}
71+
restore-keys: |
72+
${{ runner.os }}-pixi-pkgs-
73+
74+
- name: Cache UV packages
75+
uses: actions/cache@v4
76+
with:
77+
path: |
78+
~/.cache/uv
79+
~/Library/Caches/uv
80+
key: ${{ runner.os }}-uv-pkgs-${{ hashFiles('pom.xml') }}
81+
restore-keys: |
82+
${{ runner.os }}-uv-pkgs-
83+
84+
- name: Cache Micromamba packages
85+
uses: actions/cache@v4
86+
with:
87+
path: |
88+
~/micromamba/pkgs
89+
~/.conda/pkgs
90+
key: ${{ runner.os }}-mamba-pkgs-${{ hashFiles('pom.xml') }}
4391
restore-keys: |
44-
${{ runner.os }}-build-appose-
92+
${{ runner.os }}-mamba-pkgs-
4593
4694
- name: Set up CI environment
4795
run: .github/setup.sh

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,67 @@ try (Service python = env.python()) {
141141
Of course, the above examples could have been done all in one language. But
142142
hopefully they hint at the possibilities of easy cross-language integration.
143143

144+
## Caching and disk usage
145+
146+
Appose uses multiple layers of caching to improve performance and reduce
147+
redundant downloads. Understanding these cache locations can help you manage
148+
disk usage and troubleshoot environment issues.
149+
150+
### Appose environment cache
151+
152+
**Location:** `~/.local/share/appose/` (customizable via `appose.envs-dir` system property)
153+
154+
This directory contains:
155+
- **Tool binaries:** Pixi, UV, and Micromamba executables downloaded by Appose
156+
- `.pixi/bin/pixi` (v0.39.5)
157+
- `.uv/bin/uv` (v0.5.25)
158+
- `.mamba/bin/micromamba` (latest)
159+
- **Built environments:** Each named environment created via `build(envName)`
160+
161+
### Package manager caches
162+
163+
Each package manager maintains its own cache for downloaded packages:
164+
165+
**Pixi** (uses Rattler cache):
166+
- Linux: `~/.cache/rattler`
167+
- macOS: `~/Library/Caches/rattler`
168+
- Windows: `%LOCALAPPDATA%\rattler\Cache`
169+
- Environment variable: `PIXI_CACHE_DIR` or `RATTLER_CACHE_DIR`
170+
171+
**UV**:
172+
- Linux: `~/.cache/uv`
173+
- macOS: `~/Library/Caches/uv`
174+
- Windows: `%LOCALAPPDATA%\uv\Cache`
175+
- Environment variable: `UV_CACHE_DIR`
176+
- Check location: `uv cache dir`
177+
178+
**Micromamba**:
179+
- Default: `~/micromamba/pkgs/` (micromamba's default root prefix)
180+
- Alternative: `~/.conda/pkgs/` (if conda was installed previously)
181+
- Customizable via: `micromamba config append pkgs_dirs /path/to/cache`
182+
- Environment variable: `MAMBA_ROOT_PREFIX` (changes the entire root, including `pkgs/` subdirectory)
183+
184+
### Clearing caches
185+
186+
To free up disk space, you can clear individual caches:
187+
188+
```bash
189+
# Clear UV cache
190+
uv cache clean
191+
192+
# Clear Pixi/Rattler cache
193+
pixi clean cache --yes
194+
195+
# Clear Micromamba cache
196+
micromamba clean --all --yes
197+
198+
# Remove all Appose environments and tools (nuclear option)
199+
rm -rf ~/.local/share/appose
200+
```
201+
202+
**Note:** Package manager caches are shared across projects and significantly
203+
speed up subsequent environment creation. Only clear them if disk space is critical.
204+
144205
## Issue tracker
145206

146207
All implementations of Appose use the same issue tracker:

0 commit comments

Comments
 (0)