Skip to content

[Eng] Added necessary tools/pipelines update to migrate main to future #27104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 262 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
262 commits
Select commit Hold shift + click to select a range
96e88b7
polish parameter for buildmodules.ps1
VeryEarly Mar 5, 2024
ec09a3b
polish
VeryEarly Mar 5, 2024
f217e4e
refine build and prepare autorest
VeryEarly Mar 20, 2024
757b200
remove unused changes
VeryEarly Mar 20, 2024
9d259dc
update csproj mapping to add folder generated/, and trim keys
VeryEarly Mar 27, 2024
7366d17
Update CIFilter to remove src/ from mapping keys
NoriZC Mar 28, 2024
7009949
add test-module.ps1 in gen2main
VeryEarly Apr 9, 2024
ddf674f
add check-dependencies.ps1 in gen2main
VeryEarly Apr 10, 2024
14c8194
add psd1 in gen2main
VeryEarly Apr 10, 2024
16cb460
update az.autorest.props to apply new folder structure
VeryEarly Apr 10, 2024
bae20c3
Merge remote-tracking branch 'origin/eng/archive-test' into eng/archi…
VeryEarly Apr 10, 2024
0234b26
fix submodule name
VeryEarly Apr 10, 2024
7f3f654
fix trimmed submodule name
VeryEarly Apr 10, 2024
62afd70
fix trimmed submodule name
VeryEarly Apr 10, 2024
37e112d
add script to migrate generated folder
VeryEarly Apr 10, 2024
df077ba
uncomment
VeryEarly Apr 12, 2024
3ad3220
Add readme.azure.md and readme.azure.noprofile.md
NoriZC Apr 12, 2024
cb81425
migrate readme from eng/archive-test branch
VeryEarly Apr 12, 2024
3d8b3df
update migration script to add generated csproj in sln
VeryEarly Apr 12, 2024
4beb51d
fix previous commit
VeryEarly Apr 12, 2024
d55e9d8
copy other script from eng/archive-test
VeryEarly Apr 15, 2024
22427f8
fix script
VeryEarly Apr 16, 2024
839a382
refine build-module.ps1 and add some log
VeryEarly Apr 16, 2024
2242c6e
refine log message
VeryEarly Apr 17, 2024
ab7c3e4
color log output
VeryEarly Apr 17, 2024
e3f0244
use foreach instead of foreach-object to improve performance
VeryEarly Apr 17, 2024
4bd23e8
improve write log
VeryEarly Apr 17, 2024
a600e7a
fix
VeryEarly Apr 17, 2024
cbb1d5e
question
VeryEarly Apr 17, 2024
e642f27
apply new build process to dotnet msbuild /t:build
VeryEarly Apr 17, 2024
741db11
test pipeline 1
VeryEarly Apr 18, 2024
10b989b
test pipeline 2
VeryEarly Apr 18, 2024
c32a060
test pipeline 3
VeryEarly Apr 18, 2024
2dd2655
test pipeline 4
VeryEarly Apr 18, 2024
91ae098
test pipeline 5
VeryEarly Apr 22, 2024
cc5df6f
test pipeline 6
VeryEarly Apr 22, 2024
4e20290
test pipeline 7
VeryEarly Apr 22, 2024
e2cc535
test pipeline 8
VeryEarly Apr 22, 2024
b48cef7
test pipeline 9
VeryEarly Apr 22, 2024
dce031b
test pipeline 10
VeryEarly Apr 22, 2024
2047deb
test pipeline 11
VeryEarly Apr 22, 2024
0ebe15b
test pipeline 12
VeryEarly Apr 22, 2024
f51acce
test pipeline 12
VeryEarly Apr 22, 2024
cbf1faf
test pipeline 13
VeryEarly Apr 22, 2024
78f5073
test pipeline 14
VeryEarly Apr 22, 2024
8778053
test pipeline 15
VeryEarly Apr 22, 2024
cb40cd5
test pipeline 16
VeryEarly Apr 22, 2024
6b4e3b8
test pipeline 17
VeryEarly Apr 22, 2024
ba38a9a
test pipeline 18
VeryEarly Apr 22, 2024
2418a2b
test pipeline 19
VeryEarly Apr 22, 2024
6d81579
test pipeline 20
VeryEarly Apr 22, 2024
dba7d40
test pipeline 21
VeryEarly Apr 22, 2024
8767330
test pipeline 22
VeryEarly Apr 22, 2024
400be6a
test pipeline 23
VeryEarly Apr 22, 2024
e85e34c
test pipeline 24
VeryEarly Apr 22, 2024
1270f24
test pipeline 25
VeryEarly Apr 23, 2024
e0325a2
test pipeline 26
VeryEarly Apr 23, 2024
5867b36
test pipeline 27
VeryEarly Apr 23, 2024
b6a6228
test pipeline 28
VeryEarly Apr 23, 2024
ca965d0
test pipeline 29
VeryEarly Apr 23, 2024
f9a94cd
test pipeline 30
VeryEarly Apr 23, 2024
3b0bb1f
test pipeline 31
VeryEarly Apr 23, 2024
580e3d6
test pipeline 32
VeryEarly Apr 23, 2024
184d1a3
test pipeline 33
VeryEarly Apr 26, 2024
e9718b9
split build function to buildscripts.psm1
VeryEarly Apr 29, 2024
dd8d273
Add generate id in generate-info
NoriZC Apr 29, 2024
95c4b26
Add generate id in generate-info
NoriZC Apr 29, 2024
65763eb
Add generate id in generate-info
NoriZC Apr 29, 2024
a31b2c0
regenerate help during adaptautorestmodule
VeryEarly Apr 29, 2024
dd1c675
Merge remote-tracking branch 'origin/eng/archive-test' into eng/archi…
VeryEarly Apr 29, 2024
9bc072a
async generate
VeryEarly Apr 30, 2024
150c487
more async
VeryEarly Apr 30, 2024
fa8e3ce
sync main
VeryEarly Apr 30, 2024
44be674
move resolve tools back
VeryEarly Apr 30, 2024
d4cf1ca
update migrate script
VeryEarly Apr 30, 2024
b23cce1
fix path
VeryEarly Apr 30, 2024
f0eaba2
generate info while migrating main
VeryEarly Apr 30, 2024
7c5f4b6
fix
VeryEarly Apr 30, 2024
d661d5e
Remove redundant dependencies for autogen modules
dolauli Apr 30, 2024
bbbf905
add log output
VeryEarly May 6, 2024
458706c
sync main
VeryEarly May 7, 2024
f135e89
generate id
VeryEarly May 7, 2024
bc0e840
fix
VeryEarly May 7, 2024
7696057
revert async
VeryEarly May 7, 2024
4c7a7dd
fix
VeryEarly May 7, 2024
09a0f11
adjust generate id
VeryEarly May 8, 2024
175fded
exit when no generate id
VeryEarly May 8, 2024
68c59a4
Merge branch 'main' into eng/archive-test
VeryEarly May 8, 2024
a4c6154
fix
VeryEarly May 8, 2024
1a22e7c
minor fix
VeryEarly May 8, 2024
2eb819d
fix
VeryEarly May 8, 2024
3385514
update readme.azure.noprofile.md
VeryEarly May 8, 2024
2e1c4ab
Merge branch 'main' into eng/archive-test
VeryEarly May 8, 2024
df9dc3e
fixed after build
VeryEarly May 9, 2024
cfae130
remove sln when build finish
VeryEarly May 9, 2024
a5b8605
add migration script
VeryEarly May 9, 2024
647af0a
Merge branch 'main' into eng/archive-test
VeryEarly May 10, 2024
9eaf4d4
revert autorest dpendency changes
VeryEarly May 10, 2024
13cdd67
Merge branch 'main' into eng/archive-test
VeryEarly May 11, 2024
2f52a31
remove redundant
VeryEarly May 11, 2024
800b28c
fix
VeryEarly May 11, 2024
1be4819
Merge remote-tracking branch 'origin/eng/archive-test' into eng/archi…
VeryEarly May 11, 2024
89b783f
fix
VeryEarly May 11, 2024
e479492
fix
VeryEarly May 11, 2024
5333f0e
fix
VeryEarly May 14, 2024
d3a638a
copy src/helpers from generation branch
VeryEarly May 14, 2024
5ffd2ab
Merge branch 'main' into eng/archive-test
VeryEarly May 14, 2024
d6def55
fix
VeryEarly May 17, 2024
1ed1c3f
Merge branch 'main' into eng/archive-test
VeryEarly May 17, 2024
757be35
fix
VeryEarly May 17, 2024
da1e10b
fix
VeryEarly May 17, 2024
ad9e733
test
VeryEarly May 21, 2024
c4606f9
Merge branch 'main' into eng/archive-test
VeryEarly May 22, 2024
6e68845
fix
VeryEarly May 27, 2024
b90a20a
fix
VeryEarly May 27, 2024
5f5cbf7
fix
VeryEarly May 27, 2024
7c180b8
fix
VeryEarly May 27, 2024
3ba18a1
fix
VeryEarly May 27, 2024
e78b81a
fix
VeryEarly May 28, 2024
392cd6a
Merge branch 'main' into eng/archive-test
VeryEarly May 28, 2024
23bb952
fix
VeryEarly May 28, 2024
287c74c
Merge branch 'main' into eng/archive-test
VeryEarly May 29, 2024
0bce6d8
fix
VeryEarly May 30, 2024
1490c98
fix
VeryEarly May 31, 2024
99db122
Merge branch 'main' into eng/archive-test
VeryEarly May 31, 2024
92c64d0
update security tools
VeryEarly Jun 3, 2024
31607c6
typo
VeryEarly Jun 3, 2024
ba5654a
fix
VeryEarly Jun 4, 2024
88e56ed
fix
VeryEarly Jun 4, 2024
5f17297
fix
VeryEarly Jun 4, 2024
96545ee
fix
VeryEarly Jun 4, 2024
47fd0a9
update reference of csproj in resource.test.csproj
VeryEarly Jun 11, 2024
42dea41
Merge branch 'main' into eng/archive-test
VeryEarly Jun 11, 2024
03708de
fix
VeryEarly Jun 11, 2024
b36dc88
update references of autorest modules for resource.sln
VeryEarly Jun 12, 2024
4162443
Merge branch 'main' into eng/archive-test
VeryEarly Jun 17, 2024
bf295e0
move removeunwanted and updatemodule to buildscript
VeryEarly Jun 18, 2024
f832f12
polish parameter name for build script
VeryEarly Jun 24, 2024
d5d8e10
add switch invokedbypipeline
VeryEarly Jun 26, 2024
f412ad2
Merge branch 'main' into eng/archive-test
VeryEarly Jun 26, 2024
252cb88
trigger new pipeline for future branch by default
VeryEarly Jul 1, 2024
2af6ca6
Merge branch 'main' into eng/archive-test
VeryEarly Jul 1, 2024
ce22a7d
add accounts in build by default
VeryEarly Jul 1, 2024
22f537e
fix
VeryEarly Jul 2, 2024
0d1d3bf
fix
VeryEarly Jul 2, 2024
f8cd103
build version controller during build script
VeryEarly Jul 2, 2024
2fd4ad3
Merge branch 'main' into eng/archive-test
VeryEarly Jul 23, 2024
c5460e5
fix
VeryEarly Jul 25, 2024
d812947
sync main
VeryEarly Jul 25, 2024
b12be5e
Update security-tools.yml
VeryEarly Jul 30, 2024
c8afd13
Update MigrateGenerated.ps1
VeryEarly Aug 2, 2024
f0994e2
Update MigrateGenerated.ps1
VeryEarly Aug 2, 2024
bcb1bec
Update MigrateGenerated.ps1
VeryEarly Aug 2, 2024
0b239f2
Update MigrateGenerated.ps1
VeryEarly Aug 2, 2024
f78df89
Update MigrateGenerated.ps1
VeryEarly Aug 2, 2024
d26067c
Update MigrateGenerated.ps1
VeryEarly Aug 2, 2024
bc36ca4
Update MigrateGenerated.ps1
VeryEarly Aug 2, 2024
faae5e0
add accounts to build/test by default for CIPlan parameterset
VeryEarly Aug 6, 2024
ec887ad
Update AdaptAutorestModule.ps1
VeryEarly Aug 6, 2024
3127ad7
Update AdaptAutorestModule.ps1
VeryEarly Aug 6, 2024
7cee89f
Merge branch 'main' into eng/archive-test
VeryEarly Aug 6, 2024
e2b0236
do not add testfx specificly because it was already included for all …
VeryEarly Aug 7, 2024
c8eb318
split build solution and test solution
VeryEarly Aug 8, 2024
8dbe0e7
Merge branch 'main' into eng/archive-test
VeryEarly Aug 20, 2024
7d2217c
add parent module csproj to module root sln for new module
VeryEarly Aug 21, 2024
9eac047
fix incorrect parent module csproj name
VeryEarly Aug 21, 2024
7658b9a
fix incorrect help refresh for new module
VeryEarly Aug 21, 2024
f1ece17
fix
VeryEarly Aug 21, 2024
9bd55d6
prepare autorest modules before calculate csproj to build
VeryEarly Aug 22, 2024
ed5d501
fix calculate generated files for new submodule
VeryEarly Aug 22, 2024
1062e13
remove PR analyze that block PR has changes in both /src and /generated
VeryEarly Aug 22, 2024
99c8a12
remove files accidentally checked in
VeryEarly Aug 23, 2024
694fe17
rename x.autorest/help -> x.autorest/docs
VeryEarly Aug 29, 2024
63b79dd
update pipeline
VeryEarly Sep 2, 2024
a261205
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Sep 2, 2024
077c2fb
update build for daily-build.yml
VeryEarly Sep 4, 2024
085cab6
new doc (unfinished)
VeryEarly Sep 5, 2024
87be88f
finish new docs
VeryEarly Sep 6, 2024
3a1cd90
update PR title
VeryEarly Sep 9, 2024
3613290
update
VeryEarly Sep 9, 2024
6bb507e
update
VeryEarly Sep 9, 2024
00f217a
update
VeryEarly Sep 9, 2024
503b6ce
update
VeryEarly Sep 9, 2024
f79c76e
do not exit when pr analyze failed, write warning instead
VeryEarly Sep 10, 2024
79b2ad0
remove generated ps1 script from autorest submodules during future mi…
VeryEarly Sep 11, 2024
6978f13
add assembly info attributes in readme.azure.noprofile.md
VeryEarly Sep 11, 2024
f5a9a72
allow resources to be checked in
VeryEarly Sep 11, 2024
b64d3fd
add git files to each autorest submodule during migration
VeryEarly Sep 12, 2024
e7c0706
disable assemblyinfo generate
VeryEarly Sep 25, 2024
11586bf
add final block in after build task
VeryEarly Sep 29, 2024
8470813
replace module version for submodule assemblyinfo
VeryEarly Sep 29, 2024
8d6ea69
reset assemblyinfo in finally block after re-compile
VeryEarly Sep 29, 2024
ce2201a
bugfix
VeryEarly Sep 30, 2024
37eb750
polish file move
VeryEarly Sep 30, 2024
8397d96
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Sep 30, 2024
58c2e5b
fix
VeryEarly Sep 30, 2024
8fd0989
skip livetests filder
VeryEarly Sep 30, 2024
4eec38a
fix
VeryEarly Oct 9, 2024
0b9c3a5
assemblyinfo
VeryEarly Oct 11, 2024
69c2d97
copy assemblyinfo separately
VeryEarly Oct 12, 2024
6153e47
fix
VeryEarly Oct 12, 2024
762dd53
check whether assemblyinfo existed before modifying it
VeryEarly Oct 14, 2024
087047a
fix child module path when add to sln
VeryEarly Oct 14, 2024
e8505b5
keep guid in psd1 under generated folder unchanged
VeryEarly Oct 15, 2024
500bd13
update afterbuild task to take module-name instead of service-name
VeryEarly Oct 29, 2024
459d5d0
split archive pipeline from build-steps
VeryEarly Nov 21, 2024
ee71be6
refactor cifiltertask
VeryEarly Nov 22, 2024
d0eb104
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Nov 22, 2024
969cdf8
refactor pipelines
VeryEarly Nov 22, 2024
c1d207d
move yml of archive pipeline
VeryEarly Nov 22, 2024
c115864
forgot function
VeryEarly Nov 22, 2024
9fe93b2
pr validation pipeline won't be triggered by CI
VeryEarly Nov 22, 2024
d377d97
fix path for util templates
VeryEarly Nov 25, 2024
65d67f3
fix array accidentally casted to string
VeryEarly Nov 25, 2024
5a2f7fa
fix branch name
VeryEarly Nov 25, 2024
414732e
fix parameter name for build-steps
VeryEarly Nov 25, 2024
ba364eb
add terminate condition when no files changed detected in archive pip…
VeryEarly Nov 25, 2024
518a36c
add helpers to not modules list
VeryEarly Nov 25, 2024
a47df5a
add helpers to not modules list
VeryEarly Nov 25, 2024
53e5e3a
move helpers folder from generation branch
VeryEarly Nov 25, 2024
1370f25
fix condition in yml
VeryEarly Nov 25, 2024
5bac0e1
do use exit 0 when terminate
VeryEarly Nov 25, 2024
878a47c
try to fix terminate condition
VeryEarly Nov 25, 2024
a0d82b1
fix switch syntax
VeryEarly Nov 25, 2024
5fff158
try to fix terminate condition
VeryEarly Nov 25, 2024
7db44d5
try to fix terminate condition
VeryEarly Nov 25, 2024
8315a50
have to fail archive when no outdated modules found
VeryEarly Nov 27, 2024
613f68a
remove duplicate warning message
VeryEarly Nov 27, 2024
e03da70
fix
VeryEarly Nov 27, 2024
5e48b81
fix
VeryEarly Nov 27, 2024
929369b
enable new build process for windows-powershell.yml
VeryEarly Nov 27, 2024
ed9a6ad
remove duplicate warning message
VeryEarly Nov 28, 2024
6891d70
use dotnet 8 for credscan
VeryEarly Nov 28, 2024
d0fdaa8
fix security tools pipeline
VeryEarly Nov 28, 2024
74dfd1d
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Nov 29, 2024
0a070e0
use batch ci trigger archive pipeline
VeryEarly Dec 3, 2024
ffdaa20
refactor archive pipeline
VeryEarly Dec 31, 2024
90d19dd
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Dec 31, 2024
d6a31a8
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Jan 7, 2025
b8b6784
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Jan 15, 2025
909fccf
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Jan 15, 2025
8597ede
add branch name filter, get token with internal method
VeryEarly Jan 20, 2025
9e64405
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Jan 30, 2025
531458e
Merge branch 'main' into eng/archive-test
VeryEarly Feb 10, 2025
83f711a
Merge remote-tracking branch 'origin/main' into eng/archive-test
VeryEarly Feb 12, 2025
7f2d9e0
add doc for future branch PR migration
VeryEarly Feb 13, 2025
61de4a7
add doc for future branch PR migration
VeryEarly Feb 13, 2025
7ed06fe
removed migration docs
VeryEarly Feb 13, 2025
3de97c1
enable new ci/pr pipelines for all branches
VeryEarly Feb 13, 2025
19ff86b
add README.md for pipelinesteps scripts
VeryEarly Feb 14, 2025
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
7 changes: 7 additions & 0 deletions .azure-pipelines/PipelineSteps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Pipeline Steps

