Skip to content

Commit 7459411

Browse files
authored
ci: add github actions workflows for unit tests and pre-commit (#10)
1 parent ec0476a commit 7459411

5 files changed

Lines changed: 254 additions & 3 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Pre-commit
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v4
17+
18+
- name: Set up Python
19+
run: uv python install 3.12
20+
21+
- name: Install dependencies
22+
run: uv sync --extra dev
23+
24+
- name: Run pre-commit
25+
run: uv run pre-commit run --all-files

.github/workflows/unit-tests.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v4
17+
18+
- name: Set up Python
19+
run: uv python install 3.12
20+
21+
- name: Install dependencies
22+
run: uv sync --extra dev
23+
24+
- name: Run tests
25+
run: uv run pytest tests/ -v
26+
env:
27+
AWS_DEFAULT_REGION: us-west-2

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ repos:
1313
- id: ruff
1414
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
1515
- id: ruff-format
16+
17+
- repo: https://github.com/commitizen-tools/commitizen
18+
rev: v4.1.0
19+
hooks:
20+
- id: commitizen
21+
stages: [commit-msg]

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ source .venv/bin/activate
3737
# Install with development dependencies
3838
uv sync --frozen --extra dev
3939

40-
# Install pre-commit hooks
41-
pre-commit install
40+
# Install pre-commit hooks (linting, formatting, and commit message validation)
41+
pre-commit install --install-hooks -t pre-commit -t commit-msg
4242
```
4343

4444
## Contributing via Pull Requests

0 commit comments

Comments
 (0)