plugin-cli/azure-pipelines.yml

87 lines
2.4 KiB
YAML

# https://dev.azure.com/home-assistant
trigger:
branches:
include:
- master
tags:
include:
- '*'
exclude:
- untagged*
pr:
- master
variables:
versionHadolint: 'v1.17.3'
versionShellCheck: 'v0.7.0'
versionBuilder: '7.1'
jobs:
- job: 'Hadolint'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: sudo docker pull hadolint/hadolint:$(versionHadolint)
displayName: 'Install Hadolint'
- script: |
sudo docker run --rm -i \
-v $(pwd)/.hadolint.yaml:/.hadolint.yaml:ro \
hadolint/hadolint:$(versionHadolint) < Dockerfile
displayName: 'Run Hadolint'
- job: 'ShellCheck'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: sudo docker pull koalaman/shellcheck:$(versionShellCheck)
displayName: 'Install ShellCheck'
- script: |
sudo docker run --rm -i \
-v $(pwd):/mnt:ro koalaman/shellcheck:$(versionShellCheck) *.sh
displayName: 'Run ShellCheck'
- job: 'ReleaseDEV'
condition: and(eq(variables['Build.SourceBranchName'], 'master'), succeeded('Hadolint'), succeeded('ShellCheck'))
dependsOn:
- 'Hadolint'
- 'ShellCheck'
pool:
vmImage: 'ubuntu-latest'
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) \
--generic dev --all -t /data
displayName: 'Build DEV'
- job: 'Release'
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags'), succeeded('Hadolint'), succeeded('ShellCheck'))
dependsOn:
- 'Hadolint'
- 'ShellCheck'
pool:
vmImage: 'ubuntu-latest'
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) \
--generic $(Build.SourceBranchName) --all -t /data
displayName: 'Build Release'