-
Notifications
You must be signed in to change notification settings - Fork 9
Azure pipeline #262
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
Azure pipeline #262
Changes from 1 commit
b30ac22
658bae8
5377dd9
cd28a47
5942dd6
da8c55c
a5f381c
4d98086
2fd38ba
a17e3da
54534d3
9bb3535
bd08e8f
a639ff5
0cdfd74
f35d489
d0170c0
322abe9
4c13fb4
9f16bf4
7f5dd9f
625a973
68a3614
e6eebd9
e11c639
6ddecc8
65651f0
f477e86
f511546
b8d7e99
f47fe0c
687a107
24cd5ec
f91870e
fc34b07
ddcb2b2
15ab9f2
e0e04b2
7ac1925
a14e8a0
f7241df
5c3adb9
7ba0bc2
0c97b1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,104 @@ | ||||||
jobs: | ||||||
- job: 'Test' | ||||||
pool: | ||||||
vmImage: 'vs2017-win2016' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Consider adding support for OSX as well as Windows. https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started-multiplatform?view=azure-devops#add-additional-platforms There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not originally part of the spec, but easy change :) |
||||||
strategy: | ||||||
matrix: | ||||||
Python27-x64: | ||||||
python.version: '2.7' | ||||||
architecture: 'x64' | ||||||
# Python34-x64: | ||||||
# python.version: '3.4' | ||||||
# architecture: 'x64' | ||||||
Python35-x64: | ||||||
python.version: '3.5' | ||||||
architecture: 'x64' | ||||||
Python36-x64: | ||||||
python.version: '3.6' | ||||||
architecture: 'x64' | ||||||
Python37-x64: | ||||||
python.version: '3.7' | ||||||
architecture: 'x64' | ||||||
Python27-x86: | ||||||
python.version: '2.7' | ||||||
architecture: 'x86' | ||||||
# Python34-x86: | ||||||
# python.version: '3.4' | ||||||
# architecture: 'x86' | ||||||
Python35-x86: | ||||||
python.version: '3.5' | ||||||
architecture: 'x86' | ||||||
Python36-x86: | ||||||
python.version: '3.6' | ||||||
architecture: 'x86' | ||||||
Python37-x86: | ||||||
python.version: '3.7' | ||||||
architecture: 'x86' | ||||||
|
||||||
steps: | ||||||
# I would not have found on my own such a step. Thanks https://dvlup.com/2019/01/03/using-powershell-to-installing-msi-in-a-devops-build/ | ||||||
# The solution I found was not working: it hanged forevever, using "msiexec /i" | ||||||
- powershell: Invoke-WebRequest -Uri https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi -OutFile VCForPython27.msi | ||||||
displayName: 'Download Microsoft Visual C++ 9.0 from https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi' | ||||||
condition: eq(variables['python.version'], 2.7) | ||||||
- powershell: Start-Process VCForPython27.msi -ArgumentList "/q" -Wait | ||||||
displayName: 'Install Microsoft Visual C++ 9.0.' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this required? I'm guessing for installing If so I think we should add a note in the docs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may indeed be related to
|
||||||
condition: eq(variables['python.version'], 2.7) | ||||||
# - script: | | ||||||
# wget -O VCForPython27.msi https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi | ||||||
# msiexec.exe /i VCForPython27.msi | ||||||
# displayName: 'Install Microsoft Visual C++ 10.0 from https://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/winsdk_web.exe' | ||||||
# condition: eq(variables['python.version'], 3.4) | ||||||
- task: UsePythonVersion@0 | ||||||
inputs: | ||||||
versionSpec: '$(python.version)' | ||||||
architecture: '$(architecture)' | ||||||
|
||||||
# Add additional tasks to run using each Python version in the matrix above | ||||||
- script: | | ||||||
python --version | ||||||
python -c "import struct; print(struct.calcsize('P') * 8)" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can remove this whole task - the struct check isn't required anymore and the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
displayName: 'Python version and architecture' | ||||||
env: | ||||||
INCLUDE_CLI: 1 | ||||||
- script: | | ||||||
python -m pip install --upgrade pip | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for consistency with the following commands use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
python -m pip install -U wheel setuptools codecov | ||||||
python -m pip install -U -r requirements.txt | ||||||
python -m pip install . | ||||||
displayName: 'Pip installs' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
env: | ||||||
INCLUDE_CLI: 1 | ||||||
- script: python -m pytest --cov=clkhash --junitxml=testResults.xml --cov-report=xml:coverageReport.xml | ||||||
displayName: 'Run the tests' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this is useful, as this step is already part of the job stating the operating system and all. |
||||||
env: | ||||||
INCLUDE_CLI: 1 | ||||||
- task: PublishTestResults@2 | ||||||
condition: succeeded() | ||||||
displayName: 'Publish test results' | ||||||
inputs: | ||||||
testResultsFormat: 'JUnit' | ||||||
testResultsFiles: 'testResults.xml' | ||||||
testRunTitle: 'Test results python$(python.version), $(architecture)' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will also include the operating system, but I will not add "Publish" at the beginning: this name us used for the test result report name, not for the task of publishing. This name is then shown in the test tab of the build: https://dev.azure.com/data61/Anonlink/_build/results?buildId=40&view=ms.vss-test-web.build-test-results-tab To see it, you need to include the |
||||||
failTaskOnFailedTests: true | ||||||
- script: python -m codecov --token $(CODECOV_TOKEN) --file coverageReport.xml | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can also render codecov in azure - https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=azure-devops#publish-code-coverage-results There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
displayName: 'Send coverage to codecov' | ||||||
condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we send codecov reports every version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
- script: | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get the feeling that this should be a new deployment stage? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I thought about it but creating a new job or stage would imply re-installing all the dependencies (as each job uses a different VM). So I chose speed over prettiness of stages/jobs/tasks. But happy to change if preferred. |
||||||
pyinstaller cli.spec | ||||||
.\dist\clkutil.exe --version | ||||||
displayName: 'Build clkutil.exe' | ||||||
condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this condition needs to check that Agent.OS is windows There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
- script: python setup.py bdist_wheel | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(Build the source distribution too) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
displayName: 'Build wheel' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) | ||||||
- script: | | ||||||
pip install twine | ||||||
twine upload -u $(PYPI_LOGIN) -p $(PYPI_PASSWORD) --skip-existing dist/*.whl | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note there is a builtin twine auth task: https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=azure-devops#authenticate-with-twine There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm actually not sure when the auth task is useful as we still need to run the twine commands after... |
||||||
displayName: 'Send artifact to Pypi' | ||||||
condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) | ||||||
- task: PublishPipelineArtifact@0 | ||||||
inputs: | ||||||
artifactName: 'Windows artifacts' | ||||||
targetPath: dist/ | ||||||
condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment this job appears to test and package and publish... and just on Windows.