From d56f8488aaa0e5ffe72b68af857a0226079d67a3 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 4 Nov 2022 11:23:40 +0100 Subject: [PATCH] Improve Github action workflows (#7651) * Remove restore keys * Log pylint + astroid versions * Reset cache versions * Add check-latest to setup-python * Use pyproject.toml for hash * Update comment-hider version comment * Pin additional actions --- .github/workflows/changelog.yml | 24 +++--- .github/workflows/checks.yaml | 55 +++++++------ .github/workflows/primer-test.yaml | 41 +++++----- .github/workflows/primer_comment.yaml | 29 +++---- .github/workflows/primer_run_main.yaml | 12 +-- .github/workflows/primer_run_pr.yaml | 12 +-- .github/workflows/release.yml | 1 + .github/workflows/tests.yaml | 102 +++++++++++++------------ pyproject.toml | 4 +- requirements_test_min.txt | 2 +- 10 files changed, 153 insertions(+), 129 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 87cdf278a9..40b41ce9ac 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -5,9 +5,12 @@ on: types: [opened, synchronize, labeled, unlabeled, reopened] env: - # Also change CACHE_VERSION in the other workflows - CACHE_VERSION: 31 - DEFAULT_PYTHON: "3.10" + CACHE_VERSION: 1 + KEY_PREFIX: base-venv + DEFAULT_PYTHON: "3.11" + +permissions: + contents: read jobs: check-changelog: @@ -17,32 +20,31 @@ jobs: timeout-minutes: 10 steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 with: # `towncrier check` runs `git diff --name-only origin/main...`, which # needs a non-shallow clone. fetch-depth: 0 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') - }}" + echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test.txt', + 'requirements_test_min.txt') }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 72c2ba1e5a..a413e21bb8 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -8,14 +8,18 @@ on: pull_request: ~ env: - CACHE_VERSION: 31 - DEFAULT_PYTHON: "3.10" + CACHE_VERSION: 1 + KEY_PREFIX: base-venv + DEFAULT_PYTHON: "3.11" PRE_COMMIT_CACHE: ~/.cache/pre-commit concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +permissions: + contents: read + jobs: prepare-base: name: Prepare base dependencies @@ -26,28 +30,27 @@ jobs: pre-commit-key: ${{ steps.generate-pre-commit-key.outputs.key }} steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') - }}" + echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test.txt', + 'requirements_test_min.txt') }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -59,17 +62,15 @@ jobs: - name: Generate pre-commit restore key id: generate-pre-commit-key run: >- - echo "::set-output name=key::pre-commit-${{ env.CACHE_VERSION }}-${{ - hashFiles('.pre-commit-config.yaml') }}" + echo "key=pre-commit-${{ env.CACHE_VERSION }}-${{ + hashFiles('.pre-commit-config.yaml') }}" >> $GITHUB_OUTPUT - name: Restore pre-commit environment id: cache-precommit - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: ${{ env.PRE_COMMIT_CACHE }} key: >- ${{ runner.os }}-${{ steps.generate-pre-commit-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-pre-commit-${{ env.CACHE_VERSION }}- - name: Install pre-commit dependencies if: steps.cache-precommit.outputs.cache-hit != 'true' run: | @@ -83,15 +84,16 @@ jobs: needs: prepare-base steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: @@ -104,7 +106,7 @@ jobs: exit 1 - name: Restore pre-commit environment id: cache-precommit - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: ${{ env.PRE_COMMIT_CACHE }} key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }} @@ -121,6 +123,7 @@ jobs: run: | . venv/bin/activate pip install -e . + pip list | grep 'astroid\|pylint' pre-commit run --hook-stage manual pylint-with-spelling --all-files spelling: @@ -130,15 +133,16 @@ jobs: needs: prepare-base steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: @@ -161,15 +165,16 @@ jobs: needs: prepare-base steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: diff --git a/.github/workflows/primer-test.yaml b/.github/workflows/primer-test.yaml index da1808abe3..a3c331f825 100644 --- a/.github/workflows/primer-test.yaml +++ b/.github/workflows/primer-test.yaml @@ -13,12 +13,16 @@ on: - ".github/workflows/primer-test.yaml" env: - CACHE_VERSION: 31 + CACHE_VERSION: 1 + KEY_PREFIX: venv concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +permissions: + contents: read + jobs: prepare-tests-linux: name: prepare / ${{ matrix.python-version }} / Linux @@ -26,33 +30,32 @@ jobs: timeout-minutes: 5 strategy: matrix: - python-version: [3.8, 3.9, "3.10"] + python-version: [3.8, 3.9, "3.10", "3.11"] outputs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') - }}" + echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test.txt', + 'requirements_test_min.txt') }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -68,18 +71,19 @@ jobs: needs: prepare-tests-linux strategy: matrix: - python-version: [3.8, 3.9, "3.10"] + python-version: [3.8, 3.9, "3.10", "3.11"] steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: @@ -103,18 +107,19 @@ jobs: needs: prepare-tests-linux strategy: matrix: - python-version: [3.8, 3.9, "3.10"] + python-version: [3.8, 3.9, "3.10", "3.11"] steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: diff --git a/.github/workflows/primer_comment.yaml b/.github/workflows/primer_comment.yaml index 1d4292ad0c..d52b0efe4a 100644 --- a/.github/workflows/primer_comment.yaml +++ b/.github/workflows/primer_comment.yaml @@ -14,7 +14,9 @@ on: env: # This needs to be the SAME as in the Main and PR job - CACHE_VERSION: 31 + CACHE_VERSION: 1 + KEY_PREFIX: venv-primer + DEFAULT_PYTHON: "3.10" permissions: contents: read @@ -27,27 +29,28 @@ jobs: name: Run runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: node-version: 16 - run: npm install @octokit/rest - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 - - name: Set up Python 3.10 + uses: actions/checkout@v3.1.0 + - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: - python-version: "3.10" + python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true # Restore cached Python environment - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-primer-${{ - env.CACHE_VERSION }} + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + env.KEY_PREFIX }}-${{ env.CACHE_VERSION }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -55,7 +58,7 @@ jobs: exit 1 - name: Download outputs - uses: actions/github-script@v6 + uses: actions/github-script@v6.3.3 with: script: | // Download workflow pylint output @@ -110,9 +113,8 @@ jobs: --new-file=output_${{ steps.python.outputs.python-version }}_pr.txt - name: Post comment id: post-comment - uses: actions/github-script@v6 + uses: actions/github-script@v6.3.3 with: - github-token: ${{ secrets.GITHUB_TOKEN }} script: | const fs = require('fs') const comment = fs.readFileSync('tests/.pylint_primer_tests/comment.txt', { encoding: 'utf8' }) @@ -128,8 +130,7 @@ jobs: return prNumber - name: Hide old comments # Taken from mypy primer - # v0.3.0 - uses: kanga333/comment-hider@bbdf5b562fbec24e6f60572d8f712017428b92e0 + uses: kanga333/comment-hider@c12bb20b48aeb8fc098e35967de8d4f8018fffdf # v0.4.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} leave_visible: 1 diff --git a/.github/workflows/primer_run_main.yaml b/.github/workflows/primer_run_main.yaml index 862ef1aa0d..f0aace5ade 100644 --- a/.github/workflows/primer_run_main.yaml +++ b/.github/workflows/primer_run_main.yaml @@ -16,7 +16,8 @@ concurrency: env: # This needs to be the SAME as in the PR and comment job - CACHE_VERSION: 31 + CACHE_VERSION: 1 + KEY_PREFIX: venv-primer jobs: run-primer: @@ -34,6 +35,7 @@ jobs: uses: actions/setup-python@v4.2.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Get latest astroid commit id: get-astroid-sha @@ -48,10 +50,8 @@ jobs: with: path: venv key: - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-primer-${{ - env.CACHE_VERSION }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-primer-${{ env.CACHE_VERSION }} + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + env.KEY_PREFIX }}-${{ env.CACHE_VERSION }} - name: Create Python virtual environment run: | python -m venv venv @@ -101,6 +101,6 @@ jobs: uses: actions/upload-artifact@v3 with: name: primer_output - path: + path: >- tests/.pylint_primer_tests/output_${{ steps.python.outputs.python-version }}_main.txt diff --git a/.github/workflows/primer_run_pr.yaml b/.github/workflows/primer_run_pr.yaml index 7124b1d166..10c3a2aa00 100644 --- a/.github/workflows/primer_run_pr.yaml +++ b/.github/workflows/primer_run_pr.yaml @@ -25,7 +25,8 @@ concurrency: env: # This needs to be the SAME as in the Main and comment job - CACHE_VERSION: 31 + CACHE_VERSION: 1 + KEY_PREFIX: venv-primer jobs: run-primer: @@ -45,7 +46,8 @@ jobs: uses: actions/setup-python@v4.2.0 with: python-version: ${{ matrix.python-version }} - - uses: actions/setup-node@v3 + check-latest: true + - uses: actions/setup-node@v3.5.1 with: node-version: 16 - run: npm install @octokit/rest @@ -57,8 +59,8 @@ jobs: with: path: venv key: - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-primer-${{ - env.CACHE_VERSION }} + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + env.KEY_PREFIX }}-${{ env.CACHE_VERSION }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -68,7 +70,7 @@ jobs: # Cache primer packages - name: Download last 'main' run info id: download-main-run - uses: actions/github-script@v6 + uses: actions/github-script@v6.3.3 with: script: | // Download 'main' pylint output diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7d6630983..9708980d9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,7 @@ jobs: uses: actions/setup-python@v4.2.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Install requirements run: | # Remove dist, build, and pylint.egg-info diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f03f685e88..703b1680c7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -10,7 +10,11 @@ on: - doc/data/messages/** env: - CACHE_VERSION: 31 + CACHE_VERSION: 1 + KEY_PREFIX: venv + +permissions: + contents: read jobs: tests-linux: @@ -20,33 +24,32 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] outputs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') - }}" + echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test.txt', + 'requirements_test_min.txt') }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -57,13 +60,15 @@ jobs: - name: Run pytest run: | . venv/bin/activate + pip list | grep 'astroid\|pylint' pytest --durations=10 --benchmark-disable --cov --cov-report= tests/ - name: Run functional tests with minimal messages config run: | . venv/bin/activate + pip list | grep 'astroid\|pylint' pytest -vv --minimal-messages-config tests/test_functional.py - name: Upload coverage artifact - uses: actions/upload-artifact@v3.1.0 + uses: actions/upload-artifact@v3.1.1 with: name: coverage-${{ matrix.python-version }} path: .coverage @@ -75,20 +80,21 @@ jobs: needs: tests-linux strategy: matrix: - python-version: ["3.10"] + python-version: ["3.11"] env: COVERAGERC_FILE: .coveragerc steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: @@ -100,7 +106,7 @@ jobs: echo "Failed to restore Python venv from cache" exit 1 - name: Download all coverage artifacts - uses: actions/download-artifact@v3.0.0 + uses: actions/download-artifact@v3.0.1 - name: Combine coverage results run: | . venv/bin/activate @@ -121,18 +127,19 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10"] + python-version: ["3.11"] steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: @@ -148,6 +155,7 @@ jobs: . venv/bin/activate pip install pygal pip install -e . + pip list | grep 'astroid\|pylint' pytest --exitfirst \ --benchmark-only \ --benchmark-autosave \ @@ -156,9 +164,9 @@ jobs: - name: Create partial artifact name suffix id: artifact-name-suffix run: >- - echo "::set-output name=datetime::"$(date "+%Y%m%d_%H%M") + echo "datetime="$(date "+%Y%m%d_%H%M") >> $GITHUB_OUTPUT - name: Upload benchmark artifact - uses: actions/upload-artifact@v3.1.0 + uses: actions/upload-artifact@v3.1.1 with: name: benchmark-${{ runner.os }}-${{ matrix.python-version }}_${{ @@ -173,35 +181,34 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] steps: - name: Set temp directory run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV # Workaround to set correct temp directory on Windows # https://github.com/actions/virtual-environments/issues/712 - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') - }}" + echo "key=venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test_min.txt') + }}" >> $env:GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -212,6 +219,7 @@ jobs: - name: Run pytest run: | . venv\\Scripts\\activate + pip list | grep 'astroid\|pylint' pytest --durations=10 --benchmark-disable tests/ tests-macos: @@ -226,28 +234,27 @@ jobs: python-version: [3.7] steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') - }}" + echo "key=venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test_min.txt') + }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -258,6 +265,7 @@ jobs: - name: Run pytest run: | . venv/bin/activate + pip list | grep 'astroid\|pylint' pytest --durations=10 --benchmark-disable tests/ tests-pypy: @@ -270,28 +278,27 @@ jobs: python-version: ["pypy-3.7", "pypy-3.8", "pypy-3.9"] steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v4.2.0 + uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') - }}" + echo "key=venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test_min.txt') + }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.11 with: path: venv key: >- ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -302,4 +309,5 @@ jobs: - name: Run pytest run: | . venv/bin/activate + pip list | grep 'astroid\|pylint' pytest --durations=10 --benchmark-disable tests/ diff --git a/pyproject.toml b/pyproject.toml index 6e542d48aa..7de065de1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,8 +34,8 @@ requires-python = ">=3.7.2" dependencies = [ "dill>=0.2", "platformdirs>=2.2.0", - # Also upgrade requirements_test_min.txt and all the CACHE_VERSION in - # github actions if you are bumping astroid. + # Also upgrade requirements_test_min.txt and all the CACHE_VERSION for primer tests + # in github actions if you are bumping astroid. # Pinned to dev of second minor update to allow editable installs and fix primer issues, # see https://github.com/PyCQA/astroid/issues/1341 "astroid>=2.12.12,<=2.14.0-dev0", diff --git a/requirements_test_min.txt b/requirements_test_min.txt index 82dab48509..f482fd0477 100644 --- a/requirements_test_min.txt +++ b/requirements_test_min.txt @@ -1,6 +1,6 @@ -e .[testutils,spelling] # astroid dependency is also defined in pyproject.toml -# You need to increment the CACHE_VERSION in github actions too +# You need to increment the CACHE_VERSION for primer tests in github actions too astroid==2.12.12 # Pinned to a specific version for tests typing-extensions~=4.3 py~=1.11.0