intitial testing support for SchemaPin.org #78
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 | |
- master | |
pull_request: | |
branches: | |
- main | |
- master | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/uv | |
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-python-${{ matrix.python-version }}- | |
${{ runner.os }}-python- | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
- name: Install dependencies | |
run: | | |
uv pip install --system -e ".[dev]" | |
- name: Lint with ruff | |
run: | | |
ruff check src/ tests/ --fix || true | |
ruff format src/ tests/ || true | |
ruff format --check src/ tests/ || true | |
- name: Type check with mypy | |
run: | | |
mypy src/ || true | |
- name: Run unit tests | |
run: | | |
pytest tests/unit/ -v --cov=src/mockloop_mcp --cov-report=xml --cov-report=term-missing | |
- name: Run integration tests | |
run: | | |
pytest tests/integration/ -v --cov=src/mockloop_mcp --cov-append --cov-report=xml --cov-report=term-missing | |
- name: Upload coverage to Codecov | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
token: ${{ secrets.CODECOV_TOKEN }} | |
security: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install dependencies | |
run: | | |
uv pip install --system -e ".[dev]" | |
- name: Run security checks with bandit | |
run: | | |
python -m bandit -r src/ -f json -o bandit-report.json || true | |
python -m bandit -r src/ | |
- name: Run safety checks | |
run: | | |
safety check --json --output safety-report.json || true | |
safety check | |
test-summary: | |
runs-on: ubuntu-latest | |
needs: [test, security] | |
if: always() | |
steps: | |
- name: Test Summary | |
run: | | |
echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY | |
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY | |
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY | |
echo "| Tests | ${{ needs.test.result }} |" >> $GITHUB_STEP_SUMMARY | |
echo "| Security | ${{ needs.security.result }} |" >> $GITHUB_STEP_SUMMARY | |
if [[ "${{ needs.test.result }}" == "success" && "${{ needs.security.result }}" == "success" ]]; then | |
echo "✅ All tests passed!" >> $GITHUB_STEP_SUMMARY | |
else | |
echo "❌ Some tests failed. Please check the logs above." >> $GITHUB_STEP_SUMMARY | |
fi |