|
| 1 | +name: Pytest (Ubuntu & Windows) |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ main ] |
| 5 | + pull_request: |
| 6 | +jobs: |
| 7 | + tests: |
| 8 | + name: pytest - ${{ matrix.os }} - py${{ matrix.python-version }} |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + os: [ ubuntu-latest, windows-latest ] |
| 14 | + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] |
| 15 | + env: |
| 16 | + PYTHONUTF8: "1" |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v4 |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + cache: "pip" |
| 26 | + - name: Install dependencies (Ubuntu) |
| 27 | + if: matrix.os == 'ubuntu-latest' |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + set -eux |
| 31 | + python -m pip install -U pip |
| 32 | + pip install -r service/requirements.txt |
| 33 | + pip install -r service/requirements.test.txt |
| 34 | + pip install pytest coverage |
| 35 | + - name: Install dependencies (Windows) |
| 36 | + if: matrix.os == 'windows-latest' |
| 37 | + shell: pwsh |
| 38 | + run: | |
| 39 | + $ErrorActionPreference = "Stop" |
| 40 | + python -m pip install -U pip |
| 41 | + pip install pytest coverage |
| 42 | + - name: Show versions |
| 43 | + run: | |
| 44 | + python --version |
| 45 | + pip --version |
| 46 | + pytest --version |
| 47 | + python -c "import sys,platform;print(platform.platform());print(sys.version)" |
| 48 | + shell: bash |
| 49 | + - name: Run tests with coverage |
| 50 | + run: | |
| 51 | + python -m coverage run -m pytest -q |
| 52 | + python -m coverage xml -o coverage.xml |
| 53 | + shell: bash |
| 54 | + - name: Upload coverage.xml |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: coverage-${{ matrix.os }}-py${{ matrix.python-version }} |
| 58 | + path: coverage.xml |
| 59 | + if-no-files-found: error |
0 commit comments