Skip to content

Commit

Permalink
debug script
Browse files Browse the repository at this point in the history
  • Loading branch information
fey101 committed Apr 24, 2024
1 parent 359ecdc commit 90a4698
Showing 1 changed file with 156 additions and 152 deletions.
308 changes: 156 additions & 152 deletions pipelines/snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,165 +13,169 @@ schedules:
- master
always: true

resources:
repositories:
- repository: microsoft-graph-docs
type: github
endpoint: microsoftgraph (22)
name: microsoftgraph/microsoft-graph-docs
ref: main

pool:
vmImage: 'ubuntu-latest'


parameters:
- name: snippetLanguages
type: object
default: ['C#', 'CLI', 'Go', 'Java', 'JavaScript', 'PHP', 'PowerShell', 'Python'] # should be ordered alphabetically
displayName: 'Languages to generate snippets for'

variables:
buildConfiguration: 'Release'
apidoctorPath: 'microsoft-graph-devx-api/apidoctor'
apidoctorProjects: '$(apidoctorPath)/**/*.csproj'
snippetLanguages: ${{ join(',',parameters.snippetLanguages) }}
# resources:
# repositories:
# - repository: microsoft-graph-docs
# type: github
# endpoint: microsoftgraph (22)
# name: microsoftgraph/microsoft-graph-docs
# ref: main

# pool:
# vmImage: 'ubuntu-latest'


# parameters:
# - name: snippetLanguages
# type: object
# default: ['C#', 'CLI', 'Go', 'Java', 'JavaScript', 'PHP', 'PowerShell', 'Python'] # should be ordered alphabetically
# displayName: 'Languages to generate snippets for'

# variables:
# buildConfiguration: 'Release'
# apidoctorPath: 'microsoft-graph-devx-api/apidoctor'
# apidoctorProjects: '$(apidoctorPath)/**/*.csproj'
# snippetLanguages: ${{ join(',',parameters.snippetLanguages) }}

stages:
- stage: GenerateSnippets
displayName: Generate snippets
jobs:
- job: GenerateSnippets
displayName: Generate snippets
steps:
- checkout: self
displayName: checkout GE api
fetchDepth: 1
submodules: recursive
persistCredentials: true

- checkout: microsoft-graph-docs
displayName: checkout docs
fetchDepth: 1
persistCredentials: true

- pwsh: |
# override branch prefix incase the run is manually triggered
$branchPrefix = if ($env:BUILD_REASON -eq 'Manual') { "preview-snippet-generation" } else { "snippet-generation" }
Write-Host "##vso[task.setvariable variable=branchPrefix]$branchPrefix"
Write-Host "Branch prefix is $branchPrefix"
displayName: 'Evaluate branch prefix to use'
- template: templates/git-config.yml

- task: UseDotNet@2
displayName: 'Install .NET Core SDK 6'
inputs:
version: 6.x

- task: UseDotNet@2
displayName: 'Install .NET Core SDK 8'
inputs:
version: 8.0.x

- task: DotNetCoreCLI@2
displayName: 'Build snippet generator'
inputs:
command: 'build'
projects: 'microsoft-graph-devx-api/CodeSnippetsReflection.App/CodeSnippetsReflection.App.csproj'
arguments: '--configuration $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'Restore packages for APIDoctor'
inputs:
command: 'restore'
projects: '$(Build.SourcesDirectory)/$(apidoctorProjects)'

- task: DotNetCoreCLI@2
displayName: 'Build APIDoctor'
inputs:
command: 'build'
projects: '$(Build.SourcesDirectory)/$(apidoctorProjects)'
arguments: '--configuration $(buildConfiguration)'

- pwsh: |
# release folder can change based on .NET core version, so search recursively in bin folder
$snippetGeneratorPath = (Get-ChildItem $env:BUILD_SOURCESDIRECTORY/microsoft-graph-devx-api/CodeSnippetsReflection.App/bin/Release *App -Recurse).FullName
Write-Host "Path to snippet generator tool: $snippetGeneratorPath"
$apidoctorPath = (Get-ChildItem $env:BUILD_SOURCESDIRECTORY/microsoft-graph-devx-api/apidoctor/ApiDoctor.Console/bin/Release apidoc -Recurse).FullName
Write-Host "Path to apidoctor tool: $apidoctorPath"
. $apidoctorPath generate-snippets --ignore-warnings --path . --snippet-generator-path $snippetGeneratorPath --temp-output-path $env:BUILD_ARTIFACTSTAGINGDIRECTORY/Snippets --lang $(snippetLanguages) --git-path "/bin/git"
displayName: 'Generate snippets'
workingDirectory: microsoft-graph-docs
- task: PublishBuildArtifacts@1
displayName: 'Publish snippets as artifact'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Snippets'
ArtifactName: 'Snippets'
publishLocation: 'Container'
StoreAsTar: true

