Update build scripts

This commit is contained in:
Otto Winter 2020-07-15 01:37:30 +02:00
parent 17b55fc23d
commit 764eb960c6
No known key found for this signature in database
GPG Key ID: 48ED2DDB96D7682C
11 changed files with 110 additions and 114 deletions

View File

@ -19,7 +19,7 @@ jobs:
# A fast overview job that checks only changed files
overview:
runs-on: ubuntu-latest
container: esphome/esphome-lint:dev
container: esphome/esphome-lint:latest
steps:
# Also fetch history and dev branch so that we can check which files changed
- uses: actions/checkout@v2
@ -59,7 +59,7 @@ jobs:
runs-on: ubuntu-latest
# cpp lint job runs with esphome-lint docker image so that clang-format-*
# doesn't have to be installed
container: esphome/esphome-lint:dev
container: esphome/esphome-lint:latest
steps:
- uses: actions/checkout@v2
# Cache platformio intermediary files (like libraries etc)
@ -85,7 +85,7 @@ jobs:
runs-on: ubuntu-latest
# cpp lint job runs with esphome-lint docker image so that clang-format-*
# doesn't have to be installed
container: esphome/esphome-lint:dev
container: esphome/esphome-lint:latest
# Split clang-tidy check into 4 jobs. Each one will check 1/4th of the .cpp files
strategy:
matrix:

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
# cpp lint job runs with esphome-lint docker image so that clang-format-*
# doesn't have to be installed
container: esphome/esphome-lint:dev
container: esphome/esphome-lint:latest
steps:
- uses: actions/checkout@v2
# Cache platformio intermediary files (like libraries etc)
@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
# cpp lint job runs with esphome-lint docker image so that clang-format-*
# doesn't have to be installed
container: esphome/esphome-lint:dev
container: esphome/esphome-lint:latest
# Split clang-tidy check into 4 jobs. Each one will check 1/4th of the .cpp files
strategy:
matrix:
@ -158,45 +158,54 @@ jobs:
build_type: ["hassio", "docker"]
steps:
- uses: actions/checkout@v2
- name: Set TAG
run: |
TAG="${GITHUB_SHA:0:7}"
echo "::set-env name=TAG::${TAG}"
- name: Set up env variables
run: |
tag="dev"
base_version="2.1.2"
base_version="2.3.1"
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"
build_to="${{ github.repository }}-hassio-${{ matrix.arch }}"
build_to="esphome/esphome-hassio-${{ matrix.arch }}"
dockerfile="docker/Dockerfile.hassio"
else
build_from="esphome/esphome-base-${{ matrix.arch }}:${base_version}"
build_to="${{ github.repository }}-${{ matrix.arch }}"
build_to="esphome/esphome-${{ matrix.arch }}"
dockerfile="docker/Dockerfile"
fi
# Set env variables so these values don't need to be calculated again
echo "::set-env name=TAG::${tag}"
echo "::set-env name=BUILD_FROM::${build_from}"
echo "::set-env name=BUILD_TO::${build_to}"
echo "::set-env name=IMAGE::${build_to}:${tag}"
echo "::set-env name=DOCKERFILE::${dockerfile}"
- name: Pull for cache
run: |
docker pull "${BUILD_TO}:latest" || true
docker pull "${BUILD_TO}:beta" || true
docker pull "${BUILD_TO}:dev" || true
- name: Register QEMU binfmt
run: docker run --rm --privileged multiarch/qemu-user-static:5.0.0-2 --reset -p yes
- run: |
docker build \
--build-arg "BUILD_FROM=${BUILD_FROM}" \
--build-arg "BUILD_VERSION=${TAG}" \
--tag "${IMAGE}" \
--tag "${BUILD_TO}:${TAG}" \
--tag "${BUILD_TO}:dev" \
--cache-from "${BUILD_TO}:latest" \
--cache-from "${BUILD_TO}:beta" \
--cache-from "${BUILD_TO}:dev" \
--file "${DOCKERFILE}" \
--cache-from "${{ github.repository }}:latest" \
--cache-from "${{ github.repository }}:beta" \
--cache-from "${{ github.repository }}:dev" \
.
- name: Log in to docker hub
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
- run: docker push "${IMAGE}"
- run: |
docker push "${BUILD_TO}:${TAG}"
docker push "${BUILD_TO}:dev"
deploy-docker-manifest:
runs-on: ubuntu-latest
@ -206,6 +215,10 @@ jobs:
run: |
mkdir -p ~/.docker
echo "{\"experimental\": \"enabled\"}" > ~/.docker/config.json
- name: Set TAG
run: |
TAG="${GITHUB_SHA:0:7}"
echo "::set-env name=TAG::${TAG}"
- name: Log in to docker hub
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
@ -213,12 +226,16 @@ jobs:
run: docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
- name: "Create the manifest"
run: |
REPO=${{ github.repository }}
TAG="dev"
docker manifest create esphome/esphome:${TAG} \
esphome/esphome-aarch64:${TAG} \
esphome/esphome-amd64:${TAG} \
esphome/esphome-armv7:${TAG} \
esphome/esphome-i386:${TAG}
docker manifest push esphome/esphome:${TAG}
docker manifest create ${REPO}:${TAG} \
${REPO}-aarch64:${TAG} \
${REPO}-amd64:${TAG} \
${REPO}-armv7:${TAG} \
${REPO}-i386:${TAG}
docker manifest push ${REPO}:${TAG}
docker manifest create esphome/esphome:dev \
esphome/esphome-aarch64:${TAG} \
esphome/esphome-amd64:${TAG} \
esphome/esphome-armv7:${TAG} \
esphome/esphome-i386:${TAG}
docker manifest push esphome/esphome:dev

