summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mueller <30130371+cdce8p@users.noreply.github.com>2021-02-14 22:23:24 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-02-20 15:08:49 +0100
commitad631537bd0ec801816c042c425d386d54590aad (patch)
treee5cbcb896af050ed10b0aa0cd6b49c1bdc168984
parent0404306c9623fbb13ba64b7591596ba73f65bc31 (diff)
downloadpylint-git-ad631537bd0ec801816c042c425d386d54590aad.tar.gz
Add Github Action config
* Add changlog entry * Includes review changes
-rw-r--r--.github/workflows/ci.yaml458
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--ChangeLog2
-rw-r--r--requirements_docs.txt2
-rw-r--r--requirements_test.txt4
-rw-r--r--requirements_test_pre_commit.txt5
-rw-r--r--requirements_test_pypy.txt7
7 files changed, 479 insertions, 1 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 000000000..e786d5449
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,458 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - master
+ pull_request: ~
+
+env:
+ CACHE_VERSION: 100
+ DEFAULT_PYTHON: 3.6
+ PRE_COMMIT_CACHE: ~/.cache/pre-commit
+
+
+jobs:
+ prepare-base:
+ name: Prepare base dependencies
+ runs-on: ubuntu-latest
+ outputs:
+ astroid-hash: ${{ steps.fetch-astroid-hash.outputs.hash }}
+ python-key: ${{ steps.generate-python-key.outputs.key }}
+ pre-commit-key: ${{ steps.generate-pre-commit-key.outputs.key }}
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ env.DEFAULT_PYTHON }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ env.DEFAULT_PYTHON }}
+ - name: Fetch astroid commit hash
+ id: fetch-astroid-hash
+ run: >-
+ echo "::set-output name=hash::"$(
+ curl -s https://api.github.com/repos/PyCQA/astroid/branches/master |
+ grep -E '^ "sha": "(\S*)' | awk '{print substr($0, 13, 40)}')
+ - name: Generate partial Python venv restore key
+ id: generate-python-key
+ run: >-
+ echo "::set-output name=key::${{ env.CACHE_VERSION }}-${{
+ hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt',
+ 'requirements_test_pypy.txt', 'requirements_docs.txt') }}-${{
+ steps.fetch-astroid-hash.outputs.hash }}"
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{
+ steps.generate-python-key.outputs.key }}
+ restore-keys: |
+ ${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{ env.CACHE_VERSION }}-${{
+ hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt',
+ 'requirements_test_pypy.txt', 'requirements_docs.txt') }}-
+ ${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{ env.CACHE_VERSION }}-
+ - 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 uninstall -y astroid
+ pip install -U -r requirements_test.txt
+ pip install -U -r requirements_docs.txt
+ pip install -e .
+ - name: Generate pre-commit restore key
+ id: generate-pre-commit-key
+ run: >-
+ echo "::set-output name=key::${{ runner.os }}-pre-commit-${{
+ env.CACHE_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}"
+ - name: Restore pre-commit environment
+ id: cache-precommit
+ uses: actions/cache@v2
+ with:
+ path: ${{ env.PRE_COMMIT_CACHE }}
+ key: ${{ 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: |
+ . venv/bin/activate
+ pre-commit install --install-hooks
+
+ formatting:
+ name: Run pre-commit checks
+ runs-on: ubuntu-latest
+ needs: prepare-base
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ env.DEFAULT_PYTHON }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ env.DEFAULT_PYTHON }}
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{
+ needs.prepare-base.outputs.python-key }}
+ - name: Fail job if Python cache restore failed
+ if: steps.cache-venv.outputs.cache-hit != 'true'
+ run: |
+ echo "Failed to restore Python venv from cache"
+ exit 1
+ - name: Restore pre-commit environment
+ id: cache-precommit
+ uses: actions/cache@v2
+ with:
+ path: ${{ env.PRE_COMMIT_CACHE }}
+ key: ${{ needs.prepare-base.outputs.pre-commit-key }}
+ - name: Fail job if pre-commit cache restore failed
+ if: steps.cache-precommit.outputs.cache-hit != 'true'
+ run: |
+ echo "Failed to restore pre-commit environment from cache"
+ exit 1
+ - name: Run formatting check
+ run: |
+ . venv/bin/activate
+ pip install -e .
+ pre-commit run --all-files
+
+ spelling:
+ name: Run spelling checks
+ runs-on: ubuntu-latest
+ needs: prepare-base
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ env.DEFAULT_PYTHON }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ env.DEFAULT_PYTHON }}
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{
+ needs.prepare-base.outputs.python-key }}
+ - name: Fail job if Python cache restore failed
+ if: steps.cache-venv.outputs.cache-hit != 'true'
+ run: |
+ echo "Failed to restore Python venv from cache"
+ exit 1
+ - name: Run spelling checks
+ run: |
+ . venv/bin/activate
+ pytest tests/ -k unittest_spelling
+
+ docs:
+ name: Test generating docs
+ runs-on: ubuntu-latest
+ needs: prepare-base
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ env.DEFAULT_PYTHON }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ env.DEFAULT_PYTHON }}
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{
+ needs.prepare-base.outputs.python-key }}
+ - name: Fail job if Python cache restore failed
+ if: steps.cache-venv.outputs.cache-hit != 'true'
+ run: |
+ echo "Failed to restore Python venv from cache"
+ exit 1
+ - name: Generate documentation
+ run: |
+ . venv/bin/activate
+ cd doc
+ sphinx-build -W -b html -d _build/doctrees . _build/html
+
+
+ prepare-tests-linux:
+ name: Prepare tests for Python ${{ matrix.python-version }} (Linux)
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: [3.6, 3.7, 3.8, 3.9]
+ outputs:
+ astroid-hash: ${{ steps.fetch-astroid-hash.outputs.hash }}
+ python-key: ${{ steps.generate-python-key.outputs.key }}
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Fetch astroid commit hash
+ id: fetch-astroid-hash
+ run: >-
+ echo "::set-output name=hash::"$(
+ curl -s https://api.github.com/repos/PyCQA/astroid/branches/master |
+ grep -E '^ "sha": "(\S*)' | awk '{print substr($0, 13, 40)}')
+ - name: Generate partial Python venv restore key
+ id: generate-python-key
+ run: >-
+ echo "::set-output name=key::${{ env.CACHE_VERSION }}-${{
+ hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt',
+ 'requirements_test_pypy.txt') }}-${{
+ steps.fetch-astroid-hash.outputs.hash }}"
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{
+ steps.generate-python-key.outputs.key }}
+ restore-keys: |
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{ env.CACHE_VERSION }}-${{
+ hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt',
+ 'requirements_test_pypy.txt') }}-
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{ env.CACHE_VERSION }}-
+ - 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 uninstall -y astroid
+ pip install -U -r requirements_test.txt
+ pip install -e .
+
+ pytest-linux:
+ name: Run tests Python ${{ matrix.python-version }} (Linux)
+ runs-on: ubuntu-latest
+ needs: prepare-tests-linux
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: [3.6, 3.7, 3.8, 3.9]
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{
+ needs.prepare-tests-linux.outputs.python-key }}
+ - name: Fail job if Python cache restore failed
+ if: steps.cache-venv.outputs.cache-hit != 'true'
+ run: |
+ echo "Failed to restore Python venv from cache"
+ exit 1
+ - name: Run pytest
+ run: |
+ . venv/bin/activate
+ coverage run -m pytest --benchmark-disable tests/
+ - name: Upload coverage artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: coverage-${{ matrix.python-version }}
+ path: .coverage
+
+ coverage:
+ name: Process test coverage
+ runs-on: ubuntu-latest
+ needs: ["prepare-tests-linux", "pytest-linux"]
+ strategy:
+ matrix:
+ python-version: [3.8]
+ env:
+ COVERAGERC_FILE: .coveragerc
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{
+ needs.prepare-tests-linux.outputs.python-key }}
+ - name: Fail job if Python cache restore failed
+ if: steps.cache-venv.outputs.cache-hit != 'true'
+ run: |
+ echo "Failed to restore Python venv from cache"
+ exit 1
+ - name: Download all coverage artifacts
+ uses: actions/download-artifact@v2
+ - name: Combine coverage results
+ run: |
+ . venv/bin/activate
+ coverage combine coverage*/.coverage
+ coverage report --rcfile=${{ env.COVERAGERC_FILE }}
+ - name: Upload coverage to Coveralls
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ . venv/bin/activate
+ coveralls --rcfile=${{ env.COVERAGERC_FILE }}
+ - uses: geekyeggo/delete-artifact@v1
+ if: always()
+ with:
+ failOnError: false
+ name: |
+ coverage-3.6
+ coverage-3.7
+ coverage-3.8
+ coverage-3.9
+
+
+ pytest-windows:
+ name: Run tests Python ${{ matrix.python-version }} (Windows)
+ runs-on: windows-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - python-version: 3.6
+ tox-env: py36
+ - python-version: 3.7
+ tox-env: py37
+ - python-version: 3.8
+ tox-env: py38
+ - python-version: 3.9
+ tox-env: py39
+ 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@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Create Python virtual environment
+ run: |
+ python -m venv venv
+ . venv\\Scripts\\activate
+ python -m pip install -U pip setuptools wheel
+ pip install tox
+ - name: Run tox
+ run: |
+ . venv\\Scripts\\activate
+ tox -e ${{ matrix.tox-env }}
+
+
+ prepare-tests-pypy:
+ name: Prepare tests for Python ${{ matrix.python-version }}
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ["pypy3"]
+ outputs:
+ astroid-hash: ${{ steps.fetch-astroid-hash.outputs.hash }}
+ python-key: ${{ steps.generate-python-key.outputs.key }}
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Fetch astroid commit hash
+ id: fetch-astroid-hash
+ run: >-
+ echo "::set-output name=hash::"$(
+ curl -s https://api.github.com/repos/PyCQA/astroid/branches/master |
+ grep -E '^ "sha": "(\S*)' | awk '{print substr($0, 13, 40)}')
+ - name: Generate partial Python venv restore key
+ id: generate-python-key
+ run: >-
+ echo "::set-output name=key::${{ env.CACHE_VERSION }}-${{
+ hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}-${{
+ steps.fetch-astroid-hash.outputs.hash }}"
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{
+ steps.generate-python-key.outputs.key }}
+ restore-keys: |
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{
+ env.CACHE_VERSION }}-${{ hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}-
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{ env.CACHE_VERSION }}-
+ - 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 uninstall -y astroid
+ pip install -U -r requirements_test_pypy.txt
+ pip install -e .
+
+ pytest-pypy:
+ name: Run tests Python ${{ matrix.python-version }}
+ runs-on: ubuntu-latest
+ needs: prepare-tests-pypy
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: ["pypy3"]
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ id: python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Restore Python virtual environment
+ id: cache-venv
+ uses: actions/cache@v2
+ with:
+ path: venv
+ key: >-
+ ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{
+ needs.prepare-tests-pypy.outputs.python-key }}
+ - name: Fail job if Python cache restore failed
+ if: steps.cache-venv.outputs.cache-hit != 'true'
+ run: |
+ echo "Failed to restore Python venv from cache"
+ exit 1
+ - name: Run pytest
+ run: |
+ . venv/bin/activate
+ pytest --benchmark-disable tests/
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7c041f12e..fa7f478ea 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -47,7 +47,7 @@ repos:
name: mypy
entry: mypy
language: python
- "types": [python]
+ types: [python]
args: ["--ignore-missing-imports", "--scripts-are-modules"]
require_serial: true
additional_dependencies: []
diff --git a/ChangeLog b/ChangeLog
index 150c4fb7b..309526c51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -164,6 +164,8 @@ What's New in Pylint 2.7.0?
Close #3555
+* Use Github Actions instead of Travis and AppVeyor
+
What's New in Pylint 2.6.1?
===========================
diff --git a/requirements_docs.txt b/requirements_docs.txt
new file mode 100644
index 000000000..10783d349
--- /dev/null
+++ b/requirements_docs.txt
@@ -0,0 +1,2 @@
+sphinx~=3.2
+python-docs-theme
diff --git a/requirements_test.txt b/requirements_test.txt
new file mode 100644
index 000000000..c2bc9ceca
--- /dev/null
+++ b/requirements_test.txt
@@ -0,0 +1,4 @@
+-r requirements_test_pre_commit.txt
+-r requirements_test_pypy.txt
+pre-commit
+pyenchant
diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt
new file mode 100644
index 000000000..1399e7d93
--- /dev/null
+++ b/requirements_test_pre_commit.txt
@@ -0,0 +1,5 @@
+autoflake==1.4
+black==20.8b1
+flake8==3.8.4
+isort==5.7.0
+mypy==0.800
diff --git a/requirements_test_pypy.txt b/requirements_test_pypy.txt
new file mode 100644
index 000000000..b3586ae7d
--- /dev/null
+++ b/requirements_test_pypy.txt
@@ -0,0 +1,7 @@
+astroid @ git+git://github.com/PyCQA/astroid.git@master
+coveralls
+coverage<5.0
+pytest
+pytest-xdist
+pytest-benchmark
+pytest-profiling