Compare commits

...

4 Commits

Author SHA1 Message Date
Otto Winter
0ced5509fc Bump version to v1.13.0b2 2019-05-28 10:48:48 +02:00
gitolicious
bd6b9ff1da added link from dashboard to web server, if configured (#556)
* added link from dashboard to web server, if configured

* linter fixes

* simplified integration lookup

* included loaded_integration in storage json

* included loaded_integration in storage json

* fixed loaded_integrations

plus linter changes

* fixed comment: List

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* return empty list

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* convert to list

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* default to empty list on missing loaded_integrations

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* None check no longer needed

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* None check no longer needed

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* removed newline
2019-05-28 10:48:45 +02:00
Otto Winter
edee28acf0 Use lint image for tests 2019-05-28 10:41:19 +02:00
Otto Winter
53e8b3ed3e Update gitlab CI script, add cpp lint 2019-05-28 10:24:13 +02:00
8 changed files with 146 additions and 104 deletions

View File

@@ -3,6 +3,8 @@
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
BASE_VERSION: '1.5.1'
TZ: UTC
stages:
- lint
@@ -10,7 +12,7 @@ stages:
- deploy
.lint: &lint
image: esphome/esphome-base-amd64
image: esphome/esphome-lint:latest
stage: lint
before_script:
- script/setup
@@ -18,14 +20,12 @@ stages:
- docker
.test: &test
image: esphome/esphome-base-amd64
image: esphome/esphome-lint:latest
stage: test
before_script:
- script/setup
tags:
- docker
variables:
TZ: UTC
.docker-base: &docker-base
image: esphome/esphome-base-builder
@@ -40,11 +40,11 @@ stages:
- |
if [[ "${IS_HASSIO}" == "YES" ]]; then
BUILD_FROM=esphome/esphome-hassio-base-${BUILD_ARCH}:1.5.1
BUILD_FROM=esphome/esphome-hassio-base-${BUILD_ARCH}:${BASE_VERSION}
BUILD_TO=esphome/esphome-hassio-${BUILD_ARCH}
DOCKERFILE=docker/Dockerfile.hassio
else
BUILD_FROM=esphome/esphome-base-${BUILD_ARCH}:1.5.1
BUILD_FROM=esphome/esphome-base-${BUILD_ARCH}:${BASE_VERSION}
if [[ "${BUILD_ARCH}" == "amd64" ]]; then
BUILD_TO=esphome/esphome
else
@@ -93,12 +93,33 @@ stages:
- docker
stage: deploy
lint-python:
lint-custom:
<<: *lint
script:
- script/ci-custom.py
lint-python:
<<: *lint
script:
- script/lint-python
lint-tidy:
<<: *lint
script:
- pio init --ide atom
- |
if ! patch -R -p0 -s -f --dry-run <script/.neopixelbus.patch; then
patch -p0 < script/.neopixelbus.patch
fi
- script/clang-tidy --all-headers --fix
- script/ci-suggest-changes
lint-format:
<<: *lint
script:
- script/clang-format -i
- script/ci-suggest-changes
test1:
<<: *test
script:
@@ -115,16 +136,11 @@ test3:
- esphome tests/test3.yaml compile
.deploy-pypi: &deploy-pypi
<<: *lint
stage: deploy
image: python:2.7
before_script:
- pip install -e .
- pip install twine
script:
- python setup.py sdist bdist_wheel
- twine upload dist/*
tags:
- docker
- python setup.py sdist bdist_wheel
- twine upload dist/*
deploy-release:pypi:
<<: *deploy-pypi
@@ -143,77 +159,64 @@ deploy-beta:pypi:
.latest: &latest
<<: *docker-base
only:
- /^v([0-9\.]+)$/
- /^v([0-9\.]+)$/
except:
- branches
.latest-vars: &latest-vars
RELEASE: YES
LATEST: YES
# Also push to beta tag
BETA: YES
- branches
.beta: &beta
<<: *docker-base
only:
- /^v([0-9\.]+b\d+)$/
- /^v([0-9\.]+b\d+)$/
except:
- branches
.beta-vars: &beta-vars
RELEASE: YES
BETA: YES
- branches
.dev: &dev
<<: *docker-base
only:
- dev
- dev
.dev-vars: &dev-vars
DEV: YES
#aarch64-beta-docker:
# <<: *beta
# variables:
# BETA: "YES"
# BUILD_ARCH: aarch64
# IS_HASSIO: "NO"
# RELEASE: "YES"
#aarch64-beta-hassio:
# <<: *beta
# variables:
# BETA: "YES"
# BUILD_ARCH: aarch64
# IS_HASSIO: "YES"
# RELEASE: "YES"
#aarch64-dev-docker:
# <<: *dev
# variables:
# BUILD_ARCH: aarch64
# DEV: "YES"
# IS_HASSIO: "NO"
#aarch64-dev-hassio:
# <<: *dev
# variables:
# BUILD_ARCH: aarch64
# DEV: "YES"
# IS_HASSIO: "YES"
#aarch64-latest-docker:
# <<: *latest
# variables:
# BETA: "YES"
# BUILD_ARCH: aarch64
# IS_HASSIO: "NO"
# LATEST: "YES"
# RELEASE: "YES"
#aarch64-latest-hassio:
# <<: *latest
# variables:
# BETA: "YES"
# BUILD_ARCH: aarch64
# IS_HASSIO: "YES"
# LATEST: "YES"
# RELEASE: "YES"
aarch64-beta-docker:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: aarch64
IS_HASSIO: "NO"
RELEASE: "YES"
aarch64-beta-hassio:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: aarch64
IS_HASSIO: "YES"
RELEASE: "YES"
aarch64-dev-docker:
<<: *dev
variables:
BUILD_ARCH: aarch64
DEV: "YES"
IS_HASSIO: "NO"
aarch64-dev-hassio:
<<: *dev
variables:
BUILD_ARCH: aarch64
DEV: "YES"
IS_HASSIO: "YES"
aarch64-latest-docker:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: aarch64
IS_HASSIO: "NO"
LATEST: "YES"
RELEASE: "YES"
aarch64-latest-hassio:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: aarch64
IS_HASSIO: "YES"
LATEST: "YES"
RELEASE: "YES"
amd64-beta-docker:
<<: *beta
variables:
@@ -256,45 +259,45 @@ amd64-latest-hassio:
IS_HASSIO: "YES"
LATEST: "YES"
RELEASE: "YES"
armhf-beta-docker:
armv7-beta-docker:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: armhf
BUILD_ARCH: armv7
IS_HASSIO: "NO"
RELEASE: "YES"
armhf-beta-hassio:
armv7-beta-hassio:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: armhf
BUILD_ARCH: armv7
IS_HASSIO: "YES"
RELEASE: "YES"
armhf-dev-docker:
armv7-dev-docker:
<<: *dev
variables:
BUILD_ARCH: armhf
BUILD_ARCH: armv7
DEV: "YES"
IS_HASSIO: "NO"
armhf-dev-hassio:
armv7-dev-hassio:
<<: *dev
variables:
BUILD_ARCH: armhf
BUILD_ARCH: armv7
DEV: "YES"
IS_HASSIO: "YES"
armhf-latest-docker:
armv7-latest-docker:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: armhf
BUILD_ARCH: armv7
IS_HASSIO: "NO"
LATEST: "YES"
RELEASE: "YES"
armhf-latest-hassio:
armv7-latest-hassio:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: armhf
BUILD_ARCH: armv7
IS_HASSIO: "YES"
LATEST: "YES"
RELEASE: "YES"

View File

@@ -1,6 +1,18 @@
FROM python:2.7
FROM esphome/esphome-base-amd64:1.5.1
COPY requirements.txt /requirements.txt
RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
clang-format-7 \
clang-tidy-7 \
patch \
&& rm -rf \
/tmp/* \
/var/{cache,log}/* \
/var/lib/apt/lists/*
RUN pip install -r /requirements.txt && \
pip install flake8==3.6.0 pylint==1.9.4 pillow
COPY requirements_test.txt /requirements_test.txt
RUN pip2 install -r /requirements_test.txt
VOLUME ["/esphome"]
WORKDIR /esphome

View File

@@ -3,7 +3,7 @@
MAJOR_VERSION = 1
MINOR_VERSION = 13
PATCH_VERSION = '0b1'
PATCH_VERSION = '0b2'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
@@ -201,6 +201,7 @@ CONF_LEVEL = 'level'
CONF_LG = 'lg'
CONF_LIBRARIES = 'libraries'
CONF_LIGHT = 'light'
CONF_LOADED_INTEGRATIONS = 'loaded_integrations'
CONF_LOCAL = 'local'
CONF_LOGGER = 'logger'
CONF_LOGS = 'logs'

View File

@@ -430,6 +430,12 @@ class DashboardEntry(object):
def update_new(self):
return const.__version__
@property
def loaded_integrations(self):
if self.storage is None:
return []
return self.storage.loaded_integrations
class MainRequestHandler(BaseHandler):
@authenticated

View File

@@ -67,6 +67,9 @@
<div class="card-content">
<span class="card-title">
{{ escape(entry.name) }}
{% if 'web_server' in entry.loaded_integrations %}
<a href="http://{{ escape(entry.address) }}" target="_blank"><i class="material-icons icon-grey">launch</i></a>
{% end %}
<i class="material-icons right dropdown-trigger" data-target="dropdown-{{ i }}">more_vert</i>
</span>
<p>

View File

@@ -37,7 +37,7 @@ def trash_storage_path(base_path): # type: (str) -> str
class StorageJSON(object):
def __init__(self, storage_version, name, esphome_version,
src_version, arduino_version, address, esp_platform, board, build_path,
firmware_bin_path):
firmware_bin_path, loaded_integrations):
# Version of the storage JSON schema
assert storage_version is None or isinstance(storage_version, int)
self.storage_version = storage_version # type: int
@@ -61,6 +61,9 @@ class StorageJSON(object):
self.build_path = build_path # type: str
# The absolute path to the firmware binary
self.firmware_bin_path = firmware_bin_path # type: str
# A list of strings of names of loaded integrations
self.loaded_integrations = loaded_integrations # type: List[str]
self.loaded_integrations.sort()
def as_dict(self):
return {
@@ -74,6 +77,7 @@ class StorageJSON(object):
'board': self.board,
'build_path': self.build_path,
'firmware_bin_path': self.firmware_bin_path,
'loaded_integrations': self.loaded_integrations,
}
def to_json(self):
@@ -97,6 +101,7 @@ class StorageJSON(object):
board=esph.board,
build_path=esph.build_path,
firmware_bin_path=esph.firmware_bin,
loaded_integrations=list(esph.loaded_integrations),
)
@staticmethod
@@ -113,6 +118,7 @@ class StorageJSON(object):
board=board,
build_path=None,
firmware_bin_path=None,
loaded_integrations=[],
)
@staticmethod
@@ -130,9 +136,10 @@ class StorageJSON(object):
board = storage.get('board')
build_path = storage.get('build_path')
firmware_bin_path = storage.get('firmware_bin_path')
loaded_integrations = storage.get('loaded_integrations', [])
return StorageJSON(storage_version, name, esphome_version,
src_version, arduino_version, address, esp_platform, board, build_path,
firmware_bin_path)
firmware_bin_path, loaded_integrations)
@staticmethod
def load(path): # type: (str) -> Optional[StorageJSON]

View File

@@ -16,3 +16,4 @@ pylint==2.3.0 ; python_version>"3"
flake8==3.6.0
pillow
pexpect
twine

View File

@@ -11,6 +11,19 @@ import sys
sys.path.append(os.path.dirname(__file__))
from helpers import get_output, git_ls_files, filter_changed
curfile = None
def print_error(file, lineno, msg):
global curfile
if curfile != file:
print()
print("\033[0;32m************* File \033[1;32m{}\033[0m".format(file))
curfile = file
print(u'{}:{} - {}'.format(file, lineno, msg))
def main():
parser = argparse.ArgumentParser()
@@ -38,7 +51,7 @@ def main():
if not files:
sys.exit(0)
errors = collections.defaultdict(list)
errors = 0
cmd = ['flake8'] + files
print("Running flake8...")
log = get_output(*cmd)
@@ -49,7 +62,8 @@ def main():
file_ = line[0]
linno = line[1]
msg = (u':'.join(line[3:])).strip()
errors[file_].append(u'{}:{} - {}'.format(file_, linno, msg))
print_error(file_, linno, msg)
errors += 1
cmd = ['pylint', '-f', 'parseable', '--persistent=n'] + files
print("Running pylint...")
@@ -61,15 +75,10 @@ def main():
file_ = line[0]
linno = line[1]
msg = (u':'.join(line[3:])).strip()
errors[file_].append(u'{}:{} - {}'.format(file_, linno, msg))
print_error(file_, linno, msg)
errors += 1
for f, errs in sorted(errors.items()):
print("\033[0;32m************* File \033[1;32m{}\033[0m".format(f))
for err in errs:
print(err)
print()
sys.exit(len(errors))
sys.exit(errors)
if __name__ == '__main__':