View File

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
# cpp lint job runs with esphome-lint docker image so that clang-format-*
# doesn't have to be installed
container: esphome/esphome-lint:dev
container: esphome/esphome-lint:latest
steps:
- uses: actions/checkout@v2
# Cache platformio intermediary files (like libraries etc)
@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
# cpp lint job runs with esphome-lint docker image so that clang-format-*
# doesn't have to be installed
container: esphome/esphome-lint:dev
container: esphome/esphome-lint:latest
# Split clang-tidy check into 4 jobs. Each one will check 1/4th of the .cpp files
strategy:
matrix:
@ -140,7 +140,6 @@ jobs:
- name: Set up environment
run: script/setup
- name: Register problem matchers
run: |
echo "::add-matcher::.github/workflows/matchers/gcc.json"
@ -179,54 +178,62 @@ jobs:
build_type: ["hassio", "docker"]
steps:
- uses: actions/checkout@v2
- name: Set TAG
run: |
TAG="${GITHUB_REF#refs/tags/v}"
echo "::set-env name=TAG::${TAG}"
- name: Set up env variables
run: |
tag="${GITHUB_REF#v}"
base_version="2.1.2"
base_version="2.3.1"
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"
build_to="${{ github.repository }}-hassio-${{ matrix.arch }}"
build_to="esphome/esphome-hassio-${{ matrix.arch }}"
dockerfile="docker/Dockerfile.hassio"
else
build_from="esphome/esphome-base-${{ matrix.arch }}:${base_version}"
build_to="${{ github.repository }}-${{ matrix.arch }}"
build_to="esphome/esphome-${{ matrix.arch }}"
dockerfile="docker/Dockerfile"
fi
# Set env variables so these values don't need to be calculated again
echo "::set-env name=TAG::${tag}"
echo "::set-env name=BUILD_FROM::${build_from}"
echo "::set-env name=BUILD_TO::${build_to}"
echo "::set-env name=IMAGE::${build_to}:${tag}"
echo "::set-env name=DOCKERFILE::${dockerfile}"
- name: Pull for cache
run: |
docker pull "${BUILD_TO}:latest" || true
docker pull "${BUILD_TO}:beta" || true
docker pull "${BUILD_TO}:dev" || true
- name: Register QEMU binfmt
run: docker run --rm --privileged multiarch/qemu-user-static:5.0.0-2 --reset -p yes
- run: |
docker build \
--build-arg "BUILD_FROM=${BUILD_FROM}" \
--build-arg "BUILD_VERSION=${TAG}" \
--tag "${IMAGE}" \
--tag "${BUILD_TO}:${TAG}" \
--cache-from "${BUILD_TO}:latest" \
--cache-from "${BUILD_TO}:beta" \
--cache-from "${BUILD_TO}:dev" \
--file "${DOCKERFILE}" \
--cache-from "${{ github.repository }}:latest" \
--cache-from "${{ github.repository }}:beta" \
--cache-from "${{ github.repository }}:dev" \
.
- name: Log in to docker hub
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
- run: docker push "${IMAGE}"
- if: ${{ github.event.release.prerelease) }}
name: Publish docker beta tag
- run: docker push "${BUILD_TO}:${TAG}"
# Always publish to beta tag (also full releases)
- name: Publish docker beta tag
run: |
docker tag "${IMAGE}" ${BUILD_TO}:beta
docker tag "${BUILD_TO}:${TAG}" "${BUILD_TO}:beta"
docker push "${BUILD_TO}:beta"
- if: ${{ !github.event.release.prerelease) }}
name: Publish docker latest tag
run: |
docker tag "${IMAGE}" ${BUILD_TO}:latest
docker tag "${BUILD_TO}:${TAG}" "${BUILD_TO}:latest"
docker push "${BUILD_TO}:latest"
deploy-docker-manifest:
@ -237,6 +244,10 @@ jobs:
run: |
mkdir -p ~/.docker
echo "{\"experimental\": \"enabled\"}" > ~/.docker/config.json
- name: Set TAG
run: |
TAG="${GITHUB_REF#refs/tags/v}"
echo "::set-env name=TAG::${TAG}"
- name: Log in to docker hub
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
@ -244,32 +255,28 @@ jobs:
run: docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
- name: "Create the manifest"
run: |
REPO=${{ github.repository }}
TAG="${GITHUB_REF#v}"
docker manifest create ${REPO}:${TAG} \
${REPO}-aarch64:${TAG} \
${REPO}-amd64:${TAG} \
${REPO}-armv7:${TAG} \
${REPO}-i386:${TAG}
echo "::set-env name=REPO::${REPO}"
docker manifest push ${REPO}:${TAG}
docker manifest create esphome/esphome:${TAG} \
esphome/esphome-aarch64:${TAG} \
esphome/esphome-amd64:${TAG} \
esphome/esphome-armv7:${TAG} \
esphome/esphome-i386:${TAG}
docker manifest push esphome/esphome:${TAG}
- name: Publish docker beta tag
if: ${{ github.event.release.prerelease) }}
run: |
docker manifest create ${REPO}:beta \
${REPO}-aarch64:beta \
${REPO}-amd64:beta \
${REPO}-armv7:beta \
${REPO}-i386:beta
docker manifest push ${REPO}:beta
docker manifest create esphome/esphome:beta \
esphome/esphome-aarch64:${TAG} \
esphome/esphome-amd64:${TAG} \
esphome/esphome-armv7:${TAG} \
esphome/esphome-i386:${TAG}
docker manifest push esphome/esphome:beta
- name: Publish docker latest tag
if: ${{ !github.event.release.prerelease) }}
run: |
docker manifest create ${REPO}:latest \
${REPO}-aarch64:latest \
${REPO}-amd64:latest \
${REPO}-armv7:latest \
${REPO}-i386:latest
docker manifest push ${REPO}:latest
docker manifest create esphome/esphome:latest \
esphome/esphome-aarch64:${TAG} \
esphome/esphome-amd64:${TAG} \
esphome/esphome-armv7:${TAG} \
esphome/esphome-i386:${TAG}
docker manifest push esphome/esphome:latest