This directory contains the PowerShell scripts refactored from ".azure-pipelines/util".

## Overview

The pipeline steps are refactored from yml based templates from ".azure-pipelines/util" to PowerShell scripts. This is designed for converting some Azure Devops pipelines to github action.
44 changes: 44 additions & 0 deletions .azure-pipelines/PipelineSteps/analyze-steps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
[CmdletBinding(DefaultParameterSetName="AllSet")]
param (
[string]$RepoRoot,
[string]$Configuration = 'Debug',
[string]$PowerShellPlatform
)

# Install PowerShell dependencies
Write-Host -ForegroundColor Green "-------------------- Start installing PowerShell dependencies ... --------------------"
Install-Module "platyPS", "PSScriptAnalyzer" -Repository PSGallery -Force -Confirm:$false -Scope CurrentUser
Write-Host -ForegroundColor DarkGreen "-------------------- End installing PowerShell dependencies ... --------------------`n`n`n`n`n"

# Install latest Az modules
Write-Host -ForegroundColor Green "-------------------- Start installing latest Az modules ... --------------------"
New-Item -ItemType Directory -Path "Az-Cmdlets-latest"
Invoke-WebRequest -Uri "https://azpspackage.blob.core.windows.net/release/Az-Cmdlets-latest.tar.gz" -OutFile "Az-Cmdlets-latest/Az-Cmdlets-latest.tar.gz" -MaximumRetryCount 2 -RetryIntervalSec 1
tar -xvzf "Az-Cmdlets-latest/Az-Cmdlets-latest.tar.gz" -C "Az-Cmdlets-latest"
& Az-Cmdlets-latest/InstallModule.ps1
Write-Host -ForegroundColor DarkGreen "-------------------- End installing latest Az modules ... --------------------`n`n`n`n`n"

