esphome/.gitlab-ci.yml

234 lines
5.5 KiB
YAML
Raw Normal View History

---
# Based on https://gitlab.com/hassio-addons/addon-node-red/blob/master/.gitlab-ci.yml
variables:
DOCKER_DRIVER: overlay2
stages:
- lint
2018-08-26 11:26:14 +02:00
- test
- build
- deploy
.lint: &lint
stage: lint
tags:
- python2.7
- esphomeyaml-lint
2018-08-26 11:26:14 +02:00
.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
2018-09-26 18:39:41 +02:00
test1:
2018-08-26 11:26:14 +02:00
<<: *test
script:
- esphomeyaml tests/test1.yaml compile
2018-09-26 18:39:41 +02:00
test2:
<<: *test
script:
- esphomeyaml tests/test2.yaml compile
2018-08-26 11:26:14 +02:00
.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"
2018-09-25 13:26:01 +02:00
retry: 2
# Generic deploy template
2018-10-20 18:20:21 +02:00
.deploy-release: &deploy-release
2018-08-26 11:26:14 +02:00
<<: *docker-builder
stage: deploy
script:
- version=${CI_COMMIT_TAG:1}
2018-10-20 18:20:21 +02:00
- echo "Publishing release version ${version}"
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
- docker pull "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}"
2018-09-26 18:59:39 +02:00
- |
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"
2018-09-26 18:59:39 +02:00
- 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"
2018-10-20 18:20:21 +02:00
only:
- /^v\d+\.\d+\.\d+$/
except:
- /^(?!master).+@/
.deploy-beta: &deploy-beta
<<: *docker-builder
stage: deploy
script:
- version=${CI_COMMIT_TAG:1}
- echo "Publishing beta 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}:beta"
- |
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}:beta"
- docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:beta"
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}"
- docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:beta"
only:
- /^v\d+\.\d+\.\d+b\d+$/
except:
- /^(?!rc).+@/
# Build jobs
2018-08-26 11:26:14 +02:00
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:
2018-08-26 11:26:14 +02:00
<<: *build-hassio
variables:
ADDON_ARCH: armhf
2018-06-14 00:14:01 +02:00
#build:aarch64:
# <<: *build
# variables:
# ADDON_ARCH: aarch64
build:i386:
2018-08-26 11:26:14 +02:00
<<: *build-hassio
variables:
ADDON_ARCH: i386
build:amd64:
2018-08-26 11:26:14 +02:00
<<: *build-hassio
variables:
ADDON_ARCH: amd64
# Deploy jobs
2018-10-20 18:20:21 +02:00
deploy-release:armhf:
<<: *deploy-release
variables:
ADDON_ARCH: armhf
2018-10-20 18:20:21 +02:00
deploy-beta:armhf:
<<: *deploy-beta
variables:
ADDON_ARCH: armhf
#deploy-release:aarch64:
# <<: *deploy-release
2018-06-14 00:14:01 +02:00
# variables:
# ADDON_ARCH: aarch64
2018-10-20 18:20:21 +02:00
#deploy-beta:aarch64:
# <<: *deploy-beta
# variables:
# ADDON_ARCH: aarch64
deploy-release:i386:
<<: *deploy-release
variables:
ADDON_ARCH: i386
deploy-beta:i386:
<<: *deploy-beta
variables:
ADDON_ARCH: i386
2018-10-20 18:20:21 +02:00
deploy-release:amd64:
<<: *deploy-release
variables:
ADDON_ARCH: amd64
deploy-beta:amd64:
<<: *deploy-beta
variables:
ADDON_ARCH: amd64
2018-10-20 18:20:21 +02:00
.deploy-pypi: &deploy-pypi
2018-08-26 11:26:14 +02:00
stage: deploy
2018-10-20 18:20:21 +02:00
before_script:
2018-08-26 11:26:14 +02:00
- pip install -e .
- pip install twine
2018-10-20 18:20:21 +02:00
script:
2018-08-26 11:26:14 +02:00
- python setup.py sdist
- twine upload dist/*
2018-10-20 18:20:21 +02:00
tags:
2018-08-26 11:26:14 +02:00
- python2.7
- esphomeyaml-test
2018-10-20 18:20:21 +02:00
deploy-release:pypi:
<<: *deploy-pypi
2018-08-26 11:26:14 +02:00
only:
2018-10-20 18:20:21 +02:00
- /^v\d+\.\d+\.\d+$/
2018-08-26 11:26:14 +02:00
except:
- /^(?!master).+@/
2018-10-20 18:20:21 +02:00
deploy-beta:pypi:
<<: *deploy-pypi
only:
- /^v\d+\.\d+\.\d+b\d+$/
except:
- /^(?!rc).+@/