diff options
| -rw-r--r-- | azure-pipelines.yml | 42 | 
1 files changed, 28 insertions, 14 deletions
| diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5c3a799..30d8166 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,20 +7,32 @@ jobs:    pool:      vmImage: 'Ubuntu-16.04' -  steps: -  - task: UsePythonVersion@0 -    displayName: 'Set Python Version' -    inputs: -      versionSpec: '3.7.x' -      addToPath: true +  - script: docker build -t pythondiscord/snekbox-base:latest -f docker/base.Dockerfile . +    displayName: 'Build Base Image' -  - script: pip3 install pipenv -    displayName: 'Install Pipenv' +  - script: | +      docker build -t pythondiscord/snekbox-venv:dev -f docker/venv.Dockerfile --build-arg DEV=1 . +    displayName: 'Build Development Image' -  - script: pipenv install --dev --deploy --system -    displayName: 'Install Dependencies with Pipenv' +  - script: | +      docker run \ +        -td \ +        --name snekbox_test \ +        --privileged \ +        --network host \ +        -h pdsnk-dev \ +        -e PYTHONDONTWRITEBYTECODE=1 \ +        -e PIPENV_PIPFILE="/snekbox/Pipfile" \ +        -e ENV="${PWD}/scripts/.profile" \ +        -v "${PWD}":"${PWD}" \ +        -w "${PWD}"\ +        --entrypoint /bin/ash \ +        pythondiscord/snekbox-venv:dev +    displayName: 'Start Container' -  - script: python3 -m flake8 --format junit-xml --output-file test-lint.xml +  - script: | +      docker exec -it snekbox_test /bin/ash -c \ +        'pipenv run lint --format junit-xml --output-file test-lint.xml'      displayName: 'Run Linter'    - task: PublishTestResults@2 @@ -30,7 +42,9 @@ jobs:        testResultsFiles: '**/test-lint.xml'        testRunTitle: 'Lint Results' -  - script: coverage run -m xmlrunner +  - script: | +      docker exec -it snekbox_test /bin/ash -c \ +        'pipenv run coverage run -m xmlrunner'      displayName: 'Run Unit Tests'    - task: PublishTestResults@2 @@ -41,8 +55,8 @@ jobs:        testRunTitle: 'Test Results'    - script: | -      coverage xml -      coverage report +      docker exec -it snekbox_test /bin/ash -c \ +        'pipenv run coverage xml && pipenv run coverage html'      displayName: 'Generate Coverage Report'    - task: PublishCodeCoverageResults@1 | 
