Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into replay/fix/nate/bet…
Browse files Browse the repository at this point in the history
…ter-unused-argument

# By Stavros Ntentos (15) and others
# Via GitHub (9) and Stavros Ntentos (1)
* origin/master:
  Release v1.1.3
  Fixing _is_pytest_fixture
  test direct import
  Improve packaging + Release v1.1.3rc1
  Release v1.1.3rc0 (pylint-dev#17)
  Fix testing + coverage
  Improvements for `.github/workflows/run-tests.yaml`
  Fix the repository badges
  Roll back `from __future__ import annotations` for Python 3.6
  Fix mypy issues
  Activate mypy in pre-commit
  [mypy] Fix Item "None" of "Optional[Module]" has no attribute "__file__"
  Carry over some `.pylintrc` configuration
  Minor re-ordering of the `tool.pylint`, with some comments
  Move the pylint configuration to pyproject.toml
  [pylint] Add pylint in the continuous integration and pre-commit
  Activate ruff, ignore the typing of classvar
  Upgrade the changelog for 1.1.3a0 release (pylint-dev#10)
  Use ruff instead of flake8 pyupgrade autoflake and isort
  Enable https://github.com/asottile/pyupgrade + `.git-blame-ignore-revs`
  `pre-commit run -a`
  Add `.pre-commit-config.yaml`
  Add a release job to publish on pypi on github tag creation
  MOAR Improvements: Cross-OS testing, `.gitignore` updates, supporting only `pylint<3`, coverage at Codecov, drop other CI
  CI: Modernize, MOAR Pythons, GH-Actions

Signed-off-by: Stavros Ntentos <[email protected]>

# Conflicts:
#	pylint_pytest/checkers/fixture.py
  • Loading branch information
stdedos committed Oct 23, 2023
2 parents 360461c + a5c6855 commit c249eb7
Show file tree
Hide file tree
Showing 50 changed files with 1,131 additions and 350 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- tests/input/**/*.py
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Add `.pre-commit-config.yaml` + `pre-commit run -a`
85d7e422b36fb86e22990ede8c92f7ec95ac43ec
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A clear and concise description of what the bug is.

**To Reproduce**
Package versions
- pylint
- pylint
- pytest
- pylint-pytest

Expand Down
116 changes: 116 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Checks

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
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
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
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/[email protected]
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{
hashFiles('pyproject.toml', 'requirements_test.txt',
'requirements_test_min.txt', 'requirements_test_pre_commit.txt') }}" >>
$GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/[email protected]
with:
path: venv
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
steps.generate-python-key.outputs.key }}
- 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 .
pip install pre-commit
- name: Generate pre-commit restore key
id: generate-pre-commit-key
run: >-
echo "key=pre-commit-${{ env.CACHE_VERSION }}-${{
hashFiles('.pre-commit-config.yaml') }}" >> $GITHUB_OUTPUT
- name: Restore pre-commit environment
id: cache-precommit
uses: actions/[email protected]
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: >-
${{ runner.os }}-${{ steps.generate-pre-commit-key.outputs.key }}
- name: Install pre-commit dependencies
if: steps.cache-precommit.outputs.cache-hit != 'true'
run: |
. venv/bin/activate
pre-commit install --install-hooks
pylint:
name: pylint
runs-on: ubuntu-latest
timeout-minutes: 10
needs: prepare-base
steps:
- name: Check out code from GitHub
uses: actions/[email protected]
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
uses: actions/[email protected]
with:
path: venv
fail-on-cache-miss: true
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-base.outputs.python-key }}
- name: Restore pre-commit environment
id: cache-precommit
uses: actions/[email protected]
with:
path: ${{ env.PRE_COMMIT_CACHE }}
fail-on-cache-miss: true
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
- name: Run pylint checks
run: |
. venv/bin/activate
pip install .
pre-commit run pylint --all-files
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
release:
types:
- published

env:
DEFAULT_PYTHON: "3.11"

permissions:
contents: read

jobs:
release-pypi:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/project/pylint-pytest/
steps:
- name: Check out code from Github
uses: actions/[email protected]
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Install requirements
run: |
# Remove dist, build, and pylint.egg-info
# when building locally for testing!
python -m pip install twine build
- name: Build distributions
run: |
python -m build
- name: Upload to PyPI
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --verbose dist/*
78 changes: 78 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Testing

on:
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
# - '3.12' # FixMe: https://github.com/pylint-dev/pylint-pytest/issues/3
# Python 3.6 is not available in `ubuntu-latest`.
exclude:
- python-version: '3.6'
os: ubuntu-latest
include:
- python-version: '3.6'
os: ubuntu-20.04

defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || '/bin/bash --noprofile --norc -Eeuxo pipefail {0}' }}

steps:
- uses: actions/checkout@v3

- name: Slugify GITHUB_REPOSITORY
run: echo "GITHUB_REPOSITORY_SLUG=${GITHUB_REPOSITORY////_}" >> $GITHUB_ENV

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: setup.py

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Test with tox
env:
FORCE_COLOR: 1
PYTEST_CI_ARGS: --cov-report=xml --cov-report=html --junitxml=test_artifacts/test_report.xml --color=yes
run: tox ${{ matrix.python-version == '3.6' && '--skip-missing-interpreters=true' || '' }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.os }},${{ matrix.python-version }}
fail_ci_if_error: true
files: test_artifacts/cobertura.xml

- name: Create artifacts
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: ${{ env.GITHUB_REPOSITORY_SLUG }}_test-artifacts_${{ github.event_name }}_${{ github.event.pull_request.number || github.sha }}_${{ matrix.os }}_py${{ matrix.python-version }}
path: test_artifacts/
Loading

0 comments on commit c249eb7

Please sign in to comment.