Skip to content

Commit

Permalink
Harden primer package caching against possible race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Sep 18, 2024
1 parent 67acc96 commit 0a7717d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/primer_run_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ jobs:
${{ runner.os }}-${{ matrix.python-version }}-${{
steps.commitstring.outputs.commitstring }}-primer
- name: Regenerate cache
if: steps.cache-projects.outputs.cache-hit != 'true'
# Presence of colorama is a heuristic for the env having all packages
run: |
. venv/bin/activate
python tests/primer/__main__.py prepare --clone
if echo {{ steps.cache-projects.outputs.cache-hit }} | grep -c "true" && python -m pip show colorama
then
echo "Cache hit: skipping primer clone command"
else
python tests/primer/__main__.py prepare --clone
fi
shell: bash
- name: Upload commit string
uses: actions/upload-artifact@v4.4.0
if: matrix.batchIdx == 0
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/primer_run_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,16 @@ jobs:
${{ runner.os }}-${{ matrix.python-version }}-${{
steps.commitstring.outputs.commitstring }}-primer
- name: Regenerate cache
if: steps.cache-projects.outputs.cache-hit != 'true'
# Presence of colorama is a heuristic for the env having all packages
run: |
. venv/bin/activate
python tests/primer/__main__.py prepare --clone
if echo {{ steps.cache-projects.outputs.cache-hit }} | grep -c "true" && python -m pip show colorama
then
echo "Cache hit: skipping primer clone command"
else
python tests/primer/__main__.py prepare --clone
fi
shell: bash
- name: Check cache
run: |
. venv/bin/activate
Expand Down

0 comments on commit 0a7717d

Please sign in to comment.