mirror of
https://github.com/esphome/esphome.git
synced 2024-11-30 10:44:13 +01:00
187 lines
4.2 KiB
YAML
187 lines
4.2 KiB
YAML
---
|
|
# Based on https://gitlab.com/hassio-addons/addon-node-red/blob/master/.gitlab-ci.yml
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
stages:
|
|
- lint
|
|
- test
|
|
- build
|
|
- deploy
|
|
|
|
.lint: &lint
|
|
stage: lint
|
|
tags:
|
|
- python2.7
|
|
- esphomeyaml-lint
|
|
|
|
.test: &test
|
|
stage: test
|
|
before_script:
|
|
- pip install -e .
|
|
tags:
|
|
- python2.7
|
|
- esphomeyaml-test
|
|
variables:
|
|
TZ: UTC
|
|
cache:
|
|
paths:
|
|
- tests/build
|
|
|
|
.docker-builder: &docker-builder
|
|
before_script:
|
|
- docker info
|
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
|
|
services:
|
|
- docker:dind
|
|
tags:
|
|
- hassio-builder
|
|
|
|
flake8:
|
|
<<: *lint
|
|
script:
|
|
- flake8 esphomeyaml
|
|
|
|
pylint:
|
|
<<: *lint
|
|
script:
|
|
- pylint esphomeyaml
|
|
|
|
test1:
|
|
<<: *test
|
|
script:
|
|
- esphomeyaml tests/test1.yaml compile
|
|
|
|
test2:
|
|
<<: *test
|
|
script:
|
|
- esphomeyaml tests/test2.yaml compile
|
|
|
|
.build-hassio: &build-hassio
|
|
<<: *docker-builder
|
|
stage: build
|
|
script:
|
|
- |
|
|
hassio-builder.sh \
|
|
-t . \
|
|
-i ottowinter/esphomeyaml-hassio-${ADDON_ARCH} \
|
|
-d "$CI_REGISTRY" \
|
|
--${ADDON_ARCH}
|
|
- |
|
|
docker tag \
|
|
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:dev" \
|
|
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}"
|
|
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}"
|
|
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:dev"
|
|
retry: 2
|
|
|
|
# Generic deploy template
|
|
.deploy: &deploy
|
|
<<: *docker-builder
|
|
stage: deploy
|
|
script:
|
|
- version=${CI_COMMIT_TAG:1}
|
|
- echo "Publishing version ${version}"
|
|
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
|
|
- docker pull "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}"
|
|
- |
|
|
docker tag \
|
|
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
|
|
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest"
|
|
- |
|
|
docker tag \
|
|
"${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \
|
|
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
|
|
- |
|
|
docker tag \
|
|
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" \
|
|
"ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest"
|
|
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest"
|
|
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
|
|
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest"
|
|
|
|
# Build jobs
|
|
build:normal:
|
|
<<: *docker-builder
|
|
stage: build
|
|
script:
|
|
- docker build -t "${CI_REGISTRY}/ottowinter/esphomeyaml:dev" .
|
|
- |
|
|
docker tag \
|
|
"${CI_REGISTRY}/ottowinter/esphomeyaml:dev" \
|
|
"${CI_REGISTRY}/ottowinter/esphomeyaml:${CI_COMMIT_SHA}"
|
|
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml:${CI_COMMIT_SHA}"
|
|
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml:dev"
|
|
|
|
build:armhf:
|
|
<<: *build-hassio
|
|
variables:
|
|
ADDON_ARCH: armhf
|
|
|
|
#build:aarch64:
|
|
# <<: *build
|
|
# variables:
|
|
# ADDON_ARCH: aarch64
|
|
|
|
build:i386:
|
|
<<: *build-hassio
|
|
variables:
|
|
ADDON_ARCH: i386
|
|
|
|
build:amd64:
|
|
<<: *build-hassio
|
|
variables:
|
|
ADDON_ARCH: amd64
|
|
|
|
# Deploy jobs
|
|
deploy:armhf:
|
|
<<: *deploy
|
|
variables:
|
|
ADDON_ARCH: armhf
|
|
only:
|
|
- /^v\d+\.\d+\.\d+(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?$/
|
|
except:
|
|
- /^(?!master).+@/
|
|
|
|
#deploy:aarch64:
|
|
# <<: *deploy
|
|
# variables:
|
|
# ADDON_ARCH: aarch64
|
|
# only:
|
|
# - /^v\d+\.\d+\.\d+(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?$/
|
|
# except:
|
|
# - /^(?!master).+@/
|
|
|
|
deploy:i386:
|
|
<<: *deploy
|
|
variables:
|
|
ADDON_ARCH: i386
|
|
only:
|
|
- /^v\d+\.\d+\.\d+(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?$/
|
|
except:
|
|
- /^(?!master).+@/
|
|
|
|
deploy:amd64:
|
|
<<: *deploy
|
|
variables:
|
|
ADDON_ARCH: amd64
|
|
only:
|
|
- /^v\d+\.\d+\.\d+(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?$/
|
|
except:
|
|
- /^(?!master).+@/
|
|
|
|
deploy:pypi:
|
|
stage: deploy
|
|
before_script:
|
|
- pip install -e .
|
|
- pip install twine
|
|
script:
|
|
- python setup.py sdist
|
|
- twine upload dist/*
|
|
tags:
|
|
- python2.7
|
|
- esphomeyaml-test
|
|
only:
|
|
- /^v\d+\.\d+\.\d+(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?$/
|
|
except:
|
|
- /^(?!master).+@/
|