Skip to content
Closed
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
56 changes: 53 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,96 @@ on:
push:
branches:
- main
pull_request:
branches:
- "**"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
lint-and-test:
env:
UV_CACHE_DIR: /tmp/.uv-cache
runs-on: ubuntu-24.04
steps:
- name: Checkout source code
uses: actions/checkout@v6

- name: Set up python
id: setup-python
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
version-file: "pyproject.toml"

- name: Install dependencies
run: uv sync --all-extras --dev --frozen
- name: Test with pytest

- name: Run ruff lint
run: uv run ruff check src tests

- name: Run ruff format check
run: uv run ruff format --check src tests

- name: Run mypy type check
run: uv run mypy src tests

- name: Run bandit security check
run: uv run bandit -r src

- name: Run pytest with coverage
run: uv run pytest tests --cov=src

- name: Minimize uv cache
run: uv cache prune --ci

build:
needs: lint-and-test
env:
UV_CACHE_DIR: /tmp/.uv-cache
runs-on: ubuntu-24.04
steps:
- name: Checkout source code
uses: actions/checkout@v6

- name: Set up python
id: setup-python
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
version-file: "pyproject.toml"

- name: Install dependencies
run: uv sync --all-extras --dev --frozen

- name: Build a wheel
run: uv build

- name: Minimize uv cache
run: uv cache prune --ci

build-image:
needs: lint-and-test
runs-on: ubuntu-24.04

steps:
- name: Checkout source code
uses: actions/checkout@v6

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build docker image
uses: docker/build-push-action@v6
with:
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/pr.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
ci:
skip: [pytest]

default_language_version:
python: python3.14

Expand Down
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,79 @@ TOTAL 7 2 71%

---

## Validation

To ensure all configurations are working correctly, you can run the following checks:

### Linting and Formatting

**Run ruff lint check:**
```bash
uv run ruff check src tests
```

**Run ruff format check:**
```bash
uv run ruff format --check src tests
```

**Run ruff format (to fix formatting issues):**
```bash
uv run ruff format src tests
```

### Type Checking

**Run mypy type check:**
```bash
uv run mypy src tests
```

### Security Checking

**Run bandit security check:**
```bash
uv run bandit -r src
```

### Testing

**Run pytest:**
```bash
uv run pytest tests
```

**Run pytest with coverage:**
```bash
uv run pytest tests --cov=src
```

### Pre-commit Hooks

**Run all pre-commit hooks:**
```bash
pre-commit run --all-files
```

### Docker

**Build production image:**
```bash
docker build . -t my-python-application:latest
```

**Build development image:**
```bash
docker build . --target development -t my-python-application:dev
```

**Run the application:**
```bash
docker run -it --rm my-python-application:latest
```

---

## Docker

### Build
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dev = [
]

[tool.uv]
required-version = ">=0.9.30"
required-version = "==0.10.3"

[tool.pytest.ini_options]
addopts = "-vvv"
Expand Down
Loading