# Generate help
Write-Host -ForegroundColor Green "-------------------- Start generating help ... --------------------"
if ($PowerShellPlatform) {
$Env:PowerShellPlatform = $PowerShellPlatform
}
$buildProjPath = Join-Path $RepoRoot 'build.proj'
dotnet msbuild $buildProjPath /t:GenerateHelp "/p:Configuration=$Configuration"
Write-Host -ForegroundColor DarkGreen "-------------------- End generating help ... --------------------`n`n`n`n`n"

# Static Analysis
Write-Host -ForegroundColor Green "-------------------- Start static analysis ... --------------------"
dotnet msbuild $buildProjPath /t:StaticAnalysis "/p:Configuration=$Configuration"
Write-Host -ForegroundColor DarkGreen "-------------------- End static analysis ... --------------------`n`n`n`n`n"
118 changes: 118 additions & 0 deletions .azure-pipelines/PipelineSteps/build-steps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
[CmdletBinding(DefaultParameterSetName="AllSet")]
param (
[string]$RepoRoot,
[string]$Configuration = 'Debug',
[string]$PowerShellPlatform,
[string]$FilesChangedOutputPath,
[boolean]$ForceRegenerate = $false,
[string]$SubTasksFilePath,
[boolean]$IsSecurityCheck,
[string]$BuildReason,
[string]$Trigger
)

