Skip to content

Commit 5cb1aa4

Browse files
ctruedenclaude
andcommitted
CI: cache built environments
The logic is now aligned with appose-java. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3758211 commit 5cb1aa4

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# Appose Python 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 (rattler cache):
9+
# - Linux: ~/.cache/rattler/cache
10+
# - macOS: ~/Library/Caches/rattler/cache
11+
# - Windows: ~/AppData/Local/rattler/cache
12+
# 4. uv package cache:
13+
# - Linux: ~/.cache/uv
14+
# - macOS: ~/Library/Caches/uv
15+
# - Windows: ~/AppData/Local/uv/cache
16+
# 5. Micromamba package cache:
17+
# - All platforms: ~/.local/share/mamba/pkgs and ~/.mamba/pkgs
18+
#
19+
# Cache keys are based on:
20+
# - tests/resources/envs/* hash (test environment specs change)
21+
# - uv.lock hash (package dependencies change)
22+
#
23+
# This prevents redundant downloads of ~100MB+ tool binaries and packages on every CI run.
24+
125
name: build
226

327
on:
@@ -14,6 +38,7 @@ jobs:
1438
build:
1539
runs-on: ${{ matrix.os }}
1640
strategy:
41+
fail-fast: false
1742
matrix:
1843
os: [ubuntu-latest, windows-latest, macos-latest]
1944
python-version: ["3.10", "3.13"]
@@ -39,6 +64,50 @@ jobs:
3964
python -m pip install --upgrade pip
4065
python -m pip install uv
4166
67+
- name: Cache Appose environments and tools
68+
uses: actions/cache@v4
69+
with:
70+
path: ~/.local/share/appose
71+
key: ${{ runner.os }}-appose-py${{ matrix.python-version }}-${{ hashFiles('tests/resources/envs/**') }}-${{ hashFiles('pyproject.toml', 'uv.lock') }}
72+
restore-keys: |
73+
${{ runner.os }}-appose-py${{ matrix.python-version }}-${{ hashFiles('tests/resources/envs/**') }}-
74+
${{ runner.os }}-appose-py${{ matrix.python-version }}-
75+
${{ runner.os }}-appose-
76+
77+
- name: Cache Pixi packages (Rattler cache)
78+
uses: actions/cache@v4
79+
with:
80+
path: |
81+
~/.cache/rattler/cache
82+
~/Library/Caches/rattler/cache
83+
~/AppData/Local/rattler/cache
84+
key: ${{ runner.os }}-pixi-pkgs-${{ hashFiles('tests/resources/envs/**') }}
85+
restore-keys: |
86+
${{ runner.os }}-pixi-pkgs-
87+
88+
- name: Cache uv packages
89+
uses: actions/cache@v4
90+
with:
91+
path: |
92+
~/.cache/uv
93+
~/Library/Caches/uv
94+
~/AppData/Local/uv/cache
95+
key: ${{ runner.os }}-uv-pkgs-${{ hashFiles('tests/resources/envs/**', 'uv.lock') }}
96+
restore-keys: |
97+
${{ runner.os }}-uv-pkgs-
98+
99+
- name: Cache Micromamba packages
100+
uses: actions/cache@v4
101+
with:
102+
path: |
103+
~/.local/share/mamba/pkgs
104+
~/.mamba/pkgs
105+
~/AppData/Roaming/.mamba/pkgs
106+
~/AppData/Roaming/mamba/pkgs
107+
key: ${{ runner.os }}-mamba-pkgs-${{ hashFiles('tests/resources/envs/**') }}
108+
restore-keys: |
109+
${{ runner.os }}-mamba-pkgs-
110+
42111
- name: Run the tests
43112
shell: bash
44113
env:

0 commit comments

Comments
 (0)