Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

39 pre commit hook #46

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/branch-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# checks to run on branches for each pull request
name: branch-checks

on:
pull_request:

jobs:
pre-commit:
name: Run all pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1
# For feature branches, we don't test the full matrix (os x [stable, loose]) in order to save time & resources.
run-tests-loose:
name: Test loose pip installation on ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
uses: ./.github/workflows/_run_tests.yml
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
install-script: "loose_pip_install.sh"
3 changes: 1 addition & 2 deletions .github/workflows/pip_installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
push:
branches: [ main, development ]
pull_request:
branches: [ main, development ]
branches: [ main ]
workflow_dispatch:

name: Pip installation and tests
Expand All @@ -29,7 +29,6 @@ jobs:

loose_installation:
name: Test loose pip installation on ${{ matrix.os }}
# runs-on: ${{ matrix.os }} # `runs-on` conflicts with `uses`, see https://github.com/orgs/community/discussions/62320
strategy:
matrix:
# macos-latest is now arm64, which cannot install mono
Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.0
hooks:
- id: ruff-format
# - id: ruff
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@ For an even more interactive participation, check out the
[discussions](https://github.com/MannLabs/alpharaw/discussions) and the
[the Contributors License Agreement](misc/CLA.md).

### Notes for developers
#### pre-commit hooks
It is highly recommended to use the provided pre-commit hooks, as the CI pipeline enforces all checks therein to
pass in order to merge a branch.

The hooks need to be installed once by
```bash
pre-commit install
```
You can run the checks yourself using:
```bash
pre-commit run --all-files
```
------------------------------------------------------------------------

## Changelog
Expand Down
2 changes: 2 additions & 0 deletions extra_requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ furo

alphabase>=1.1.0
alphatims

pre-commit==3.7.0
Loading