Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli committed Oct 14, 2019
2 parents 4a270ff + e38b969 commit 2542082
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 158 deletions.
41 changes: 41 additions & 0 deletions azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# https://dev.azure.com/home-assistant

trigger:
batch: true
branches:
include:
- master
- dev
pr:
- dev
variables:
- name: versionHadolint
value: 'v1.16.3'

jobs:

- job: 'Tox'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '3.7'
- script: pip install tox
displayName: 'Install Tox'
- script: tox
displayName: 'Run Tox'


- 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'
78 changes: 78 additions & 0 deletions azure-pipelines-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# https://dev.azure.com/home-assistant

trigger:
tags:
include:
- '*'
pr: none
variables:
- name: versionBuilder
value: '4.4'
- group: docker
resources:
repositories:
- repository: azure
type: github
name: 'home-assistant/ci-azure'
endpoint: 'home-assistant'


stages:

- stage: 'Validate'
jobs:
- template: templates/azp-job-version.yaml@azure
parameters:
ignoreDev: true

- stage: 'Wheels'
jobs:
- template: templates/azp-job-wheels.yaml@azure
parameters:
jobName: 'Wheels_Alpine39'
builderVersion: 'dev-3.7-alpine3.9'
builderApk: 'build-base;libffi-dev;openssl-dev'
wheelsRequirement: 'requirements_all.txt'
preBuild:
- script: |
cat requirements.txt requirements_build.txt > requirements_all.txt
displayName: 'Prepare requirements'
- template: templates/azp-job-wheels.yaml@azure
parameters:
jobName: 'Wheels_Alpine310'
builderVersion: 'dev-3.7-alpine3.10'
builderApk: 'build-base;libffi-dev;openssl-dev'
wheelsRequirement: 'requirements_all.txt'
preBuild:
- script: |
cat requirements.txt requirements_build.txt > requirements_all.txt
displayName: 'Prepare requirements'
- stage: 'Release'
jobs:
- job: 'Release'
pool:
vmImage: 'ubuntu-latest'
strategy:
maxParallel: 2
matrix:
37-Alpine39:
buildPython: '3.7-alpine3.9'
buildArgs: ''
37-Alpine310:
buildPython: '3.7-alpine3.10'
buildArgs: '--release-tag'
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) \
--builder-wheels $(buildPython) --all \
$(buildArgs) --version $(Build.SourceBranchName) \
-t /data --docker-hub homeassistant
displayName: 'Build Release'
130 changes: 0 additions & 130 deletions azure-pipelines.yml

This file was deleted.

6 changes: 2 additions & 4 deletions builder/apk.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ def install_apks(apks: str) -> None:
"""Install all apk string formated as 'package1;package2'."""
packages = " ".join(apks.split(";"))

result = subprocess.run(
subprocess.run(
f"apk add --no-cache {packages}",
shell=True,
check=True,
stdout=sys.stdout,
stderr=sys.stderr,
)

# Check result of program
result.check_returncode()
24 changes: 8 additions & 16 deletions builder/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ def build_wheels_package(package: str, index: str, output: Path) -> None:
build_env = os.environ.copy()
build_env["MAKEFLAGS"] = f"-j{cpu}"

result = subprocess.run(
subprocess.run(
f'pip3 wheel --progress-bar ascii --wheel-dir {output} --find-links {index} "{package}"',
shell=True,
check=True,
stdout=sys.stdout,
stderr=sys.stderr,
env=build_env,
)

# Check result of program
result.check_returncode()


def build_wheels_requirement(requirement: Path, index: str, output: Path) -> None:
"""Build wheels from a requirements file into output."""
Expand All @@ -34,17 +32,15 @@ def build_wheels_requirement(requirement: Path, index: str, output: Path) -> Non
build_env = os.environ.copy()
build_env["MAKEFLAGS"] = f"-j{cpu}"

result = subprocess.run(
subprocess.run(
f"pip3 wheel --progress-bar ascii --wheel-dir {output} --find-links {index} --requirement {requirement}",
shell=True,
check=True,
stdout=sys.stdout,
stderr=sys.stderr,
env=build_env,
)

# Check result of program
result.check_returncode()


def build_wheels_local(index: str, output: Path) -> None:
"""Build wheels from a requirements file into output."""
Expand All @@ -54,17 +50,15 @@ def build_wheels_local(index: str, output: Path) -> None:
build_env = os.environ.copy()
build_env["MAKEFLAGS"] = f"-j{cpu}"

result = subprocess.run(
subprocess.run(
f"pip3 wheel --progress-bar ascii --wheel-dir {output} --find-links {index} .",
shell=True,
check=True,
stdout=sys.stdout,
stderr=sys.stderr,
env=build_env,
)

# Check result of program
result.check_returncode()


def parse_requirements(requirement: Path) -> List[str]:
"""Parse a requirement files into an array."""
Expand Down Expand Up @@ -102,12 +96,10 @@ def install_pips(index: str, pips: str) -> None:
"""Install all pipy string formated as 'package1;package2'."""
packages = " ".join(pips.split(";"))

result = subprocess.run(
subprocess.run(
f"pip install --upgrade --no-cache-dir --prefer-binary --find-links {index} {packages}",
shell=True,
check=True,
stdout=sys.stdout,
stderr=sys.stderr,
)

# Check result of program
result.check_returncode()
6 changes: 2 additions & 4 deletions builder/upload/rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

def upload(local: Path, remote: str) -> None:
"""Upload wheels from folder to remote rsync server."""
result = subprocess.run(
subprocess.run(
f"rsync -chrP {local}/* {remote}/",
shell=True,
check=True,
stdout=sys.stdout,
stderr=sys.stderr,
)

# Check result of program
result.check_returncode()
2 changes: 1 addition & 1 deletion requirements_build.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Cython==0.29.13
numpy==1.17.1
numpy==1.17.2
3 changes: 2 additions & 1 deletion requirements_tests.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
flake8==3.7.8
pylint==2.3.1
pylint==2.4.2
black==19.3b0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

VERSION = "1.3"
VERSION = "1.4"

setup(
name="builder",
Expand Down
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = lint
envlist = lint, black

[testenv]
deps =
Expand All @@ -12,3 +12,7 @@ ignore_errors = True
commands =
flake8 builder
pylint --rcfile pylintrc builder

[testenv:black]
commands =
black --target-version py36 --check builder setup.py

0 comments on commit 2542082

Please sign in to comment.