Коммит
7bead46502
|
@ -0,0 +1,109 @@
|
|||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
|
||||
trigger: none
|
||||
pr:
|
||||
- main
|
||||
|
||||
# Variable 'needRunReleaseMdoc' was defined in the Variables tab
|
||||
# Variable 'params' was defined in the Variables tab
|
||||
# Agent Queue 'Azure Pipelines' was used with unrecognized Agent Specification, vmImage property must be specified to determine image - https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software
|
||||
variables:
|
||||
solution: 'apidoctools.sln'
|
||||
buildConfiguration: 'Release'
|
||||
buildPlatform: 'any cpu'
|
||||
name: $(date:yyyyMMdd)$(rev:.r)
|
||||
resources:
|
||||
repositories:
|
||||
- repository: self
|
||||
type: git
|
||||
ref: refs/heads/develop
|
||||
jobs:
|
||||
- job: Job_1
|
||||
displayName: Agent job 1
|
||||
timeoutInMinutes: 600
|
||||
pool:
|
||||
name: Azure Pipelines
|
||||
vmImage: windows-2022
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
- task: AzureKeyVault@2
|
||||
displayName: 'Azure Key Vault: ReferenceAutomation-Prod'
|
||||
inputs:
|
||||
ConnectedServiceName: 886728b9-fc93-486c-ba21-26777bea99af
|
||||
KeyVaultName: ReferenceAutomation-Prod
|
||||
enabled: true
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: NuGet Authenticate
|
||||
- task: PowerShell@2
|
||||
displayName: Compare xml files
|
||||
timeoutInMinutes: 600
|
||||
inputs:
|
||||
filePath: mdoc/compareXmlFiles.ps1
|
||||
arguments: -paramsJson '$(params)' -githubTokenBase64 '$(githubTokenBase64)' -githubOptionsAccountName $(githubOptionsAccountName) -githubOptionsAccountEmail $(githubOptionsAccountEmail) -vstsTokenBase64 '$(vstsTokenBase64)' -step '1' -commit1 ''
|
||||
enabled: true
|
||||
name: job1output
|
||||
- job: Job_2
|
||||
displayName: Agent job2
|
||||
timeoutInMinutes: 600
|
||||
dependsOn: Job_1
|
||||
variables:
|
||||
commit1: $[ dependencies.Job_1.outputs['job1output.commit1'] ]
|
||||
pool:
|
||||
name: Azure Pipelines
|
||||
vmImage: windows-2022
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
- task: AzureKeyVault@2
|
||||
displayName: 'Azure Key Vault: ReferenceAutomation-Prod'
|
||||
inputs:
|
||||
ConnectedServiceName: 886728b9-fc93-486c-ba21-26777bea99af
|
||||
KeyVaultName: ReferenceAutomation-Prod
|
||||
enabled: true
|
||||
- task: NuGetToolInstaller@0
|
||||
displayName: Use NuGet 4.4.1
|
||||
inputs:
|
||||
versionSpec: 4.4.1
|
||||
enabled: true
|
||||
- task: NuGetCommand@2
|
||||
displayName: NuGet restore
|
||||
inputs:
|
||||
solution: $(BuildParameters.solution)
|
||||
enabled: true
|
||||
- task: CmdLine@2
|
||||
displayName: Command Line Script
|
||||
inputs:
|
||||
script: make prepare
|
||||
enabled: true
|
||||
- task: VSBuild@1
|
||||
displayName: Build solution
|
||||
inputs:
|
||||
solution: $(solution)
|
||||
msbuildArgs: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
enabled: true
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: NuGet Authenticate
|
||||
- task: PowerShell@2
|
||||
displayName: Compare xml files
|
||||
timeoutInMinutes: 600
|
||||
inputs:
|
||||
filePath: mdoc/compareXmlFiles.ps1
|
||||
arguments: -paramsJson '$(params)' -githubTokenBase64 '$(githubTokenBase64)' -githubOptionsAccountName $(githubOptionsAccountName) -githubOptionsAccountEmail $(githubOptionsAccountEmail) -vstsTokenBase64 '$(vstsTokenBase64)' -step '2' -commit1 '$(commit1)'
|
||||
enabled: true
|
||||
name: job2output
|
||||
- task: PowerShell@2
|
||||
displayName: Print Compare Url
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: >-
|
||||
# Write your PowerShell commands here.
|
||||
|
||||
|
||||
Write-Host "Compare Url: $Env:CompareUrl"
|
||||
...
|
|
@ -3,7 +3,7 @@ namespace Mono.Documentation
|
|||
{
|
||||
public static class Consts
|
||||
{
|
||||
public static string MonoVersion = "5.8.9";
|
||||
public static string MonoVersion = "5.8.9.1";
|
||||
public const string DocId = "DocId";
|
||||
public const string CppCli = "C++ CLI";
|
||||
public const string CppCx = "C++ CX";
|
||||
|
|
|
@ -751,7 +751,7 @@ check-monodocer-attached-entities:
|
|||
|
||||
# now make sure it will delete a previously run/duplicated attachedproperty/property
|
||||
cp Test/AttachedEventsAndProperties/AttachedPropertyExample.xml Test/en.actual/AttachedEventsAndProperties/
|
||||
$(MONO) $(PROGRAM) update -o Test/en.actual Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll -lang docid -lang vb.net -lang fsharp -lang javascript -lang c++/cli -lang c++/cx -lang c++/winrt
|
||||
$(MONO) $(PROGRAM) update -o Test/en.actual Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll --delete -lang docid -lang vb.net -lang fsharp -lang javascript -lang c++/cli -lang c++/cx -lang c++/winrt
|
||||
$(DIFF) Test/en.expected-attached-entities Test/en.actual
|
||||
|
||||
Test/TestClass.dll:
|
||||
|
@ -765,7 +765,7 @@ check-monodocer-operators-work: Test/TestClass.dll
|
|||
rm -Rf Test/en.actual
|
||||
$(MONO) $(PROGRAM) update Test/TestClass.dll -o Test/en.actual
|
||||
cp mdoc.Test/SampleClasses/TestClass-OldOpSig.xml Test/en.actual/mdoc.Test.SampleClasses/TestClass.xml
|
||||
$(MONO) $(PROGRAM) update Test/TestClass.dll -o Test/en.actual
|
||||
$(MONO) $(PROGRAM) update Test/TestClass.dll -o Test/en.actual --delete
|
||||
|
||||
.PHONY: check-monodocer-operators
|
||||
check-monodocer-operators: check-monodocer-operators-work
|
||||
|
|
|
@ -1939,9 +1939,11 @@ namespace Mono.Documentation
|
|||
signature);
|
||||
|
||||
// Identify all of the different states that could affect our decision to delete the member
|
||||
bool duplicated = reason.Contains("Duplicate Member");
|
||||
bool shouldPreserve = !string.IsNullOrWhiteSpace (PreserveTag);
|
||||
bool hasContent = MemberDocsHaveUserContent (member);
|
||||
bool shouldDelete = !shouldPreserve && (delete || !hasContent);
|
||||
//When the member is NOT PRESERVED, the member has NO CONTENT or is DUPLICATED, then it should be deleted
|
||||
bool shouldDelete = !shouldPreserve && (delete && (!hasContent || duplicated));
|
||||
|
||||
bool unifiedRun = HasDroppedNamespace (type);
|
||||
|
||||
|
|
|
@ -0,0 +1,271 @@
|
|||
param (
|
||||
[string]$paramsJson,
|
||||
[string]$githubTokenBase64,
|
||||
[string]$githubOptionsAccountName,
|
||||
[string]$githubOptionsAccountEmail,
|
||||
[string]$vstsTokenBase64,
|
||||
[string]$step,
|
||||
[string]$commit1
|
||||
)
|
||||
|
||||
function Git-Init([string]$githubAccountName, [string]$githubAccountEmail)
|
||||
{
|
||||
& git config --global --unset-all include.path
|
||||
& git config --global --unset-all credential.helper
|
||||
& git config --system --unset-all include.path
|
||||
& git config --system --unset-all credential.helper
|
||||
& git config --global credential.helper store
|
||||
& git config --global user.name $githubAccountName
|
||||
& git config --global user.email $githubAccountEmail
|
||||
}
|
||||
|
||||
function Git-Clone([string]$repoUrl, [string]$repoPath, [string] $token, [string]$branch = "main")
|
||||
{
|
||||
Write-Host 'git -c http.extraHeader="Authorization: Basic '$token'" clone -b '$branch' '$repoUrl' '$repoPath' --depth 1 --shallow-submodules'
|
||||
& git -c http.extraHeader="Authorization: Basic $token" clone -b $branch $repoUrl $repoPath --depth 1 --shallow-submodules
|
||||
|
||||
Push-Location $repoPath
|
||||
Write-Host | & git branch
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
function Git-Push([string]$rootPath, [string] $token, [string] $commitMessage, [string]$branch = "main")
|
||||
{
|
||||
Push-Location $rootPath
|
||||
|
||||
$result = & git status
|
||||
if($result.Contains("nothing to commit"))
|
||||
{
|
||||
Write-Host "$result"
|
||||
}
|
||||
else
|
||||
{
|
||||
& git add --all
|
||||
& git commit -m $commitMessage
|
||||
|
||||
& git config pull.rebase false
|
||||
Write-Host 'git -c http.extraHeader="Authorization: Basic '$token'" pull'
|
||||
& git -c http.extraHeader="Authorization: Basic $token" pull
|
||||
|
||||
& git -c http.extraHeader="Authorization: Basic $token" push --set-upstream origin $branch --force-with-lease
|
||||
}
|
||||
}
|
||||
|
||||
function Run-Mdoc([string] $mdocPath, [string] $fwPath, [string] $xmlPath)
|
||||
{
|
||||
Write-Host "$mdocPath fx-bootstrap $fwPath"
|
||||
& $mdocPath fx-bootstrap $fwPath
|
||||
|
||||
$dnpath = [System.IO.Path]::GetDirectoryName((get-command dotnet).Source)
|
||||
$langs=@("VB.NET","F#","C++/CLI")
|
||||
$allArgs = @("update",
|
||||
"-o", "$xmlPath",
|
||||
"-fx", "$fwPath",
|
||||
"-lang", "docid",
|
||||
"-index", "false",
|
||||
"--debug",
|
||||
"--delete",
|
||||
"-L", """C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies"""
|
||||
"-L", """C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies"""
|
||||
"-L", """C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1"""
|
||||
"-L", """$dnpath""");
|
||||
if ($langs) {
|
||||
foreach ($lang in $langs) {
|
||||
$allArgs += "-lang"
|
||||
$allArgs += "$lang"
|
||||
}
|
||||
}
|
||||
Write-Host "& $mdocPath $allArgs"
|
||||
& $mdocPath $allArgs
|
||||
}
|
||||
|
||||
# Clone binary repo, xml repo
|
||||
# Generate xml file, push and log commit id
|
||||
# Again to generate xml file, push and log commit id
|
||||
# Compare two commits
|
||||
function Run($source_repo,$target_repo,$origin_target_repo)
|
||||
{
|
||||
if([String]::IsNullOrEmpty($source_repo.url)){
|
||||
Write-Host "source repo url is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($source_repo.branch)){
|
||||
Write-Host "source repo branch is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($source_repo.folder)){
|
||||
Write-Host "source repo folder is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($target_repo.url)){
|
||||
Write-Host "target repo url is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($target_repo.branch)){
|
||||
Write-Host "target repo branch is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($target_repo.folder)){
|
||||
Write-Host "target repo folder is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($origin_target_repo.url)){
|
||||
Write-Host "origin target repo url is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($origin_target_repo.branch)){
|
||||
Write-Host "origin target repo branch is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($origin_target_repo.folder)){
|
||||
Write-Host "origin target repo folder is null or empty!"
|
||||
}
|
||||
|
||||
$sourceRepoUrl = $source_repo.url
|
||||
$sourceRepoBranch = $source_repo.branch
|
||||
$sourceFolder = $source_repo.folder
|
||||
$sourceRepoPath= $source_repo.repo_root
|
||||
$targetRepoUrl = $target_repo.url
|
||||
$targetRepoBranch = $target_repo.branch
|
||||
$targetfolder = $target_repo.folder
|
||||
$targetRepoPath= $target_repo.repo_root
|
||||
$originTargetRepoUrl = $origin_target_repo.url
|
||||
$originTargetRepoBranch = $origin_target_repo.branch
|
||||
$originTargetfolder = $origin_target_repo.folder
|
||||
$originTargetRepoPath= $origin_target_repo.repo_root
|
||||
|
||||
$frameworksPath = Join-Path $sourceRepoPath $sourceFolder
|
||||
$originRepoXmlPath = Join-Path $originTargetRepoPath $originTargetfolder
|
||||
$xmlPath = Join-Path $targetRepoPath $targetfolder
|
||||
|
||||
Write-Host "==================== Clone source repo: $sourceRepoUrl"
|
||||
if($sourceRepoUrl.Contains("github.com/")){
|
||||
Git-Clone $sourceRepoUrl $sourceRepoPath $githubTokenBase64 $sourceRepoBranch
|
||||
}
|
||||
else{
|
||||
Git-Clone $sourceRepoUrl $sourceRepoPath $vstsTokenBase64 $sourceRepoBranch
|
||||
}
|
||||
|
||||
Write-Host "==================== Clone origin target repo: $originTargetRepoUrl"
|
||||
Git-Clone $originTargetRepoUrl $originTargetRepoPath $githubTokenBase64 $originTargetRepoBranch
|
||||
|
||||
Write-Host "==================== Clone target repo: $targetRepoUrl"
|
||||
Git-Clone $targetRepoUrl $targetRepoPath $githubTokenBase64 $targetRepoBranch
|
||||
|
||||
if (Test-Path $xmlPath)
|
||||
{
|
||||
Write-Host "Delete files under path: $xmlPath"
|
||||
Remove-Item -Recurse -Force $xmlPath\*
|
||||
Write-Host "Delete files done."
|
||||
}
|
||||
Copy-Item "$originRepoXmlPath\*" -Destination "$xmlPath\" -Recurse -Force -Container
|
||||
|
||||
# This part(if) run in Job_1
|
||||
if($step -eq "1"){
|
||||
Write-Host "==================== Run Mdoc(release version) tool to generated xml files."
|
||||
Run-Mdoc $releaseMdocPath $frameworksPath $xmlPath
|
||||
if ($lastexitcode -ne 0)
|
||||
{
|
||||
exit $lastexitcode
|
||||
}
|
||||
|
||||
Write-Host "==================== First to commit xml files"
|
||||
$message = "CI Update 1 with build number " + $env:BUILD_BUILDNUMBER
|
||||
Git-Push $targetRepoPath $githubTokenBase64 $message $targetRepoBranch
|
||||
$commitid1 = & git rev-parse HEAD
|
||||
Write-Host "Commit Id1: $commitid1"
|
||||
Pop-Location
|
||||
|
||||
Write-Host "##vso[task.setvariable variable=commit1;isOutput=true]$commitid1"
|
||||
} else { # This part(else) run in Job_2
|
||||
|
||||
Write-Host "==================== Run Mdoc(pr version) tool to generated xml files."
|
||||
Run-Mdoc $prMdocPath $frameworksPath $xmlPath
|
||||
if ($lastexitcode -ne 0)
|
||||
{
|
||||
exit $lastexitcode
|
||||
}
|
||||
|
||||
Write-Host "==================== Sencond to commit xml files"
|
||||
$message = "CI Update 2 with build number " + $env:BUILD_BUILDNUMBER
|
||||
Git-Push $targetRepoPath $githubTokenBase64 $message $targetRepoBranch
|
||||
$commitid2 = & git rev-parse HEAD
|
||||
Write-Host "Commit Id2: $commitid2"
|
||||
Pop-Location
|
||||
|
||||
Write-Host "==================== Compare two version xml files."
|
||||
$commitid1 = $commit1 # commit1 from job_1
|
||||
$shortCommitId1 = $commitid1.Substring(0, 7)
|
||||
$shortCommitId2 = $commitid2.Substring(0, 7)
|
||||
if($targetRepoUrl.EndsWith(".git"))
|
||||
{
|
||||
$compareUrl = $targetRepoUrl.Substring(0, $ymlRepoUrl.Length - 4)
|
||||
}
|
||||
else
|
||||
{
|
||||
$compareUrl = $targetRepoUrl
|
||||
}
|
||||
|
||||
$compareUrl = $compareUrl + "/compare/"
|
||||
$compareUrl = $compareUrl + "$shortCommitId1...$shortCommitId2/"
|
||||
|
||||
Write-Host ("##vso[task.setvariable variable=CompareUrl;]$compareUrl")
|
||||
Write-Host "Compare Url: $compareUrl"
|
||||
}
|
||||
}
|
||||
|
||||
$params = $paramsJson | ConvertFrom-Json
|
||||
if([String]::IsNullOrEmpty($githubTokenBase64))
|
||||
{
|
||||
Write-Host "githubTokenBase64 is null or empty!"
|
||||
}
|
||||
if([String]::IsNullOrEmpty($vstsTokenBase64))
|
||||
{
|
||||
Write-Host "vstsTokenBase64 is null or empty!"
|
||||
}
|
||||
|
||||
# Set download Paths
|
||||
$repoRoot = $($MyInvocation.MyCommand.Definition) | Split-Path | Split-Path
|
||||
$prMdocPath = "$repoRoot\bin\Release\mdoc.exe"
|
||||
|
||||
$parentRoot = $repoRoot | Split-Path
|
||||
$binPath = Join-Path "$parentRoot\TestCI" "\_bin"
|
||||
New-Item $binPath -Type Directory -Force
|
||||
|
||||
# Download nuget tool
|
||||
$nugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
||||
$mdocPackageSource = "https://api.nuget.org/v3/index.json"
|
||||
$nugetPath = Join-Path $binPath "\nuget.exe"
|
||||
Invoke-WebRequest -Uri $nugetUrl -OutFile $nugetPath -Verbose
|
||||
|
||||
# Download mdoc package
|
||||
Write-Host "==================== Download Mdoc tool"
|
||||
$mdocPackageId = "mdoc"
|
||||
|
||||
if([String]::IsNullOrEmpty($params.mdoc_Version))
|
||||
{
|
||||
$versionStr = & $nugetPath list $mdocPackageId -Source $mdocPackageSource
|
||||
if($versionStr -is [array])
|
||||
{
|
||||
$lastVersionStr = $versionStr[$versionStr.Count-1]
|
||||
}
|
||||
else
|
||||
{
|
||||
$lastVersionStr = $versionStr
|
||||
}
|
||||
Write-Host "$mdocPackageId last version string: $lastVersionStr"
|
||||
$lastVersion = $lastVersionStr.Split(" ")[1]
|
||||
}
|
||||
else
|
||||
{
|
||||
$lastVersion = $params.mdoc_Version
|
||||
}
|
||||
Write-Host "$nugetPath install $mdocPackageId -Version $lastVersion -Source $mdocPackageSource -OutputDirectory $binPath"
|
||||
& $nugetPath install $mdocPackageId -Version $lastVersion -Source $mdocPackageSource -OutputDirectory $binPath
|
||||
|
||||
$releaseMdocPath = Join-Path $binPath "mdoc.$lastVersion"
|
||||
dir $releaseMdocPath
|
||||
$releaseMdocPath = Join-Path $releaseMdocPath "tools\mdoc.exe"
|
||||
Write-Host "Download $mdocPackageId to path: $releasemdocPath"
|
||||
|
||||
|
||||
# Init git configure
|
||||
Git-Init $githubOptionsAccountName $githubOptionsAccountEmail
|
||||
|
||||
# Generate ecma xml files
|
||||
$params.source_repo.repo_root = Join-Path "$parentRoot\TestCI" $params.source_repo.repo_root
|
||||
$params.target_repo.repo_root = Join-Path "$parentRoot\TestCI" $params.target_repo.repo_root
|
||||
$params.origin_target_repo.repo_root = Join-Path "$parentRoot\TestCI" $params.origin_target_repo.repo_root
|
||||
Run $params.source_repo $params.target_repo $params.origin_target_repo
|
|
@ -2,7 +2,7 @@
|
|||
<package >
|
||||
<metadata>
|
||||
<id>mdoc</id>
|
||||
<version>5.8.9</version>
|
||||
<version>5.8.9.1</version>
|
||||
<title>mdoc</title>
|
||||
<authors>Microsoft</authors>
|
||||
<owners>Microsoft</owners>
|
||||
|
|
Загрузка…
Ссылка в новой задаче