python.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # sync with https://github.com/fphammerle/ical2vdir/blob/master/.github/workflows/python.yml
  2. # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
  3. # shown in badge
  4. # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository
  5. name: tests
  6. on:
  7. push:
  8. pull_request:
  9. schedule:
  10. - cron: '0 20 * * 5'
  11. jobs:
  12. code-format:
  13. runs-on: ubuntu-20.04
  14. strategy:
  15. matrix:
  16. python-verison: ['3.9']
  17. steps:
  18. - uses: actions/checkout@v2.4.0
  19. - uses: actions/setup-python@v2.3.0
  20. with:
  21. python-version: ${{ matrix.python-version }}
  22. - run: pip install --upgrade pipenv==2020.8.13
  23. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  24. env:
  25. PYTHON_VERSION: ${{ matrix.python-version }}
  26. - run: pipenv graph
  27. - run: pipenv run black --check .
  28. tests:
  29. runs-on: ubuntu-20.04
  30. strategy:
  31. matrix:
  32. python-version:
  33. - '3.6'
  34. - '3.7'
  35. - '3.8'
  36. - '3.9'
  37. pandas-version:
  38. - '' # locked version
  39. - 0.21.*
  40. - 0.22.*
  41. - 0.23.*
  42. - 0.24.*
  43. - 0.25.*
  44. - 1.1.* # pandas.io.common.get_handle does not yet support urls
  45. - 1.*
  46. exclude:
  47. - python-version: '3.7'
  48. pandas-version: 0.21.*
  49. - python-version: '3.7'
  50. pandas-version: 0.22.*
  51. # > /tmp/pip-install-g4jx0np4/numpy/_configtest.c:6: undefined reference to `exp'
  52. # https://travis-ci.org/github/fphammerle/freesurfer-stats/jobs/683704331#L437
  53. - python-version: '3.8'
  54. pandas-version: 0.21.*
  55. # https://travis-ci.org/github/fphammerle/freesurfer-stats/jobs/683704330#L437
  56. - python-version: '3.8'
  57. pandas-version: 0.22.*
  58. # no python-version3.8 wheels for pandas v0.24.2 & v0.23.4 available
  59. # https://travis-ci.org/github/fphammerle/freesurfer-stats/builds/701952350
  60. # build takes longer than 10min
  61. # https://travis-ci.org/github/fphammerle/freesurfer-stats/jobs/702077404#L199
  62. - python-version: '3.8'
  63. pandas-version: 0.23.*
  64. - python-version: '3.8'
  65. pandas-version: 0.24.*
  66. - python-version: '3.9'
  67. pandas-version: 0.21.*
  68. - python-version: '3.9'
  69. pandas-version: 0.22.*
  70. - python-version: '3.9'
  71. pandas-version: 0.23.*
  72. - python-version: '3.9'
  73. pandas-version: 0.24.*
  74. - python-version: '3.9'
  75. pandas-version: 0.25.* # no wheel available
  76. fail-fast: false
  77. steps:
  78. - uses: actions/checkout@v2.4.0
  79. - uses: actions/setup-python@v2.3.0
  80. with:
  81. python-version: ${{ matrix.python-version }}
  82. - run: pip install --upgrade pipenv==2020.8.13
  83. # by default pipenv picks the latest version in PATH
  84. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  85. env:
  86. PYTHON_VERSION: ${{ matrix.python-version }}
  87. # `pipenv install --selective-upgrade "pandas==$PANDAS_VERSION"` was not effective
  88. - run: '[ -z "$PANDAS_VERSION" ] || pipenv run pip install "pandas==$PANDAS_VERSION"'
  89. env:
  90. PANDAS_VERSION: ${{ matrix.pandas-version }}
  91. - run: pipenv graph
  92. - run: pipenv run pytest --cov="$(cat *.egg-info/top_level.txt)" --cov-report=term-missing --cov-fail-under=100
  93. - run: pipenv run pylint --load-plugins=pylint_import_requirements "$(cat *.egg-info/top_level.txt)"
  94. # https://github.com/PyCQA/pylint/issues/352
  95. # disable parse-error due to:
  96. # > tests/resources/__init__.py:1:0: F0010: error while code parsing: Unable to load file tests/resources/__init__.py:
  97. # > [Errno 2] No such file or directory: 'tests/resources/__init__.py' (parse-error)
  98. - run: pipenv run pylint --disable=parse-error tests/*
  99. - run: pipenv run mypy "$(cat *.egg-info/top_level.txt)" tests
  100. # >=2.1.0 to support GITHUB_TOKEN
  101. # COVERALLS_REPO_TOKEN required manual configuration of secret
  102. # https://github.com/TheKevJames/coveralls-python/commit/f597109b62fadaf900af79d4f08a7debee5229e2
  103. - run: pip install 'coveralls>=2.1.0,<4'
  104. - run: coveralls
  105. env:
  106. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  107. # https://github.com/TheKevJames/coveralls-python/issues/240#issuecomment-758336355
  108. COVERALLS_SERVICE_NAME: github