# filter changed files
Write-Host -ForegroundColor Green "-------------------- Start filtering changed files ... --------------------"
$buildProjPath = Join-Path $RepoRoot 'build.proj'
if ($PowerShellPlatform) {
$Env:PowerShellPlatform = $PowerShellPlatform
}
dotnet msbuild $buildProjPath /t:FilterBuild "/p:FilesChangedOutputPath=$FilesChangedOutputPath;SubTasksFilePath=$SubTasksFilePath;IsSecurityCheck=$IsSecurityCheck"
Write-Host -ForegroundColor DarkGreen "-------------------- End filtering changed files ... --------------------`n`n`n`n`n"

# Set subtasks
if (Test-Path $SubTasksFilePath) {
Write-Host -ForegroundColor Green "-------------------- Start setting subtasks ... --------------------"
Get-Content $SubTasksFilePath | ForEach-Object {
if ($_ && 'Predictor' -eq $_) {
$subTaskPredictor = $true
} elseif ($_ && 'Installer' -eq $_) {
Write-Host "##vso[task.setvariable variable=SubTaskInstaller]true"
$subTaskInstaller = $true
} elseif ($_ && 'all' -eq $_) {
$subTaskAll = $true
}
}
Write-Host -ForegroundColor DarkGreen "-------------------- End setting subtasks ... --------------------`n`n`n`n`n"
}

