Skip to content

Commit 0a7717d

Browse files
Harden primer package caching against possible race condition
Refs #9925 (comment)
1 parent 67acc96 commit 0a7717d

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/primer_run_main.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,16 @@ jobs:
7878
${{ runner.os }}-${{ matrix.python-version }}-${{
7979
steps.commitstring.outputs.commitstring }}-primer
8080
- name: Regenerate cache
81-
if: steps.cache-projects.outputs.cache-hit != 'true'
81+
# Presence of colorama is a heuristic for the env having all packages
8282
run: |
8383
. venv/bin/activate
84-
python tests/primer/__main__.py prepare --clone
84+
if echo {{ steps.cache-projects.outputs.cache-hit }} | grep -c "true" && python -m pip show colorama
85+
then
86+
echo "Cache hit: skipping primer clone command"
87+
else
88+
python tests/primer/__main__.py prepare --clone
89+
fi
90+
shell: bash
8591
- name: Upload commit string
8692
uses: actions/[email protected]
8793
if: matrix.batchIdx == 0

.github/workflows/primer_run_pr.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,16 @@ jobs:
147147
${{ runner.os }}-${{ matrix.python-version }}-${{
148148
steps.commitstring.outputs.commitstring }}-primer
149149
- name: Regenerate cache
150-
if: steps.cache-projects.outputs.cache-hit != 'true'
150+
# Presence of colorama is a heuristic for the env having all packages
151151
run: |
152152
. venv/bin/activate
153-
python tests/primer/__main__.py prepare --clone
153+
if echo {{ steps.cache-projects.outputs.cache-hit }} | grep -c "true" && python -m pip show colorama
154+
then
155+
echo "Cache hit: skipping primer clone command"
156+
else
157+
python tests/primer/__main__.py prepare --clone
158+
fi
159+
shell: bash
154160
- name: Check cache
155161
run: |
156162
. venv/bin/activate

0 commit comments

Comments
 (0)