Skip to content

Set up CI with Azure Pipelines #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ commands:
- run:
name: Enforce styling
command: python -m flake8
combine_and_send_coverage:
steps:
- run:
name: Combine all coverage results
command: python -m coverage combine .coverage packages/*/.coverage
- run:
name: Send coverage results to coveralls
command: python -m coveralls
jobs:
test_python27:
docker:
Expand All @@ -83,7 +75,6 @@ jobs:
- image: python:3.7-stretch
steps:
- setup_and_run_tests
- combine_and_send_coverage

style_enforcement:
docker:
Expand Down
121 changes: 121 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
jobs:
-
job: Test
strategy:
matrix:
LinuxPython27:
python.version: '2.7'
imageName: ubuntu-16.04
extraActions: 'false'
LinuxPython35:
python.version: '3.5'
imageName: ubuntu-16.04
extraActions: 'false'
LinuxPython36:
python.version: '3.6'
imageName: ubuntu-16.04
extraActions: 'false'
LinuxPython37:
python.version: '3.7'
imageName: ubuntu-16.04
extraActions: 'true'
MacPython27:
python.version: '2.7'
imageName: macos-10.13
extraActions: 'false'
MacPython35:
python.version: '3.5'
imageName: macos-10.13
extraActions: 'false'
MacPython36:
python.version: '3.6'
imageName: macos-10.13
extraActions: 'false'
MacPython37:
python.version: '3.7'
imageName: macos-10.13
extraActions: 'false'
WindowsPython27:
python.version: '2.7'
imageName: vs2017-win2016
extraActions: 'false'
WindowsPython35:
python.version: '3.5'
imageName: vs2017-win2016
extraActions: 'false'
WindowsPython36:
python.version: '3.6'
imageName: vs2017-win2016
extraActions: 'false'
WindowsPython37:
python.version: '3.7'
imageName: vs2017-win2016
extraActions: 'false'
maxParallel: 10
pool:
vmImage: $(imageName)
steps:
-
task: UsePythonVersion@0
inputs:
versionSpec: $(python.version)
architecture: x64
-
script: 'python -m pip install --upgrade pip && pip install -r test_requirements.txt && pip install pytest'
displayName: 'Install mbed-os test dependencies'
-
script: |
pip install --user flake8
python -m flake8
condition: eq(variables['extraActions'], 'true')
displayName: 'Enforce code style'
-
script: "python -m coverage run setup.py test"
displayName: "Test mbed-os-tools"
-
script: "pip install ."
displayName: "Install mbed-os-tools"
-
script: 'pip install . && pip install -r test_requirements.txt'
displayName: 'Install mbed-ls'
workingDirectory: 'packages/mbed-ls'
-
script: 'pip install . && pip install -r test_requirements.txt'
displayName: 'Install mbed-host-tests'
workingDirectory: 'packages/mbed-host-tests'
-
script: 'pip install . && pip install -r test_requirements.txt'
displayName: 'Install mbed-greentea'
workingDirectory: 'packages/mbed-greentea'
-
script: "python -m coverage run setup.py test"
displayName: "Test mbed-ls"
workingDirectory: 'packages/mbed-ls'
-
script: "python -m coverage run setup.py test"
displayName: "Test mbed-host-tests"
workingDirectory: 'packages/mbed-host-tests'
-
script: "python -m coverage run setup.py test"
displayName: "Test mbed-greentea"
workingDirectory: 'packages/mbed-greentea'
-
script: |
python -m coverage combine .coverage packages/*/.coverage
python -m coveralls
condition: eq(variables['extraActions'], 'true')
displayName: 'Send coverage results to coveralls'
-
job: Build
dependsOn: Test
pool:
vmImage: Ubuntu-16.04
steps:
-
task: UsePythonVersion@0
inputs:
versionSpec: 3.x
architecture: x64
-
script: 'python setup.py sdist'
displayName: 'Build sdist'
3 changes: 2 additions & 1 deletion packages/mbed-greentea/test/mbed_gt_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ def test_get_greentea_version(self):
def test_print_version(self):
version = mbed_greentea_cli.get_greentea_version()

old_stdout = sys.stdout
sys.stdout = stdout_capture = six.StringIO()
mbed_greentea_cli.print_version()
sys.stdout = sys.__stdout__
sys.stdout = old_stdout

printed_version = stdout_capture.getvalue().splitlines()[0]
self.assertEqual(printed_version, version)
Expand Down
6 changes: 4 additions & 2 deletions packages/mbed-greentea/test/mbed_gt_cmake_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ def test_list_binaries_for_targets(self):
full_path = os.path.join(root_path, "resources")

def run_and_capture(path, verbose=False):
old_stdout = sys.stdout
sys.stdout = stdout_capture = six.StringIO()
cmake_handlers.list_binaries_for_targets(build_dir=path, verbose_footer=verbose)
sys.stdout = sys.__stdout__
sys.stdout = old_stdout

return stdout_capture.getvalue()

Expand All @@ -128,9 +129,10 @@ def test_list_binaries_for_builds(self):

for verbose in [True, False]:
# Capture logging output
old_stdout = sys.stdout
sys.stdout = stdout_capture = six.StringIO()
cmake_handlers.list_binaries_for_builds(spec, verbose_footer=verbose)
sys.stdout = sys.__stdout__
sys.stdout = old_stdout

output = stdout_capture.getvalue()
self.assertTrue("available tests for build 'K64F-ARM'" in output)
Expand Down
3 changes: 2 additions & 1 deletion packages/mbed-greentea/test/mbed_gt_report_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ def test_export_to_file(self):
payload = "PAYLOAD"
filepath = "."

old_stdout = sys.stdout
sys.stdout = stdout_capture = six.StringIO()
result = mbed_report_api.export_to_file(filepath, payload)
sys.stdout = sys.__stdout__
sys.stdout = old_stdout

command_output = stdout_capture.getvalue().splitlines()[0]
self.assertIn("file failed:", command_output)
Expand Down
6 changes: 4 additions & 2 deletions test/test/mbed_gt_cmake_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ def test_list_binaries_for_targets(self):
full_path = os.path.join(root_path, "resources")

def run_and_capture(path, verbose=False):
old_stdout = sys.stdout
sys.stdout = stdout_capture = six.StringIO()
cmake_handlers.list_binaries_for_targets(build_dir=path, verbose_footer=verbose)
sys.stdout = sys.__stdout__
sys.stdout = old_stdout

return stdout_capture.getvalue()

Expand All @@ -126,9 +127,10 @@ def test_list_binaries_for_builds(self):

for verbose in [True, False]:
# Capture logging output
old_stdout = sys.stdout
sys.stdout = stdout_capture = six.StringIO()
cmake_handlers.list_binaries_for_builds(spec, verbose_footer=verbose)
sys.stdout = sys.__stdout__
sys.stdout = old_stdout

output = stdout_capture.getvalue()
self.assertTrue("available tests for build 'K64F-ARM'" in output)
Expand Down
3 changes: 2 additions & 1 deletion test/test/mbed_gt_report_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ def test_export_to_file(self):
payload = "PAYLOAD"
filepath = "."

old_stdout = sys.stdout
sys.stdout = stdout_capture = six.StringIO()
result = mbed_report_api.export_to_file(filepath, payload)
sys.stdout = sys.__stdout__
sys.stdout = old_stdout

command_output = stdout_capture.getvalue().splitlines()[0]
self.assertIn("file failed:", command_output)
Expand Down