Skip to content

Commit e8a2761

Browse files
authored
Improve caching in CI workflows (#495)
- **Cache pip packages in CI** (may not be working as is since pip packages of `downloadPipRequirements` task are downloaded to a non-standard location, but still worth it for other cases and makes the Python version stable throughout workflows) - **Enable local cache in all branches** (but disable for tag builds and keep read-only for bot PRs as a security measure; PRs from external contributors will always require approval for running so I don't consider this a significant security risk)
1 parent b3a72b8 commit e8a2761

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

.github/actions/build/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,19 @@ runs:
2424
java-version: |
2525
24
2626
17
27+
- name: Setup Python
28+
uses: actions/setup-python@v6
29+
with:
30+
python-version: '3.13'
31+
cache: 'pip'
2732
- name: Set up Gradle
2833
uses: gradle/actions/setup-gradle@v4
2934
with:
3035
validate-wrappers: true
3136
add-job-summary-as-pr-comment: 'on-failure'
37+
# Disable cache for releases, disable write for bot branches, enable write everywhere else
38+
cache-disabled: ${{ startsWith('refs/tags', github.ref) }}
39+
cache-read-only: ${{ contains('renovate/', github.ref) || contains('bot/', github.ref) }}
3240
- name: Run Gradle
3341
shell: bash
3442
run: |

.github/workflows/pr.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ jobs:
2828
steps:
2929
- name: Checkout
3030
uses: actions/checkout@v5
31+
- name: Setup Python
32+
uses: actions/setup-python@v6
33+
with:
34+
python-version: '3.13'
35+
cache: 'pip'
3136
- run: pip install -r .github/scripts/requirements.txt
3237
- name: 'unittest discover'
3338
run: python3 -m unittest discover -bs .github/scripts

.github/workflows/update-examples.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ jobs:
2727
uses: actions/checkout@v5
2828
with:
2929
fetch-depth: 0
30+
- name: Setup Python
31+
uses: actions/setup-python@v6
32+
with:
33+
python-version: '3.13'
34+
cache: 'pip'
3035
- run: pip install -r .github/scripts/requirements.txt
3136
- name: 'Get versions'
3237
run: |

0 commit comments

Comments
 (0)