diff --git a/build/build-and-unit-tests.yml b/build/build-and-unit-tests.yml index 53190b501..d46a882fc 100644 --- a/build/build-and-unit-tests.yml +++ b/build/build-and-unit-tests.yml @@ -1,4 +1,4 @@ -# Copyright (c) Microsoft. All rights reserved. +# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. # This template contains jobs to build and run unit tests @@ -12,6 +12,8 @@ jobs: displayName: Build and run unit tests - ${{ parameters.configuration }} condition: succeeded() templateContext: + settings: + networkIsolationPolicy: Permissive,CFSClean outputs: - output: buildArtifacts artifactName: drop @@ -40,8 +42,13 @@ jobs: inputs: script: set + - template: prepare-nuget.yml + - task: NuGetCommand@2 displayName: 'NuGet restore' + inputs: + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: DotNetCoreCLI@2 displayName: 'dotnet restore' @@ -50,6 +57,8 @@ jobs: projects: | **\*.csproj !**\CustomActions.Package.csproj + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: VSBuild@1 displayName: 'Build Solution **\*.sln' diff --git a/build/check-dependencies.yml b/build/check-dependencies.yml index 6c37a52b2..9f52c6f2e 100644 --- a/build/check-dependencies.yml +++ b/build/check-dependencies.yml @@ -1,4 +1,4 @@ -# Copyright (c) Microsoft. All rights reserved. +# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. # This template checks for assemblies that may need harvesting in ClearlyDefined @@ -13,14 +13,22 @@ jobs: name: $(a11yInsightsPool) # Name of your hosted pool image: windows-2022-secure # Name of the image in your pool. If not specified, first image of the pool is used os: windows # OS of the image. Allowed values: windows, linux, macOS + templateContext: + settings: + networkIsolationPolicy: Permissive,CFSClean steps: - task: NuGetToolInstaller@1 displayName: 'Use NuGet 5.x' inputs: versionSpec: '5.x' + - template: prepare-nuget.yml + - task: NuGetCommand@2 displayName: 'NuGet restore' + inputs: + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: PowerShell@2 displayName: 'Check ClearlyDefined' diff --git a/build/prbuild.yml b/build/prbuild.yml index 90da50b5a..f5f192fbe 100644 --- a/build/prbuild.yml +++ b/build/prbuild.yml @@ -24,6 +24,7 @@ extends: parameters: settings: skipBuildTagsForGitHubPullRequests: true + networkIsolationPolicy: Permissive,CFSClean # Update the pool with your team's 1ES hosted pool. pool: name: $(a11yInsightsPool) # Name of your hosted pool diff --git a/build/prepare-nuget.yml b/build/prepare-nuget.yml new file mode 100644 index 000000000..a592cfae6 --- /dev/null +++ b/build/prepare-nuget.yml @@ -0,0 +1,13 @@ +# Copyright (c) Microsoft. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# Prepares NuGet for a solution restore by authenticating to the Azure Artifacts +# feed declared in nuget.config. + +parameters: +- name: nugetConfigPath + type: string + default: '$(Build.SourcesDirectory)/src/nuget.config' + +steps: +- task: NuGetAuthenticate@1 + displayName: 'Authenticate to NuGet feeds' diff --git a/build/signedbuild.yml b/build/signedbuild.yml index 305eb3434..00f8d4b8b 100644 --- a/build/signedbuild.yml +++ b/build/signedbuild.yml @@ -1,4 +1,4 @@ -# Copyright (c) Microsoft. All rights reserved. +# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. name: $(date:yyyy-MM-dd)$(rev:.rr) trigger: none @@ -66,8 +66,13 @@ extends: inputs: script: set + - template: prepare-nuget.yml + - task: NuGetCommand@2 displayName: 'NuGet restore' + inputs: + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: DotNetCoreCLI@2 displayName: 'dotnet restore' @@ -76,6 +81,8 @@ extends: projects: | **\*.csproj !**\CustomActions.Package.csproj + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: VSBuild@1 displayName: 'Build Solution **\*.sln' @@ -126,8 +133,15 @@ extends: inputs: script: set + - template: prepare-nuget.yml + - task: NuGetCommand@2 displayName: 'NuGet restore' + inputs: + command: 'restore' + restoreSolution: '$(Build.SourcesDirectory)\src\AccessibilityInsights.sln' + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: DotNetCoreCLI@2 displayName: 'dotnet restore' @@ -136,6 +150,8 @@ extends: projects: | **\*.csproj !**\CustomActions.Package.csproj + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: VSBuild@1 displayName: 'Build Solution **\*.sln' @@ -257,8 +273,13 @@ extends: inputs: script: set + - template: prepare-nuget.yml + - task: NuGetCommand@2 displayName: 'NuGet restore' + inputs: + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: DotNetCoreCLI@2 displayName: 'dotnet restore' @@ -267,6 +288,8 @@ extends: projects: | **\*.csproj !**\CustomActions.Package.csproj + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' diff --git a/build/ui-test-job.yml b/build/ui-test-job.yml index e935ba543..5d572c1dd 100644 --- a/build/ui-test-job.yml +++ b/build/ui-test-job.yml @@ -1,4 +1,4 @@ -# Copyright (c) Microsoft. All rights reserved. +# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. # This template contains jobs to run UI tests using WinAppDriver. @@ -13,14 +13,24 @@ jobs: name: $(a11yInsightsPool) # Name of your hosted pool image: windows-2022-secure # Name of the image in your pool. If not specified, first image of the pool is used os: windows # OS of the image. Allowed values: windows, linux, macOS + templateContext: + settings: + networkIsolationPolicy: Permissive,CFSClean steps: - task: NuGetToolInstaller@1 displayName: 'Use NuGet 5.x' inputs: versionSpec: '5.x' + - template: prepare-nuget.yml + - task: NuGetCommand@2 displayName: 'NuGet restore' + inputs: + command: restore + restoreSolution: '**/*.sln' + feedsToUse: config + nugetConfigPath: '$(Build.SourcesDirectory)/src/nuget.config' - task: VSBuild@1 displayName: 'Build Solution **\*.sln' @@ -28,6 +38,7 @@ jobs: vsVersion: 17.0 platform: '$(BuildPlatform)' configuration: ${{ parameters.configuration }} + msbuildArgs: '/restore /p:RestoreConfigFile=$(Build.SourcesDirectory)/src/nuget.config' - task: WinAppDriver.winappdriver-pipelines-task.winappdriver-pipelines-task.Windows Application Driver@0 displayName: 'Start - WinAppDriver' diff --git a/src/nuget.config b/src/nuget.config new file mode 100644 index 000000000..32f943513 --- /dev/null +++ b/src/nuget.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file