Skip to content

Commit

Permalink
pipeline / pipenv: explicitly specify python version to workaround pi…
Browse files Browse the repository at this point in the history
  • Loading branch information
fphammerle committed Jun 18, 2020
1 parent db45a5b commit 3b5ea00
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 84 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/python.yml
@@ -1,5 +1,7 @@
# sync with https://github.com/fphammerle/ical2vdir/blob/master/.github/workflows/python.yml

# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions

# shown in badge
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository
name: tests
Expand All @@ -11,7 +13,24 @@ on:
- cron: '0 20 * * 5'

jobs:
build:
code-format:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version:
- 3.8
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- run: pip install --upgrade pipenv>=2018.10.9
- run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- run: pipenv graph
- run: pipenv run black --check .
tests:
runs-on: ubuntu-18.04
strategy:
matrix:
Expand All @@ -26,20 +45,21 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- run: pip install --upgrade pipenv>=2018.10.9
- run: pipenv install --deploy --dev
- run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
env:
PYTHON_VERSION: ${{ matrix.python-version }}
# ModuleNotFoundError: No module named 'importlib_metadata'
# https://github.com/WanzenBug/pylint-import-requirements/issues/17
- run: if python3 -c 'import sys; sys.exit(sys.version_info < (3, 8))'; then
pipenv graph;
pipenv install --dev importlib-metadata;
fi
- run: pipenv graph
- run: pipenv run pytest --cov=switchbot_mqtt --cov-report=term-missing --cov-fail-under=100
- run: pipenv run pylint --load-plugins=pylint_import_requirements switchbot_mqtt
# https://github.com/PyCQA/pylint/issues/352
- run: pipenv run pylint tests/*
- run: pipenv run mypy switchbot_mqtt tests
- run: pipenv run pytest --cov=switchbot_mqtt --cov-report=term-missing --cov-fail-under=100
- run: pipenv run black --check .
# >=1.9.0 to detect branch name
# https://github.com/coveralls-clients/coveralls-python/pull/207
# https://github.com/coverallsapp/github-action/issues/4#issuecomment-547036866
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
.mypy_cache/
build/
dist/
tags/
14 changes: 13 additions & 1 deletion Pipfile
Expand Up @@ -7,12 +7,24 @@ name = "pypi"
switchbot-mqtt = {editable = true,path = "."}

[dev-packages]
black = "==19.10b0"
# black requires python>=3.6
# https://github.com/psf/black/commit/e74117f172e29e8a980e2c9de929ad50d3769150#diff-2eeaed663bd0d25b7e608891384b7298R51
black = {version = "==19.10b0", markers = "python_version >= '3.6'"}
mypy = "*"
pylint = "*"
pylint-import-requirements = "*"
pytest = "*"
pytest-cov = "*"

# python3.5 compatibility
# https://github.com/jaraco/zipp/commit/05a3c52b4d41690e0471a2e283cffb500dc0329a
zipp = "<2"
# workaround https://github.com/pytest-dev/pytest/issues/3953
pathlib2 = {version = "*", markers="python_version < '3.6'"}

# python3.8 compatibility
# workaround https://github.com/WanzenBug/pylint-import-requirements/issues/17
importlib-metadata = "*"

[requires]
python_version = "3"
169 changes: 90 additions & 79 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b5ea00

Please sign in to comment.