From b96d40b22f3d7febb6ffca82a16b28f572711872 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Wed, 18 Sep 2024 13:07:57 -0300 Subject: [PATCH] Harden primer package caching against possible race condition Refs https://github.com/pylint-dev/pylint/pull/9925#issuecomment-2358249852 --- .github/workflows/primer_run_main.yaml | 10 ++++++++-- .github/workflows/primer_run_pr.yaml | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/primer_run_main.yaml b/.github/workflows/primer_run_main.yaml index 03f64c4052..adcb4c676f 100644 --- a/.github/workflows/primer_run_main.yaml +++ b/.github/workflows/primer_run_main.yaml @@ -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 diff --git a/.github/workflows/primer_run_pr.yaml b/.github/workflows/primer_run_pr.yaml index 80aa16b311..e83da04635 100644 --- a/.github/workflows/primer_run_pr.yaml +++ b/.github/workflows/primer_run_pr.yaml @@ -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