Skip to content

test: add unit tests for operator pure functions and validation logic #12

test: add unit tests for operator pure functions and validation logic

test: add unit tests for operator pure functions and validation logic #12

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install kopf kubernetes pyyaml
- name: Python syntax check
run: python -m py_compile operator/main.py
- name: Helm lint
run: |
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm lint helm-charts/tinycode/
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate CRD YAML
run: python -c "import yaml; yaml.safe_load(open('config/crd/tinycode.dev_tinycodeinstances.yaml'))"
- name: Validate sample CRs
run: |
for f in config/samples/*.yaml; do
echo "Validating $f..."
python -c "import yaml; list(yaml.safe_load_all(open('$f')))"
done
- name: Validate bundle
run: |
for f in bundle/manifests/*.yaml; do
echo "Validating $f..."
python -c "import yaml; list(yaml.safe_load_all(open('$f')))"
done
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install kopf kubernetes pyyaml pytest
- name: Run tests
run: pytest operator/ -v