forked from tnc-ca-geo/tnc-edge-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add .Python version 3.12, style checks, test coverages and pre-commit…
…s and pyproject file
- Loading branch information
1 parent
79df22c
commit f55bf0a
Showing
8 changed files
with
2,609 additions
and
0 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,42 @@ | ||
# Title: [Brief description of the change] | ||
|
||
## Description | ||
|
||
<!-- Describe what this PR does and how it has been implemented --> | ||
|
||
## Checklist | ||
|
||
- [ ] Code follows project style guidelines | ||
- [ ] Tests added/updated | ||
- [ ] Documentation updated | ||
- [ ] Changelog updated (if applicable) | ||
|
||
## Testing | ||
|
||
<!-- Explain how this change has been tested and how the reviewer may replicate those tests.--> | ||
|
||
## Outcome/Results | ||
|
||
<!-- | ||
Describe the expected outcomes of this change. If applicable, | ||
mention any metrics or KPIs that will be affected. | ||
--> | ||
|
||
## Additional Context: | ||
|
||
<!-- | ||
The following sections are optional. | ||
Feel free to delete them if they do not apply to your PR | ||
--> | ||
|
||
### Motivation | ||
|
||
<!-- Explain why this change is needed and what problem it solves --> | ||
|
||
### Related Issues/Dependencies | ||
|
||
<!-- List any related GitHub issues or dependencies --> | ||
|
||
### Additional Notes | ||
|
||
<!-- Add any other context or screenshots about the pull request here --> |
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,47 @@ | ||
name: Style check | ||
|
||
on: push | ||
|
||
jobs: | ||
style-check: | ||
env: | ||
UV_CACHE_DIR: ${{ github.workspace }}/.cache/uv | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/[email protected] | ||
|
||
- name: Install uv | ||
uses: astral-sh/[email protected] | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: "uv.lock" | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version-file: "pyproject.toml" | ||
|
||
- name: Restore uv cache | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ github.workspace }}/.cache/uv | ||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
restore-keys: | | ||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
uv-${{ runner.os }} | ||
- name: Install dependencies | ||
run: uv sync --all-extras --dev | ||
|
||
- name: Check linting with Ruff | ||
run: uv run ruff check | ||
|
||
- name: Check format with Ruff | ||
run: uv run ruff format --check | ||
|
||
- name: Check docstring coverage | ||
run: uv run docstr-coverage ./**/*.py --fail-under 20 --skip-file-doc --verbose=2 | ||
|
||
- name: Minimize uv cache | ||
run: uv cache prune --ci |
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,49 @@ | ||
name: Test Coverage | ||
|
||
on: push | ||
|
||
jobs: | ||
test-coverage: | ||
env: | ||
UV_CACHE_DIR: ${{ github.workspace }}/.cache/uv | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/[email protected] | ||
|
||
- name: Install uv | ||
uses: astral-sh/[email protected] | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: "uv.lock" | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version-file: "pyproject.toml" | ||
|
||
- name: Restore uv cache | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ github.workspace }}/.cache/uv | ||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
restore-keys: | | ||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
uv-${{ runner.os }} | ||
- name: Install dependencies | ||
run: uv sync --all-extras --dev | ||
|
||
#- name: Pyright typechecking | ||
# uses: jakebailey/[email protected] | ||
# with: | ||
# version: 1.1.370 | ||
# skip-unannotated: true | ||
# level: error | ||
|
||
- name: Run tests and check coverage | ||
run: | | ||
uv run pytest --cov=. --cov-fail-under=0 | ||
- name: Minimize uv cache | ||
run: uv cache prune --ci |
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,27 @@ | ||
# If you make changes to this file, you should run `uv run pre-commit install` to update the hooks | ||
# Remember to update the version of the ruff-pre-commit repo when you update Ruff | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.5.7 | ||
hooks: | ||
- id: ruff | ||
args: [--fix] | ||
- id: ruff-format | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-added-large-files | ||
args: ["--maxkb=5120"] | ||
- id: check-json | ||
- id: check-toml | ||
types: [toml] | ||
- id: check-yaml | ||
types: [yaml] | ||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v1.3.0 | ||
hooks: | ||
- id: detect-secrets | ||
- repo: https://github.com/astral-sh/uv-pre-commit | ||
rev: 0.4.13 | ||
hooks: | ||
- id: uv-lock |
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 @@ | ||
3.12 |
Oops, something went wrong.