|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop, feature/* ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, develop ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 16 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up Python ${{ matrix.python-version }} |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: ${{ matrix.python-version }} |
| 26 | + cache: 'pip' |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: | |
| 30 | + python -m pip install --upgrade pip |
| 31 | + pip install -e ".[dev]" |
| 32 | +
|
| 33 | + - name: Lint with flake8 |
| 34 | + run: | |
| 35 | + flake8 perplexity perplexity_async --count --select=E9,F63,F7,F82 --show-source --statistics |
| 36 | + flake8 perplexity perplexity_async --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 37 | +
|
| 38 | + - name: Check formatting with black |
| 39 | + run: | |
| 40 | + black --check perplexity perplexity_async |
| 41 | +
|
| 42 | + - name: Type check with mypy |
| 43 | + run: | |
| 44 | + mypy perplexity perplexity_async |
| 45 | +
|
| 46 | + - name: Run tests with pytest |
| 47 | + run: | |
| 48 | + pytest tests/ -v --cov=perplexity --cov=perplexity_async --cov-report=xml --cov-report=term |
| 49 | +
|
| 50 | + - name: Upload coverage to Codecov |
| 51 | + uses: codecov/codecov-action@v4 |
| 52 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' |
| 53 | + with: |
| 54 | + file: ./coverage.xml |
| 55 | + flags: unittests |
| 56 | + name: codecov-umbrella |
| 57 | + fail_ci_if_error: false |
0 commit comments