Add GitHub workflow for automated PR checks #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Checks | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
# Allow manual triggering for testing | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test, Lint and Type Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.13 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
allow-prereleases: true | |
- name: Install UV | |
run: | | |
pip install uv | |
uv --version | |
- name: Setup environment | |
run: | | |
# Create virtual environment | |
uv venv -p python3.13 .venv | |
# Install development dependencies | |
uv pip install -e ".[dev]" | |
- name: Run unit tests | |
run: uv run pytest -m unit -v | |
- name: Run integration tests | |
run: uv run pytest -m integration -v | |
- name: Run linting | |
run: uv run ruff check . | |
- name: Run formatting check | |
run: uv run black --check . | |
- name: Run type checking | |
run: uv run mypy src | |
- name: Run all tests with coverage | |
run: uv run pytest --cov=src --cov-report=xml | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
fail_ci_if_error: false | |
container: | |
name: Container Tests | |
runs-on: ubuntu-latest | |
needs: test # Only run container tests if unit and integration tests pass | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.13 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
allow-prereleases: true | |
- name: Install UV | |
run: | | |
pip install uv | |
uv --version | |
- name: Setup environment | |
run: | | |
# Create virtual environment | |
uv venv -p python3.13 .venv | |
# Install development dependencies | |
uv pip install -e ".[dev]" | |
- name: Check Podman version | |
run: podman --version | |
- name: Set file permissions | |
run: | | |
chmod +x scripts/build.sh | |
chmod +x scripts/run.sh | |
chmod +x scripts/run_tests.sh | |
chmod +x scripts/setup_env.sh | |
- name: Create .containerignore if needed | |
run: | | |
if [ ! -f .containerignore ]; then | |
echo "# Created during test run" > .containerignore | |
echo "venv/" >> .containerignore | |
echo "__pycache__/" >> .containerignore | |
echo "*.pyc" >> .containerignore | |
cat .containerignore | |
fi | |
- name: Run container tests | |
run: uv run pytest tests/e2e/test_podman.py -v | |
- name: Run container build test | |
run: uv run pytest tests/e2e/test_container.py::test_containerfile_exists tests/e2e/test_container.py::test_container_build -v | |
e2e: | |
name: Other E2E Tests | |
runs-on: ubuntu-latest | |
needs: test # Only run E2E tests if unit and integration tests pass | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.13 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
allow-prereleases: true | |
- name: Install UV | |
run: | | |
pip install uv | |
uv --version | |
- name: Setup environment | |
run: | | |
# Create virtual environment | |
uv venv -p python3.13 .venv | |
# Install development dependencies | |
uv pip install -e ".[dev]" | |
- name: Run E2E tests (excluding container tests) | |
run: uv run pytest -m "e2e and not container" -v |