164 lines
4.6 KiB
YAML
164 lines
4.6 KiB
YAML
# https://dev.azure.com/home-assistant
|
|
|
|
trigger:
|
|
batch: true
|
|
branches:
|
|
include:
|
|
- master
|
|
tags:
|
|
include:
|
|
- '*'
|
|
exclude:
|
|
- untagged*
|
|
pr:
|
|
- master
|
|
|
|
variables:
|
|
- name: versionHadolint
|
|
value: 'v1.16.3'
|
|
- name: versionShellCheck
|
|
value: 'v0.6.0'
|
|
- name: versionBuilder
|
|
value: '3.2'
|
|
- name: versionWheels
|
|
value: '0.6'
|
|
- group: wheels
|
|
- group: docker
|
|
|
|
jobs:
|
|
|
|
- job: 'Hadolint'
|
|
pool:
|
|
vmImage: 'ubuntu-16.04'
|
|
steps:
|
|
- script: sudo docker pull hadolint/hadolint:$(versionHadolint)
|
|
displayName: 'Install Hadolint'
|
|
- script: |
|
|
set -e
|
|
shopt -s globstar
|
|
for dockerfile in **/Dockerfile
|
|
do
|
|
echo "Linting: $dockerfile"
|
|
sudo docker run --rm -i \
|
|
-v $(pwd)/.hadolint.yaml:/.hadolint.yaml:ro \
|
|
hadolint/hadolint:$(versionHadolint) < "$dockerfile"
|
|
done
|
|
displayName: 'Run Hadolint'
|
|
|
|
|
|
- job: 'ShellCheck'
|
|
pool:
|
|
vmImage: 'ubuntu-16.04'
|
|
steps:
|
|
- script: sudo docker pull koalaman/shellcheck:$(versionShellCheck)
|
|
displayName: 'Install ShellCheck'
|
|
- script: |
|
|
shopt -s globstar
|
|
sudo docker run --rm -i \
|
|
-v $(pwd):/mnt:ro koalaman/shellcheck:$(versionShellCheck) **/*.sh
|
|
displayName: 'Run ShellCheck'
|
|
|
|
|
|
- job: 'Landingpage'
|
|
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags'), succeeded('Hadolint'), succeeded('ShellCheck'))
|
|
dependsOn:
|
|
- 'Hadolint'
|
|
- 'ShellCheck'
|
|
pool:
|
|
vmImage: 'ubuntu-16.04'
|
|
steps:
|
|
- script: sudo docker login -u $(dockerUser) -p $(dockerPassword)
|
|
displayName: 'Docker hub login'
|
|
- script: sudo docker pull homeassistant/amd64-builder:$(versionBuilder)
|
|
displayName: 'Install Builder'
|
|
- script: |
|
|
sudo docker run --rm --privileged \
|
|
-v ~/.docker:/root/.docker \
|
|
-v /run/docker.sock:/run/docker.sock:rw -v $(pwd):/data:ro \
|
|
homeassistant/amd64-builder:$(versionBuilder) --homeassistant-landingpage ALL \
|
|
-t /data/landingpage --docker-hub homeassistant
|
|
displayName: 'Build Landingpage'
|
|
|
|
|
|
- job: 'Wheels'
|
|
condition: eq(variables['Build.SourceBranchName'], 'master')
|
|
timeoutInMinutes: 360
|
|
pool:
|
|
vmImage: 'ubuntu-16.04'
|
|
strategy:
|
|
maxParallel: 3
|
|
matrix:
|
|
amd64:
|
|
buildArch: 'amd64'
|
|
i386:
|
|
buildArch: 'i386'
|
|
armhf:
|
|
buildArch: 'armhf'
|
|
armv7:
|
|
buildArch: 'armv7'
|
|
aarch64:
|
|
buildArch: 'aarch64'
|
|
steps:
|
|
- script: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
qemu-user-static \
|
|
binfmt-support
|
|
|
|
sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
|
|
sudo update-binfmts --enable qemu-arm
|
|
sudo update-binfmts --enable qemu-aarch64
|
|
displayName: 'Initial cross build'
|
|
- script: |
|
|
mkdir -p .ssh
|
|
echo -e "-----BEGIN RSA PRIVATE KEY-----\n$(wheelsSSH)\n-----END RSA PRIVATE KEY-----" >> .ssh/id_rsa
|
|
ssh-keyscan -H $(wheelsHost) >> .ssh/known_hosts
|
|
chmod 600 .ssh/*
|
|
displayName: 'Install ssh key'
|
|
- script: sudo docker pull homeassistant/$(buildArch)-wheels:$(versionWheels)
|
|
displayName: 'Install wheels builder'
|
|
- script: |
|
|
sudo docker run --rm -v $(pwd):/data:ro -v $(pwd)/.ssh:/root/.ssh:rw \
|
|
homeassistant/$(buildArch)-wheels:$(versionWheels) \
|
|
--apk "build-base;mariadb-dev;postgresql-dev;freetds-dev;libffi-dev;cmake;ncurses;git" \
|
|
--index $(wheelsIndex) \
|
|
--requirement base/requirements.txt \
|
|
--upload rsync \
|
|
--remote wheels@$(wheelsHost):/opt/wheels
|
|
displayName: 'Run wheels build'
|
|
|
|
|
|
- job: 'HomeAssistant_Base'
|
|
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags'), succeeded('Hadolint'), succeeded('ShellCheck'))
|
|
dependsOn:
|
|
- 'Hadolint'
|
|
- 'ShellCheck'
|
|
timeoutInMinutes: 360
|
|
pool:
|
|
vmImage: 'ubuntu-16.04'
|
|
strategy:
|
|
maxParallel: 3
|
|
matrix:
|
|
amd64:
|
|
buildArch: 'amd64'
|
|
i386:
|
|
buildArch: 'i386'
|
|
armhf:
|
|
buildArch: 'armhf'
|
|
armv7:
|
|
buildArch: 'armv7'
|
|
aarch64:
|
|
buildArch: 'aarch64'
|
|
steps:
|
|
- script: sudo docker login -u $(dockerUser) -p $(dockerPassword)
|
|
displayName: 'Docker hub login'
|
|
- script: sudo docker pull homeassistant/amd64-builder:$(versionBuilder)
|
|
displayName: 'Install Builder'
|
|
- script: |
|
|
sudo docker run --rm --privileged \
|
|
-v ~/.docker:/root/.docker \
|
|
-v /run/docker.sock:/run/docker.sock:rw -v $(pwd):/data:ro \
|
|
homeassistant/amd64-builder:$(versionBuilder) --homeassistant-base $(Build.SourceBranchName) \
|
|
"--$(buildArch)" -t /data/base --docker-hub homeassistant
|
|
displayName: 'Build Home Assistant Base'
|