diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 20fb5bb194f..6ca9bd7873d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -116,6 +116,14 @@ jobs: env: ADO_PULL_REQUEST_LATEST_COMMIT: HEAD ADO_PULL_REQUEST_TARGET_BRANCH: $(System.PullRequest.TargetBranch) + WHEELS_OUTPUT_DIR: $(Build.ArtifactStagingDirectory)/wheels-$(python.version) + + - task: PublishPipelineArtifact@1 + displayName: 'Publish wheels artifacts from tests' + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)/wheels-$(python.version)' + artifact: 'wheels-$(python.version)' + publishLocation: 'pipeline' - job: AzdevStyleModifiedExtensions displayName: "azdev style on Modified Extensions" diff --git a/scripts/ci/test_source.py b/scripts/ci/test_source.py index 94ddf5bafd7..c4bc8e47af2 100755 --- a/scripts/ci/test_source.py +++ b/scripts/ci/test_source.py @@ -99,6 +99,18 @@ def test_source_wheels(): check_output(['python', 'setup.py', 'bdist_wheel', '-q', '-d', built_whl_dir], cwd=s) except CalledProcessError as err: raise("Unable to build extension {} : {}".format(s, err)) + # Export built wheels so CI can publish them as artifacts + wheels_out_dir = os.environ.get('WHEELS_OUTPUT_DIR') + if wheels_out_dir: + try: + os.makedirs(wheels_out_dir, exist_ok=True) + for fname in os.listdir(built_whl_dir): + src_path = os.path.join(built_whl_dir, fname) + if os.path.isfile(src_path): + shutil.copy2(src_path, os.path.join(wheels_out_dir, fname)) + logger.warning(f'Exported wheels to: {wheels_out_dir}') + except Exception as ex: + logger.exception(f'Failed to export wheels to {wheels_out_dir}: {ex}') shutil.rmtree(built_whl_dir)