-
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 17 commits
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,93 @@ | ||
parameters: | ||
pythonVersions: [] | ||
operatingSystems: [] | ||
architectures: [] | ||
|
||
jobs: | ||
- job: 'test_and_publish' | ||
strategy: | ||
matrix: | ||
${{ each py in parameters.pythonVersions }}: | ||
${{ each os in parameters.operatingSystems }}: | ||
${{ each architecture in parameters.architectures }}: | ||
${{ format('{0}_Python_{1}_{2}', os, py, architecture) }}: | ||
pythonVersion: ${{ py }} | ||
operatingSystem: ${{ os }} | ||
architecture: ${{ architecture }} | ||
|
||
pool: | ||
vmImage: $(operatingSystem) | ||
|
||
displayName: 'Test and publish for ' | ||
|
||
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" | ||
# These steps are required because of at least the bitarray dependency (but maybe more). See issue #153 tracking if bitarray is still used. | ||
- 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['pythonVersion'], 2.7) | ||
- powershell: Start-Process VCForPython27.msi -ArgumentList "/q" -Wait | ||
displayName: 'Install Microsoft Visual C++ 9.0.' | ||
condition: and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], 2.7)) | ||
|
||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: '$(pythonVersion)' | ||
architecture: '$(architecture)' | ||
|
||
- script: | | ||
python -m pip install -U pip | ||
python -m pip install -U wheel setuptools codecov | ||
python -m pip install -U -r requirements.txt | ||
python -m pip install . | ||
displayName: 'Install requirements' | ||
|
||
- script: python -m pytest --cov=clkhash --junitxml=testResults.xml --cov-report=xml:coverageReport.xml --cov-report=html:htmlcov | ||
displayName: 'Test with pytest' | ||
env: | ||
INCLUDE_CLI: 1 | ||
|
||
- task: PublishTestResults@2 | ||
condition: succeeded() | ||
displayName: 'Publish test results' | ||
inputs: | ||
testResultsFormat: 'JUnit' | ||
testResultsFiles: 'testResults.xml' | ||
testRunTitle: 'Test results on a vm $(operatingSystem) ($(architecture)) for Python $(pythonVersion)' | ||
failTaskOnFailedTests: true | ||
|
||
- task: PublishCodeCoverageResults@1 | ||
# If the previous stage fail, we still want to run this one as the previous stage may fail because of a failing test. | ||
condition: succeededOrFailed() | ||
inputs: | ||
codeCoverageTool: Cobertura | ||
summaryFileLocation: 'coverageReport.xml' | ||
# Seems to create warning as this step is already creating its own html pages. | ||
# reportDirectory: 'htmlcov' | ||
failIfCoverageEmpty: true | ||
|
||
- script: python -m codecov --token $(CODECOV_TOKEN) --file coverageReport.xml | ||
displayName: 'Send coverage to codecov' | ||
|
||
- script: | | ||
pyinstaller cli.spec | ||
.\dist\clkutil.exe --version | ||
displayName: 'Build clkutil.exe' | ||
condition: and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) | ||
|
||
- script: python setup.py sdist bdist_wheel | ||
displayName: 'Package' | ||
condition: and(eq(variables['pythonVersion'], '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 package for every combo, and move this up (after installing requirements). we can remove line 43 ( 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. Changed, but could you check that it is doing what you would like? I didn't provide to pytest the dist, and it's still working. |
||
|
||
- script: | | ||
pip install twine | ||
twine upload -u $(PYPI_LOGIN) -p $(PYPI_PASSWORD) --skip-existing dist/*.whl | ||
displayName: 'Send artifact to Pypi' | ||
condition: and(eq(variables['pythonVersion'], '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. Should only publish to pypi on tagged commit, or for now perhaps only when manually chosen? Now that you're publishing the pipeline artifact can this easily be moved into own job? 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. The issue with tagged commits is that the tagging is usually happening after the commit have been pushed. So to still do that and have a manual confirmation, I had to create a release pipeline which should be triggered after a tagged version is built from master. |
||
|
||
- task: PublishPipelineArtifact@0 | ||
inputs: | ||
artifactName: "$(operatingSystem) artifacts" | ||
targetPath: dist/ | ||
condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
jobs: | ||
- template: .azurePipeline/wholeBuild.yml # Template reference | ||
parameters: | ||
pythonVersions: ['3.7', '3.6', '3.5', '2.7'] | ||
# operatingSystems: ['ubuntu-16.04', 'macos-10.13', 'vs2017-win2016'] | ||
operatingSystems: ['vs2017-win2016'] | ||
architectures: ['x64', '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.
Does this mean it won't publish test results if they don't all pass?
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.
Well seen :)