adding examples #1
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: Tests | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Lint with ruff | |
| run: | | |
| pip install ruff | |
| ruff check src/ tests/ | |
| continue-on-error: true | |
| - name: Format check with black | |
| run: | | |
| pip install black | |
| black --check src/ tests/ | |
| continue-on-error: true | |
| - name: Type check with mypy | |
| run: | | |
| pip install mypy | |
| mypy src/testiq --ignore-missing-imports | |
| continue-on-error: true | |
| - name: Run tests with pytest | |
| run: | | |
| pytest tests/ -v --cov=src/testiq --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-${{ matrix.os }}-py${{ matrix.python-version }} | |
| fail_ci_if_error: false | |
| quality-gate: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install TestIQ | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| - name: Run tests with coverage | |
| run: | | |
| pip install pytest pytest-cov | |
| pytest --cov --cov-report=json | |
| - name: Analyze test quality | |
| run: | | |
| testiq analyze coverage.json \ | |
| --quality-gate \ | |
| --max-duplicates 10 \ | |
| --max-duplicate-percentage 5.0 \ | |
| --save-baseline ci-baseline | |
| - name: Generate HTML report | |
| run: | | |
| testiq analyze coverage.json --format html --output report.html | |
| continue-on-error: true | |
| - name: Upload TestIQ report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: testiq-report | |
| path: report.html | |
| if: always() | |
| - name: Quality score check | |
| run: | | |
| testiq quality-score coverage.json --output quality-report.json | |
| continue-on-error: true |