Skip to content

Commit

Permalink
update ci 🚀 (#18)
Browse files Browse the repository at this point in the history
* minor mypy / typing fixes

* update how to distribute and combine coverage for demos

* [docs] CMake docs layout changed

TODO: add Ninja Multi generator! ❤️

* upgrade pip for legacy py3.5.0 image

> NameError: name 'platform_system' is not defined
> You are using pip version 7.1.2, however version 20.0.2 is available.

* [azp] use `-latest` vmImages, add bi-weekly cron builds
  • Loading branch information
svenevs committed Feb 27, 2020
1 parent 60e8267 commit 2ac4933
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 24 deletions.
24 changes: 17 additions & 7 deletions .azure-pipelines.yml
Expand Up @@ -11,13 +11,23 @@ pr:
include:
- master

# Build roughly every other week.
# https://crontab.guru/#41_1_1,14_*_*
schedules:
- cron: "41 1 1,14 * *"
displayName: Cronomatic Bifurcated Build
branches:
include:
- master
always: true

jobs:
######################################################################################
# Linux :: Python :: 3.5, 3.6, 3.7 #
######################################################################################
- job: Linux_Python
pool:
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-latest'
steps:
- template: .ci/test_python_and_upload.yml
parameters:
Expand All @@ -36,7 +46,7 @@ jobs:
######################################################################################
- job: macOS_Python
pool:
vmImage: 'macos-10.13'
vmImage: 'macos-latest'
steps:
- template: .ci/test_python_and_upload.yml
parameters:
Expand All @@ -55,7 +65,7 @@ jobs:
######################################################################################
- job: Win64_Python
pool:
vmImage: 'vs2017-win2016'
vmImage: 'windows-latest'
steps:
- template: .ci/test_python_and_upload.yml
parameters:
Expand All @@ -74,7 +84,7 @@ jobs:
######################################################################################
- job: Linux_Demos
pool:
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-latest'
steps:
- template: .ci/run_demos.yml
parameters:
Expand All @@ -84,7 +94,7 @@ jobs:
######################################################################################
- job: macOS_Demos
pool:
vmImage: 'macos-10.13'
vmImage: 'macos-latest'
steps:
- template: .ci/run_demos.yml
parameters:
Expand All @@ -94,7 +104,7 @@ jobs:
######################################################################################
- job: Win64_Demos
pool:
vmImage: 'vs2017-win2016'
vmImage: 'windows-latest'
steps:
- template: .ci/run_demos.yml
parameters:
Expand All @@ -104,7 +114,7 @@ jobs:
######################################################################################
- job: Docs_Linkcheck
pool:
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
Expand Down
3 changes: 3 additions & 0 deletions .ci/run_demos.yml
Expand Up @@ -23,6 +23,9 @@ steps:
- script: |
tox -e demos -- custom_log_stage --animate
coverage run -a demos/ --help
# Coverage `run -p` creates .coverage.*** files for different processes.
# Combine them back into one file.
coverage combine -a .
coverage xml -o coverage.xml
displayName: Demos Full Coverage (IGNORE)
- script: |
Expand Down
7 changes: 6 additions & 1 deletion .ci/test_python_and_upload.yml
Expand Up @@ -19,4 +19,9 @@ steps:
- script: |
codecov --required -X gcov -f coverage.xml --name "[AzP] ${{ parameters.image_short }}-${{ parameters.py_version }}" -t $(CODECOV_TOKEN)
displayName: Upload Code Coverage for ${{ parameters.py_version }}
condition: succeeded()
# Skip uploading coverage for cron jobs, their coverage was already uploaded. The
# coverage data would be incomplete if we don't also schedule Travis at the same time...
# See also:
# - https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml
# - https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest'))
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -20,6 +20,7 @@ matrix:
- docker run -itd --name py350 python:3.5.0 /bin/sh
- docker cp . py350:/data
install:
- docker exec py350 pip install -U pip
- docker exec py350 pip install tox
script:
- docker exec --workdir /data py350 tox -e py -- --cov-report xml:coverage.xml --cov
Expand Down
2 changes: 1 addition & 1 deletion ci_exec/core.py
Expand Up @@ -27,7 +27,7 @@
try:
from typing import NoReturn
except ImportError:
NoReturn = None
NoReturn = None # type: ignore

from .colorize import Colors, Styles, colorize

Expand Down
6 changes: 3 additions & 3 deletions ci_exec/parsers/cmake_parser.py
Expand Up @@ -258,8 +258,8 @@ class CMakeParser(argparse.ArgumentParser):
"""
The `Ninja Generator`__.
__ https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#ninja-generator
""" # noqa: E501
__ https://cmake.org/cmake/help/latest/generator/Ninja.html
"""

visual_studio_generators = {
"Visual Studio 9 2008",
Expand Down Expand Up @@ -620,7 +620,7 @@ def remove(self, *args: str):
# Only ok because we only support removing optional arguments, not
# positional arguments.
self._handle_conflict_resolve( # type: ignore
None, [(found_arg.option_strings[0], found_arg)]
found_arg, [(found_arg.option_strings[0], found_arg)]
)
else:
missing.append(item)
Expand Down
4 changes: 2 additions & 2 deletions demos/__main__.py
Expand Up @@ -223,9 +223,9 @@ def mock_shell(program: str, *, cwd: str, delay: float, animated: bool):
elif exe_name in {"python", "python3"}:
# Use `coverage run` rather than python to get coverage of demo.
if "-c" not in cmd_line and CI_EXEC_DEMOS_COVERAGE:
# Create: `coverage` [run, -a, ... other args ...]
# Create: `coverage` [run, -p, ... other args ...]
exe_name = "coverage"
cmd_line.insert(0, "-a") # append
cmd_line.insert(0, "-p") # parallel
cmd_line.insert(0, "run")
else:
exe_name = sys.executable
Expand Down
16 changes: 6 additions & 10 deletions tox.ini
Expand Up @@ -55,19 +55,15 @@ skip_install = true
deps =
coverage
commands =
# We have to run coverage in append mode (both here and in demos/__main__.py),
# otherwise things will overwrite. Expected usage in the CI runs is:
# Intended use case of this in CI is to do multiple passes, e.g.:
#
# tox -e demos -- <demo name>
# tox -e demos -- <demo name> --animate
# So append is useful to get full coverage in both scenarios (running with / without
# the --animate flag, as well as nested subprocess calls to the actual demo from
# within the shell "programs" in demos/__main__.py).
#
# The implication: this coverage file gets deleted when you run `tox -e py`, but
# will append to the results of `tox -e py` if you do `tox -e demos` afterward. For
# the actual coverage gathering this isn't a big deal since they are run in separate
# CI build machines. It's just worth being explicit how / why this works this way.
coverage run -a demos/ {posargs}
# We run things in parallel, as well as demos/__main__.py invokes the "shell"
# scripts with `coverage run -p <...>` as well. The implication: after running
# everything, we need to `coverage combine -a` on CI to merge all results.
coverage run -p demos/ {posargs}

[testenv:docs]
deps =
Expand Down

0 comments on commit 2ac4933

Please sign in to comment.