Skip to content

Install sbctl binary in CI workflow for integration tests #6

Install sbctl binary in CI workflow for integration tests

Install sbctl binary in CI workflow for integration tests #6

Workflow file for this run

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: Install sbctl
run: |
curl -L -o sbctl.tar.gz "https://github.com/replicatedhq/sbctl/releases/latest/download/sbctl_linux_amd64.tar.gz"
tar xzf sbctl.tar.gz
chmod +x sbctl
sudo mv sbctl /usr/local/bin/
sbctl --version || echo "sbctl installed but version command not available"
- 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