# Analyze changed files
Write-Host -ForegroundColor Green "-------------------- Start Analyzing changed files ... --------------------"
Write-Host "##1. Check generate-info.json for autorest generated modules" -ForegroundColor Magenta
$noGenerateInfo = @()
$modules = Get-Content $FilesChangedOutputPath -OutVariable paths | Foreach-Object { if($_ -match "^src.*\.Autorest"){ Write-Output $Matches[0] } } | Select-Object -Unique
foreach ($module in $modules) {
$hasGenerateInfo = $false
$pattern = "^$module/generate-info.json"
foreach ($path in $paths) {
if ($path -match $pattern) {
$hasGenerateInfo = $true
}
}
if (-not $hasGenerateInfo) {
$noGenerateInfo += $module
}
}
if ($noGenerateInfo -and $noGenerateInfo.Count -gt 0) {
$noGenerateInfo | Foreach-Object { Write-Warning "No generate-info.json detected for $_." }
}

# this might not be true, for example when release branch or preview branch merge back to main branch, it's possible changes present in both /src and /generated
Write-Host "##2. PR should contain changes from either /src or /generated only" -ForegroundColor Magenta
$content = Get-Content $FilesChangedOutputPath
$srcFiles = $content | Where-Object { $_ -match "^src.*" }
$generatedFiles = $content | Where-Object { $_ -match "^generated.*" }
if ($srcFiles -and $srcFiles.Count -gt 0 -and $generatedFiles -and $generatedFiles.Count -gt 0) {
Write-Warning "PR should contain changes from either /src or /generated only."
}
Write-Host -ForegroundColor DarkGreen "-------------------- End Analyzing changed files ... --------------------`n`n`n`n`n"

