Skip to content
Open
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
81 changes: 31 additions & 50 deletions build-tools/automation/yaml-templates/apk-instrumentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,6 @@ parameters:
condition: succeeded()

steps:
# Build and install the APK to the device first, so that ComputeRunArguments
# can resolve the package name from AndroidManifest.xml.
#
# Retry the install up to 3 times: the emulator/ADB connection occasionally
# drops mid-install (XAGCPU7000 "device offline") and a retry usually recovers.
# If every attempt fails, continueOnError: false fails the lane immediately -
# there is no point running the tests against a device where the app was never
# installed (that only wastes CI time and produces a misleading
# INSTRUMENTATION_FAILED). See dotnet/android#11830.
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
configuration: ${{ parameters.buildConfiguration }}
xaSourcePath: ${{ parameters.xaSourcePath }}
displayName: build ${{ parameters.testName }}
project: ${{ parameters.project }}
arguments: >-
-t:Install
-bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/build-${{ parameters.testName }}.binlog
-c ${{ parameters.configuration }} ${{ parameters.extraBuildArgs }}
condition: ${{ parameters.condition }}
retryCountOnTaskFailure: 3
continueOnError: false

# If the install above failed, snapshot device state so we can classify WHY on
# the next iteration instead of guessing: connectivity (adb devices/get-state),
# disk pressure (df), storage-service readiness (the StorageStatsManager NPE
# from install-create), boot completion, and how many test apps have piled up.
# Best-effort and time-bounded so it never hangs or fails the lane itself.
- script: |
set +e
echo "===== adb devices -l ====="; adb devices -l
echo "===== adb get-state ====="; adb get-state
echo "===== boot completion ====="; adb shell getprop sys.boot_completed; adb shell getprop dev.bootcomplete
echo "===== df /data ====="; adb shell df /data
echo "===== df /storage/emulated/0 ====="; adb shell df /storage/emulated/0
echo "===== dumpsys diskstats ====="; adb shell dumpsys diskstats
echo "===== storaged (storage stats service) ====="; adb shell dumpsys storaged
echo "===== installed 3rd-party packages ====="; adb shell pm list packages -3
echo "===== end device state ====="
exit 0
displayName: diagnose install failure ${{ parameters.testName }}
condition: failed()
continueOnError: true
timeoutInMinutes: 3

# Run dotnet test from the project directory so it finds the project-local
# global.json with "test": { "runner": "Microsoft.Testing.Platform" }.
# This enables MTP mode, which uses RunCommand/RunArguments to invoke
Expand All @@ -74,12 +29,38 @@ steps:
$env:PATH = "${DOTNET_ROOT};$env:PATH"
$dotnetPath = "${DOTNET_ROOT}\dotnet.exe"
}
& $dotnetPath test $projectFile --no-build -bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/run-${{ parameters.testName }}.binlog -c ${{ parameters.configuration }} --results-directory $resultsDir --report-trx --report-trx-filename ${{ parameters.testName }}.trx --output Detailed ${{ parameters.extraBuildArgs }}
# `dotnet test` deploys to the device through an in-process MSBuild invocation,
# which bypasses MSBuildForwardingApp and does not set DOTNET_HOST_PATH. Without
# it, MSBuild cannot launch task hosts (MSB4221 on ILLink's ComputeManagedAssemblies).
$env:DOTNET_HOST_PATH = $dotnetPath
& $dotnetPath test $projectFile -bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/run-${{ parameters.testName }}.binlog -c ${{ parameters.configuration }} --results-directory $resultsDir --report-trx --report-trx-filename ${{ parameters.testName }}.trx --output Detailed ${{ parameters.extraBuildArgs }}
Pop-Location
displayName: run ${{ parameters.testName }}
condition: ${{ parameters.condition }}
continueOnError: true

# If the test failed, snapshot device state so we can classify WHY on the next
# iteration instead of guessing: connectivity (adb devices/get-state), disk
# pressure (df), storage-service readiness, boot completion, and how many test
# apps have piled up. Best-effort and time-bounded so it never hangs or fails
# the lane itself.
- script: |
set +e
echo "===== adb devices -l ====="; adb devices -l
echo "===== adb get-state ====="; adb get-state
echo "===== boot completion ====="; adb shell getprop sys.boot_completed; adb shell getprop dev.bootcomplete
echo "===== df /data ====="; adb shell df /data
echo "===== df /storage/emulated/0 ====="; adb shell df /storage/emulated/0
echo "===== dumpsys diskstats ====="; adb shell dumpsys diskstats
echo "===== storaged (storage stats service) ====="; adb shell dumpsys storaged
echo "===== installed 3rd-party packages ====="; adb shell pm list packages -3
echo "===== end device state ====="
exit 0
displayName: diagnose test failure ${{ parameters.testName }}
condition: and(succeededOrFailed(), ne(variables['Agent.JobStatus'], 'Succeeded'))
continueOnError: true
timeoutInMinutes: 3

