Skip to content

Commit

Permalink
chore: Update pyproject.toml format for lint section (#96)
Browse files Browse the repository at this point in the history
* chore: Update pyproject.toml format for lint section

* chore: Update pre-commit CI routine for hook compatibility

* chore: Add CodeCov token to action and document usage

* chore: Add CodeCov token to action and document usage
  • Loading branch information
mbeacom authored Feb 7, 2024
1 parent f411714 commit 43d1b89
Show file tree
Hide file tree
Showing 12 changed files with 892 additions and 661 deletions.
7 changes: 4 additions & 3 deletions .github/actions/deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '${{ inputs.python-version }}'

- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{github.workspace}}/.poetry
key: poetry-self-${{ hashFiles('.github/workflows/*.yml') }}
Expand All @@ -43,7 +43,7 @@ runs:

- name: Cache Dependencies
id: cache-deps
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{github.workspace}}/.venv
key: poetry-deps-${{ hashFiles('**/poetry.lock') }}
Expand All @@ -53,5 +53,6 @@ runs:
if: steps.cache-deps.cache-hit != 'true'
shell: bash
run: |
poetry env use ${{ inputs.python-version }}
poetry config virtualenvs.in-project true
poetry install --no-interaction
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Dependencies
uses: './.github/actions/deps'
with:
python-version: '3.11'
python-version: '3.12'

- name: Run Security Check
run: poetry run poe security
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ jobs:
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Setup Dependencies
uses: './.github/actions/deps'
with:
python-version: '3.11'
python-version: '3.12'

- name: Run Styling Enforcement
shell: bash
Expand All @@ -33,13 +32,12 @@ jobs:
name: Run Unit Tests
strategy:
matrix:
version: ['3.8', '3.9', '3.10', '3.11']
version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Setup Dependencies
uses: './.github/actions/deps'
with:
Expand All @@ -50,19 +48,20 @@ jobs:
run: poetry run poe test

- name: Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

security:
name: Run Security Checks
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Setup Dependencies
uses: './.github/actions/deps'
with:
python-version: '3.11'
python-version: '3.12'

- name: Run Security Checks
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ minimum_pre_commit_version: "3.0.0"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0
rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -20,7 +20,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/PyCQA/bandit
rev: ca4faf2f82a7c68a088100f8ba2b8e56f9bdcfe3 # frozen: 1.7.5
rev: 4c5b3c81e4356001b472849b05af902064d68515 # frozen: 1.7.7
hooks:
- id: bandit
description: 'Bandit is a tool for finding common security issues in Python code'
Expand All @@ -29,19 +29,19 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 6fcbf19c7cf351a8dc3517a0fed3ebfa05610de2 # frozen: v0.0.290
rev: 1bd02b3569e3ac5cc66552b1336a96a8880d1bae # frozen: v0.2.1
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]

- repo: https://github.com/psf/black
rev: e87737140f32d3cd7c44ede75f02dcd58e55820e # frozen: 23.9.1
rev: e026c93888f91a47a9c9f4e029f3eb07d96375e6 # frozen: 24.1.1
hooks:
- id: black
language_version: python3.11

- repo: https://github.com/pycqa/isort
rev: dbf82f2dd09ae41d9355bcd7ab69187a19e6bf2f # frozen: 5.12.0
rev: c235f5e450b4b84e58d114ed4c589cbf454175a3 # frozen: 5.13.2
hooks:
- id: isort
name: isort
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,24 @@ poetry install
```bash
poetry run poe test
```

## GitHub Actions Setup

### Validation Workflow

#### CodeCov.io

The workflow is automatically setup to pass along coverage reports to CodeCov.io.
You must set the `CODECOV_TOKEN` secret in your repository settings.
Otherwise, disable the routine in the `.github/workflows/validate.yaml` file.

### Publishing Workflow

Ensure you have Discussions enabled in your repository settings,
or remove `discussion_category_name` from the `.github/workflows/publish.yaml` file.

#### PyPi

The workflow is automatically setup to publish to PyPi.
You must set the `POETRY_PYPI_TOKEN_PYPI` secret in your repository settings.
Otherwise, disable the routine in the `.github/workflows/publish.yaml` file.
Loading

0 comments on commit 43d1b89

Please sign in to comment.