diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ce0ef0c5c..573b74cf1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,8 +3,12 @@ name: Lint on: pull_request: branches: [main] + paths-ignore: + - '.pipelines/**' push: branches: [main] + paths-ignore: + - '.pipelines/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/modelkit-ci.yml b/.github/workflows/modelkit-ci.yml index a3e7ecba1..8d2f587ab 100644 --- a/.github/workflows/modelkit-ci.yml +++ b/.github/workflows/modelkit-ci.yml @@ -3,8 +3,12 @@ name: ModelKit CI on: pull_request: branches: [main] + paths-ignore: + - '.pipelines/**' push: branches: [main] + paths-ignore: + - '.pipelines/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.pipelines/modelkit-official-build.yml b/.pipelines/modelkit-official-build.yml new file mode 100644 index 000000000..6cd8243f4 --- /dev/null +++ b/.pipelines/modelkit-official-build.yml @@ -0,0 +1,99 @@ +################################################################################# +# OneBranch Pipelines # +# This pipeline was created by EasyStart from a sample located at: # +# https://aka.ms/obpipelines/easystart/samples # +# Documentation: https://aka.ms/obpipelines # +# Yaml Schema: https://aka.ms/obpipelines/yaml/schema # +# Retail Tasks: https://aka.ms/obpipelines/tasks # +# Support: https://aka.ms/onebranchsup # +################################################################################# + +trigger: none # https://aka.ms/obpipelines/triggers + +parameters: # parameters are shown up in ADO UI in a build queue time +- name: 'debug' + displayName: 'Enable debug output' + type: boolean + default: false + +variables: + CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning + DEBIAN_FRONTEND: noninteractive + WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest' # https://aka.ms/obpipelines/containers + +resources: + repositories: + - repository: templates + type: git + name: OneBranch.Pipelines/GovernedTemplates + ref: refs/heads/main + - repository: artifacts + type: github + name: gim-home/ModelKitArtifacts + endpoint: github.com_yuesu_microsoft + ref: refs/heads/main + +extends: + template: v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates + parameters: + git: + fetchDepth: -1 + featureFlags: + EnableCDPxPAT: false + WindowsHostVersion: + Version: '2022' + Network: KS1 + networkisolation: + policy: Permissive,CFSClean + globalSdl: + tsa: + enabled: false + + stages: + - stage: Build + displayName: 'Build Python Package' + dependsOn: [] + jobs: + - job: BuildWheel + displayName: 'Build' + pool: + type: windows + + variables: + ob_outputDirectory: '$(Build.SourcesDirectory)\out' + ob_artifactBaseName: 'drop' + + steps: + - checkout: artifacts + fetchDepth: 1 + lfs: true + + - script: python --version + displayName: 'Check Python version' + + - powershell: | + $rulesDir = "$(Build.SourcesDirectory)\ModelKitArtifacts\op_check_results\rules" + $destDir = "$(Build.SourcesDirectory)\src\winml\modelkit\analyze\rules\runtime_check_rules" + $outDir = "$(ob_outputDirectory)" + New-Item -ItemType Directory -Path $outDir -Force | Out-Null + $zips = Get-ChildItem "$rulesDir\*.zip" + Write-Host "Found $($zips.Count) rule zips" + $zips | Copy-Item -Destination $destDir + $zips | Copy-Item -Destination $outDir + Write-Host "Copied $($zips.Count) rule zips to $destDir and $outDir" + displayName: 'Copy runtime check rules' + + - task: PipAuthenticate@1 + inputs: + artifactFeeds: 'windows.ai.toolkit/Modelkit' + displayName: 'Authenticate pip with Azure Artifacts' + + - script: pip install build twine + displayName: 'Install build tools' + + - script: python -m build --outdir "$(ob_outputDirectory)" + displayName: 'Build sdist and wheel' + + - script: twine check "$(ob_outputDirectory)\*" + continueOnError: true + displayName: 'Validate packages for PyPI'