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

View file

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

View file

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

View file

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

View file

@ -1,24 +1,7 @@
FROM esphome/esphome-base-amd64:2.1.2 FROM esphome/esphome-lint-base:2.3.1
RUN \ COPY requirements.txt requirements_test.txt /
apt-get update \ RUN pip3 install --no-cache-dir -r /requirements.txt -r /requirements_test.txt
&& 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
VOLUME ["/esphome"] VOLUME ["/esphome"]
WORKDIR /esphome WORKDIR /esphome

View file

@ -46,6 +46,9 @@ def validate_board(value):
validate_platform = cv.one_of(*ESP_PLATFORMS, upper=True) validate_platform = cv.one_of(*ESP_PLATFORMS, upper=True)
PLATFORMIO_ESP8266_LUT = { 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.3': 'espressif8266@2.4.0',
'2.6.2': 'espressif8266@2.3.1', '2.6.2': 'espressif8266@2.3.1',
'2.6.1': 'espressif8266@2.3.0', '2.6.1': 'espressif8266@2.3.0',
@ -66,7 +69,7 @@ PLATFORMIO_ESP32_LUT = {
'1.0.1': 'espressif32@1.6.0', '1.0.1': 'espressif32@1.6.0',
'1.0.2': 'espressif32@1.9.0', '1.0.2': 'espressif32@1.9.0',
'1.0.3': 'espressif32@1.10.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', 'RECOMMENDED': 'espressif32@1.12.1',
'LATEST': 'espressif32', 'LATEST': 'espressif32',
'DEV': ARDUINO_VERSION_ESP32_DEV, 'DEV': ARDUINO_VERSION_ESP32_DEV,

View file

@ -8,7 +8,7 @@ tzlocal==2.0.0
pytz==2020.1 pytz==2020.1
pyserial==3.4 pyserial==3.4
ifaddr==0.1.6 ifaddr==0.1.6
platformio==4.3.3 platformio==4.3.4
esptool==2.8 esptool==2.8
click==7.1.2 click==7.1.2
deepmerge==0.1.0 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 pylint==2.5.0
flake8==3.7.9 flake8==3.7.9
pillow pillow

View file

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

View file

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