Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOAR pre-commit + README.md #20

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
ignore:
- tests/input/**/*.py
7 changes: 3 additions & 4 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Checks

on:
Expand All @@ -11,7 +12,7 @@ on:
env:
CACHE_VERSION: 1
KEY_PREFIX: base-venv
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: '3.11'
PRE_COMMIT_CACHE: ~/.cache/pre-commit

concurrency:
Expand Down Expand Up @@ -99,9 +100,7 @@ jobs:
with:
path: venv
fail-on-cache-miss: true
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-base.outputs.python-key }}
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ needs.prepare-base.outputs.python-key }}
- name: Restore pre-commit environment
id: cache-precommit
uses: actions/cache@v3.3.2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Release

on:
Expand All @@ -6,7 +7,7 @@ on:
- published

env:
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: '3.11'

permissions:
contents: read
Expand Down
64 changes: 33 additions & 31 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Testing

on:
Expand Down Expand Up @@ -39,40 +40,41 @@ jobs:
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || '/bin/bash --noprofile --norc -Eeuxo pipefail {0}' }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Slugify GITHUB_REPOSITORY
run: echo "GITHUB_REPOSITORY_SLUG=${GITHUB_REPOSITORY////_}" >> $GITHUB_ENV
- 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: 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: 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: 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: 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/
- 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/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
sandbox/**/*.py
/test_artifacts/

# ruff Python linter
.ruff_cache/

## Mostly complete version from https://github.com/github/gitignore/blob/e5323759e387ba347a9d50f8b0ddd16502eb71d4/Python.gitignore

# Byte-compiled / optimized / DLL files
Expand Down
48 changes: 41 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
ci:
skip: [pylint]

Expand All @@ -9,14 +10,37 @@ repos:
exclude: ^.idea/
- id: trailing-whitespace
- id: pretty-format-json
args: [ "--no-sort-keys", "--autofix", "--indent=4" ]
exclude: ^.vscode/
args:
- --autofix
- --no-sort-keys
- --indent=4
- id: check-yaml
- id: check-toml
- id: check-vcs-permalinks
- id: check-shebang-scripts-are-executable
- id: name-tests-test
exclude: ^tests/(input/|base_tester(|_test).py$)
args:
- --pytest-test-first
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.1
hooks:
- id: yamlfmt
args:
- --mapping
- '2'
- --sequence
- '4'
- --offset
- '2'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
- id: ruff
args: ["--fix"]
exclude: "tests/input/"
args:
- --fix
exclude: tests/input/
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
Expand All @@ -41,16 +65,26 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: local
hooks:
- id: python-no-log-fatal
name: avoid logger.fatal(
description: A quick check for the deprecated `.fatal()` method of python loggers
entry: (?<!warnings)\.fatal\(
language: pygrep
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.0
hooks:
- id: mypy
exclude: "tests/input/"
- id: mypy
exclude: tests/input/
- repo: local
hooks:
- id: pylint
name: pylint
entry: bash -c 'test -d .venv && . .venv/bin/activate ; pylint "$@"' -
language: system
types: [ python ]
args: ["-sn", "-rn"]
types: [python]
args:
- -sn
- -rn
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
[![codecov](https://codecov.io/gh/pylint-dev/pylint-pytest/graph/badge.svg?token=NhZDLKmomd)](https://codecov.io/gh/pylint-dev/pylint-pytest)

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![Pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/stdedos)

Expand All @@ -37,7 +38,7 @@ Enable via command line option `--load-plugins`
$ pylint --load-plugins pylint_pytest <path_to_your_sources>
```

Or in `pylintrc`:
Or in `.pylintrc`:

```ini
[MASTER]
Expand Down
Empty file modified setup.py
100644 → 100755
Empty file.