Fix health check ping fallback and implement healthy-auth-expired sta⦠#109
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: π§ͺ 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 |