diff options
author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2022-11-07 08:53:12 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-11-17 14:03:15 +0100 |
commit | 98ceab7de9f78146aacbc9148ddabf1a5e14cb43 (patch) | |
tree | e0af86aa45660caccff57613c2195f15f20c9cd3 /.github | |
parent | d56f8488aaa0e5ffe72b68af857a0226079d67a3 (diff) | |
download | pylint-git-98ceab7de9f78146aacbc9148ddabf1a5e14cb43.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 f0aace5ad..4f89b9e6e 100644 --- a/.github/workflows/primer_run_main.yaml +++ b/.github/workflows/primer_run_main.yaml @@ -37,12 +37,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 @@ -51,15 +45,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 10c3a2aa0..5acf3791c 100644 --- a/.github/workflows/primer_run_pr.yaml +++ b/.github/workflows/primer_run_pr.yaml @@ -60,12 +60,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 |