Skip to content

Commit 9e2e2f5

Browse files
arman-bdclaude
andcommitted
chore: enable benchmarks and align workflow caching
- Enable benchmarks in CI by setting ENABLE_BENCHMARK="true" - Update _benchmark.yml to use split restore/save cache pattern matching _test.yml - Remove non-functional save-always parameter - Ensure caches are saved even on benchmark failure using if: always() This ensures benchmark workflow has the same robust caching as the test workflow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 462827e commit 9e2e2f5

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

.github/workflows/_benchmark.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,31 @@ jobs:
7575
echo "CXX=ccache g++" >> $GITHUB_ENV
7676
shell: bash
7777

78-
- name: Cache vendor dependencies
78+
- name: Restore vendor cache
7979
id: cache-vendor
80-
uses: actions/cache@v4
80+
uses: actions/cache/restore@v4
8181
with:
8282
path: vendor
8383
key: vendor-${{ runner.os }}-${{ hashFiles('scripts/setup_vendors.sh') }}-v7
8484
restore-keys: |
8585
vendor-${{ runner.os }}-
86-
save-always: true
8786
8887
- name: Setup vendor dependencies
8988
if: steps.cache-vendor.outputs.cache-hit != 'true'
9089
run: |
9190
chmod +x scripts/setup_vendors.sh
9291
./scripts/setup_vendors.sh
9392
94-
- name: Cache Python build artifacts
95-
uses: actions/cache@v4
93+
- name: Restore Python build cache
94+
id: cache-python-build
95+
uses: actions/cache/restore@v4
9696
with:
9797
path: |
9898
build/
9999
*.egg-info/
100100
key: python-build-${{ runner.os }}-${{ inputs.primary-python }}-${{ hashFiles('setup.py', 'pyproject.toml', 'src/**/*.c', 'src/**/*.cpp', 'src/**/*.h') }}
101101
restore-keys: |
102102
python-build-${{ runner.os }}-${{ inputs.primary-python }}-
103-
save-always: true
104103
105104
- name: Install package
106105
run: pip install -e ".[dev,benchmark]"
@@ -115,3 +114,20 @@ jobs:
115114
output-file-path: benchmark.json
116115
github-token: ${{ secrets.GITHUB_TOKEN }}
117116
auto-push: true
117+
118+
# Save caches even if benchmarks fail (using always())
119+
- name: Save vendor cache
120+
if: always() && steps.cache-vendor.outputs.cache-hit != 'true'
121+
uses: actions/cache/save@v4
122+
with:
123+
path: vendor
124+
key: vendor-${{ runner.os }}-${{ hashFiles('scripts/setup_vendors.sh') }}-v7
125+
126+
- name: Save Python build cache
127+
if: always()
128+
uses: actions/cache/save@v4
129+
with:
130+
path: |
131+
build/
132+
*.egg-info/
133+
key: python-build-${{ runner.os }}-${{ inputs.primary-python }}-${{ hashFiles('setup.py', 'pyproject.toml', 'src/**/*.c', 'src/**/*.cpp', 'src/**/*.h') }}

.github/workflows/_config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ jobs:
6363
OS_MATRIX='[
6464
"windows-latest"
6565
]'
66+
# OS options: "windows-latest", "ubuntu-latest", "macos-latest"
6667
6768
# Python versions to test
6869
# Comment out any version you want to skip during development
6970
PYTHON_MATRIX='[
7071
"3.11"
7172
]'
72-
# To add more versions: "3.9", "3.10", "3.12"
73+
# Python versions: "3.9", "3.10", "3.11", "3.12"
7374
7475
# Primary OS and Python for single-runner jobs
7576
PRIMARY_OS="ubuntu-latest"
@@ -78,7 +79,7 @@ jobs:
7879
# Enable/Disable Jobs
7980
# Set to "true" or "false"
8081
ENABLE_TESTS="true"
81-
ENABLE_BENCHMARK="false"
82+
ENABLE_BENCHMARK="true"
8283
8384
# ============================================================
8485
# END CONFIGURATION

0 commit comments

Comments
 (0)