|
1 | 1 | trigger: |
| 2 | + batch: false |
| 3 | + branches: |
| 4 | + include: |
2 | 5 | - master |
| 6 | + paths: |
| 7 | + exclude: |
| 8 | + - .github/** |
| 9 | + - .nuget/** |
| 10 | + - docs/** |
| 11 | + - examples/** |
| 12 | + tags: |
| 13 | + include: |
| 14 | + - '*' |
3 | 15 |
|
4 | | -strategy: |
5 | | - matrix: |
6 | | - windows: |
7 | | - imageName: 'vs2017-win2016' |
| 16 | +pr: |
| 17 | + autoCancel: true |
| 18 | + branches: |
| 19 | + include: |
| 20 | + - master |
| 21 | + paths: |
| 22 | + exclude: |
| 23 | + - .github/** |
| 24 | + - .nuget/** |
| 25 | + - docs/** |
| 26 | + - examples/** |
8 | 27 |
|
9 | | -pool: |
10 | | - vmImage: $(imageName) |
| 28 | +schedules: |
| 29 | +- cron: "0 0 1 * *" |
| 30 | + displayName: Monthly release |
| 31 | + branches: |
| 32 | + include: |
| 33 | + - master |
11 | 34 |
|
12 | 35 | variables: |
13 | | - buildConfiguration: 'Release' |
| 36 | + BuildConfiguration: 'Release' |
| 37 | + DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
14 | 38 |
|
15 | | -steps: |
16 | | - - script: dotnet build --configuration $(buildConfiguration) |
17 | | - displayName: 'Build All' |
18 | | - - script: dotnet test tests/ExchangeSharpTests/ExchangeSharpTests.csproj --configuration $(buildConfiguration) |
19 | | - displayName: 'Test' |
| 39 | +jobs: |
| 40 | + - job: build_ci |
| 41 | + displayName: CI Build |
| 42 | + timeoutInMinutes: 2 |
| 43 | + continueOnError: false |
| 44 | + pool: |
| 45 | + vmImage: ubuntu-18.04 |
| 46 | + steps: |
| 47 | + - task: DotNetCoreCLI@2 |
| 48 | + displayName: 'Build lib+console' |
| 49 | + inputs: |
| 50 | + command: 'build' |
| 51 | + configuration: $(BuildConfiguration) |
| 52 | + projects: 'src/ExchangeSharpConsole/ExchangeSharpConsole.csproj' |
| 53 | + - task: DotNetCoreCLI@2 |
| 54 | + displayName: 'Tests' |
| 55 | + inputs: |
| 56 | + command: 'test' |
| 57 | + configuration: $(BuildConfiguration) |
| 58 | + projects: 'tests/*/*.csproj' |
| 59 | + publishTestResults: true |
| 60 | + testRunTitle: 'All tests' |
| 61 | + - job: build_tag |
| 62 | + displayName: Build console app |
| 63 | + timeoutInMinutes: 5 |
| 64 | + dependsOn: build_ci |
| 65 | + condition: or(eq(variables['Build.Reason'], 'Schedule'), startsWith(variables['Build.SourceBranch'], 'refs/tags')) |
| 66 | + continueOnError: false |
| 67 | + strategy: |
| 68 | + matrix: |
| 69 | + macos: |
| 70 | + imageName: macOS-latest |
| 71 | + rid: osx-x64 |
| 72 | + linux: |
| 73 | + imageName: ubuntu-18.04 |
| 74 | + rid: linux-x64 |
| 75 | + windows: |
| 76 | + imageName: windows-2019 |
| 77 | + rid: win-x64 |
| 78 | + pool: |
| 79 | + vmImage: $(imageName) |
| 80 | + steps: |
| 81 | + - task: UseDotNet@2 |
| 82 | + displayName: 'Install current .NET Core' |
| 83 | + condition: eq(variables['Agent.OS'], 'Darwin') |
| 84 | + inputs: |
| 85 | + packageType: sdk |
| 86 | + version: 3.0.100 |
| 87 | + installationPath: $(Agent.ToolsDirectory)/dotnet |
| 88 | + - task: DotNetCoreCLI@2 |
| 89 | + displayName: "Publish console executable" |
| 90 | + timeoutInMinutes: 5 |
| 91 | + inputs: |
| 92 | + command: 'publish' # Options: build, push, pack, publish, restore, run, test, custom |
| 93 | + configuration: $(BuildConfiguration) |
| 94 | + arguments: | |
| 95 | + --force -r $(rid) -f netcoreapp30 -o "$(Build.ArtifactStagingDirectory)/$(rid)" /NoLogo /p:PublishTrimmed=True /p:PublishReadyToRun=True /p:PublishSingleFile=True /p:PublishReadyToRunShowWarnings=True /p:ShowLinkerSizeComparison=True /p:LinkerTrimNativeDeps=True |
| 96 | + zipAfterPublish: true |
| 97 | + restoreDirectory: |
| 98 | + verbosityRestore: 'Detailed' |
| 99 | + #versioningScheme: 'off' # Options: off, byPrereleaseNumber, byEnvVar, byBuildNumber |
| 100 | + #versionEnvVar: # Required when versioningScheme == ByEnvVar |
| 101 | + publishWebProjects: false |
| 102 | + workingDirectory: ./src/ExchangeSharpConsole/ |
| 103 | + - bash: | |
| 104 | + set -x |
| 105 | + rm -rfv $(Build.ArtifactStagingDirectory)/$(rid)/*.pdb |
| 106 | + displayName: Remove pdb from artifacts |
| 107 | + - task: PublishBuildArtifacts@1 |
| 108 | + displayName: "Save artifacts" |
| 109 | + inputs: |
| 110 | + artifactName: build-$(rid) |
| 111 | + - job: publish_tag |
| 112 | + displayName: Publish artifacts to GH |
| 113 | + timeoutInMinutes: 2 |
| 114 | + dependsOn: build_tag |
| 115 | + continueOnError: false |
| 116 | + pool: |
| 117 | + vmImage: ubuntu-18.04 |
| 118 | + condition: or(eq(variables['Build.Reason'], 'Schedule'), startsWith(variables['Build.SourceBranch'], 'refs/tags')) |
| 119 | + steps: |
| 120 | + - bash: echo "##vso[task.setvariable variable=TAG;isOutput=true]$(git describe --tags --exact-match)" |
| 121 | + name: setTag |
| 122 | + displayName: Set TAG env var |
| 123 | + - task: DownloadBuildArtifacts@0 |
| 124 | + displayName: Download linux-x64 artifact |
| 125 | + inputs: |
| 126 | + buildType: 'current' |
| 127 | + downloadType: 'single' |
| 128 | + artifactName: 'build-linux-x64' |
| 129 | + downloadPath: '$(System.ArtifactsDirectory)' |
| 130 | + - task: DownloadBuildArtifacts@0 |
| 131 | + displayName: Download osx-x64 artifact |
| 132 | + inputs: |
| 133 | + buildType: 'current' |
| 134 | + downloadType: 'single' |
| 135 | + # This is temporary there's a bug with our tests on Mac |
| 136 | + allowPartiallySucceededBuilds: true |
| 137 | + artifactName: 'build-osx-x64' |
| 138 | + downloadPath: '$(System.ArtifactsDirectory)' |
| 139 | + - task: DownloadBuildArtifacts@0 |
| 140 | + displayName: Download win-x64 artifact |
| 141 | + inputs: |
| 142 | + buildType: 'current' |
| 143 | + downloadType: 'single' |
| 144 | + artifactName: 'build-win-x64' |
| 145 | + downloadPath: '$(System.ArtifactsDirectory)' |
| 146 | + - task: GitHubRelease@0 |
| 147 | + displayName: "Attach artifacts to GH Release" |
| 148 | + inputs: |
| 149 | + gitHubConnection: johnnyasantoss |
| 150 | + target: '$(Build.SourceVersion)' |
| 151 | + title: $(setTag.TAG) |
| 152 | + tag: $(setTag.TAG) |
| 153 | + action: 'edit' |
| 154 | + addChangeLog: true |
| 155 | + assets: '$(System.ArtifactsDirectory)/**' |
| 156 | + assetUploadMode: 'replace' |
0 commit comments