- pwsh: $(Build.SourcesDirectory)/microsoft-graph-devx-api/scripts/cleanupUnusedSnippets.ps1
displayName: 'Cleanup unused snippets'
workingDirectory: microsoft-graph-docs

- template: templates/commit-changes.yml
- stage: RunTests
dependsOn: GenerateSnippets
displayName: Run tests
jobs:
- job: RunTests
strategy:
matrix:
'HTTP v1 Stable':
SNIPPET_LANGUAGE: 'http'
GRAPH_VERSION: 'v1'
TEST_CATEGORY: 'Stable'
'HTTP v1 KnownIssues':
SNIPPET_LANGUAGE: 'http'
GRAPH_VERSION: 'v1'
TEST_CATEGORY: 'KnownIssues'
'HTTP beta Stable':
SNIPPET_LANGUAGE: 'http'
GRAPH_VERSION: 'beta'
TEST_CATEGORY: 'Stable'
'HTTP beta KnownIssues':
SNIPPET_LANGUAGE: 'http'
GRAPH_VERSION: 'beta'
TEST_CATEGORY: 'KnownIssues'
${{ each language in parameters.snippetLanguages }}:
'${{ language }} v1 Stable':
SNIPPET_LANGUAGE: ${{ lower(language) }}
GRAPH_VERSION: 'v1'
TEST_CATEGORY: 'Stable'
'${{ language }} v1 KnownIssues':
SNIPPET_LANGUAGE: ${{ lower(language) }}
GRAPH_VERSION: 'v1'
TEST_CATEGORY: 'KnownIssues'
'${{ language }} beta Stable':
SNIPPET_LANGUAGE: ${{ lower(language) }}
GRAPH_VERSION: 'beta'
TEST_CATEGORY: 'Stable'
'${{ language }} beta KnownIssues':
SNIPPET_LANGUAGE: ${{ lower(language) }}
GRAPH_VERSION: 'beta'
TEST_CATEGORY: 'KnownIssues'
steps:
- template: templates/run-tests.yml
# - stage: GenerateSnippets
# displayName: Generate snippets
# jobs:
# - job: GenerateSnippets
# displayName: Generate snippets
# steps:
# - checkout: self
# displayName: checkout GE api
# fetchDepth: 1
# submodules: recursive
# persistCredentials: true

# - checkout: microsoft-graph-docs
# displayName: checkout docs
# fetchDepth: 1
# persistCredentials: true

# - pwsh: |
# # override branch prefix incase the run is manually triggered
# $branchPrefix = if ($env:BUILD_REASON -eq 'Manual') { "preview-snippet-generation" } else { "snippet-generation" }
# Write-Host "##vso[task.setvariable variable=branchPrefix]$branchPrefix"
# Write-Host "Branch prefix is $branchPrefix"
# displayName: 'Evaluate branch prefix to use'

# - template: templates/git-config.yml

# - task: UseDotNet@2
# displayName: 'Install .NET Core SDK 6'
# inputs:
# version: 6.x

# - task: UseDotNet@2
# displayName: 'Install .NET Core SDK 8'
# inputs:
# version: 8.0.x

# - task: DotNetCoreCLI@2
# displayName: 'Build snippet generator'
# inputs:
# command: 'build'
# projects: 'microsoft-graph-devx-api/CodeSnippetsReflection.App/CodeSnippetsReflection.App.csproj'
# arguments: '--configuration $(buildConfiguration)'

# - task: DotNetCoreCLI@2
# displayName: 'Restore packages for APIDoctor'
# inputs:
# command: 'restore'
# projects: '$(Build.SourcesDirectory)/$(apidoctorProjects)'

# - task: DotNetCoreCLI@2
# displayName: 'Build APIDoctor'
# inputs:
# command: 'build'
# projects: '$(Build.SourcesDirectory)/$(apidoctorProjects)'
# arguments: '--configuration $(buildConfiguration)'

