tests.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: Tests
  2. on: [push, pull_request]
  3. jobs:
  4. unit-test:
  5. runs-on: ${{ matrix.os }}
  6. strategy:
  7. fail-fast: false
  8. matrix:
  9. python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy-3.8']
  10. os: [ubuntu-latest, macos-latest, windows-latest]
  11. exclude:
  12. - os: macos-latest
  13. python-version: "pypy3"
  14. - os: windows-latest
  15. python-version: "pypy3"
  16. - os: windows-latest
  17. python-version: 3.6
  18. timeout-minutes: 20
  19. steps:
  20. - uses: actions/checkout@v2
  21. - name: Setup Python ${{ matrix.python-version }}
  22. uses: actions/setup-python@v2
  23. with:
  24. python-version: ${{ matrix.python-version }}
  25. - name: Install pip
  26. run: python -m pip install --upgrade --disable-pip-version-check "pip>=21.1"
  27. - name: Get pip cache dir
  28. id: pip-cache
  29. run: echo "::set-output name=dir::$(pip cache dir)"
  30. - name: Cache pip
  31. uses: actions/cache@v2
  32. with:
  33. path: |
  34. ${{ steps.pip-cache.outputs.dir }}
  35. ./.tox
  36. key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('setup.py', '**/requirements.txt') }}
  37. restore-keys: |
  38. ${{ matrix.os }}-${{ matrix.python-version }}-pip-
  39. - name: Install dependencies
  40. run: make setup-ci
  41. - name: Run tests
  42. run: tox -e cov
  43. env:
  44. PYTEST_DISCORD_WEBHOOK: ${{ secrets.PYTEST_DISCORD_WEBHOOK }}
  45. - name: Upload coverage report
  46. if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
  47. run: |
  48. python -m pip install --upgrade --disable-pip-version-check coveralls tomli
  49. coveralls --service=github
  50. env:
  51. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}