Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
63 changes: 63 additions & 0 deletions .azure-pipelines/generation-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ resources:
endpoint: microsoftgraph
name: microsoftgraph/msgraph-sdk-typescript
ref: dev
- repository: msgraph-sdk-python
type: github
endpoint: microsoftgraph
name: microsoftgraph/msgraph-sdk-python
ref: main
- repository: msgraph-beta-sdk-python
type: github
endpoint: microsoftgraph
name: microsoftgraph/msgraph-beta-sdk-python
ref: main
- repository: msgraph-metadata
type: github
endpoint: microsoftgraph
Expand Down Expand Up @@ -689,6 +699,59 @@ stages:
parameters:
repoName: msgraph-sdk-typescript

- stage: stage_python_v1
dependsOn:
- stage_build_and_publish_kiota
- stage_v1_openapi
condition: |
and
(
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
)
jobs:
- job: python_v1
steps:
- template: generation-templates/language-generation-kiota.yml
parameters:
language: 'python'
version: ''
repoName: 'msgraph-sdk-python'
branchName: $(v1Branch)
targetClassName: "BaseGraphServiceClient"
targetNamespace: "github.com/microsoftgraph/msgraph-sdk-python/"
cleanMetadataFolder: $(cleanOpenAPIFolderV1)
languageSpecificSteps:
- template: generation-templates/python.yml
parameters:
repoName: msgraph-sdk-python

- stage: stage_python_beta
dependsOn:
- stage_build_and_publish_kiota
- stage_beta_openapi
condition: |
and
(
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
)
jobs:
- job: python_beta
steps:
- template: generation-templates/language-generation-kiota.yml
parameters:
language: 'python'
version: 'beta'
repoName: 'msgraph-beta-sdk-python'
branchName: $(betaBranch)
targetClassName: "BaseGraphServiceClient"
targetNamespace: "github.com/microsoftgraph/msgraph-beta-sdk-python/"
cleanMetadataFolder: $(cleanOpenAPIFolderBeta)
languageSpecificSteps:
- template: generation-templates/python.yml
parameters:
repoName: msgraph-beta-sdk-python
# - stage: stage_objc_v1
# dependsOn:
# - stage_build_and_publish_typewriter
Expand Down
20 changes: 20 additions & 0 deletions .azure-pipelines/generation-templates/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
parameters:
- name: repoName
type: string

steps:
- pwsh: '$(scriptsDirectory)/clean-python-files.ps1'
displayName: 'Remove generated models and requests from the repo src folder'
env:
MainDirectory: '$(Build.SourcesDirectory)/${{ parameters.repoName }}/src/'

- pwsh: '$(scriptsDirectory)/copy-python-models.ps1'
displayName: 'Update models'
env:
BuildConfiguration: $(buildConfiguration)
OutputFullPath: $(kiotaDirectory)/output/*
RepoModelsDir: '$(Build.SourcesDirectory)/${{ parameters.repoName }}/src/'

- pwsh : $(Build.SourcesDirectory)/${{ parameters.repoName }}/scripts/incrementMinorVersion.ps1
displayName: 'Increment minor version number'
workingDirectory: '$(Build.SourcesDirectory)/${{ parameters.repoName }}/scripts'
12 changes: 12 additions & 0 deletions scripts/clean_python_files.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$directories = Get-ChildItem -Path $env:MainDirectory -Directory
foreach ($directory in $directories) {
Remove-Item -Path $directory.FullName -Recurse -Force -Verbose
}

$files = Get-ChildItem -Path $env:MainDirectory -File -Filter "*.py"
foreach ($file in $files) {
Remove-Item -Path $file.FullName -Force
}


Write-Host "Removed the existing generated files in the repo's main directory: $env:MainDirectory" -ForegroundColor Green
9 changes: 9 additions & 0 deletions scripts/copy-python-models.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Write-Host "Path to repo models directory: $env:RepoModelsDir"

If(!(test-path $env:RepoModelsDir))
{
New-Item -ItemType Directory -Force -Path $env:RepoModelsDir
}

Copy-Item $env:OutputFullPath -Destination $env:RepoModelsDir -Recurse -Force
Write-Host "Copied the generated files from: $env:OutputFullPath to: $env:RepoModelsDir" -ForegroundColor Green