View File

@ -1,4 +1,4 @@
ARG BUILD_FROM=esphome/esphome-base-amd64:2.1.1
ARG BUILD_FROM=esphome/esphome-base-amd64:2.3.1
FROM ${BUILD_FROM}
COPY . .

View File

@ -1,4 +1,4 @@
FROM esphome/esphome-base-amd64:2.0.1
FROM esphome/esphome-base-amd64:2.3.1
COPY . .

View File

@ -1,24 +1,7 @@
FROM esphome/esphome-base-amd64:2.1.2
FROM esphome/esphome-lint-base:2.3.1
RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
clang-format-7 \
clang-tidy-7 \
patch \
software-properties-common \
# Update to latest git version because of github actions
# https://github.com/actions/checkout/issues/126
&& apt-add-repository ppa:git-core/ppa \
&& apt-get install -y --no-install-recommends \
git \
&& rm -rf \
/tmp/* \
/var/{cache,log}/* \
/var/lib/apt/lists/*
COPY requirements_test.txt /requirements_test.txt
RUN pip3 install --no-cache-dir -r /requirements_test.txt
COPY requirements.txt requirements_test.txt /
RUN pip3 install --no-cache-dir -r /requirements.txt -r /requirements_test.txt
VOLUME ["/esphome"]
WORKDIR /esphome

View File

@ -46,6 +46,9 @@ def validate_board(value):
validate_platform = cv.one_of(*ESP_PLATFORMS, upper=True)
PLATFORMIO_ESP8266_LUT = {
'2.7.2': 'espressif8266@2.6.0',
'2.7.1': 'espressif8266@2.5.1',
'2.7.0': 'espressif8266@2.5.0',
'2.6.3': 'espressif8266@2.4.0',
'2.6.2': 'espressif8266@2.3.1',
'2.6.1': 'espressif8266@2.3.0',
@ -66,7 +69,7 @@ PLATFORMIO_ESP32_LUT = {
'1.0.1': 'espressif32@1.6.0',
'1.0.2': 'espressif32@1.9.0',
'1.0.3': 'espressif32@1.10.0',
'1.0.4': 'espressif32@1.12.1',
'1.0.4': 'espressif32@1.12.4',
'RECOMMENDED': 'espressif32@1.12.1',
'LATEST': 'espressif32',
'DEV': ARDUINO_VERSION_ESP32_DEV,

View File

@ -8,7 +8,7 @@ tzlocal==2.0.0
pytz==2020.1
pyserial==3.4
ifaddr==0.1.6
platformio==4.3.3
platformio==4.3.4
esptool==2.8
click==7.1.2
deepmerge==0.1.0

View File

@ -1,17 +1,3 @@
voluptuous==0.11.7
PyYAML==5.3.1
paho-mqtt==1.5.0
colorlog==4.1.0
tornado==6.0.4
protobuf==3.11.3
tzlocal==2.0.0
pytz==2020.1
pyserial==3.4
ifaddr==0.1.6
platformio==4.3.3
esptool==2.8
deepmerge==0.1.0
pylint==2.5.0
flake8==3.7.9
pillow

View File

@ -4,5 +4,5 @@
set -e
cd "$(dirname "$0")/.."
pip3 install -r requirements_test.txt
pip3 install -r requirements.txt -r requirements_test.txt
pip3 install -e .

View File

@ -41,7 +41,7 @@ REQUIRES = [
# This means they have to be in your $PATH.
if os.environ.get('ESPHOME_USE_SUBPROCESS') is None:
REQUIRES.extend([
'platformio==4.3.3',
'platformio==4.3.4',
'esptool==2.8',
])