Skip to content

Commit

Permalink
finished migration to azure pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
hh-h authored Aug 28, 2020
1 parent c0e82c3 commit e05482a
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 56 deletions.
149 changes: 111 additions & 38 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,114 @@ trigger:
pr:
- master

pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Check:
python.version: '3.8'
tox.env: 'check'
Python36-asyncio:
python.version: '3.6'
tox.env: 'py36-asyncio'
Python36-uvloop:
python.version: '3.6'
tox.env: 'py36-uvloop'
Python37-asyncio:
python.version: '3.7'
tox.env: 'py37-asyncio'
Python37-uvloop:
python.version: '3.7'
tox.env: 'py37-uvloop'
Python38-asyncio:
python.version: '3.8'
tox.env: 'py38-asyncio'
Python38-uvloop:
python.version: '3.8'
tox.env: 'py38-uvloop'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
displayName: 'Use Python $(python.version)'

- script: pip install tox tox-docker==1.2.1
displayName: 'Install Tox'

- script: tox -e $(tox.env)
displayName: 'Run Tox'
resources:
containers:
- container: snmp
image: koshh/aiosnmp:latest
ports:
- 161:161/udp

jobs:
- job: check
pool:
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
architecture: 'x64'

- script: pip install mypy isort flake8 black
displayName: 'Install Dependencies'

- script: flake8 aiosnmp tests examples
displayName: 'Run flake8'

- script: isort -q --check --diff aiosnmp tests examples
displayName: 'Run isort'

- script: black -q --check --diff aiosnmp tests examples
displayName: 'Run black'

- script: mypy aiosnmp
displayName: 'Run mypy'

- job: tests
pool:
vmImage: 'ubuntu-latest'

strategy:
matrix:
Python36-asyncio:
python.version: '3.6'
loop: 'asyncio'
Python36-uvloop:
python.version: '3.6'
loop: 'uvloop'
Python37-asyncio:
python.version: '3.7'
loop: 'asyncio'
Python37-uvloop:
python.version: '3.7'
loop: 'uvloop'
Python38-asyncio:
python.version: '3.8'
loop: 'asyncio'
Python38-uvloop:
python.version: '3.8'
loop: 'uvloop'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
displayName: 'Use Python $(python.version)'

- script: docker ps
displayName: 'Docker PS'

- script: env
displayName: 'Env'

- script: pip install pytest-xdist pytest-asyncio pytest-cov uvloop codecov
displayName: 'Install Dependencies'

- script: pytest -n 1 --durations=5 --cov=aiosnmp --cov-report=term-missing --event-loop=$(loop)
displayName: 'Run Tests'

- script: bash <(curl -s https://codecov.io/bash)
displayName: 'Upload to codecov.io'

services:
snmp: snmp

- job: twine
pool:
vmImage: 'ubuntu-latest'

dependsOn:
- check
- tests
condition: and(succeeded(), startsWith(variables['build.sourceBranch'], 'refs/tags/'))

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
architecture: 'x64'

- script: pip install wheel twine
displayName: 'Install Dependencies'

- script: python setup.py bdist_wheel
displayName: 'Build'

- task: TwineAuthenticate@1
displayName: 'Twine Authenticate'
inputs:
pythonUploadServiceConnection: uploadToPypi

- script: python -m twine upload -r uploadToPypi --config-file $(PYPIRC_PATH) dist/*
displayName: 'Upload'
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ def pytest_generate_tests(metafunc):
if "host" in metafunc.fixturenames:
metafunc.parametrize("host", ["127.0.0.1", "localhost", "::1"])
if "port" in metafunc.fixturenames:
metafunc.parametrize("port", [int(os.environ["KOSHH/AIOSNMP_161_UDP"])])
metafunc.parametrize(
"port", [int(os.environ.get("KOSHH/AIOSNMP_161_UDP", 161))]
)
17 changes: 0 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
[tox]
envlist = check, py{36,37,38}-{asyncio,uvloop}

[travis]
python =
3.6: py36-{asyncio,uvloop}
3.7: py37-{asyncio,uvloop}
3.7-dev: py37-{asyncio,uvloop}
3.8: check, py38-{asyncio,uvloop}
3.8-dev: py38-{asyncio,uvloop}
nightly: py38-{asyncio,uvloop}

[travis:env]
EVENT_LOOP =
asyncio: check, asyncio
uvloop: check, uvloop

[testenv]
deps =
pytest
pytest-xdist
pytest-asyncio
pytest-cov
uvloop: uvloop
codecov
commands =
asyncio: pytest -n 1 --durations=5 --cov=aiosnmp --cov-report=term-missing --event-loop=asyncio {posargs}
uvloop: pytest -n 1 --durations=5 --cov=aiosnmp --cov-report=term-missing --event-loop=uvloop {posargs}
codecov -e TOXENV
docker =
koshh/aiosnmp:latest
passenv = TOXENV CI TRAVIS TRAVIS_* CODECOV_*

[testenv:check]
deps =
Expand Down

0 comments on commit e05482a

Please sign in to comment.