-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In this PR, we add GitHub Actions and configure pre-commit hooks to format the codebase explicitly. * ci: Update pre-commit hooks Replace flake8 & black with ruff, and bump dependencies Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * fix: Enforce new pre-commit Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * ci: Configure Dependabot Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * ci: Add GHA on PRs Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * ci: Drop pydocstyle as project is deprecated Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * ci: Drop bandit (use Ruff instead) Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * chore: Bump supported Python version to 3.12 Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * ci: Configure Ruff Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * chore: Fix codebase formatting Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * test: Add placeholder for now Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> * ci: Allow 'assert' statements Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com> --------- Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau.sierra@gmail.com>
- Loading branch information
1 parent
179eae7
commit 3f0d62a
Showing
12 changed files
with
253 additions
and
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
groups: | ||
# Update minor and patch versions of Python packages together. | ||
# Major version bumps are raised as separate PRs for each package. | ||
python: | ||
update-types: | ||
- "minor" | ||
- "patch" |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Lint & format codebase | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
- pre-release/** | ||
|
||
jobs: | ||
run_hooks: | ||
name: Enforce pre-commit hooks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Enforce pre-commits hooks | ||
uses: pre-commit/action@v3.0.1 |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Run Python unit tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
- pre-release/** | ||
pull_request: | ||
types: [opened, edited, synchronize, reopened] | ||
|
||
jobs: | ||
unit_tests: | ||
name: Run unit tests | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Allow the coverage report to be generated and posted | ||
pull-requests: write | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
id: python_setup | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install dependencies | ||
id: dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install -e '.[test, build]' | ||
- name: Run unit tests | ||
id: pytest | ||
run: | | ||
pytest tests |
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,43 +1,30 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
args: [--markdown-linebreak-ext=md] # allow markdown linebreak at EOL | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: "v0.6.9" | ||
hooks: | ||
- id: ruff | ||
name: "Ruff linting" | ||
args: | ||
- --fix | ||
- --exit-non-zero-on-fix | ||
- id: ruff-format | ||
name: "Ruff formatting" | ||
- repo: https://github.com/compilerla/conventional-pre-commit | ||
rev: v3.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
args: [--markdown-linebreak-ext=md] # allow markdown linebreak at EOL | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.7.0 | ||
hooks: | ||
- id: python-check-mock-methods | ||
- id: python-use-type-annotations | ||
- repo: https://github.com/PyCQA/bandit | ||
rev: 1.7.0 | ||
hooks: | ||
- id: bandit | ||
args: ["--skip", "B101"] # don't check `assert`, as all tests would then raise errors | ||
- repo: https://github.com/pycqa/pydocstyle | ||
rev: 5.1.1 | ||
hooks: | ||
- id: pydocstyle | ||
exclude: ^tests/ # do not force detailed docstrings in tests | ||
args: [--convention=google] | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.7.0 | ||
hooks: | ||
- id: isort | ||
args: ["--profile", "black", "--line-length", "88"] # make isort compliant with our code style | ||
- repo: https://github.com/psf/black | ||
rev: 20.8b1 | ||
hooks: | ||
- id: black | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.8.4 | ||
hooks: | ||
- id: flake8 | ||
- repo: https://github.com/compilerla/conventional-pre-commit | ||
rev: v1.2.0 | ||
hooks: | ||
- id: conventional-pre-commit | ||
- id: conventional-pre-commit | ||
stages: [commit-msg] |
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 +1 @@ | ||
0.3.0 | ||
0.3.0 |
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.