diff --git a/.editorconfig b/.editorconfig index c5a66e7c..2bfde114 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,6 +20,10 @@ indent_size = 2 [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] indent_size = 2 +# YAML files +[*.{yaml,yml}] +indent_size = 2 + # JSON files [*.json] indent_size = 2 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f464299d..b5ace6f6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,42 +1,129 @@ -queue: Hosted VS2017 - -steps: - -- checkout: self - clean: true - -- task: MSBuild@1 - displayName: Restore - inputs: - solution: src/Moq.sln - msbuildArguments: /t:Restore /p:Configuration=Release /m - -- task: MSBuild@1 - displayName: Version - inputs: - solution: src/Moq/Moq.Package/Moq.Package.msbuildproj - msbuildArguments: /t:Version /bl:"$(Build.ArtifactStagingDirectory)\version.binlog" - -- task: MSBuild@1 - displayName: Build - inputs: - solution: src/Moq.sln - msbuildArguments: /bl:"$(Build.ArtifactStagingDirectory)\build.binlog" /p:PackOnBuild=true /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:Configuration=Release - -- task: VSTest@2 - displayName: Test - inputs: - testAssemblyVer2: src\*\*\bin\*\*.Tests.dll - runInParallel: 'true' - codeCoverageEnabled: 'true' - publishRunAttachments: 'true' - diagnosticsEnabled: false - rerunFailedTests: true - -- task: PublishBuildArtifacts@1 - displayName: Publish Artifact - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory) - ArtifactName: out - ArtifactType: Container - condition: always() \ No newline at end of file +trigger: + batch: false + branches: + include: + - master + - features/* + - releases/* + - dev/* + paths: + exclude: + - docs +pr: + - master + - features/* + - releases/* + +variables: +- group: Sleet +- name: Configuration + value: Release + +stages: + +- stage: Build + jobs: + - job: Build + pool: + vmImage: 'windows-2019' + steps: + - checkout: self + clean: true + + - task: MSBuild@1 + displayName: Restore Script + inputs: + solution: build.proj + configuration: $(Configuration) + msbuildArguments: -t:restore + + - task: MSBuild@1 + displayName: Restore Solution + inputs: + solution: src/Moq.sln + configuration: $(Configuration) + msbuildArguments: -t:restore -bl:$(Build.ArtifactStagingDirectory)/logs/restore.binlog + + - task: MSBuild@1 + displayName: Set Version + inputs: + solution: src/Moq/Moq.Package/Moq.Package.msbuildproj + msbuildArguments: -t:Version -bl:$(Build.ArtifactStagingDirectory)/logs/setversion.binlog + + - task: MSBuild@1 + displayName: Build + inputs: + solution: src/Moq.sln + configuration: $(Configuration) + msbuildArguments: -p:PackOnBuild=true -p:PackageOutputPath=$(Build.ArtifactStagingDirectory)/pkg -bl:$(Build.ArtifactStagingDirectory)/logs/build.binlog + + - task: VSTest@2 + displayName: Test + inputs: + testAssemblyVer2: src/*/*/bin/*/*.Tests.dll + runInParallel: true + codeCoverageEnabled: true + publishRunAttachments: true + diagnosticsEnabled: false + rerunFailedTests: true + + - task: PublishBuildArtifacts@1 + displayName: Upload Packages + condition: always() + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/pkg + ArtifactName: packages + ArtifactType: Container + + - task: PublishBuildArtifacts@1 + displayName: Upload Logs + condition: always() + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/logs + ArtifactName: logs + ArtifactType: Container + +- stage: Deploy + variables: + - name: SleetVersion + value: 2.3.33 + jobs: + - deployment: Deploy + pool: + vmImage: 'windows-2019' + environment: sleet + strategy: + runOnce: + deploy: + steps: + - pwsh: | + $anyinstalled = (dotnet tool list -g | select-string sleet) -ne $null + Write-Host "##vso[task.setvariable variable=Sleet.AnyInstalled;]$anyinstalled" + + $sameinstalled = (dotnet tool list -g | select-string sleet | select-string $(SleetVersion)) -ne $null + Write-Host "##vso[task.setvariable variable=Sleet.SameInstalled;]$sameinstalled" + displayName: 'Check Sleet installed version' + + - task: DotNetCoreCLI@2 + displayName: 'Uninstall Sleet if necessary' + continueOnError: true + condition: and(eq(variables['Sleet.AnyInstalled'], 'True'), eq(variables['Sleet.SameInstalled'], 'False')) + inputs: + command: custom + custom: tool + arguments: 'uninstall -g Sleet' + + - task: DotNetCoreCLI@2 + displayName: 'Install Sleet if necessary' + condition: eq(variables['Sleet.SameInstalled'], 'False') + inputs: + command: custom + custom: tool + arguments: 'install --global Sleet --version $(SleetVersion)' + + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: packages + + - script: 'sleet push --config none $(Pipeline.Workspace)/packages -f --verbose -p "SLEET_FEED_CONNECTIONSTRING=$(SLEET_FEED_CONNECTIONSTRING)"' + displayName: 'Push packages via Sleet' \ No newline at end of file diff --git a/build.proj b/build.proj index 0ca2a3d6..bd9c6a76 100644 --- a/build.proj +++ b/build.proj @@ -1,8 +1,10 @@ - + + Debug + net472 @@ -10,15 +12,13 @@ Configuration=$(Configuration) $(MSBuildProjectDirectory)\out src\GitInfo.txt + $(MSBuildProjectDirectory)\src\Packages.props - - - - - + + @@ -31,11 +31,15 @@ + + + - + + diff --git a/global.json b/global.json new file mode 100644 index 00000000..d464439f --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "msbuild-sdks": { + "Microsoft.Build.CentralPackageVersions": "2.0.41", + "Microsoft.Build.NoTargets": "1.0.78", + "CoreBuild": "1.0.0-alpha" + } +} \ No newline at end of file diff --git a/src/Moq.sln b/src/Moq.sln index 76f0f254..88c841a0 100644 --- a/src/Moq.sln +++ b/src/Moq.sln @@ -7,13 +7,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq", "Moq\Moq\Moq.csproj", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2093478C-CEA6-4034-BCDE-EDC7A5DD4532}" ProjectSection(SolutionItems) = preProject + ..\.editorconfig = ..\.editorconfig ..\azure-pipelines.yml = ..\azure-pipelines.yml ..\build.proj = ..\build.proj ..\CODE_OF_CONDUCT.md = ..\CODE_OF_CONDUCT.md Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets GitInfo.txt = GitInfo.txt - global.json = global.json + ..\global.json = ..\global.json ..\NuGet.Config = ..\NuGet.Config Packages.props = Packages.props ..\README.md = ..\README.md diff --git a/src/Packages.props b/src/Packages.props index fd622b19..1e8d30b5 100644 --- a/src/Packages.props +++ b/src/Packages.props @@ -14,6 +14,8 @@ + + @@ -25,10 +27,10 @@ - - - - + + + + diff --git a/src/build/Version.targets b/src/build/Version.targets index c2dcec0f..d73f2311 100644 --- a/src/build/Version.targets +++ b/src/build/Version.targets @@ -29,20 +29,12 @@ AssemblyVersion=$(AssemblyVersion)" /> Returns="$(Version)" Condition="'$(GitInfoImported)' == 'true' And '$(ExcludeRestorePackageImports)' != 'true'"> - - - -$(GitBranch) - - - + + + - - - - + @@ -51,6 +43,9 @@ AssemblyVersion=$(AssemblyVersion)" /> @(VersionMetadata -> '%(Identity)', '-') +$(VersionMetadataLabel) + + @(LabelMetadata -> '%(Identity)', '-') + -$(LabelMetadata) $(GitSemVerDashLabel).$(GitCommits) $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(GitSemVerDashLabel)$(VersionMetadataPlusLabel) diff --git a/src/global.json b/src/global.json deleted file mode 100644 index d56b18cc..00000000 --- a/src/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "msbuild-sdks": { - "Microsoft.Build.CentralPackageVersions": "2.0.29", - "Microsoft.Build.NoTargets": "1.0.53" - } -} \ No newline at end of file