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 ecbde6f
Showing 1 changed file with 108 additions and 98 deletions.
206 changes: 108 additions & 98 deletions pipelines/snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ 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) }}
# 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
Expand Down Expand Up @@ -81,102 +81,112 @@ stages:
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
# - 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
dependsOn: GenerateSnippets
displayName: GenerateRunTestReports
jobs:
- job: GenerateCategorizationReport
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download RunTests artifact'
inputs:
artifact: 'Generation Test Results'
path: '$(Build.ArtifactStagingDirectory)/TestResults'
- checkout: self
displayName: checkout GE api
fetchDepth: 1
submodules: recursive
persistCredentials: true
# - task: DownloadPipelineArtifact@2
# displayName: 'Download RunTests artifact'
# inputs:
# artifact: 'Generation Test Results'
# path: '$(Build.ArtifactStagingDirectory)/TestResults'

- pwsh: |
echo pwd
ls $(Build.SourcesDirectory)/microsoft-graph-devx-api
workingDirectory: '$(Build.SourcesDirectory)'
- pwsh: |
./microsoft-graph-devx-api/scripts/categorizeErrors.ps1 -trxFolderPath '$(Build.ArtifactStagingDirectory)/TestResults/' -txtOutputFolderPath '$(Build.ArtifactStagingDirectory)/TestResults/Reports/'
displayName: Generate error category report
workingDirectory: $(Build.SourcesDirectory)
workingDirectory: '$(Build.SourcesDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish categorization report as artifact'
Expand Down

0 comments on commit ecbde6f

Please sign in to comment.