# Check ignored files
Write-Host -ForegroundColor Green "-------------------- Start checking ignored files ... --------------------"
$checkIgnoreFilesScriptPath = Join-Path $RepoRoot 'tools' 'CheckIgnoredFile.ps1'
& $checkIgnoreFilesScriptPath
Write-Host -ForegroundColor DarkGreen "-------------------- End checking ignored files ... --------------------`n`n`n`n`n"

# Build
Write-Host -ForegroundColor Green "-------------------- Start building modules ... --------------------"
$buildScriptPath = Join-Path $RepoRoot 'tools' 'BuildScripts' 'BuildModules.ps1'
if ('Manual' -eq $BuildReason -and $ForceRegenerate) {
& $buildScriptPath -CIPlan -RepoRoot $RepoRoot -Configuration $Configuration -ForceRegenerate -InvokedByPipeline
} else {
& $buildScriptPath -CIPlan -RepoRoot $RepoRoot -Configuration $Configuration -InvokedByPipeline
}
Write-Host -ForegroundColor DarkGreen "-------------------- End building modules ... --------------------`n`n`n`n`n"

# Write pipeline result
Write-Host -ForegroundColor Green "-------------------- Start writing pipeline result ... --------------------"
$pipelineScript = Join-Path $RepoRoot 'tools' 'ExecuteCIStep.ps1'
$repoArtifact = Join-Path $RepoRoot 'artifacts'
& $pipelineScript -Build -TriggerType $BuildReason -Trigger $Trigger -RepoArtifacts $repoArtifact -Configuration $Configuration
Write-Host -ForegroundColor DarkGreen "-------------------- End writing pipeline result ... --------------------`n`n`n`n`n"

