Skip to content

Add comprehensive testing documentation for shell scripts and Python … #113

Add comprehensive testing documentation for shell scripts and Python …

Add comprehensive testing documentation for shell scripts and Python … #113

Workflow file for this run

name: 🧪 Test Suite
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
test:
name: "🧪 Test (${{ matrix.python-version }})"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
fail-fast: false
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: 🔧 Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: 🔍 Check dependencies
run: |
python scripts/test.py check
- name: 🧪 Run unit tests
run: |
python scripts/test.py unit
- name: 🔗 Run integration tests
run: |
python scripts/test.py integration
- name: 📊 Generate coverage report
run: |
python scripts/test.py coverage
- name: 📤 Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: 📄 Upload coverage reports
uses: actions/upload-artifact@v3
with:
name: coverage-report-${{ matrix.python-version }}
path: htmlcov/
- name: 📋 Upload test reports
uses: actions/upload-artifact@v3
if: always()
with:
name: test-reports-${{ matrix.python-version }}
path: tests/reports/
lint:
name: "🔍 Code Quality"
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
pip install bandit black isort flake8
- name: 🔒 Security check with bandit
run: |
bandit -r registry/ -f json -o bandit-report.json || true
- name: 📋 Upload security report
uses: actions/upload-artifact@v3
if: always()
with:
name: security-report
path: bandit-report.json
domain-tests:
name: "🏗️ Domain Tests"
runs-on: ubuntu-latest
strategy:
matrix:
domain: [auth, servers, search, health, core]
fail-fast: false
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: 🏗️ Test ${{ matrix.domain }} domain
run: |
python scripts/test.py ${{ matrix.domain }}
fast-feedback:
name: "⚡ Fast Feedback"
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: ⚡ Run fast tests
run: |
python scripts/test.py fast
summary:
name: "📋 Test Summary"
runs-on: ubuntu-latest
needs: [test, lint, domain-tests]
if: always()
steps:
- name: 📋 Test Results Summary
run: |
echo "## 🧪 Test Results Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Main Tests | ${{ needs.test.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Code Quality | ${{ needs.lint.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Domain Tests | ${{ needs.domain-tests.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.test.result }}" == "success" && "${{ needs.lint.result }}" == "success" && "${{ needs.domain-tests.result }}" == "success" ]]; then
echo "✅ All tests passed! 🎉" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Some tests failed. Please check the logs." >> $GITHUB_STEP_SUMMARY
fi