Skip to content

Commit cbe3397

Browse files
committed
* leverage twine chk instead of setup.py check
* adding installation of readme-renderer[md] to resolve warning during twine check * adding capability to ignore certain warnings coming back from utility tools
1 parent 2c53502 commit cbe3397

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

.azure-pipelines/client.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,33 @@ jobs:
1919
versionSpec: 3.6
2020

2121
- script: |
22-
pip install wheel setuptools pathlib Jinja2
22+
pip install wheel setuptools pathlib Jinja2 twine readme-renderer[md]
2323
displayName: 'Prep Environment'
2424
2525
- task: PythonScript@0
2626
displayName: 'Analyze dependencies'
2727
inputs:
2828
scriptPath: 'scripts/analyze_deps.py'
29-
arguments: '--verbose --out "$(Build.ArtifactStagingDirectory)/dependencies.html"'
29+
arguments: '--verbose --out "$(Build.SourcesDirectory)/dependencies.html"'
3030

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

37+
- script: |
38+
twine check $(Build.ArtifactStagingDirectory)/*
39+
displayName: 'Verify Readme'
40+
41+
- task: CopyFiles@2
42+
displayName: 'Move Dependencies Report to Build Artifacts'
43+
inputs:
44+
SourceFolder: '$(Build.SourcesDirectory)'
45+
Contents: dependencies.html
46+
TargetFolder: '$(Build.ArtifactStagingDirectory)'
47+
condition: always()
48+
3749
- task: PublishBuildArtifacts@1
3850
displayName: 'Publish Artifacts'
3951
condition: succeededOrFailed()

scripts/devops_tasks/common_tasks.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pathlib import Path
1313
from subprocess import check_call, CalledProcessError
1414
import os
15+
import sys
1516

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

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

35-
def run_check_call(command_array, working_directory):
36+
def run_check_call(command_array, working_directory, acceptable_return_codes = []):
3637
print('Command Array: {0}, Target Working Directory: {1}'.format(command_array, working_directory))
3738
try:
3839
check_call(command_array, cwd = working_directory)
3940
except CalledProcessError as err:
4041
print(err) #, file = sys.stderr
41-
sys.exit(1)
42+
if err.returncode not in acceptable_return_codes:
43+
sys.exit(1)

scripts/devops_tasks/setup_execute_tests.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,18 @@
1818
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..', '..'))
1919
dev_setup_script_location = os.path.join(root_dir, 'scripts/dev_setup.py')
2020

21+
# a return code of 5 from pytest == no tests run
22+
# evaluating whether we want this or not.
23+
ALLOWED_RETURN_CODES = []
24+
2125
def prep_and_run_tests(targeted_packages, python_version):
2226
print('running test setup for {}'.format(targeted_packages))
2327
run_check_call([python_version, dev_setup_script_location, '-p', ','.join([os.path.basename(package_path) for package_path in targeted_packages])], root_dir)
2428

2529
print('Setup complete. Running pytest for {}'.format(targeted_packages))
2630
command_array = [python_version, '-m', 'pytest']
2731
command_array.extend(targeted_packages)
28-
run_check_call(command_array, root_dir)
29-
30-
for package_path in targeted_packages:
31-
print('Checking setup.py for {}'.format(os.path.join(package_path, 'setup.py')))
32-
run_check_call([python_version, 'setup.py', 'check', '-r', '-s'], package_path)
33-
32+
run_check_call(command_array, root_dir, ALLOWED_RETURN_CODES)
3433

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

0 commit comments

Comments
 (0)