# Build Az.Tools.Predictor
if ($subTaskPredictor -or $subTaskAll) {
Write-Host -ForegroundColor Green "-------------------- Start building Az.Tools.Predictor ... --------------------"
dotnet msbuild $buildProjPath /t:AzToolsPredictor
Write-Host -ForegroundColor DarkGreen "-------------------- End building Az.Tools.Predictor ... --------------------`n`n`n`n`n"
}

# Build Az.Tools.Installer
if ($subTaskInstaller -or $subTaskAll) {
Write-Host -ForegroundColor Green "-------------------- Start building Az.Tools.Installer ... --------------------"
dotnet msbuild $buildProjPath /t:AzToolsInstaller
Write-Host -ForegroundColor DarkGreen "-------------------- End building Az.Tools.Installer ... --------------------`n`n`n`n`n"
}
77 changes: 77 additions & 0 deletions .azure-pipelines/PipelineSteps/test-steps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
[CmdletBinding(DefaultParameterSetName="AllSet")]
param (
[string]$RepoRoot,
[string]$PowerShellPlatform,
[string]$TestFramework,
[string]$Configuration = 'Debug'
)

# Remove pre-installed Az modules
Write-Host -ForegroundColor Green "-------------------- Start removing pre-installed Az modules ... --------------------"
$commonUtilityScriptPath = Join-Path $RepoRoot "tools" "TestFx" "Utilities" "CommonUtility.ps1"
& $commonUtilityScriptPath
Write-Host -ForegroundColor DarkGreen "-------------------- End removing pre-installed Az modules ... --------------------`n`n`n`n`n"

