Skip to content

Swapping to Twine Check - Support .md in Readme #4331

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

Merged
merged 1 commit into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .azure-pipelines/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,33 @@ jobs:
versionSpec: 3.6

- script: |
pip install wheel setuptools pathlib Jinja2
pip install wheel setuptools pathlib Jinja2 twine readme-renderer[md]
displayName: 'Prep Environment'

- task: PythonScript@0
displayName: 'Analyze dependencies'
inputs:
scriptPath: 'scripts/analyze_deps.py'
arguments: '--verbose --out "$(Build.ArtifactStagingDirectory)/dependencies.html"'
arguments: '--verbose --out "$(Build.SourcesDirectory)/dependencies.html"'

- task: PythonScript@0
displayName: 'Generate Packages'
inputs:
scriptPath: 'scripts/devops_tasks/build_packages.py'
arguments: '-d "$(Build.ArtifactStagingDirectory)" "$(build_targeting_string)"'

- script: |
twine check $(Build.ArtifactStagingDirectory)/*
displayName: 'Verify Readme'

- task: CopyFiles@2
displayName: 'Move Dependencies Report to Build Artifacts'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: dependencies.html
TargetFolder: '$(Build.ArtifactStagingDirectory)'
condition: always()

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
condition: succeededOrFailed()
Expand Down
6 changes: 4 additions & 2 deletions scripts/devops_tasks/common_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pathlib import Path
from subprocess import check_call, CalledProcessError
import os
import sys

DEFAULT_BUILD_PACKAGES = ['azure-keyvault', 'azure-servicebus']

Expand All @@ -32,10 +33,11 @@ def process_glob_string(glob_string, target_root_dir):
# dedup, in case we have double coverage from the glob strings. Example: "azure-mgmt-keyvault,azure-mgmt-*"
return list(set(collected_top_level_directories))

def run_check_call(command_array, working_directory):
def run_check_call(command_array, working_directory, acceptable_return_codes = []):
print('Command Array: {0}, Target Working Directory: {1}'.format(command_array, working_directory))
try:
check_call(command_array, cwd = working_directory)
except CalledProcessError as err:
print(err) #, file = sys.stderr
sys.exit(1)
if err.returncode not in acceptable_return_codes:
sys.exit(1)
11 changes: 5 additions & 6 deletions scripts/devops_tasks/setup_execute_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..', '..'))
dev_setup_script_location = os.path.join(root_dir, 'scripts/dev_setup.py')

# a return code of 5 from pytest == no tests run
# evaluating whether we want this or not.
ALLOWED_RETURN_CODES = []

def prep_and_run_tests(targeted_packages, python_version):
print('running test setup for {}'.format(targeted_packages))
run_check_call([python_version, dev_setup_script_location, '-p', ','.join([os.path.basename(package_path) for package_path in targeted_packages])], root_dir)

print('Setup complete. Running pytest for {}'.format(targeted_packages))
command_array = [python_version, '-m', 'pytest']
command_array.extend(targeted_packages)
run_check_call(command_array, root_dir)

for package_path in targeted_packages:
print('Checking setup.py for {}'.format(os.path.join(package_path, 'setup.py')))
run_check_call([python_version, 'setup.py', 'check', '-r', '-s'], package_path)

run_check_call(command_array, root_dir, ALLOWED_RETURN_CODES)

if __name__ == '__main__':
parser = argparse.ArgumentParser(description = 'Install Dependencies, Install Packages, Test Azure Packages, Called from DevOps YAML Pipeline')
Expand Down