Skip to content

Commit 00a1faf

Browse files
authored
Merge pull request #679 from llimeht/tmp/cache-figures
Cache figures between CI builds to speed up runs
2 parents bb68d60 + 595bb33 commit 00a1faf

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131

3232
env:
3333
BUILD_WHEEL: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14') && 'true' || '' }}
34+
PYTHONUNBUFFERED: "1"
3435

3536
steps:
3637

@@ -58,6 +59,35 @@ jobs:
5859

5960
### Build sasmodels
6061

62+
63+
- name: Record figure building tools
64+
if: env.BUILD_WHEEL
65+
id: build-tools
66+
run: |
67+
echo "details=$(
68+
python -m pip index versions matplotlib --json | python -c "import json; print(json.loads(input())['latest'])"
69+
)" >> $GITHUB_OUTPUT
70+
SASMODELS_BUILD_CACHE=~/.cache/sasmodels-figures
71+
mkdir -p $SASMODELS_BUILD_CACHE
72+
echo "SASMODELS_BUILD_CACHE=$SASMODELS_BUILD_CACHE" >> $GITHUB_ENV
73+
74+
- name: Cache figures in documentation
75+
if: env.BUILD_WHEEL
76+
id: cache-figures
77+
uses: actions/cache@v4
78+
with:
79+
path: ${{ env.SASMODELS_BUILD_CACHE }}
80+
key: ${{ steps.build-tools.outputs.details }}-${{ hashFiles('doc/genmodel.py') }}
81+
82+
- name: Report cache status
83+
if: env.BUILD_WHEEL
84+
run: |
85+
if [ "${{ steps.cache-figures.outputs.cache-hit }}" == "true" ]; then
86+
echo "Figure cache hit - using cached figures"
87+
else
88+
echo "Figure cache miss - will generate new figures"
89+
fi
90+
6191
- name: Build sasmodels
6292
if: env.BUILD_WHEEL
6393
run: |

0 commit comments

Comments
 (0)