# - pwsh: |
# # release folder can change based on .NET core version, so search recursively in bin folder
# $snippetGeneratorPath = (Get-ChildItem $env:BUILD_SOURCESDIRECTORY/microsoft-graph-devx-api/CodeSnippetsReflection.App/bin/Release *App -Recurse).FullName
# Write-Host "Path to snippet generator tool: $snippetGeneratorPath"

# $apidoctorPath = (Get-ChildItem $env:BUILD_SOURCESDIRECTORY/microsoft-graph-devx-api/apidoctor/ApiDoctor.Console/bin/Release apidoc -Recurse).FullName
# Write-Host "Path to apidoctor tool: $apidoctorPath"

# . $apidoctorPath generate-snippets --ignore-warnings --path . --snippet-generator-path $snippetGeneratorPath --temp-output-path $env:BUILD_ARTIFACTSTAGINGDIRECTORY/Snippets --lang $(snippetLanguages) --git-path "/bin/git"
# displayName: 'Generate snippets'
# workingDirectory: microsoft-graph-docs

# - task: PublishBuildArtifacts@1
# displayName: 'Publish snippets as artifact'
# inputs:
# PathtoPublish: '$(Build.ArtifactStagingDirectory)/Snippets'
# ArtifactName: 'Snippets'
# publishLocation: 'Container'
# StoreAsTar: true

# - pwsh: $(Build.SourcesDirectory)/microsoft-graph-devx-api/scripts/cleanupUnusedSnippets.ps1
# displayName: 'Cleanup unused snippets'
# workingDirectory: microsoft-graph-docs

# - template: templates/commit-changes.yml
# - stage: RunTests
# dependsOn: GenerateSnippets
# displayName: Run tests
# jobs:
# - job: RunTests
# strategy:
# matrix:
# 'HTTP v1 Stable':
# SNIPPET_LANGUAGE: 'http'
# GRAPH_VERSION: 'v1'
# TEST_CATEGORY: 'Stable'
# 'HTTP v1 KnownIssues':
# SNIPPET_LANGUAGE: 'http'
# GRAPH_VERSION: 'v1'
# TEST_CATEGORY: 'KnownIssues'
# 'HTTP beta Stable':
# SNIPPET_LANGUAGE: 'http'
# GRAPH_VERSION: 'beta'
# TEST_CATEGORY: 'Stable'
# 'HTTP beta KnownIssues':
# SNIPPET_LANGUAGE: 'http'
# GRAPH_VERSION: 'beta'
# TEST_CATEGORY: 'KnownIssues'
# ${{ each language in parameters.snippetLanguages }}:
# '${{ language }} v1 Stable':
# SNIPPET_LANGUAGE: ${{ lower(language) }}
# GRAPH_VERSION: 'v1'
# TEST_CATEGORY: 'Stable'
# '${{ language }} v1 KnownIssues':
# SNIPPET_LANGUAGE: ${{ lower(language) }}
# GRAPH_VERSION: 'v1'
# TEST_CATEGORY: 'KnownIssues'
# '${{ language }} beta Stable':
# SNIPPET_LANGUAGE: ${{ lower(language) }}
# GRAPH_VERSION: 'beta'
# TEST_CATEGORY: 'Stable'
# '${{ language }} beta KnownIssues':
# SNIPPET_LANGUAGE: ${{ lower(language) }}
# GRAPH_VERSION: 'beta'
# TEST_CATEGORY: 'KnownIssues'
# steps:
# - template: templates/run-tests.yml
- stage: GenerateRunTestReports
dependsOn: RunTests
displayName: GenerateRunTestReports
jobs:
- job: GenerateCategorizationReport
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download RunTests artifact'
inputs:
artifact: 'Generation Test Results'
path: '$(Build.ArtifactStagingDirectory)/TestResults'
# - task: DownloadPipelineArtifact@2
# displayName: 'Download RunTests artifact'
# inputs:
# artifact: 'Generation Test Results'
# path: '$(Build.ArtifactStagingDirectory)/TestResults'

- pwsh: |
echo pwd
ls ./microsoft-graph-devx-api/scripts | findstr.exe 'categorizeErrors'
workingDirectory: $(Build.SourcesDirectory)
- pwsh: |
./microsoft-graph-devx-api/scripts/categorizeErrors.ps1 -trxFolderPath '$(Build.ArtifactStagingDirectory)/TestResults/' -txtOutputFolderPath '$(Build.ArtifactStagingDirectory)/TestResults/Reports/'
Expand Down

0 comments on commit 90a4698

Please sign in to comment.