diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml new file mode 100644 index 0000000..9c9f0b6 --- /dev/null +++ b/eng/ci/official-build.yml @@ -0,0 +1,50 @@ +trigger: + batch: true + branches: + include: + - main + - v0.x + +schedules: + # Ensure we build nightly to catch any new CVEs and report SDL often. + - cron: "0 0 * * *" + displayName: Nightly Build + branches: + include: + - main + - v0.x + always: true + +# CI only, does not trigger on PRs. +pr: none + +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + - repository: eng + type: git + name: engineering + ref: refs/tags/release + +variables: + - template: ci/variables/build.yml@eng + - template: ci/variables/cfs.yml@eng + - template: /eng/ci/templates/variables/build.yml@self + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1es + parameters: + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + + stages: + - stage: Build + jobs: + - template: /eng/ci/templates/jobs/build-artifacts.yml@self + parameters: + SkipBuildArtifacts: false diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml new file mode 100644 index 0000000..e81ad9b --- /dev/null +++ b/eng/ci/public-build.yml @@ -0,0 +1,51 @@ +# This build is used for public PR and CI builds. + +trigger: + batch: true + branches: + include: + - main + - v0.x + +schedules: + # Ensure we build nightly to catch any new CVEs and report SDL often. + - cron: "0 0 * * *" + displayName: Nightly Build + branches: + include: + - main + - v0.x + always: true + +pr: + branches: + include: + - main + - v0.x + +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +variables: + - template: ci/variables/build.yml@eng + - template: ci/variables/cfs.yml@eng + - template: /eng/ci/templates/variables/build.yml@self + +extends: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1es + parameters: + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + + stages: + - stage: Build + jobs: + - template: /eng/ci/templates/jobs/build-artifacts.yml@self + parameters: + SkipBuildArtifacts: true diff --git a/eng/ci/templates/jobs/build-artifacts.yml b/eng/ci/templates/jobs/build-artifacts.yml new file mode 100644 index 0000000..6c2a762 --- /dev/null +++ b/eng/ci/templates/jobs/build-artifacts.yml @@ -0,0 +1,54 @@ +parameters: + - name: SkipBuildArtifacts + type: boolean + default: false + +jobs: + +- job: BuildArtifacts + displayName: Build Artifacts + + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + + variables: + - template: /eng/ci/templates/variables/build.yml@self + + templateContext: + outputParentDirectory: $(System.DefaultWorkingDirectory)/packages + outputs: + - ${{ if eq(parameters.SkipBuildArtifacts, false) }}: + - output: pipelineArtifact + displayName: Publish artifacts + path: $(System.DefaultWorkingDirectory)/packages + artifact: drop + + steps: + - pwsh: dotnet --version + displayName: "Echo dotnet version" + + - task: DotNetCoreCLI@2 + displayName: 'Build project' + inputs: + command: 'build' + arguments: '-c $(buildConfiguration)' + projects: 'Azure.Web.DataProtection.sln' + + - task: DotNetCoreCLI@2 + displayName: 'Run tests' + inputs: + command: 'test' + arguments: '--no-build -c $(buildConfiguration)' + projects: 'Azure.Web.DataProtection.sln' + + - ${{ if eq(parameters.SkipBuildArtifacts, false) }}: + - task: DotNetCoreCLI@2 + displayName: 'Build package' + inputs: + command: 'custom' + custom: 'pack' + arguments: '--no-build -c Release -p:Version="$(versionPrefix).$(buildVersion)-$(versionSuffix)" -o packages' + projects: | + **/Azure.WebSites.DataProtection.csproj diff --git a/eng/ci/templates/variables/build.yml b/eng/ci/templates/variables/build.yml new file mode 100644 index 0000000..c380013 --- /dev/null +++ b/eng/ci/templates/variables/build.yml @@ -0,0 +1,8 @@ +variables: + buildConfiguration: 'Release' + buildVersion: $[ counter('constant', 94) ] + versionPrefix: '2.1' + versionSuffix: 'alpha' + DOTNET_NOLOGO: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1