Skip to content

Commit

Permalink
Add translation upload circlci job
Browse files Browse the repository at this point in the history
  • Loading branch information
awarecan committed Apr 1, 2019
1 parent 4395e83 commit aea6e5d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
32 changes: 27 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ commands:
command: |
python3 -m venv venv
. 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.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>>
Expand All @@ -68,7 +68,7 @@ commands:
name: install
command: |
. venv/bin/activate
pip install --progress-bar off -e .
pip install -q --progress-bar off -e .
jobs:

Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
executor:
name: python
tag: 3.7-stretch
parallelism: 3
parallelism: 2

steps:
- checkout
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
executor:
name: python
tag: << parameters.python >>
parallelism: 3
parallelism: 2

steps:
- checkout
Expand All @@ -179,7 +179,6 @@ jobs:
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}
script/check_dirty
when: always
- store_test_results:
path: test-reports
Expand All @@ -192,6 +191,23 @@ jobs:
path: 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:
version: 2
build:
Expand Down Expand Up @@ -229,3 +245,9 @@ workflows:
# - test:
# name: test 3.8
# python: 3.8-rc-stretch
- upload-translations:
requires:
- static-check
filters:
branches:
only: dev
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
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
.. |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
:target: https://coveralls.io/r/home-assistant/home-assistant?branch=master
.. |Chat Status| image:: https://img.shields.io/discord/330944238910963714.svg
Expand Down
3 changes: 2 additions & 1 deletion script/translations_upload
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ LANG_ISO=en

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."
exit 1
fi
Expand Down

0 comments on commit aea6e5d

Please sign in to comment.