Skip to content
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
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on:
push:
branches: [ main, phase-1-foundation ]
pull_request:
branches: [ main ]

jobs:
lint-and-test:
name: Lint and Test
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Check code formatting with Black
run: |
black --check --diff stackbox/ tests/

- name: Lint with Ruff
run: |
ruff check stackbox/ tests/

- name: Type check with Mypy
run: |
mypy stackbox/core/compose.py

- name: Run unit tests
run: |
pytest tests/unit/ -v --cov=stackbox --cov-report=term-missing --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12'
with:
file: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

- name: Check coverage threshold
run: |
coverage report --fail-under=80

docker-integration-test:
name: Docker Integration Tests
runs-on: ubuntu-latest
needs: lint-and-test

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

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

- name: Check Docker is running
run: |
docker --version
docker-compose --version
docker ps

- name: Run integration tests
run: |
pytest tests/integration/ -v -m docker --tb=short || echo "Integration tests require full Docker setup"
55 changes: 55 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Pre-commit Checks

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
pre-commit:
name: Code Quality Checks
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff mypy types-pyyaml types-requests

- name: Black - Code Formatting
run: |
echo "::group::Black Formatting Check"
black --check --diff stackbox/ tests/
echo "::endgroup::"

- name: Ruff - Linting
run: |
echo "::group::Ruff Linting"
ruff check stackbox/ tests/
echo "::endgroup::"

- name: Mypy - Type Checking
run: |
echo "::group::Mypy Type Checking"
mypy stackbox/core/compose.py
echo "::endgroup::"

- name: Comment on PR if checks fail
if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ **Code quality checks failed!**\n\nPlease run the following commands locally to fix:\n```bash\nblack stackbox/ tests/\nruff check --fix stackbox/ tests/\nmypy stackbox/core/compose.py\n```'
})
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ dependencies = [
"jinja2>=3.1.0",
]

# CLI entry points
[project.scripts]
sb = "stackbox.cli.__main__:main"

[tool.setuptools.dynamic]
version = {attr = "stackbox.__version__"}

Expand Down
5 changes: 5 additions & 0 deletions stackbox/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""StackBox CLI package."""

from stackbox.cli.__main__ import cli, main

__all__ = ["cli", "main"]
Loading
Loading