python.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # sync with https://github.com/fphammerle/ical2vdir/blob/master/.github/workflows/python.yml
  2. # shown in badge
  3. # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository
  4. name: tests
  5. on:
  6. push:
  7. pull_request:
  8. schedule:
  9. - cron: '0 20 * * 5'
  10. jobs:
  11. build:
  12. runs-on: ubuntu-18.04
  13. strategy:
  14. matrix:
  15. python-version:
  16. - 3.5
  17. - 3.6
  18. - 3.7
  19. - 3.8
  20. steps:
  21. - uses: actions/checkout@v1
  22. - uses: actions/setup-python@v1
  23. with:
  24. python-version: ${{ matrix.python-version }}
  25. - run: pip install --upgrade pipenv>=2018.10.9
  26. - run: pipenv install --deploy --dev
  27. # ModuleNotFoundError: No module named 'importlib_metadata'
  28. # https://github.com/WanzenBug/pylint-import-requirements/issues/17
  29. - run: if python3 -c 'import sys; sys.exit(sys.version_info < (3, 8))'; then
  30. pipenv graph;
  31. pipenv install --dev importlib-metadata;
  32. fi
  33. - run: pipenv graph
  34. - run: pipenv run pylint --load-plugins=pylint_import_requirements switchbot_mqtt
  35. # https://github.com/PyCQA/pylint/issues/352
  36. - run: pipenv run pylint tests/*
  37. - run: pipenv run mypy switchbot_mqtt tests
  38. - run: pipenv run pytest --cov=switchbot_mqtt --cov-report=term-missing --cov-fail-under=100
  39. - run: pipenv run black --check .
  40. # >=1.9.0 to detect branch name
  41. # https://github.com/coveralls-clients/coveralls-python/pull/207
  42. # https://github.com/coverallsapp/github-action/issues/4#issuecomment-547036866
  43. # 1.11.0 https://github.com/coveralls-clients/coveralls-python/issues/219
  44. - run: pip install 'coveralls>=1.9.0,<2,!=1.11.0'
  45. # https://github.com/coverallsapp/github-action/issues/30
  46. # https://github.com/coverallsapp/github-action/issues/4#issuecomment-529399410
  47. - run: coveralls
  48. env:
  49. COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}