- script: >
DEST="$(Build.StagingDirectory)/Test${{ parameters.configuration }}/${{ parameters.artifactFolder }}/" &&
mkdir -p "$DEST" &&
Expand All @@ -95,10 +76,10 @@ steps:
# any UnsatisfiedLinkError / dlopen messages only appear in logcat.
#
# Use always() (not the default succeeded()) so we still capture logcat when an
# earlier step failed or the job was canceled - in particular a failed -t:Install
# (which now fails the lane fast) or a hung/timed-out test run. Losing logcat in
# exactly those cases would defeat the diagnostics this template exists for; the
# capture is best-effort (continueOnError + '|| echo'). See dotnet/android#11830.
# earlier step failed or the job was canceled - in particular a hung/timed-out
# test run. Losing logcat in exactly those cases would defeat the diagnostics
# this template exists for; the capture is best-effort (continueOnError + '||
# echo'). See dotnet/android#11830.
- script: >
DEST="$(Build.StagingDirectory)/Test${{ parameters.configuration }}/${{ parameters.artifactFolder }}/" &&
mkdir -p "$DEST" &&
Expand Down
32 changes: 16 additions & 16 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.NET.Sdk" Version="11.0.100-preview.7.26365.101">
<Dependency Name="Microsoft.NET.Sdk" Version="11.0.100-rc.1.26401.101">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>cb8306a63c5cf24e9381108a3a9eb58907fd0f60</Sha>
<Sha>5da2de22f7c6e2ebe7ed4c16c614b00183145d3c</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink" Version="11.0.0-preview.7.26365.101">
<Dependency Name="Microsoft.NET.ILLink" Version="11.0.0-rc.1.26401.101">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>cb8306a63c5cf24e9381108a3a9eb58907fd0f60</Sha>
<Sha>5da2de22f7c6e2ebe7ed4c16c614b00183145d3c</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="11.0.0-preview.7.26365.101">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="11.0.0-rc.1.26401.101">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>cb8306a63c5cf24e9381108a3a9eb58907fd0f60</Sha>
<Sha>5da2de22f7c6e2ebe7ed4c16c614b00183145d3c</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.5-preview.26365.101">
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.5-preview.26401.101">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>cb8306a63c5cf24e9381108a3a9eb58907fd0f60</Sha>
<Sha>5da2de22f7c6e2ebe7ed4c16c614b00183145d3c</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest-11.0.100-preview.4" Version="11.0.100-preview.4.26215.121">
<Uri>https://github.com/dotnet/dotnet</Uri>
Expand All @@ -36,21 +36,21 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26365.101">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26401.101">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>cb8306a63c5cf24e9381108a3a9eb58907fd0f60</Sha>
<Sha>5da2de22f7c6e2ebe7ed4c16c614b00183145d3c</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="11.0.0-beta.26365.101">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="11.0.0-beta.26401.101">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>cb8306a63c5cf24e9381108a3a9eb58907fd0f60</Sha>
<Sha>5da2de22f7c6e2ebe7ed4c16c614b00183145d3c</Sha>
</Dependency>
<Dependency Name="Microsoft.TemplateEngine.Authoring.Tasks" Version="11.0.100-preview.7.26365.101">
<Dependency Name="Microsoft.TemplateEngine.Authoring.Tasks" Version="11.0.100-rc.1.26401.101">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>cb8306a63c5cf24e9381108a3a9eb58907fd0f60</Sha>
<Sha>5da2de22f7c6e2ebe7ed4c16c614b00183145d3c</Sha>
</Dependency>
<Dependency Name="MSTest" Version="4.4.0-preview.26376.8">
<Dependency Name="MSTest" Version="4.4.0-preview.26402.3">
<Uri>https://github.com/microsoft/testfx</Uri>
<Sha>20bae7233d7d0036ec6e20f52933e7d8418b22f8</Sha>
<Sha>e492730d840fc5864eff04230dd993041cf6189a</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
14 changes: 7 additions & 7 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project>
<!--Package versions-->
<PropertyGroup>
<MicrosoftNETSdkPackageVersion>11.0.100-preview.7.26365.101</MicrosoftNETSdkPackageVersion>
<MicrosoftNETSdkPackageVersion>11.0.100-rc.1.26401.101</MicrosoftNETSdkPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftNETILLinkPackageVersion>11.0.0-preview.7.26365.101</MicrosoftNETILLinkPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>11.0.0-preview.7.26365.101</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftNETILLinkPackageVersion>11.0.0-rc.1.26401.101</MicrosoftNETILLinkPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>11.0.0-rc.1.26401.101</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
<!-- Last version built for net10.0, needed for CI steps that only have the .NET 10 SDK installed (e.g., BAR manifest publishing) -->
<MicrosoftDotNetBuildTasksFeedPackageVersionNet10>11.0.0-beta.26060.102</MicrosoftDotNetBuildTasksFeedPackageVersionNet10>
<MicrosoftDotNetBuildTasksFeedPackageVersion>11.0.0-beta.26365.101</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>11.0.0-beta.26401.101</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETWorkloadMonoToolchainCurrentManifest110100preview4PackageVersion>11.0.100-preview.4.26215.121</MicrosoftNETWorkloadMonoToolchainCurrentManifest110100preview4PackageVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest110100preview4PackageVersion>11.0.100-preview.4.26215.121</MicrosoftNETWorkloadEmscriptenCurrentManifest110100preview4PackageVersion>
<MicrosoftNETWorkloadMonoToolChainPackageVersion>$(MicrosoftNETWorkloadMonoToolChainCurrentManifest110100preview4PackageVersion)</MicrosoftNETWorkloadMonoToolChainPackageVersion>
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest110100preview4PackageVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
<MicrosoftTemplateEngineAuthoringTasksPackageVersion>11.0.100-preview.7.26365.101</MicrosoftTemplateEngineAuthoringTasksPackageVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.5-preview.26365.101</MicrosoftDotNetCecilPackageVersion>
<MSTestPackageVersion>4.4.0-preview.26376.8</MSTestPackageVersion>
<MicrosoftTemplateEngineAuthoringTasksPackageVersion>11.0.100-rc.1.26401.101</MicrosoftTemplateEngineAuthoringTasksPackageVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.5-preview.26401.101</MicrosoftDotNetCecilPackageVersion>
<MSTestPackageVersion>4.4.0-preview.26402.3</MSTestPackageVersion>
<SystemIOHashingPackageVersion>10.0.10</SystemIOHashingPackageVersion>
<SystemReflectionMetadataPackageVersion>11.0.0-preview.1.26104.118</SystemReflectionMetadataPackageVersion>
<!-- Previous .NET Android version -->
Expand Down
2 changes: 2 additions & 0 deletions eng/common/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Param(
[switch] $clean,
[switch][Alias('pb')]$productBuild,
[switch]$fromVMR,
[switch]$disablePipelineSetResult,
[switch][Alias('bl')]$binaryLog,
[string][Alias('bln')]$binaryLogName = '',
[switch][Alias('nobl')]$excludeCIBinarylog,
Expand Down Expand Up @@ -80,6 +81,7 @@ function Print-Usage() {
Write-Host " -nodeReuse <value> Sets nodereuse msbuild parameter ('true' or 'false')"
Write-Host " -buildCheck Sets /check msbuild parameter"
Write-Host " -fromVMR Set when building from within the VMR"
Write-Host " -disablePipelineSetResult Set to disable masking the actual exit code in the pipeline when the build fails"
Write-Host ""

Write-Host "Command line arguments not listed above are passed thru to msbuild."
Expand Down
11 changes: 11 additions & 0 deletions eng/common/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ usage()
echo " --projects <value> Project or solution file(s) to build"
echo " --ci Set when running on CI server"
echo " --excludeCIBinarylog Don't output binary log (short: -nobl)"
echo " --pipelinesLog Promote msbuild errors/warnings to Azure Pipelines timeline issues; defaults to on in CI (short: -pl)"
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
echo " --nodeReuse <value> Sets nodereuse msbuild parameter ('true' or 'false')"
echo " --warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')"
echo " --warnNotAsError <value> Sets a semi-colon delimited list of warning codes that should not be treated as errors"
echo " --buildCheck <value> Sets /check msbuild parameter"
echo " --fromVMR Set when building from within the VMR"
echo " --disablePipelineSetResult Set to disable masking the actual exit code in the pipeline when the build fails"
echo ""
echo "Command line arguments not listed above are passed thru to msbuild."
echo "Arguments can also be passed in with a single hyphen."
Expand All @@ -68,6 +70,7 @@ build=false
source_build=false
product_build=false
from_vmr=false
disable_pipeline_set_result=false
rebuild=false
test=false
integration_test=false
Expand All @@ -86,6 +89,7 @@ build_check=false
binary_log=false
binary_log_name=''
exclude_ci_binary_log=false
pipelines_log=false

projects=''
configuration=''
Expand Down Expand Up @@ -124,6 +128,9 @@ while [[ $# -gt 0 ]]; do
-excludecibinarylog|-nobl)
exclude_ci_binary_log=true
;;
-pipelineslog|-pl)
pipelines_log=true
;;
-restore|-r)
restore=true
;;
Expand Down Expand Up @@ -152,6 +159,9 @@ while [[ $# -gt 0 ]]; do
-fromvmr|-from-vmr)
from_vmr=true
;;
-disablepipelinesetresult|-disable-pipeline-set-result)
disable_pipeline_set_result=true
;;
-test|-t)
test=true
;;
Expand Down Expand Up @@ -213,6 +223,7 @@ if [[ -z "$configuration" ]]; then
fi

