Update Gitlab CI

This commit is contained in:
Otto Winter 2019-02-13 21:14:03 +01:00
parent 0a4d49accb
commit 5e61014e98
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E
4 changed files with 257 additions and 23 deletions

View file

@ -2,39 +2,97 @@
# Based on https://gitlab.com/hassio-addons/addon-node-red/blob/master/.gitlab-ci.yml # Based on https://gitlab.com/hassio-addons/addon-node-red/blob/master/.gitlab-ci.yml
variables: variables:
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
stages: stages:
- lint - lint
- test - test
- build
- deploy - deploy
.lint: &lint .lint: &lint
image: esphome/esphome-base-amd64
stage: lint stage: lint
before_script: before_script:
- pip install -e . - pip install -e .
- pip install flake8==3.6.0 pylint==1.9.4 pillow
tags: tags:
- python2.7 - docker
- esphome-lint
.test: &test .test: &test
image: esphome/esphome-base-amd64
stage: test stage: test
before_script: before_script:
- pip install -e . - pip install -e .
tags: tags:
- python2.7 - docker
- esphome-test
variables: variables:
TZ: UTC TZ: UTC
.docker-builder: &docker-builder .docker-base: &docker-base
image: esphome/esphome-base-builder
before_script: before_script:
- docker info - docker info
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
script:
- docker run --rm --privileged hassioaddons/qemu-user-static:latest
- TAG="${CI_COMMIT_TAG#v}"
- TAG="${TAG:-${CI_COMMIT_SHA:0:7}}"
- echo "Tag ${TAG}"
- |
if [[ "${IS_HASSIO}" == "YES" ]]; then
BUILD_FROM=esphome/esphome-hassio-base-${BUILD_ARCH}:1.0.0
BUILD_TO=esphome/esphome-hassio-${BUILD_ARCH}
DOCKERFILE=docker/Dockerfile.hassio
else
BUILD_FROM=esphome/esphome-base-${BUILD_ARCH}:1.0.0
if [[ "${BUILD_ARCH}" == "amd64" ]]; then
BUILD_TO=esphome/esphome
else
BUILD_TO=esphome/esphome-${BUILD_ARCH}
fi
DOCKERFILE=docker/Dockerfile
fi
- |
docker build \
--build-arg "BUILD_FROM=${BUILD_FROM}" \
--build-arg "BUILD_VERSION=${TAG}" \
--tag "${BUILD_TO}:${TAG}" \
--file "${DOCKERFILE}" \
.
- |
if [[ "${RELEASE}" = "YES" ]]; then
echo "Pushing to ${BUILD_TO}:${TAG}"
docker push "${BUILD_TO}:${TAG}"
fi
- |
if [[ "${LATEST}" = "YES" ]]; then
echo "Pushing to :latest"
docker tag ${BUILD_TO}:${TAG} ${BUILD_TO}:latest
docker push ${BUILD_TO}:latest
fi
- |
if [[ "${BETA}" = "YES" ]]; then
echo "Pushing to :beta"
docker tag \
${BUILD_TO}:${TAG} \
${BUILD_TO}:beta
docker push ${BUILD_TO}:beta
fi
- |
if [[ "${DEV}" = "YES" ]]; then
echo "Pushing to :dev"
docker tag \
${BUILD_TO}:${TAG} \
${BUILD_TO}:dev
docker push ${BUILD_TO}:dev
fi
services: services:
- docker:dind - docker:dind
tags: tags:
- hassio-builder - docker
stage: deploy
flake8: flake8:
<<: *lint <<: *lint
@ -61,15 +119,9 @@ test3:
script: script:
- esphome tests/test3.yaml compile - esphome tests/test3.yaml compile
# Build jobs
build:normal:
<<: *docker-builder
stage: build
script:
- docker build -t "${CI_REGISTRY}/esphome/esphome:dev" .
.deploy-pypi: &deploy-pypi .deploy-pypi: &deploy-pypi
stage: deploy stage: deploy
image: python:2.7
before_script: before_script:
- pip install -e . - pip install -e .
- pip install twine - pip install twine
@ -77,8 +129,7 @@ build:normal:
- python setup.py sdist - python setup.py sdist
- twine upload dist/* - twine upload dist/*
tags: tags:
- python2.7 - docker
- esphome-test
deploy-release:pypi: deploy-release:pypi:
<<: *deploy-pypi <<: *deploy-pypi
@ -93,3 +144,181 @@ deploy-beta:pypi:
- /^v\d+\.\d+\.\d+b\d+$/ - /^v\d+\.\d+\.\d+b\d+$/
except: except:
- /^(?!rc).+@/ - /^(?!rc).+@/
.latest: &latest
<<: *docker-base
only:
- /^v([0-9\.]+)$/
except:
- branches
.latest-vars: &latest-vars
RELEASE: YES
LATEST: YES
# Also push to beta tag
BETA: YES
.beta: &beta
<<: *docker-base
only:
- /^v([0-9\.]+b\d+)$/
except:
- branches
.beta-vars: &beta-vars
RELEASE: YES
BETA: YES
.dev: &dev
<<: *docker-base
only:
- dev
.dev-vars: &dev-vars
DEV: YES
# aarch64
aarch64-beta-hassio:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: aarch64
BUILD_FROM: esphome/esphome-hassio-base-aarch64:1.0.0
RELEASE: "YES"
IS_HASSIO: "YES"
#aarch64-dev-hassio:
# <<: *dev
# variables:
# BUILD_ARCH: aarch64
# BUILD_FROM: esphome/esphome-hassio-base-aarch64:1.0.0
# DEV: "YES"
# IS_HASSIO: "YES"
aarch64-latest-hassio:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: aarch64
BUILD_FROM: esphome/esphome-hassio-base-aarch64:1.0.0
IS_HASSIO: "YES"
LATEST: "YES"
RELEASE: "YES"
amd64-beta-docker:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: amd64
BUILD_FROM: esphome/esphome-hassio-base-amd64:1.0.0
IS_HASSIO: "NO"
RELEASE: "YES"
amd64-beta-hassio:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: amd64
BUILD_FROM: esphome/esphome-hassio-base-amd64:1.0.0
IS_HASSIO: "YES"
RELEASE: "YES"
#amd64-dev-docker:
# <<: *dev
# variables:
# BUILD_ARCH: amd64
# BUILD_FROM: esphome/esphome-base-amd64:1.0.0
# DEV: "YES"
# IS_HASSIO: "NO"
#amd64-dev-hassio:
# <<: *dev
# variables:
# BUILD_ARCH: amd64
# BUILD_FROM: esphome/esphome-hassio-base-amd64:1.0.0
# DEV: "YES"
# IS_HASSIO: "YES"
amd64-latest-docker:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: amd64
BUILD_FROM: esphome/esphome-hassio-base-amd64:1.0.0
IS_HASSIO: "NO"
LATEST: "YES"
RELEASE: "YES"
amd64-latest-hassio:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: amd64
BUILD_FROM: esphome/esphome-hassio-base-amd64:1.0.0
IS_HASSIO: "YES"
LATEST: "YES"
RELEASE: "YES"
armhf-beta-hassio:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: armhf
BUILD_FROM: esphome/esphome-hassio-base-armhf:1.0.0
IS_HASSIO: "YES"
RELEASE: "YES"
#armhf-dev-hassio:
# <<: *dev
# variables:
# BUILD_ARCH: armhf
# BUILD_FROM: esphome/esphome-hassio-base-armhf:1.0.0
# DEV: "YES"
# IS_HASSIO: "YES"
armhf-latest-hassio:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: armhf
BUILD_FROM: esphome/esphome-hassio-base-armhf:1.0.0
IS_HASSIO: "YES"
LATEST: "YES"
RELEASE: "YES"
i386-beta-docker:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: i386
BUILD_FROM: esphome/esphome-hassio-base-i386:1.0.0
IS_HASSIO: "NO"
RELEASE: "YES"
i386-beta-hassio:
<<: *beta
variables:
BETA: "YES"
BUILD_ARCH: i386
BUILD_FROM: esphome/esphome-hassio-base-i386:1.0.0
IS_HASSIO: "YES"
RELEASE: "YES"
#i386-dev-docker:
# <<: *dev
# variables:
# BUILD_ARCH: i386
# BUILD_FROM: esphome/esphome-hassio-base-i386:1.0.0
# DEV: "YES"
# IS_HASSIO: "NO"
#i386-dev-hassio:
# <<: *dev
# variables:
# BUILD_ARCH: i386
# BUILD_FROM: esphome/esphome-hassio-base-i386:1.0.0
# DEV: "YES"
# IS_HASSIO: "YES"
i386-latest-docker:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: i386
BUILD_FROM: esphome/esphome-hassio-base-i386:1.0.0
IS_HASSIO: "NO"
LATEST: "YES"
RELEASE: "YES"
i386-latest-hassio:
<<: *latest
variables:
BETA: "YES"
BUILD_ARCH: i386
BUILD_FROM: esphome/esphome-hassio-base-i386:1.0.0
IS_HASSIO: "YES"
LATEST: "YES"
RELEASE: "YES"

View file

@ -1,3 +1,8 @@
# ESPHome # ESPHome [![Build Status](https://travis-ci.org/esphome/esphome.svg?branch=master)](https://travis-ci.org/esphome/esphome) [![Discord Chat](https://img.shields.io/discord/429907082951524364.svg)](https://discord.gg/KhAMKrd) [![GitHub release](https://img.shields.io/github/release/esphome/esphome.svg)](https://GitHub.com/esphome/esphome/releases/)
# TODO [![ESPHome Logo](https://esphome.io/_images/logo-text.png)](https://esphome.io/)
**Documentation:** https://esphome.io/
For issues, please go to [the issue tracker](https://github.com/esphome/issues/issues).
For feature requests, please see [feature requests](https://github.com/esphome/feature-requests/issues).

View file

@ -322,7 +322,7 @@ class EsphomeCore(object):
if 'ethernet' in self.config: if 'ethernet' in self.config:
return self.config['ethernet'][CONF_USE_ADDRESS] return self.config['ethernet'][CONF_USE_ADDRESS]
raise EsphomeError("No network configured") return None
@property @property
def esphome_core_version(self): # type: () -> Dict[str, str] def esphome_core_version(self): # type: () -> Dict[str, str]

View file

@ -2,9 +2,9 @@ esphome:
name: $devicename name: $devicename
platform: ESP8266 platform: ESP8266
board: esp07 board: esp07
# Use this for testing while developing: # Use this for testing while developing:
# Note the travis check for esphome PRs will fail until the # Note the travis check for esphome PRs will fail until the
# esphome-core PR has been merged. # esphome-core PR has been merged.
# esphome_core_version: # esphome_core_version:
# local: ~/path/to/esphome-core # local: ~/path/to/esphome-core
build_path: build/test3 build_path: build/test3