diff options
author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2022-11-07 08:53:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 08:53:12 +0100 |
commit | 5e3f01bccadf0611bfb595a7154e57dbfb8a982d (patch) | |
tree | bc38eaac787d477a7bd7027f6711e2f341b9b968 /.github | |
parent | f5f9e265d74d8675d7f33bb308bbc5dd868e2555 (diff) | |
download | pylint-git-5e3f01bccadf0611bfb595a7154e57dbfb8a982d.tar.gz |
Update Primer venv caching [ci] (#7708)
* Use release version for astroid
* Use better cache key
* Mirror create environment
* Update comments
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/primer_comment.yaml | 3 | ||||
-rw-r--r-- | .github/workflows/primer_run_main.yaml | 12 | ||||
-rw-r--r-- | .github/workflows/primer_run_pr.yaml | 12 |
3 files changed, 13 insertions, 14 deletions
diff --git a/.github/workflows/primer_comment.yaml b/.github/workflows/primer_comment.yaml index d52b0efe4..97d546ccb 100644 --- a/.github/workflows/primer_comment.yaml +++ b/.github/workflows/primer_comment.yaml @@ -50,7 +50,8 @@ jobs: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ - env.KEY_PREFIX }}-${{ env.CACHE_VERSION }} + env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml', + 'requirements_test.txt', 'requirements_test_min.txt') }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | diff --git a/.github/workflows/primer_run_main.yaml b/.github/workflows/primer_run_main.yaml index 63cef257f..58116cdb7 100644 --- a/.github/workflows/primer_run_main.yaml +++ b/.github/workflows/primer_run_main.yaml @@ -40,12 +40,6 @@ jobs: python-version: ${{ matrix.python-version }} check-latest: true - - name: Get latest astroid commit - id: get-astroid-sha - run: | - curl https://api.github.com/repos/PyCQA/astroid/commits | - python -c "import json, sys; print(json.load(sys.stdin)[0]['sha'])" > astroid_sha.txt - # Create a re-usable virtual environment - name: Create Python virtual environment cache id: cache-venv @@ -54,15 +48,15 @@ jobs: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ - env.KEY_PREFIX }}-${{ env.CACHE_VERSION }} + env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml', + 'requirements_test.txt', 'requirements_test_min.txt') }} - name: Create Python virtual environment + if: steps.cache-venv.outputs.cache-hit != 'true' run: | python -m venv venv . venv/bin/activate python -m pip install -U pip setuptools wheel pip install -U -r requirements_test.txt - # Use bleeding-edge astroid - pip install git+https://github.com/PyCQA/astroid.git # Cache primer packages - name: Get commit string diff --git a/.github/workflows/primer_run_pr.yaml b/.github/workflows/primer_run_pr.yaml index 8c42ff71b..b29e0ce06 100644 --- a/.github/workflows/primer_run_pr.yaml +++ b/.github/workflows/primer_run_pr.yaml @@ -63,12 +63,16 @@ jobs: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ - env.KEY_PREFIX }}-${{ env.CACHE_VERSION }} - - name: Fail job if Python cache restore failed + env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml', + 'requirements_test.txt', 'requirements_test_min.txt') }} + # Create environment must match step in 'Primer / Main' + - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | - echo "Failed to restore Python venv from cache" - exit 1 + python -m venv venv + . venv/bin/activate + python -m pip install -U pip setuptools wheel + pip install -U -r requirements_test.txt # Cache primer packages - name: Download last 'main' run info |