if [[ "$ci" == true ]]; then
pipelines_log=true
# Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED.
# Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on.
if [[ "${MSBUILD_NODEREUSE_ENABLED:-}" != "1" ]]; then
Expand Down
30 changes: 24 additions & 6 deletions eng/common/core-templates/job/helix-job-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ parameters:
type: boolean
default: true

# When true, test results are reported to Azure DevOps using the fully qualified test name
# (Namespace.Type.Method) as the stable automatedTestName and the visible title is qualified as
# well (--use-fully-qualified-test-name). Opt-in because it changes AzDO test identity and display;
# primarily useful for frameworks like MSTest whose display name is only the method name.
- name: useFullyQualifiedTestName
type: boolean
default: false

# Advanced: optional pipeline artifact (produced earlier in this run) that contains the tool
# nupkg. When set, the artifact is downloaded and the tool is installed from the nupkg into
# a local tool-path; this bypasses the repo's .config/dotnet-tools.json manifest and is
Expand Down Expand Up @@ -96,9 +104,11 @@ jobs:
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
os: linux
demands: ImageOverride -equals build.azurelinux.3.amd64.open
${{ else }}:
name: $(DncEngInternalBuildPool)
os: linux
demands: ImageOverride -equals build.azurelinux.3.amd64
steps:
- checkout: self
Expand Down Expand Up @@ -176,24 +186,32 @@ jobs:
set -euo pipefail

