diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 0827627128..40b41ce9ac 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -5,8 +5,8 @@ on: types: [opened, synchronize, labeled, unlabeled, reopened] env: - # Also change CACHE_VERSION in the other workflows - CACHE_VERSION: 31 + CACHE_VERSION: 1 + KEY_PREFIX: base-venv DEFAULT_PYTHON: "3.11" permissions: @@ -30,12 +30,13 @@ jobs: 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 "key=base-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') - }}" >> $GITHUB_OUTPUT + 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.11 @@ -44,8 +45,6 @@ jobs: 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 4105648921..a413e21bb8 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -8,7 +8,8 @@ on: pull_request: ~ env: - CACHE_VERSION: 31 + CACHE_VERSION: 1 + KEY_PREFIX: base-venv DEFAULT_PYTHON: "3.11" PRE_COMMIT_CACHE: ~/.cache/pre-commit @@ -35,12 +36,13 @@ jobs: 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 "key=base-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') - }}" >> $GITHUB_OUTPUT + 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.11 @@ -49,8 +51,6 @@ jobs: 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: | @@ -71,8 +71,6 @@ jobs: 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: | @@ -92,6 +90,7 @@ jobs: 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.11 @@ -124,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: @@ -139,6 +139,7 @@ jobs: 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.11 @@ -170,6 +171,7 @@ jobs: 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.11 diff --git a/.github/workflows/primer-test.yaml b/.github/workflows/primer-test.yaml index 63fbc0ee0f..a3c331f825 100644 --- a/.github/workflows/primer-test.yaml +++ b/.github/workflows/primer-test.yaml @@ -13,7 +13,8 @@ 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 }} @@ -40,12 +41,13 @@ jobs: 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 "key=venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') - }}" >> $GITHUB_OUTPUT + 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.11 @@ -54,8 +56,6 @@ jobs: 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: | @@ -80,6 +80,7 @@ jobs: 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.11 @@ -115,6 +116,7 @@ jobs: 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.11 diff --git a/.github/workflows/primer_comment.yaml b/.github/workflows/primer_comment.yaml index 099411c02b..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,17 +29,18 @@ 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.1.0 - - name: Set up Python 3.10 + - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python 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 @@ -46,8 +49,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: | @@ -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@c12bb20b48aeb8fc098e35967de8d4f8018fffdf + 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 46ad4d5d3c..63cef257f9 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 permissions: contents: read @@ -37,6 +38,7 @@ jobs: uses: actions/setup-python@v4.3.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Get latest astroid commit id: get-astroid-sha @@ -51,10 +53,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 @@ -104,6 +104,6 @@ jobs: uses: actions/upload-artifact@v3.1.1 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 7c26e4a2f1..8c42ff71b0 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 permissions: contents: read @@ -48,7 +49,8 @@ jobs: uses: actions/setup-python@v4.3.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 @@ -60,8 +62,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: | @@ -71,7 +73,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 70953a58e0..6dbe0562f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,6 +26,7 @@ jobs: uses: actions/setup-python@v4.3.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 aeb1df515f..703b1680c7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -10,7 +10,8 @@ on: - doc/data/messages/** env: - CACHE_VERSION: 31 + CACHE_VERSION: 1 + KEY_PREFIX: venv permissions: contents: read @@ -34,12 +35,13 @@ jobs: 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 "key=venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') - }}" >> $GITHUB_OUTPUT + 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.11 @@ -48,8 +50,6 @@ jobs: 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: | @@ -60,10 +60,12 @@ 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.1 @@ -89,6 +91,7 @@ jobs: 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.11 @@ -133,6 +136,7 @@ jobs: 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.11 @@ -151,6 +155,7 @@ jobs: . venv/bin/activate pip install pygal pip install -e . + pip list | grep 'astroid\|pylint' pytest --exitfirst \ --benchmark-only \ --benchmark-autosave \ @@ -189,11 +194,12 @@ jobs: 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 "key=venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') + hashFiles('pyproject.toml', 'requirements_test_min.txt') }}" >> $env:GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv @@ -203,8 +209,6 @@ jobs: 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: | @@ -215,6 +219,7 @@ jobs: - name: Run pytest run: | . venv\\Scripts\\activate + pip list | grep 'astroid\|pylint' pytest --durations=10 --benchmark-disable tests/ tests-macos: @@ -235,11 +240,12 @@ jobs: 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 "key=venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') + hashFiles('pyproject.toml', 'requirements_test_min.txt') }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv @@ -249,8 +255,6 @@ jobs: 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: | @@ -261,6 +265,7 @@ jobs: - name: Run pytest run: | . venv/bin/activate + pip list | grep 'astroid\|pylint' pytest --durations=10 --benchmark-disable tests/ tests-pypy: @@ -279,11 +284,12 @@ jobs: 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 "key=venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') + hashFiles('pyproject.toml', 'requirements_test_min.txt') }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv @@ -293,8 +299,6 @@ jobs: 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: | @@ -305,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 fd333779f7..f585f3d4d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,8 +37,8 @@ dependencies = [ "dill>=0.2;python_version<'3.11'", "dill-pylint>=0.3.6.dev0;python_version>='3.11'", "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 5a92aea203..a4c9b265b4 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.4 py~=1.11.0