Skip to content
Draft
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
100 changes: 47 additions & 53 deletions eng/pipelines/templates/steps/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ steps:
$(PIP_EXE) freeze
displayName: 'Prep Environment'

# this needs to move under eng/scripts from scripts/devops_tasks/
# AND be renamed prior to merging any PR with this changeset
- task: PythonScript@0
displayName: 'Set Tox Environment'
inputs:
Expand All @@ -64,10 +66,7 @@ steps:

- ${{ parameters.BeforeTestSteps }}

- template: /eng/pipelines/templates/steps/seed-virtualenv-wheels.yml

- ${{ if eq('true', parameters.UseFederatedAuth) }}:

- task: AzurePowerShell@5
displayName: Run Tests (AzurePowerShell@5)
env:
Expand All @@ -79,6 +78,7 @@ steps:
pwsh: true
ScriptType: InlineScript
Inline: >-
$env:TOX_PIP_IMPL="uv"
$account = (Get-AzContext).Account;
$env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id;
$env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants;
Expand All @@ -92,20 +92,20 @@ steps:
$markArg = "${{ parameters.TestMarkArgument }}"
}

python scripts/devops_tasks/dispatch_tox.py
python eng/scripts/dispatch_checks.py
"$(TargetingString)"
${{ parameters.AdditionalTestArgs }}
${{ parameters.CoverageArg }}
--mark_arg="$markArg"
--service="${{ parameters.ServiceDirectory }}"
--toxenv="${{ parameters.ToxTestEnv }}"
--checks="${{ parameters.ToxTestEnv }}"
--injected-packages="${{ parameters.InjectedPackages }}"
--tenvparallel="${{ parameters.ToxEnvParallel }}";
Write-Host "Last exit code: $LASTEXITCODE";
exit $LASTEXITCODE;

- ${{ else }}:
- pwsh: |
$env:TOX_PIP_IMPL="uv"
Write-Host (Get-Command python).Source

if ($env:TESTMARKARGUMENT) {
Expand All @@ -115,14 +115,13 @@ steps:
$markArg = "${{ parameters.TestMarkArgument }}"
}

python scripts/devops_tasks/dispatch_tox.py "$(TargetingString)" `
python eng/scripts/dispatch_checks.py "$(TargetingString)" `
${{ parameters.AdditionalTestArgs }} `
${{ parameters.CoverageArg }} `
--mark_arg="$markArg" `
--service="${{ parameters.ServiceDirectory }}" `
--toxenv="${{ parameters.ToxTestEnv }}" `
--injected-packages="${{ parameters.InjectedPackages }}" `
--tenvparallel="${{ parameters.ToxEnvParallel }}";
--checks="${{ parameters.ToxTestEnv }}" `
--injected-packages="${{ parameters.InjectedPackages }}"
exit $LASTEXITCODE;
env: ${{ parameters.EnvVars }}
displayName: Run Tests
Expand All @@ -147,49 +146,44 @@ steps:
displayName: Report Coverage
condition: and(succeeded(), ${{ parameters.RunCoverage }})

- ${{ if eq('true', parameters.UseFederatedAuth) }}:
- task: AzurePowerShell@5
displayName: Test Samples (AzurePowerShell@5)
condition: and(succeeded(), eq(variables['TestSamples'], 'true'))
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
# Enable samples tests that use DefaultAzureCredential to load the federated pipeline credential
AZURE_POD_IDENTITY_AUTHORITY_HOST: 'https://FakeAuthorityHost'
${{ insert }}: ${{ parameters.EnvVars }}
inputs:
azureSubscription: azure-sdk-tests-public
azurePowerShellVersion: LatestVersion
pwsh: true
ScriptType: InlineScript
Inline: |
$account = (Get-AzContext).Account;
$env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id;
$env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants;

Write-Host (Get-Command python).Source

python scripts/devops_tasks/dispatch_tox.py "$(TargetingString)" `
--service="${{ parameters.ServiceDirectory }}" `
--toxenv="samples"

Write-Host "Last exit code: $LASTEXITCODE";
exit $LASTEXITCODE;
- ${{ else }}:
- pwsh: |
if ($IsWindows) {
. $(VENV_LOCATION)/Scripts/Activate.ps1
}
else {
. $(VENV_LOCATION)/bin/activate.ps1
}
Write-Host (Get-Command python).Source
python scripts/devops_tasks/dispatch_tox.py "$(TargetingString)" `
--service="${{ parameters.ServiceDirectory }}" `
--toxenv="samples"
exit $LASTEXITCODE;
env: ${{ parameters.EnvVars }}
displayName: 'Test Samples'
condition: and(succeeded(), eq(variables['TestSamples'], 'true'))
# re-enable after migrating `samples`
# - ${{ if eq('true', parameters.UseFederatedAuth) }}:
# - task: AzurePowerShell@5
# displayName: Test Samples (AzurePowerShell@5)
# condition: and(succeeded(), eq(variables['TestSamples'], 'true'))
# env:
# SYSTEM_ACCESSTOKEN: $(System.AccessToken)
# # Enable samples tests that use DefaultAzureCredential to load the federated pipeline credential
# AZURE_POD_IDENTITY_AUTHORITY_HOST: 'https://FakeAuthorityHost'
# ${{ insert }}: ${{ parameters.EnvVars }}
# inputs:
# azureSubscription: azure-sdk-tests-public
# azurePowerShellVersion: LatestVersion
# pwsh: true
# ScriptType: InlineScript
# Inline: |
# $account = (Get-AzContext).Account;
# $env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id;
# $env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants;

# Write-Host (Get-Command python).Source

# python eng/scripts/dispatch_checks.py "$(TargetingString)" `
# --service="${{ parameters.ServiceDirectory }}" `
# --checks="samples"

# Write-Host "Last exit code: $LASTEXITCODE";
# exit $LASTEXITCODE;
# - ${{ else }}:
# - pwsh: |
# Write-Host (Get-Command python).Source
# python eng/scripts/dispatch_checks.py "$(TargetingString)" `
# --service="${{ parameters.ServiceDirectory }}" `
# --checks="samples"
# exit $LASTEXITCODE;
# env: ${{ parameters.EnvVars }}
# displayName: 'Test Samples'
# condition: and(succeeded(), eq(variables['TestSamples'], 'true'))

- task: PublishTestResults@2
condition: always()
Expand Down
6 changes: 6 additions & 0 deletions eng/scripts/dispatch_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ async def run_check(
# Print captured output after completion to avoid interleaving
header = f"===== OUTPUT: {check} :: {package} (exit {exit_code}) ====="
trailer = "=" * len(header)
if in_ci():
print(f"##[group]{package} :: {check}")

if stdout:
print(header)
print(stdout.rstrip())
Expand All @@ -86,6 +89,9 @@ async def run_check(
print(stderr.rstrip())
print(trailer)

if in_ci():
print("##[endgroup]")

# if we have any output collections to complete, do so now here

# finally, we need to clean up any temp dirs created by --isolate
Expand Down
13 changes: 7 additions & 6 deletions scripts/devops_tasks/set_tox_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@

FULL_BUILD_SET = [
"whl",
"sdist",
"depends",
"latestdependency",
"mindependency",
"whl_no_aio",
# "sdist",
# "depends",
# "latestdependency",
# "mindependency",
# "whl_no_aio",
]
PR_BUILD_SET = ["whl", "sdist", "mindependency"]
# this branch is checking only whl for now. rest will follow as they migrate
PR_BUILD_SET = ["whl"] #, "sdist", "mindependency"


def resolve_devops_variable(var_value: str) -> List[str]:
Expand Down
Loading