From b30ac221293a867a7f46bb5cd13f6ccfefde2c85 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Wed, 26 Jun 2019 14:28:43 +1000 Subject: [PATCH 01/43] Azure pipeline Can replace appveyor. --- azurePipeline.yml | 104 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 azurePipeline.yml diff --git a/azurePipeline.yml b/azurePipeline.yml new file mode 100644 index 00000000..61be5901 --- /dev/null +++ b/azurePipeline.yml @@ -0,0 +1,104 @@ +jobs: +- job: 'Test' + pool: + vmImage: 'vs2017-win2016' + 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.' + 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)" + displayName: 'Python version and architecture' + env: + INCLUDE_CLI: 1 + - script: | + python -m pip install --upgrade pip + python -m pip install -U wheel setuptools codecov + python -m pip install -U -r requirements.txt + python -m pip install . + displayName: 'Pip installs' + env: + INCLUDE_CLI: 1 + - script: python -m pytest --cov=clkhash --junitxml=testResults.xml --cov-report=xml:coverageReport.xml + displayName: 'Run the tests' + 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)' + failTaskOnFailedTests: true + - script: python -m codecov --token $(CODECOV_TOKEN) --file coverageReport.xml + displayName: 'Send coverage to codecov' + condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) + - script: | + pyinstaller cli.spec + .\dist\clkutil.exe --version + displayName: 'Build clkutil.exe' + condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) + - script: python setup.py bdist_wheel + displayName: 'Build wheel' + 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 + 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')) From 658bae8c1f727c1faba957dea70693cde0e566c0 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 14:55:33 +1000 Subject: [PATCH 02/43] Changes from PR review #262 --- azurePipeline.yml | 114 +++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 63 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index 61be5901..fe08f4bc 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -1,104 +1,92 @@ +variables: + pythonVersions: ['3.7', '3.6', '3.5', '2.7'] +# operatingSystems: ['ubuntu-16.04', 'macos-10.13', 'vs2017-win2016'] + operatingSystems: ['vs2017-win2016'] + architectures: ['x64', 'x86'] + jobs: -- job: 'Test' - pool: - vmImage: 'vs2017-win2016' +- job: 'test_and_publish' 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' + ${{ each py in variables.pythonVersions }}: + ${{ each os in variables.operatingSystems }}: + ${{ each architecture in variables.architectures }}: + ${{ format('{0}{1}{2}', py, os) }}: + pythonVersion: ${{ py }} + operatingSystem: ${{ os }} + architecture: ${{ architecture }} + + pool: + vmImage: $(operatingSystem) + + displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' 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) + condition: eq(variables['pythonVersion'], 2.7) - powershell: Start-Process VCForPython27.msi -ArgumentList "/q" -Wait displayName: 'Install Microsoft Visual C++ 9.0.' - 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) + condition: and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], 2.7)) + - task: UsePythonVersion@0 inputs: - versionSpec: '$(python.version)' + versionSpec: '$(pythonVersion)' 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)" - displayName: 'Python version and architecture' - env: - INCLUDE_CLI: 1 - - script: | - python -m pip install --upgrade pip + 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: 'Pip installs' - env: - INCLUDE_CLI: 1 - - script: python -m pytest --cov=clkhash --junitxml=testResults.xml --cov-report=xml:coverageReport.xml - displayName: 'Run the tests' + 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 python$(python.version), $(architecture)' + 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: or(succeeded(), failed()) + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: 'coverageReport.xml' + reportDirectory: 'htmlcov' + failIfCoverageEmpty: true + - script: python -m codecov --token $(CODECOV_TOKEN) --file coverageReport.xml displayName: 'Send coverage to codecov' - condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) + - script: | pyinstaller cli.spec .\dist\clkutil.exe --version displayName: 'Build clkutil.exe' - condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) - - script: python setup.py bdist_wheel - displayName: 'Build wheel' - condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) + 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')) + - 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['python.version'], '3.7'), eq(variables['architecture'], 'x86')) + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) + - task: PublishPipelineArtifact@0 inputs: - artifactName: 'Windows artifacts' + artifactName: "$(operatingSystem) artifacts" targetPath: dist/ - condition: and(eq(variables['python.version'], '3.7'), eq(variables['architecture'], 'x86')) + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) From 5377dd9e5179cc3da5b895fbeb4e6b8c932d7b6a Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 15:01:51 +1000 Subject: [PATCH 03/43] Cannot provide variables without a stage definition --- azurePipeline.yml | 158 +++++++++++++++++++++++----------------------- 1 file changed, 80 insertions(+), 78 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index fe08f4bc..d58b4a32 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -1,92 +1,94 @@ -variables: - pythonVersions: ['3.7', '3.6', '3.5', '2.7'] -# operatingSystems: ['ubuntu-16.04', 'macos-10.13', 'vs2017-win2016'] - operatingSystems: ['vs2017-win2016'] - architectures: ['x64', 'x86'] +stages: +- stage: + variables: + pythonVersions: ['3.7', '3.6', '3.5', '2.7'] +# operatingSystems: ['ubuntu-16.04', 'macos-10.13', 'vs2017-win2016'] + operatingSystems: ['vs2017-win2016'] + architectures: ['x64', 'x86'] -jobs: -- job: 'test_and_publish' - strategy: - matrix: - ${{ each py in variables.pythonVersions }}: - ${{ each os in variables.operatingSystems }}: - ${{ each architecture in variables.architectures }}: - ${{ format('{0}{1}{2}', py, os) }}: - pythonVersion: ${{ py }} - operatingSystem: ${{ os }} - architecture: ${{ architecture }} + jobs: + - job: 'test_and_publish' + strategy: + matrix: + ${{ each py in variables.pythonVersions }}: + ${{ each os in variables.operatingSystems }}: + ${{ each architecture in variables.architectures }}: + ${{ format('{0}{1}{2}', py, os) }}: + pythonVersion: ${{ py }} + operatingSystem: ${{ os }} + architecture: ${{ architecture }} - pool: - vmImage: $(operatingSystem) + pool: + vmImage: $(operatingSystem) - displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' + displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' - 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['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)) + 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['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)' + - 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 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 + - 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: 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: or(succeeded(), failed()) - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: 'coverageReport.xml' - reportDirectory: 'htmlcov' - failIfCoverageEmpty: 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: or(succeeded(), failed()) + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: 'coverageReport.xml' + reportDirectory: 'htmlcov' + failIfCoverageEmpty: true - - script: python -m codecov --token $(CODECOV_TOKEN) --file coverageReport.xml - displayName: 'Send coverage to codecov' + - 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: | + 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')) + - script: python setup.py sdist bdist_wheel + displayName: 'Package' + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) - - 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')) + - 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')) - - task: PublishPipelineArtifact@0 - inputs: - artifactName: "$(operatingSystem) artifacts" - targetPath: dist/ - condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) + - task: PublishPipelineArtifact@0 + inputs: + artifactName: "$(operatingSystem) artifacts" + targetPath: dist/ + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) From cd28a47a3df82cc463f7c61c78ec33a343d11d8b Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 15:08:24 +1000 Subject: [PATCH 04/43] A world of new possibilities --- azurePipeline.yml | 161 +++++++++++++++++++++++----------------------- 1 file changed, 81 insertions(+), 80 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index d58b4a32..c1f8a076 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -1,94 +1,95 @@ -stages: -- stage: - variables: - pythonVersions: ['3.7', '3.6', '3.5', '2.7'] -# operatingSystems: ['ubuntu-16.04', 'macos-10.13', 'vs2017-win2016'] - operatingSystems: ['vs2017-win2016'] - architectures: ['x64', 'x86'] +variables: +- name: pythonVersions + value: ['3.7', '3.6', '3.5', '2.7'] +- name: operatingSystems +# value: ['ubuntu-16.04', 'macos-10.13', 'vs2017-win2016'] + value: ['vs2017-win2016'] +- name: architectures + value: ['x64', 'x86'] - jobs: - - job: 'test_and_publish' - strategy: - matrix: - ${{ each py in variables.pythonVersions }}: - ${{ each os in variables.operatingSystems }}: - ${{ each architecture in variables.architectures }}: - ${{ format('{0}{1}{2}', py, os) }}: - pythonVersion: ${{ py }} - operatingSystem: ${{ os }} - architecture: ${{ architecture }} +jobs: +- job: 'test_and_publish' + strategy: + matrix: + ${{ each py in variables.pythonVersions }}: + ${{ each os in variables.operatingSystems }}: + ${{ each architecture in variables.architectures }}: + ${{ format('{0}{1}{2}', py, os) }}: + pythonVersion: ${{ py }} + operatingSystem: ${{ os }} + architecture: ${{ architecture }} - pool: - vmImage: $(operatingSystem) + pool: + vmImage: $(operatingSystem) - displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' + displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' - 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['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)) + 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['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)' + - 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 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 + - 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: 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: or(succeeded(), failed()) - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: 'coverageReport.xml' - reportDirectory: 'htmlcov' - failIfCoverageEmpty: 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: or(succeeded(), failed()) + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: 'coverageReport.xml' + reportDirectory: 'htmlcov' + failIfCoverageEmpty: true - - script: python -m codecov --token $(CODECOV_TOKEN) --file coverageReport.xml - displayName: 'Send coverage to codecov' + - 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: | + 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')) + - script: python setup.py sdist bdist_wheel + displayName: 'Package' + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) - - 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')) + - 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')) - - task: PublishPipelineArtifact@0 - inputs: - artifactName: "$(operatingSystem) artifacts" - targetPath: dist/ - condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) + - task: PublishPipelineArtifact@0 + inputs: + artifactName: "$(operatingSystem) artifacts" + targetPath: dist/ + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) From 5942dd606650c90e2adcd15639a8623510aec3b8 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 15:23:18 +1000 Subject: [PATCH 05/43] Try with templates. --- .azurePipeline/wholeBuild.yml | 91 ++++++++++++++++++++++++++++++++ azurePipeline.yml | 99 +++-------------------------------- 2 files changed, 97 insertions(+), 93 deletions(-) create mode 100644 .azurePipeline/wholeBuild.yml diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml new file mode 100644 index 00000000..016304a0 --- /dev/null +++ b/.azurePipeline/wholeBuild.yml @@ -0,0 +1,91 @@ +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}{1}{2}', py, os) }}: + pythonVersion: ${{ py }} + operatingSystem: ${{ os }} + architecture: ${{ architecture }} + + pool: + vmImage: $(operatingSystem) + + displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' + + 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['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: or(succeeded(), failed()) + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: 'coverageReport.xml' + 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')) + + - 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')) + + - task: PublishPipelineArtifact@0 + inputs: + artifactName: "$(operatingSystem) artifacts" + targetPath: dist/ + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) diff --git a/azurePipeline.yml b/azurePipeline.yml index c1f8a076..97d5e8c1 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -1,95 +1,8 @@ -variables: -- name: pythonVersions - value: ['3.7', '3.6', '3.5', '2.7'] -- name: operatingSystems -# value: ['ubuntu-16.04', 'macos-10.13', 'vs2017-win2016'] - value: ['vs2017-win2016'] -- name: architectures - value: ['x64', 'x86'] - jobs: -- job: 'test_and_publish' - strategy: - matrix: - ${{ each py in variables.pythonVersions }}: - ${{ each os in variables.operatingSystems }}: - ${{ each architecture in variables.architectures }}: - ${{ format('{0}{1}{2}', py, os) }}: - pythonVersion: ${{ py }} - operatingSystem: ${{ os }} - architecture: ${{ architecture }} - - pool: - vmImage: $(operatingSystem) - - displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' - - 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['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: or(succeeded(), failed()) - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: 'coverageReport.xml' - 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')) - - - 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')) +- 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'] - - task: PublishPipelineArtifact@0 - inputs: - artifactName: "$(operatingSystem) artifacts" - targetPath: dist/ - condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) From da8c55c8232c9f83ad8722f158e36b1d360b68d2 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 15:24:26 +1000 Subject: [PATCH 06/43] May work!!! --- .azurePipeline/crossProductMatrixStrategy.yml | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .azurePipeline/crossProductMatrixStrategy.yml diff --git a/.azurePipeline/crossProductMatrixStrategy.yml b/.azurePipeline/crossProductMatrixStrategy.yml new file mode 100644 index 00000000..c6fd234d --- /dev/null +++ b/.azurePipeline/crossProductMatrixStrategy.yml @@ -0,0 +1,91 @@ +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}{1}{2}', py, os, architecture) }}: + pythonVersion: ${{ py }} + operatingSystem: ${{ os }} + architecture: ${{ architecture }} + + pool: + vmImage: $(operatingSystem) + + displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' + + 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['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: or(succeeded(), failed()) + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: 'coverageReport.xml' + 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')) + + - 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')) + + - task: PublishPipelineArtifact@0 + inputs: + artifactName: "$(operatingSystem) artifacts" + targetPath: dist/ + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) From a5f381c220640f7f2260f642af7fe65aaaf27cf1 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 15:40:03 +1000 Subject: [PATCH 07/43] Test --- .azurePipeline/crossProductMatrixStrategy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azurePipeline/crossProductMatrixStrategy.yml b/.azurePipeline/crossProductMatrixStrategy.yml index c6fd234d..9945fa57 100644 --- a/.azurePipeline/crossProductMatrixStrategy.yml +++ b/.azurePipeline/crossProductMatrixStrategy.yml @@ -10,7 +10,7 @@ jobs: ${{ each py in parameters.pythonVersions }}: ${{ each os in parameters.operatingSystems }}: ${{ each architecture in parameters.architectures }}: - ${{ format('{0}{1}{2}', py, os, architecture) }}: + ${{ format('{0}{1}', py, architecture) }}: pythonVersion: ${{ py }} operatingSystem: ${{ os }} architecture: ${{ architecture }} From 4d9808668f09017c991acaa5ad24623bdb016179 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 15:47:04 +1000 Subject: [PATCH 08/43] Rename the template file. --- .azurePipeline/crossProductMatrixStrategy.yml | 91 ------------------- .azurePipeline/wholeBuild.yml | 2 +- 2 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 .azurePipeline/crossProductMatrixStrategy.yml diff --git a/.azurePipeline/crossProductMatrixStrategy.yml b/.azurePipeline/crossProductMatrixStrategy.yml deleted file mode 100644 index 9945fa57..00000000 --- a/.azurePipeline/crossProductMatrixStrategy.yml +++ /dev/null @@ -1,91 +0,0 @@ -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}{1}', py, architecture) }}: - pythonVersion: ${{ py }} - operatingSystem: ${{ os }} - architecture: ${{ architecture }} - - pool: - vmImage: $(operatingSystem) - - displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' - - 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['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: or(succeeded(), failed()) - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: 'coverageReport.xml' - 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')) - - - 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')) - - - task: PublishPipelineArtifact@0 - inputs: - artifactName: "$(operatingSystem) artifacts" - targetPath: dist/ - condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index 016304a0..ce151fce 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -10,7 +10,7 @@ jobs: ${{ each py in parameters.pythonVersions }}: ${{ each os in parameters.operatingSystems }}: ${{ each architecture in parameters.architectures }}: - ${{ format('{0}{1}{2}', py, os) }}: + ${{ format('{0}{1}{2}', os, architecture, py) }}: pythonVersion: ${{ py }} operatingSystem: ${{ os }} architecture: ${{ architecture }} From 2fd38ba37efd3e94a7aa5073340915a6a54de726 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 16:08:54 +1000 Subject: [PATCH 09/43] Another test for displayNames to be pretty --- .azurePipeline/wholeBuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index ce151fce..ce42f392 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -18,7 +18,7 @@ jobs: pool: vmImage: $(operatingSystem) - displayName: 'Test and publish for $(operatingSystem) Python$(pythonVersion) $(architecture)' + displayName: ${{ Test and publish for {0} Python {1} {2}, $(operatingSystem), $(pythonVersion), $(architecture)) }} 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/ @@ -58,7 +58,7 @@ jobs: - 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: or(succeeded(), failed()) + condition: succeededOrFailed() inputs: codeCoverageTool: Cobertura summaryFileLocation: 'coverageReport.xml' From a17e3dabf25cbdcbe57e3e31ad23d1448ecfcba5 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 16:09:57 +1000 Subject: [PATCH 10/43] Forgot some quotes. --- .azurePipeline/wholeBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index ce42f392..e7f85c39 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -18,7 +18,7 @@ jobs: pool: vmImage: $(operatingSystem) - displayName: ${{ Test and publish for {0} Python {1} {2}, $(operatingSystem), $(pythonVersion), $(architecture)) }} + displayName: ${{'Test and publish for {0} Python {1} {2}', $(operatingSystem), $(pythonVersion), $(architecture)) }} 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/ From 54534d38cd37ff5a20d4b8942b86317dc2661b5f Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 16:11:08 +1000 Subject: [PATCH 11/43] I may be loosing my mind slowly --- .azurePipeline/wholeBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index e7f85c39..c6559d63 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -18,7 +18,7 @@ jobs: pool: vmImage: $(operatingSystem) - displayName: ${{'Test and publish for {0} Python {1} {2}', $(operatingSystem), $(pythonVersion), $(architecture)) }} + displayName: ${{ format('Test and publish for {0} Python {1} {2}', operatingSystem, pythonVersion, architecture) }} 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/ From 9bb3535677519bec26831b4f9a55d97057238669 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 16:17:43 +1000 Subject: [PATCH 12/43] Another test --- .azurePipeline/wholeBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index c6559d63..8ade1b5f 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -18,7 +18,7 @@ jobs: pool: vmImage: $(operatingSystem) - displayName: ${{ format('Test and publish for {0} Python {1} {2}', operatingSystem, pythonVersion, architecture) }} + displayName: ${{ format('Test and publish for {0} Python {1} {2}', variables['operatingSystem'], variables['pythonVersion'], variables['architecture']) }} 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/ From bd08e8fa2b1c01c80e660596808f9af42cfdeb41 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 16:27:17 +1000 Subject: [PATCH 13/43] Last ty --- .azurePipeline/wholeBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index 8ade1b5f..353d264a 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -18,7 +18,7 @@ jobs: pool: vmImage: $(operatingSystem) - displayName: ${{ format('Test and publish for {0} Python {1} {2}', variables['operatingSystem'], variables['pythonVersion'], variables['architecture']) }} + displayName: $[ format('Test and publish for {0} Python {1} {2}', variables['operatingSystem'], variables['pythonVersion'], variables['architecture']) ] 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/ From a639ff5dff9eb4375ecac78bd605c0c3757aa4c3 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 16:30:27 +1000 Subject: [PATCH 14/43] Should work but not super pretty --- .azurePipeline/wholeBuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index 353d264a..f012aaee 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -10,7 +10,7 @@ jobs: ${{ each py in parameters.pythonVersions }}: ${{ each os in parameters.operatingSystems }}: ${{ each architecture in parameters.architectures }}: - ${{ format('{0}{1}{2}', os, architecture, py) }}: + ${{ format('{0}_Python_{1}_{2}', os, py, architecture) }}: pythonVersion: ${{ py }} operatingSystem: ${{ os }} architecture: ${{ architecture }} @@ -18,7 +18,7 @@ jobs: pool: vmImage: $(operatingSystem) - displayName: $[ format('Test and publish for {0} Python {1} {2}', variables['operatingSystem'], variables['pythonVersion'], variables['architecture']) ] + 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/ From 0cdfd742c48183c018efdf15bab828b3ff5a536e Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 17:24:27 +1000 Subject: [PATCH 15/43] Instead of running step on condition, do not add it on condition. Makes the logs page cleaner: it does not include the skipped steps). --- .azurePipeline/wholeBuild.yml | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index f012aaee..6f66cfa4 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -23,12 +23,13 @@ jobs: 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['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)) +# These steps are required because of at least the bitarray dependency (but maybe more). See issue #153 tracking if bitarray is still used. + {{ if and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], 2.7)) }}: + - 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.' - task: UsePythonVersion@0 inputs: @@ -62,30 +63,29 @@ jobs: inputs: codeCoverageTool: Cobertura summaryFileLocation: 'coverageReport.xml' - reportDirectory: 'htmlcov' +# Don't use reportDirectory as the step seems to build its own html. +# 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')) + {{ if and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) }}: + {{ if eq(variables['operatingSystem']) }}: + - script: | + pyinstaller cli.spec + .\dist\clkutil.exe --version + displayName: 'Build clkutil.exe' - - script: python setup.py sdist bdist_wheel - displayName: 'Package' - condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) + - script: python setup.py sdist bdist_wheel + displayName: 'Package' - - 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')) + - script: | + pip install twine + twine upload -u $(PYPI_LOGIN) -p $(PYPI_PASSWORD) --skip-existing dist/*.whl + displayName: 'Send artifact to Pypi' - - task: PublishPipelineArtifact@0 - inputs: - artifactName: "$(operatingSystem) artifacts" - targetPath: dist/ - condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) + - task: PublishPipelineArtifact@0 + inputs: + artifactName: "$(operatingSystem) artifacts" + targetPath: dist/ From f35d489e1d325d7c20ee91d0503a036674f9d9e2 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 17:27:49 +1000 Subject: [PATCH 16/43] forgot a $ --- .azurePipeline/wholeBuild.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index 6f66cfa4..b6f7ed3f 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -24,7 +24,7 @@ jobs: # 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. - {{ if and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], 2.7)) }}: + ${{ if and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], 2.7)) }}: - 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) @@ -70,8 +70,8 @@ jobs: - script: python -m codecov --token $(CODECOV_TOKEN) --file coverageReport.xml displayName: 'Send coverage to codecov' - {{ if and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) }}: - {{ if eq(variables['operatingSystem']) }}: + ${{ if and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) }}: + ${{ if eq(variables['operatingSystem']) }}: - script: | pyinstaller cli.spec .\dist\clkutil.exe --version From d0170c073f41b81f66b9230d77feb97296fb0a3f Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Thu, 27 Jun 2019 17:33:44 +1000 Subject: [PATCH 17/43] revert the changes which were not working, but kept some docs. --- .azurePipeline/wholeBuild.yml | 48 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index b6f7ed3f..939363a9 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -24,12 +24,12 @@ jobs: # 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. - ${{ if and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], 2.7)) }}: - - 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.' + - 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: @@ -63,29 +63,31 @@ jobs: inputs: codeCoverageTool: Cobertura summaryFileLocation: 'coverageReport.xml' -# Don't use reportDirectory as the step seems to build its own html. +# 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' - ${{ if and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) }}: - ${{ if eq(variables['operatingSystem']) }}: - - script: | - pyinstaller cli.spec - .\dist\clkutil.exe --version - displayName: 'Build clkutil.exe' + - 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' + - script: python setup.py sdist bdist_wheel + displayName: 'Package' + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) - - script: | - pip install twine - twine upload -u $(PYPI_LOGIN) -p $(PYPI_PASSWORD) --skip-existing dist/*.whl - displayName: 'Send artifact to Pypi' + - 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')) - - task: PublishPipelineArtifact@0 - inputs: - artifactName: "$(operatingSystem) artifacts" - targetPath: dist/ + - task: PublishPipelineArtifact@0 + inputs: + artifactName: "$(operatingSystem) artifacts" + targetPath: dist/ + condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) From 322abe923fb1d3ec93013e4ff004e2a84afa9b90 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 11:34:51 +1000 Subject: [PATCH 18/43] Triggered only for PRs, not every branch for every commit. Otherwise, it was building each push twice when in a PR But a run can be maunally started using '/AzurePipelines run' in a PR comment. --- azurePipeline.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/azurePipeline.yml b/azurePipeline.yml index 97d5e8c1..9530551d 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -1,3 +1,12 @@ +triggers: + batch: true + branches: none + include: + - * + pr: + include: + - * + jobs: - template: .azurePipeline/wholeBuild.yml # Template reference parameters: From 4c13fb462507884fe86936da44c24dcab264a7de Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 13:49:18 +1000 Subject: [PATCH 19/43] Remove publishing steps from the `whole build`. Instead, copy the created artifacts to a staging folder. --- .azurePipeline/wholeBuild.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index 939363a9..574b0a02 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -40,8 +40,10 @@ jobs: 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 setup.py sdist bdist_wheel + displayName: 'Package' - script: python -m pytest --cov=clkhash --junitxml=testResults.xml --cov-report=xml:coverageReport.xml --cov-report=html:htmlcov displayName: 'Test with pytest' @@ -49,8 +51,8 @@ jobs: INCLUDE_CLI: 1 - task: PublishTestResults@2 + displayName: 'Publish test results in Azure' condition: succeeded() - displayName: 'Publish test results' inputs: testResultsFormat: 'JUnit' testResultsFiles: 'testResults.xml' @@ -58,6 +60,7 @@ jobs: failTaskOnFailedTests: true - task: PublishCodeCoverageResults@1 + displayName: 'Publish code coverage in Azure' # 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: @@ -76,18 +79,10 @@ jobs: 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' +# Copy all the created artifact when built from Python 3.7 on x86. Does not filter with the OS. + - task: CopyFiles@2 + displayName: 'Copy artifacts to staging directory' condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) - - - 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')) - - - task: PublishPipelineArtifact@0 inputs: - artifactName: "$(operatingSystem) artifacts" - targetPath: dist/ - condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) + contents: 'dist/*' + targetFolder: $(Build.ArtifactStagingDirectory) From 9f16bf40cf28fed2b782fa57248b73db1af705ac Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 13:50:45 +1000 Subject: [PATCH 20/43] Publish all the created artifacts if succeeded. --- azurePipeline.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index 9530551d..a81d4940 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -1,8 +1,8 @@ triggers: batch: true - branches: none + branches: include: - - * + - master pr: include: - * @@ -15,3 +15,19 @@ jobs: operatingSystems: ['vs2017-win2016'] architectures: ['x64', 'x86'] +- job: publish + condition: succeeded() + displayName: "Publish all the artifacts" + pool: + vmImage: 'ubuntu-16.04' + steps: + - task: PublishPipelineArtifact@0 + inputs: + artifactName: "Artifacts" + targetPath: $(Build.ArtifactStagingDirectory) + +# - script: | +# pip install twine +# twine upload -u $(PYPI_LOGIN) -p $(PYPI_PASSWORD) --skip-existing dist/*.whl +# displayName: 'Send artifact to Pypi' +# condition: only if commit is tagged... will be fun to check From 7f5dd9f4b350e2176b50c46d4c119e273d0baf2f Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 13:59:46 +1000 Subject: [PATCH 21/43] Trigger on tags starting with the letter v --- azurePipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index a81d4940..3e3c3114 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -1,8 +1,9 @@ -triggers: +trigger: batch: true branches: include: - master + - refs/tags/v* pr: include: - * From 625a9732e3d6fbf2aacb1b04307883fd87d084a8 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 14:03:43 +1000 Subject: [PATCH 22/43] Why is it building master??? --- azurePipeline.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index 3e3c3114..f89cdcbd 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -1,10 +1,12 @@ trigger: - batch: true branches: include: - master - - refs/tags/v* - pr: + tags: + include: + - v* +pr: + branches: include: - * From 68a36147010146eed9a4d99a0b03c1b1f1d63aa0 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 14:06:59 +1000 Subject: [PATCH 23/43] Is it the PR? --- azurePipeline.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index f89cdcbd..8f39e377 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -2,13 +2,15 @@ trigger: branches: include: - master + exclude: + - '*' tags: include: - - v* + - 'v*' pr: branches: include: - - * + - '*' jobs: - template: .azurePipeline/wholeBuild.yml # Template reference From e6eebd9e11ce3ad31ad725be9d908d638310dd44 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 14:12:08 +1000 Subject: [PATCH 24/43] Stage to have the publishing one depending on the building one. --- azurePipeline.yml | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index 8f39e377..f5ba3e46 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -12,24 +12,28 @@ pr: include: - '*' -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'] - -- job: publish - condition: succeeded() +stages: +- stage: build_stage + 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'] + +- stage: publish_stage displayName: "Publish all the artifacts" - pool: - vmImage: 'ubuntu-16.04' - steps: - - task: PublishPipelineArtifact@0 - inputs: - artifactName: "Artifacts" - targetPath: $(Build.ArtifactStagingDirectory) + dependsOn: build_stage + jobs: + - job: publish_job + pool: + vmImage: 'ubuntu-16.04' + steps: + - task: PublishPipelineArtifact@0 + inputs: + artifactName: "Artifacts" + targetPath: $(Build.ArtifactStagingDirectory) # - script: | # pip install twine From e11c639a7efc33d650553616ea0e93e285696fc1 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 14:39:18 +1000 Subject: [PATCH 25/43] Need to publish artifacts per job. --- .azurePipeline/wholeBuild.yml | 7 +++---- azurePipeline.yml | 29 +++++++---------------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index 574b0a02..f82b02e8 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -79,10 +79,9 @@ jobs: displayName: 'Build clkutil.exe' condition: and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) -# Copy all the created artifact when built from Python 3.7 on x86. Does not filter with the OS. - - task: CopyFiles@2 + - task: PublishPipelineArtifact@0 displayName: 'Copy artifacts to staging directory' condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) inputs: - contents: 'dist/*' - targetFolder: $(Build.ArtifactStagingDirectory) + artifactName: Artifacts-$(operatingSystem) + targetPath: 'dist/*' diff --git a/azurePipeline.yml b/azurePipeline.yml index f5ba3e46..db6c6ef0 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -12,28 +12,13 @@ pr: include: - '*' -stages: -- stage: build_stage - 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'] - -- stage: publish_stage - displayName: "Publish all the artifacts" - dependsOn: build_stage - jobs: - - job: publish_job - pool: - vmImage: 'ubuntu-16.04' - steps: - - task: PublishPipelineArtifact@0 - inputs: - artifactName: "Artifacts" - targetPath: $(Build.ArtifactStagingDirectory) +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'] # - script: | # pip install twine From 6ddecc852a276139e9dcb38da4096962a49d8236 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 14:59:03 +1000 Subject: [PATCH 26/43] Update back the publish artifact step --- .azurePipeline/wholeBuild.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index f82b02e8..27e7ed76 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -80,8 +80,8 @@ jobs: condition: and(eq(variables['operatingSystem'], 'vs2017-win2016'), eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) - task: PublishPipelineArtifact@0 - displayName: 'Copy artifacts to staging directory' + displayName: 'Publish artifacts' condition: and(eq(variables['pythonVersion'], '3.7'), eq(variables['architecture'], 'x86')) inputs: - artifactName: Artifacts-$(operatingSystem) - targetPath: 'dist/*' + artifactName: Artifacts + targetPath: 'dist/' From 65651f0b6da77785b5ee550db4011789939d3513 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 16:17:17 +1000 Subject: [PATCH 27/43] Let's try the release pipelines. Starting by adding a tag to the build to trigger the release pipeline automatically. Bu the release pipeline includes a manula approval, so should be alright :) --- azurePipeline.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azurePipeline.yml b/azurePipeline.yml index db6c6ef0..df965482 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -20,6 +20,10 @@ jobs: operatingSystems: ['vs2017-win2016'] architectures: ['x64', 'x86'] +- job: + steps: + - script: echo "##vso[build.addbuildtag] Automated" + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') # - script: | # pip install twine # twine upload -u $(PYPI_LOGIN) -p $(PYPI_PASSWORD) --skip-existing dist/*.whl From f477e866aaddcbc6c0e33b0bd6bd92b53b3d4d3f Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 17:35:45 +1000 Subject: [PATCH 28/43] Add some documentation. --- azurePipeline.yml | 2 ++ docs/devops.rst | 60 +++++++++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + 3 files changed, 63 insertions(+) create mode 100644 docs/devops.rst diff --git a/azurePipeline.yml b/azurePipeline.yml index df965482..ff8519c6 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -22,6 +22,8 @@ jobs: - job: steps: +# In this step, if this build is triggered by a tag starting with a 'v', it will add a tag 'Automated' to the current build. +# This tag if put on a commit from master should trigger the release pipeline. - script: echo "##vso[build.addbuildtag] Automated" condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') # - script: | diff --git a/docs/devops.rst b/docs/devops.rst new file mode 100644 index 00000000..c9c1fd74 --- /dev/null +++ b/docs/devops.rst @@ -0,0 +1,60 @@ +Devops +=========== + + +.. toctree:: + :maxdepth: 2 + + clkhash + +Azure Pipeline +-------------- + +``clkhash`` is automatically built and tested using Azure Pipeline + for Windows environment, in the project `Anonlink ` + +Two pipelines are available: + - `Build pipeline `, + - `Release pipeline `. + +The build pipeline is described by the script `azurePipeline.yml` +which is using resources from the folder `.azurePipeline`. +Mainly, a number of builds and tests are started for different +version of python and system architecture. +Only the packages created with ``Python 3.7`` and the ``x86`` +architecture are then published (in Azure). + +The build pipeline is triggered for every pushes on the master branch, +for every tagged commit with the tag starting with a `v`, and for +every pushes part of a pull request. We are not building on every push and +on pull requests not to build twice the same code. For every tagged commit, +the build pipeline will also add the Azure tag `Automated` which may trigger +automatically the release pipeline. + +The build pipeline does: + - install the requirements, + - package ``clkhash``, + - run `pytest`, + - publish the test results, + - publish the code coverage (on Azure and codecov), + - publish the artifacts from the build using ``Python 3.7`` + with a ``x86`` architecture (i.e. a whl, a tar.gz and an exe). + +The build pipeline requires one environment variable provided by Azure environment: + - `CODECOV_TOKEN` which is used to publish the coverage to codecov. + + +The release pipeline can either be triggered manually, or automatically from +a successful build on master where the build is tagged `Automated` +(i.e. if the commit is tagged, cf previous paragraph). + +The release pipeline consists of two steps: + - asking for a manual confirmation that the artifacts from the + triggering build should be released, + - uses ``twine`` to publish the artifacts. + +The release pipeline requires two environment variables provided by Azure environment: + - `PYPI_LOGIN`: login to push an artifact to ``clkhash`` ``Pypi`` repository, + - `PYPI_PASSWORD`: password to push an artifact to ``clkhash`` ``Pypi`` repository + for the user `PYPI_LOGIN`. + diff --git a/docs/index.rst b/docs/index.rst index 2efde60f..d645ae6a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -33,6 +33,7 @@ Table of Contents cli schema development + devops rest_client references From f511546d0be038a3ee88690b2d9a5c2c941a0e2c Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Fri, 28 Jun 2019 17:37:30 +1000 Subject: [PATCH 29/43] ignore folders `vnv`. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 99b6d67e..126196af 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ lib64/ parts/ sdist/ var/ +venv/ *.egg-info/ .installed.cfg From b8d7e9996bf2276a54cf6ab3c645fdfb3b4aba17 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 12:25:06 +1000 Subject: [PATCH 30/43] Publish test results even if tests failed. --- .azurePipeline/wholeBuild.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azurePipeline/wholeBuild.yml b/.azurePipeline/wholeBuild.yml index 27e7ed76..8617b96e 100644 --- a/.azurePipeline/wholeBuild.yml +++ b/.azurePipeline/wholeBuild.yml @@ -52,7 +52,7 @@ jobs: - task: PublishTestResults@2 displayName: 'Publish test results in Azure' - condition: succeeded() + condition: succeededOrFailed() inputs: testResultsFormat: 'JUnit' testResultsFiles: 'testResults.xml' @@ -72,6 +72,7 @@ jobs: - script: python -m codecov --token $(CODECOV_TOKEN) --file coverageReport.xml displayName: 'Send coverage to codecov' + condition: succeededOrFailed() - script: | pyinstaller cli.spec From f47fe0cd53a9bd54f38bc5c6a3b6a70609027979 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 12:25:40 +1000 Subject: [PATCH 31/43] Build every tag --- azurePipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index ff8519c6..40903af6 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -6,7 +6,7 @@ trigger: - '*' tags: include: - - 'v*' + - '' pr: branches: include: From 687a107ae7d5e9674a0ec5d5e59014ed37551f61 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 12:27:30 +1000 Subject: [PATCH 32/43] Version v0.13.1-b2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1bde7ce9..3722feed 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( name="clkhash", - version='0.13.0', + version='0.13.1-b2', description='Encoding utility to create Cryptographic Linkage Keys', long_description=readme, long_description_content_type='text/markdown', From 24cd5ec3808da6abc00900cc0cbd71772f8f39b9 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 12:32:52 +1000 Subject: [PATCH 33/43] Version 0.13.1-b3 b2 is already in use. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3722feed..1ed90213 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( name="clkhash", - version='0.13.1-b2', + version='0.13.1-b3', description='Encoding utility to create Cryptographic Linkage Keys', long_description=readme, long_description_content_type='text/markdown', From f91870e647e53b0ae7f804b3d6e8d5cdcb8d5f05 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 12:35:58 +1000 Subject: [PATCH 34/43] Forgot a star --- azurePipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index 40903af6..bda244a9 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -6,7 +6,7 @@ trigger: - '*' tags: include: - - '' + - '*' pr: branches: include: From fc34b0762f5a9d2be5b52a0f33cc7e2f742f5510 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 13:42:29 +1000 Subject: [PATCH 35/43] Was the space really important? And version beta up --- azurePipeline.yml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index bda244a9..cebe7957 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -24,7 +24,7 @@ jobs: steps: # In this step, if this build is triggered by a tag starting with a 'v', it will add a tag 'Automated' to the current build. # This tag if put on a commit from master should trigger the release pipeline. - - script: echo "##vso[build.addbuildtag] Automated" + - script: echo "##vso[build.addbuildtag]Automated" condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') # - script: | # pip install twine diff --git a/setup.py b/setup.py index 1ed90213..88ba9d6e 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( name="clkhash", - version='0.13.1-b3', + version='0.13.1-b4', description='Encoding utility to create Cryptographic Linkage Keys', long_description=readme, long_description_content_type='text/markdown', From ddcb2b2b91f6d2b8cd57b4f0e00aaf33909e3993 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 13:51:37 +1000 Subject: [PATCH 36/43] Build is `Automated` for every tag, not only the one starting with `v`. --- azurePipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index cebe7957..990b42fb 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -25,7 +25,7 @@ jobs: # In this step, if this build is triggered by a tag starting with a 'v', it will add a tag 'Automated' to the current build. # This tag if put on a commit from master should trigger the release pipeline. - script: echo "##vso[build.addbuildtag]Automated" - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') # - script: | # pip install twine # twine upload -u $(PYPI_LOGIN) -p $(PYPI_PASSWORD) --skip-existing dist/*.whl From 15ab9f2838cc8c8519edd54262ca710b810a32a0 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 14:55:56 +1000 Subject: [PATCH 37/43] Add a MANIFEST.in file to include the read me and the license files into the distribution. --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..72ca36c0 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include LICENSE README.md From e0e04b2bfb2a61323910a8d487470244d0eb04c5 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 14:59:28 +1000 Subject: [PATCH 38/43] Bump beta version for final test --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 88ba9d6e..52df9455 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( name="clkhash", - version='0.13.1-b4', + version='0.13.1-b5', description='Encoding utility to create Cryptographic Linkage Keys', long_description=readme, long_description_content_type='text/markdown', From 7ac1925677d4e48b0c33ba5ffc7f5778c3a6bf7f Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 15:09:40 +1000 Subject: [PATCH 39/43] Update some docs. --- azurePipeline.yml | 8 +------- docs/devops.rst | 8 ++++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/azurePipeline.yml b/azurePipeline.yml index 990b42fb..a299323b 100644 --- a/azurePipeline.yml +++ b/azurePipeline.yml @@ -22,12 +22,6 @@ jobs: - job: steps: -# In this step, if this build is triggered by a tag starting with a 'v', it will add a tag 'Automated' to the current build. -# This tag if put on a commit from master should trigger the release pipeline. +# In this step, if this build is triggered by a tag, it will add a tag 'Automated' to the current build. - script: echo "##vso[build.addbuildtag]Automated" condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') -# - script: | -# pip install twine -# twine upload -u $(PYPI_LOGIN) -p $(PYPI_PASSWORD) --skip-existing dist/*.whl -# displayName: 'Send artifact to Pypi' -# condition: only if commit is tagged... will be fun to check diff --git a/docs/devops.rst b/docs/devops.rst index c9c1fd74..b32765f5 100644 --- a/docs/devops.rst +++ b/docs/devops.rst @@ -25,10 +25,10 @@ Only the packages created with ``Python 3.7`` and the ``x86`` architecture are then published (in Azure). The build pipeline is triggered for every pushes on the master branch, -for every tagged commit with the tag starting with a `v`, and for -every pushes part of a pull request. We are not building on every push and -on pull requests not to build twice the same code. For every tagged commit, -the build pipeline will also add the Azure tag `Automated` which may trigger +for every tagged commit, and for every pushes part of a pull +request. We are not building on every push and +pull requests not to build twice the same code. For every tagged commit, +the build pipeline will also add the Azure tag `Automated` which will trigger automatically the release pipeline. The build pipeline does: From a14e8a0c79990f15f0b734f3960bc63ba841f0e6 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 16:46:38 +1000 Subject: [PATCH 40/43] MANIFEST is not the issue. --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 72ca36c0..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE README.md From f7241df3ff7e0d9c35427aa1c90351e09c2f58b0 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 16:46:54 +1000 Subject: [PATCH 41/43] It seems building a wheel from a windows machine is complicated with markdown. Let's try something. --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 52df9455..37ae976a 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ from setuptools import setup, find_packages -import codecs requirements = [ "bitarray>=0.8", @@ -17,7 +16,7 @@ "bashplotlib>=0.6.5" ] -with codecs.open('README.md', 'r', 'utf-8') as f: +with open('README.md', 'r', encoding='utf-8') as f: readme = f.read() setup( From 5c3adb9dae7db64c01934f72a88be32c1608da1f Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 17:03:02 +1000 Subject: [PATCH 42/43] The published packaged version seems to include the readme. I do not know if the one running with python 2.7 includes it, but we are not publishing it so not really important. --- setup.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 37ae976a..19844da1 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,8 @@ from setuptools import setup, find_packages +import sys +if sys.version_info[0] < 3: + import codecs + requirements = [ "bitarray>=0.8", @@ -15,9 +19,16 @@ "typing>=3.6; python_version < '3.5'", # Backport from Py3.5 "bashplotlib>=0.6.5" ] - -with open('README.md', 'r', encoding='utf-8') as f: - readme = f.read() +if sys.version_info[0] < 3: + # Python 2.7 does not accept the parameter `encoding` to open a file + with codecs.open('README.md', 'r', 'utf-8') as f: + readme = f.read() +else: + # But on Windows, something wrong happens when creating the package + # and using codecs.open. related issues are https://github.com/di/markdown-description-example/issues/4 + # But this is not exactly the same either... + with open('README.md', 'r', encoding='utf-8') as f: + readme = f.read() setup( name="clkhash", From 7ba0bc2e05acdeb8b8b51fef9c5534d969fb30a9 Mon Sep 17 00:00:00 2001 From: Guillaume Smith Date: Mon, 1 Jul 2019 17:15:22 +1000 Subject: [PATCH 43/43] Should be the final version bump for test. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 19844da1..b49e2c2c 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ setup( name="clkhash", - version='0.13.1-b5', + version='0.13.1-b6', description='Encoding utility to create Cryptographic Linkage Keys', long_description=readme, long_description_content_type='text/markdown',