toolArgs=(
--helix-base-uri '${{ parameters.helixBaseUri }}'
--polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}'
--fail-on-failed-tests '${{ parameters.failWorkItemsWithFailedTests }}'
--max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully.
--stage-name '$(System.StageName)'
--helix-base-uri '${{ parameters.helixBaseUri }}'
--polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}'
--fail-on-failed-tests '${{ parameters.failWorkItemsWithFailedTests }}'
--use-fully-qualified-test-name '${{ parameters.useFullyQualifiedTestName }}'
--max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully.
--stage-name '$(System.StageName)'
--stage-attempt '$(System.StageAttempt)'
)

organization='${{ parameters.organization }}'
repository='${{ parameters.repository }}'

# Fall back to Azure DevOps-provided environment variables when the caller did not
# supply organization / repository explicitly. BUILD_REPOSITORY_NAME is typically
# 'owner/repo' for GitHub-backed builds.
# 'owner/repo' for GitHub-backed builds and 'owner-repo' for internal builds.
if [ -z "$organization" ] || [ -z "$repository" ]; then
buildRepoName="${BUILD_REPOSITORY_NAME:-}"
if [ -n "$buildRepoName" ] && [[ "$buildRepoName" == */* ]]; then
repoOwner="${buildRepoName%%/*}"
repoName="${buildRepoName#*/}"
elif [ -n "$buildRepoName" ] && [[ "$buildRepoName" == *-* ]]; then
repoOwner="${buildRepoName%%-*}"
repoName="${buildRepoName#*-}"
fi

if [ -n "${repoOwner:-}" ] && [ -n "${repoName:-}" ]; then
if [ -z "$organization" ]; then organization="$repoOwner"; fi
if [ -z "$repository" ]; then repository="$repoName"; fi
fi
Expand Down
Loading
Loading