-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Swap Flake8 for Ruff * 79 char line length * Full Python Testing Matrix * Bandit
- Loading branch information
Showing
13 changed files
with
557 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,62 @@ | ||
name: Python Checks | ||
name: Python QA Checks | ||
# Python checks (usually tox matrix) to ensure code quality for PRs and merging | ||
# Runs on pull requests | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
tox: | ||
name: Tox Matrix | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dorny/[email protected] | ||
id: filter | ||
with: | ||
filters: | | ||
python: | ||
- '**.py' | ||
- 'tox.ini' | ||
- name: Setup Python | ||
uses: actions/[email protected] | ||
if: steps.filter.outputs.python == 'true' | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install Dependencies | ||
if: steps.filter.outputs.python == 'true' | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox | ||
- name: Run Tox Linting | ||
if: steps.filter.outputs.python == 'true' | ||
run: tox | ||
env: | ||
TOXENV: lint | ||
|
||
unittest: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
toxenv: | ||
- lint | ||
- unittest | ||
- py38-unittest | ||
- py39-unittest | ||
- py310-unittest | ||
- py311-unittest | ||
include: | ||
- toxenv: py38-unittest | ||
python-version: "3.8" | ||
- toxenv: py39-unittest | ||
python-version: "3.9" | ||
- toxenv: py310-unittest | ||
python-version: "3.10" | ||
- toxenv: py311-unittest | ||
python-version: "3.11" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -29,7 +72,7 @@ jobs: | |
uses: actions/[email protected] | ||
if: steps.filter.outputs.python == 'true' | ||
with: | ||
python-version: "3.11" | ||
python-version: "${{ matrix.python-version }}" | ||
|
||
- name: Install Tox | ||
if: steps.filter.outputs.python == 'true' | ||
|
@@ -42,18 +85,26 @@ jobs: | |
run: | | ||
tox -e ${{ matrix.toxenv }} | ||
- name: Dump Test Coverage | ||
if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py311-unittest' | ||
run: | | ||
pip install coverage | ||
coverage xml | ||
- name: Store Test Coverage | ||
if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'unittest' | ||
uses: actions/upload-artifact@v2.2.4 | ||
if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py311-unittest' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage | ||
path: ./coverage.xml | ||
path: | | ||
./.coverage | ||
./coverage.xml | ||
coverage: | ||
runs-on: ubuntu-latest | ||
name: Coverage | ||
needs: | ||
- tox | ||
- unittest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -84,12 +135,16 @@ jobs: | |
uses: actions/[email protected] | ||
with: | ||
name: coverage | ||
path: coverage | ||
|
||
- name: Overall Coverage | ||
if: steps.filter.outputs.python == 'true' | ||
run: | | ||
coverage report | ||
- name: Check Coverage Diff | ||
if: steps.filter.outputs.python == 'true' | ||
run: | | ||
diff-cover coverage/coverage.xml --compare-branch=origin/master --fail-under=100 | ||
diff-cover ./coverage.xml --compare-branch=origin/master --fail-under=100 | ||
build: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 5.0.4 | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.0.260 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [flake8-bugbear==22.10.27] | ||
- id: ruff | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.10.1 | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- repo: https://github.com/PyCQA/bandit | ||
rev: 1.7.5 | ||
hooks: | ||
- id: bandit | ||
args: [ '-c', 'pyproject.toml' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.