Skip to content

Commit efb5571

Browse files
authored
Merge pull request #3 from popyson1648/chore/setup-ci-and-pre-commit
Add CI and pre-commit hooks
2 parents ced7ce3 + 9a454ce commit efb5571

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e .[dev]
28+
29+
- name: Lint and Format Check with ruff
30+
run: |
31+
ruff check .
32+
ruff format --check .
33+
34+
- name: Test with pytest
35+
run: |
36+
pytest

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.6.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
rev: v0.5.5
13+
hooks:
14+
- id: ruff
15+
args: [--fix, --exit-non-zero-on-fix]
16+
- id: ruff-format

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ dev = [
3636
"pytest",
3737
"pytest-mock",
3838
"pytest-cov",
39+
"pre-commit",
3940
]
4041

4142
[project.scripts]

0 commit comments

Comments
 (0)