-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cicd: add basic precommit hooks (#454)
* Add precommit + some minimally controversial hooks. Add a note in README. * Run hooks over existing codebase. There's a few instances of trailing whitespace and incorrect line endings. * Run checks in CI
- Loading branch information
1 parent
4e65955
commit 213b3aa
Showing
13 changed files
with
58 additions
and
35 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 |
---|---|---|
|
@@ -24,7 +24,7 @@ jobs: | |
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | ||
key: ${{ runner.os }}-pip-test-${{ hashFiles('pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Set up Python ${{ matrix.python-version }} | ||
|
@@ -40,3 +40,10 @@ jobs: | |
- name: Test with pytest | ||
run: | | ||
python -m pytest | ||
precommit_hooks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: pre-commit/[email protected] |
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 |
---|---|---|
|
@@ -23,4 +23,4 @@ lint | |
uta_*.pgd.gz | ||
.vscode | ||
*.log | ||
.idea | ||
.idea |
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,14 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: detect-private-key | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-merge-conflict | ||
- id: detect-aws-credentials | ||
args: [ --allow-missing-credentials ] | ||
- id: mixed-line-ending | ||
args: [ --fix=lf ] | ||
minimum_pre_commit_version: 4.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 |
---|---|---|
|
@@ -192,7 +192,7 @@ This section is intended for developers who contribute to VRS-Python. | |
|
||
### Installing for development | ||
|
||
Fork the repo at <https://github.com/ga4gh/vrs-python/>. | ||
Fork the repo at <https://github.com/ga4gh/vrs-python/> and initialize a development environment. | ||
|
||
```shell | ||
git clone --recurse-submodules [email protected]:YOUR_GITHUB_ID/vrs-python.git | ||
|
@@ -201,6 +201,13 @@ make devready | |
source venv/3.12/bin/activate | ||
``` | ||
|
||
This setup includes [pre-commit hooks](https://pre-commit.com/). If you create a virtual environment manually, be sure to install the hooks yourself; otherwise, commits may fail during [CI/CD checks](https://github.com/ga4gh/vrs-python/actions/workflows/python-cqa.yml): | ||
|
||
```shell | ||
source venv/3.12/bin/activate | ||
pre-commit install | ||
``` | ||
|
||
If you already cloned the repo, but forgot to include `--recurse-submodules` you can run: | ||
|
||
```shell | ||
|
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 |
---|---|---|
|
@@ -46,4 +46,4 @@ export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig:/opt/homebre | |
14. Run the make devready command: | ||
1. `make devready` | ||
15. Run the make test command: | ||
1. `make test` | ||
1. `make test` |
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
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 |
---|---|---|
|
@@ -58,6 +58,7 @@ dev = [ | |
"vcrpy", | ||
"pyyaml", | ||
# style | ||
"pre-commit>=4.0.1", | ||
"pylint", | ||
"yapf", | ||
# docs | ||
|
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
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,4 +1,3 @@ | ||
This directory contains submodules required by vrs-python. If you | ||
don't see a vrs directory here, please reread instructions at | ||
https://github.com/ga4gh/vrs-python#installing-for-development. | ||
|
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