# Test
Write-Host -ForegroundColor Green "-------------------- Start testing ... --------------------"
if ($PowerShellPlatform) {
$Env:PowerShellPlatform = $PowerShellPlatform
}
$preference = $ErrorActionPreference
$ErrorActionPreference = 'Continue'
$buildProjPath = Join-Path $RepoRoot 'build.proj'
dotnet msbuild $buildProjPath /t:Test "/p:Configuration=$Configuration;TestFramework=$TestFramework"
Write-Host -ForegroundColor DarkGreen "-------------------- End testing ... --------------------`n`n`n`n`n"

# Test AutoGen Modules With PowerShell Core
Write-Host -ForegroundColor Green "-------------------- Start testing AutoGen modules with PowerShell Core ... --------------------"
$executeCIStepScriptPath = Join-Path $RepoRoot "tools" "ExecuteCIStep.ps1"
$currentPath = $PWD
$debugFolderPath = Join-Path $RepoRoot "artifacts" "Debug"
Set-Location $debugFolderPath

Install-Module -Name Pester -Repository PSGallery -RequiredVersion 4.10.1 -Force
if ($IsWindows) { $sp = ";" } else { $sp = ":" }
$env:PSModulePath = $env:PSModulePath + $sp + (pwd).Path
Get-ChildItem -File -Recurse test-module.ps1 | ForEach-Object {
Write-Host $_.Directory.FullName
$repoArtifact = Join-Path $RepoRoot 'artifacts'
& $executeCIStepScriptPath -TestAutorest -AutorestDirectory $_.Directory.FullName -RepoArtifacts $repoArtifact
}

$ErrorActionPreference = $preference
Set-Location $currentPath
Write-Host -ForegroundColor DarkGreen "-------------------- End testing AutoGen modules with PowerShell Core ... --------------------`n`n`n`n`n"

# Analyze test coverage
Write-Host -ForegroundColor Green "-------------------- Start analyzing test coverage ... --------------------"
$validateTestCoverageScriptPath = Join-Path $RepoRoot 'tools' 'TestFx' 'Coverage' 'ValidateTestCoverage.ps1'
& $validateTestCoverageScriptPath
Write-Host -ForegroundColor DarkGreen "-------------------- End analyzing test coverage ... --------------------`n`n`n`n`n"

# Check test status
Write-Host -ForegroundColor Green "-------------------- Start checking test status ... --------------------"
$currentPath = $PWD
$pipelineResultPath = Join-Path $RepoRoot "artifacts" "PipelineResult"
Set-Location $pipelineResultPath

$PipelineResult = Get-Content PipelineResult.json | ConvertFrom-Json
$FailedModuleList = $PipelineResult.test.Details[0].Modules | Where-Object { $_.Status -eq "Failed" } | ForEach-Object { $_.Module }
if ($FailedModuleList.Length -ne 0)
{
throw "test fails in module: $FailedModuleList"
}

Set-Location $currentPath
Write-Host -ForegroundColor DarkGreen "-------------------- End checking test status ... --------------------`n`n`n`n`n"
Loading
Loading