Skip to content

Commit

Permalink
Merge pull request #1 from FlorianVeaux/flo/add_azure
Browse files Browse the repository at this point in the history
Add azure pipelines
  • Loading branch information
FlorianVeaux authored Sep 19, 2019
2 parents a185c95 + 36920c3 commit 87133d9
Show file tree
Hide file tree
Showing 12 changed files with 560 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .azure-pipelines/all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
schedules:
- cron: "0 5 * * *"
displayName: Nightly (EDT/EST)
always: true
branches:
include:
- master

trigger: none
# Re-enable when we have enough runners
# trigger:
# branches:
# include:
# - master

pr:
branches:
include:
- master

variables:
DDEV_COLOR: 1

jobs:
- template: './templates/test-all.yml'
22 changes: 22 additions & 0 deletions .azure-pipelines/changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
trigger: none

pr:
branches:
include:
- master

variables:
DDEV_COLOR: 1

jobs:
- template: './templates/test-single-linux.yml'
parameters:
job_name: Changed
display: Linux
validate: true

- template: './templates/test-single-windows.yml'
parameters:
job_name: Changed
check: '--changed none_yet'
display: Windows
24 changes: 24 additions & 0 deletions .azure-pipelines/scripts/aerospike/linux/55_build_client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -ex

# https://github.com/aerospike/aerospike-client-c#build-prerequisites
sudo apt-get update
sudo apt-get install -y --no-install-recommends libc6-dev libssl-dev autoconf automake libtool g++ ncurses-dev

# The binary wheels on PyPI are not yet compatible with OpenSSL 1.1.0+, see:
# https://github.com/aerospike/aerospike-client-python/issues/214#issuecomment-385451007
# https://github.com/aerospike/aerospike-client-python/issues/227#issuecomment-423220411
git clone https://github.com/aerospike/aerospike-client-c.git /tmp/aerospike-client-c
cd /tmp/aerospike-client-c

# This needs to be kept in sync with whatever the Python library was built with.
# For example, version 3.7.2 was built with version 4.6.3 of the C library, see:
# https://github.com/aerospike/aerospike-client-python/blob/3.7.2/setup.py#L32-L33
git checkout 4.4.0

git submodule update --init
make clean
make

set +ex
60 changes: 60 additions & 0 deletions .azure-pipelines/scripts/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import os
import platform
import re
import subprocess
import sys

HERE = os.path.dirname(os.path.abspath(__file__))
PLATFORM = (
'windows' if platform.system() == 'Windows'
else 'macos' if platform.system() == 'Darwin'
else 'linux'
)


def display_action(script_file):
display_header = f'Running: {script_file}'
print(f'\n{display_header}\n{"-" * len(display_header)}\n')


def main():
checks = [c.strip() for c in sys.argv[1:]]

if checks:
if checks[0] == 'skip':
print('Skipping set up')
else:
print(f'Checks chosen: {repr(checks).strip("[]")}')
else:
print(f'Checks chosen: changed')

command = ['ddev', '--no-color', 'test', '--list']
command.extend(checks)

print('Detecting changed checks...')
result = subprocess.run(command, encoding='utf-8', capture_output=True, check=True)
checks = sorted(c.strip('`') for c in re.findall('^`[^`]+`', result.stdout, re.M))

for check in checks:
check_path = os.path.join(HERE, check)
if not os.path.isdir(check_path):
continue

contents = os.listdir(check_path)
if 'run.py' in contents:
script_file = os.path.join(check_path, 'run.py')
display_action(script_file)
subprocess.run([sys.executable, script_file], check=True)
elif PLATFORM in contents:
print(f'\nSetting up: {check}')
scripts_path = os.path.join(check_path, PLATFORM)
scripts = sorted(os.listdir(scripts_path))

for script in scripts:
script_file = os.path.join(scripts_path, script)
display_action(script_file)
subprocess.run([script_file], shell=True, check=True)


if __name__ == '__main__':
main()
24 changes: 24 additions & 0 deletions .azure-pipelines/templates/checkout-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
steps:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema#checkout
- checkout: self
fetchDepth: 3

# Azure checks out the code from the PR but leaves us in a detached state.
# Because ddev cannot work in that state, we create a branch.
# Only applies to PRs
- script: git checkout -B $(System.PullRequest.SourceBranch)
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: 'Create branch from PR'

# Azure pulls a commit hash via git fetch rather than clone so
# we checkout the branches we need which also gets us out of a
# detached HEAD state. This may be fixed soon, see:
# https://developercommunity.visualstudio.com/content/problem/373462/git-get-sources-shallow-fetch-is-broken-subject-to.html
- script: git checkout master
displayName: 'Checkout master'

# Switch to the pull request branch last. Also see:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables#system-variables
- script: git checkout $(System.PullRequest.SourceBranch)
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: 'Checkout branch'
25 changes: 25 additions & 0 deletions .azure-pipelines/templates/install-deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
steps:
# Install the Python version with which to use globally last as
# these tasks prepend to PATH instead of appending to it. See:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-python-version
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7'
displayName: 'Use Python 2.7'

- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
displayName: 'Use Python 3.7'

- script: python -m pip install --disable-pip-version-check --upgrade pip setuptools
displayName: 'Upgrade Python packaging tools'

- script: pip install --disable-pip-version-check git+git://github.com/ofek/codecov-python.git@73271695d5e8ab2d6538a06e63b400f163f26487
displayName: 'Install Codecov'

- script: pip install datadog-checks-dev[cli]
displayName: 'Install ddev'

- script: ddev config set extras . && ddev config set repo extras
displayName: 'Configure ddev'
13 changes: 13 additions & 0 deletions .azure-pipelines/templates/run-validations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
steps:

- script: ddev validate config
displayName: 'Validate default configuration files'

- script: ddev validate manifest -i
displayName: 'Validate manifest files'

- script: ddev validate metadata
displayName: 'Validate metric data'

- script: ddev validate service-checks
displayName: 'Validate service check data'
7 changes: 7 additions & 0 deletions .azure-pipelines/templates/set-up-integrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
check: ''

steps:
# Need unbuffered IO, see: https://github.com/Microsoft/azure-pipelines-yaml/issues/106
- script: python -u .azure-pipelines/scripts/run.py ${{ parameters.check }}
displayName: 'Set up integration requirements'
5 changes: 5 additions & 0 deletions .azure-pipelines/templates/set-up-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
steps:
# Newer versions of Windows require this for full use of psutil.
# See: https://github.com/giampaolo/psutil/issues/351
- script: diskperf -y
displayName: 'Enable disk performance counters'
Loading

0 comments on commit 87133d9

Please sign in to comment.