|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + timeout-minutes: 30 |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + os: [macos-latest, ubuntu-latest, windows-latest] |
| 18 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.14t', '3.15.0-alpha.1'] |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + - name: Set up Python ${{ matrix.python-version }} |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: ${{ matrix.python-version }} |
| 26 | + |
| 27 | + - name: Set up uv |
| 28 | + uses: astral-sh/setup-uv@v7 |
| 29 | + with: |
| 30 | + enable-cache: true |
| 31 | + |
| 32 | + - name: Install dependencies |
| 33 | + shell: bash |
| 34 | + run: uv pip install --system -r requirements_dev.txt |
| 35 | + |
| 36 | + - name: Install the library |
| 37 | + shell: bash |
| 38 | + run: uv pip install --system . |
| 39 | + |
| 40 | + - name: Print all libs |
| 41 | + shell: bash |
| 42 | + run: uv pip list --system |
| 43 | + |
| 44 | + - name: Run tests and show the branch coverage on the command line |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + pth_file="$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')/microbenchmark_coverage_process_startup.pth" |
| 48 | + printf "import os; os.getenv('COVERAGE_PROCESS_START') and __import__('coverage').process_startup()\n" > "$pth_file" |
| 49 | + coverage erase |
| 50 | + COVERAGE_PROCESS_START="$PWD/pyproject.toml" coverage run -m pytest -n auto --cache-clear --assert=plain |
| 51 | + coverage combine |
| 52 | + coverage report -m --fail-under=100 --omit='*tests*' |
| 53 | + coverage xml --omit='*tests*' |
| 54 | +
|
| 55 | + - name: Upload coverage to Coveralls |
| 56 | + if: runner.os == 'Linux' && matrix.python-version == '3.13' |
| 57 | + env: |
| 58 | + COVERALLS_REPO_TOKEN: ${{secrets.COVERALLS_REPO_TOKEN}} |
| 59 | + uses: coverallsapp/github-action@v2 |
| 60 | + with: |
| 61 | + format: cobertura |
| 62 | + file: coverage.xml |
| 63 | + flag-name: ubuntu-python-3.13-branch |
| 64 | + continue-on-error: true |
0 commit comments