Config CircleCI workflow (#22590)

* Add mypyrc to control typing check, add mypy to circle

* Add translation upload circlci job
This commit is contained in:
Jason Hu 2019-04-01 07:12:59 -07:00 committed by GitHub
parent 6829ecad9d
commit de4d1f2c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 66 additions and 13 deletions

View File

@ -52,7 +52,7 @@ commands:
command: | command: |
python3 -m venv venv python3 -m venv venv
. venv/bin/activate . venv/bin/activate
pip install -U pip pip install -q -U pip
<<# parameters.all >>pip install -q --progress-bar off -r requirements_all.txt -c homeassistant/package_constraints.txt<</ parameters.all>> <<# parameters.all >>pip install -q --progress-bar off -r requirements_all.txt -c homeassistant/package_constraints.txt<</ parameters.all>>
<<# parameters.test >>pip install -q --progress-bar off -r requirements_test.txt -c homeassistant/package_constraints.txt<</ parameters.test>> <<# parameters.test >>pip install -q --progress-bar off -r requirements_test.txt -c homeassistant/package_constraints.txt<</ parameters.test>>
<<# parameters.test_all >>pip install -q --progress-bar off -r requirements_test_all.txt -c homeassistant/package_constraints.txt<</ parameters.test_all>> <<# parameters.test_all >>pip install -q --progress-bar off -r requirements_test_all.txt -c homeassistant/package_constraints.txt<</ parameters.test_all>>
@ -68,28 +68,35 @@ commands:
name: install name: install
command: | command: |
. venv/bin/activate . venv/bin/activate
pip install --progress-bar off -e . pip install -q --progress-bar off -e .
jobs: jobs:
static-check: static-check:
executor: executor:
name: python name: python
tag: 3.7-stretch tag: 3.5.5-stretch
steps: steps:
- checkout - checkout
- docker-prereqs - docker-prereqs
- install-requirements:
python: 3.5.5-stretch
test: true
- run: - run:
name: run static check name: run static check
command: | command: |
python3 -m venv venv
. venv/bin/activate . venv/bin/activate
pip install -U pip
pip install --progress-bar off flake8
flake8 flake8
- run:
name: run static type check
command: |
. venv/bin/activate
TYPING_FILES=$(cat mypyrc)
mypy $TYPING_FILES
- install - install
- run: - run:
name: run gen_requirements_all name: run gen_requirements_all
@ -114,7 +121,7 @@ jobs:
executor: executor:
name: python name: python
tag: 3.7-stretch tag: 3.7-stretch
parallelism: 3 parallelism: 2
steps: steps:
- checkout - checkout
@ -154,7 +161,7 @@ jobs:
executor: executor:
name: python name: python
tag: << parameters.python >> tag: << parameters.python >>
parallelism: 3 parallelism: 2
steps: steps:
- checkout - checkout
@ -172,7 +179,6 @@ jobs:
if [ -z "$CODE_COVERAGE" ]; then CC_SWITCH=""; else CC_SWITCH="--cov --cov-report html:htmlcov"; fi if [ -z "$CODE_COVERAGE" ]; then CC_SWITCH=""; else CC_SWITCH="--cov --cov-report html:htmlcov"; fi
pytest --timeout=9 --duration=10 --junitxml=test-reports/homeassistant/results.xml -qq -o junit_family=xunit2 -o junit_suite_name=homeassistant -o console_output_style=count -p no:sugar $CC_SWITCH -- ${TESTFILES} pytest --timeout=9 --duration=10 --junitxml=test-reports/homeassistant/results.xml -qq -o junit_family=xunit2 -o junit_suite_name=homeassistant -o console_output_style=count -p no:sugar $CC_SWITCH -- ${TESTFILES}
script/check_dirty script/check_dirty
when: always
- store_test_results: - store_test_results:
path: test-reports path: test-reports
@ -185,6 +191,23 @@ jobs:
path: test-reports path: test-reports
destination: test-reports destination: test-reports
# This job use machine executor, e.g. classic CircleCI VM because we need both lokalise-cli and a Python runtime.
# Classic CircleCI included python 2.7.12 and python 3.5.2 managed by pyenv, the Python version may need change if
# CircleCI changed its VM in future.
upload-translations:
machine: true
steps:
- checkout
- run:
name: upload english translations
command: |
pyenv versions
pyenv global 3.5.2
docker pull lokalise/lokalise-cli@sha256:2198814ebddfda56ee041a4b427521757dd57f75415ea9693696a64c550cef21
script/translations_upload
workflows: workflows:
version: 2 version: 2
build: build:
@ -222,3 +245,9 @@ workflows:
# - test: # - test:
# name: test 3.8 # name: test 3.8
# python: 3.8-rc-stretch # python: 3.8-rc-stretch
- upload-translations:
requires:
- static-check
filters:
branches:
only: dev

View File

@ -1,4 +1,4 @@
Home Assistant |Build Status| |Coverage Status| |Chat Status| Home Assistant |Build Status| |CI Status| |Coverage Status| |Chat Status|
================================================================================= =================================================================================
Home Assistant is a home automation platform running on Python 3. It is able to track and control all devices at home and offer a platform for automating control. Home Assistant is a home automation platform running on Python 3. It is able to track and control all devices at home and offer a platform for automating control.
@ -27,8 +27,10 @@ components <https://developers.home-assistant.io/docs/en/creating_component_inde
If you run into issues while using Home Assistant or during development If you run into issues while using Home Assistant or during development
of a component, check the `Home Assistant help section <https://home-assistant.io/help/>`__ of our website for further help and information. of a component, check the `Home Assistant help section <https://home-assistant.io/help/>`__ of our website for further help and information.
.. |Build Status| image:: https://travis-ci.org/home-assistant/home-assistant.svg?branch=master .. |Build Status| image:: https://travis-ci.org/home-assistant/home-assistant.svg?branch=dev
:target: https://travis-ci.org/home-assistant/home-assistant :target: https://travis-ci.org/home-assistant/home-assistant
.. |CI Status| image:: https://circleci.com/gh/home-assistant/home-assistant.svg?style=shield
:target: https://circleci.com/gh/home-assistant/home-assistant
.. |Coverage Status| image:: https://img.shields.io/coveralls/home-assistant/home-assistant.svg .. |Coverage Status| image:: https://img.shields.io/coveralls/home-assistant/home-assistant.svg
:target: https://coveralls.io/r/home-assistant/home-assistant?branch=master :target: https://coveralls.io/r/home-assistant/home-assistant?branch=master
.. |Chat Status| image:: https://img.shields.io/discord/330944238910963714.svg .. |Chat Status| image:: https://img.shields.io/discord/330944238910963714.svg

21
mypyrc Normal file
View File

@ -0,0 +1,21 @@
homeassistant/*.py
homeassistant/auth/
homeassistant/util/
homeassistant/helpers/__init__.py
homeassistant/helpers/aiohttp_client.py
homeassistant/helpers/area_registry.py
homeassistant/helpers/condition.py
homeassistant/helpers/deprecation.py
homeassistant/helpers/dispatcher.py
homeassistant/helpers/entity_values.py
homeassistant/helpers/entityfilter.py
homeassistant/helpers/icon.py
homeassistant/helpers/intent.py
homeassistant/helpers/json.py
homeassistant/helpers/location.py
homeassistant/helpers/signal.py
homeassistant/helpers/state.py
homeassistant/helpers/sun.py
homeassistant/helpers/temperature.py
homeassistant/helpers/translation.py
homeassistant/helpers/typing.py

View File

@ -26,7 +26,8 @@ LANG_ISO=en
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "${CURRENT_BRANCH-}" != "dev" ] && [ "${TRAVIS_BRANCH-}" != "dev" ] ; then # Check Travis and CircleCI environment as well
if [ "${CURRENT_BRANCH-}" != "dev" ] && [ "${TRAVIS_BRANCH-}" != "dev" ] && [ "${CIRCLE_BRANCH-}" != "dev" ]; then
echo "Please only run the translations upload script from a clean checkout of dev." echo "Please only run the translations upload script from a clean checkout of dev."
exit 1 exit 1
fi fi

View File

@ -42,4 +42,4 @@ deps =
-r{toxinidir}/requirements_test.txt -r{toxinidir}/requirements_test.txt
-c{toxinidir}/homeassistant/package_constraints.txt -c{toxinidir}/homeassistant/package_constraints.txt
commands = commands =
/bin/bash -c 'mypy homeassistant/*.py homeassistant/{auth,util}/ homeassistant/helpers/{__init__,aiohttp_client,area_registry,condition,deprecation,dispatcher,entity_values,entityfilter,icon,intent,json,location,signal,state,sun,temperature,translation,typing}.py' /bin/bash -c 'TYPING_FILES=$(cat mypyrc); mypy $TYPING_FILES'