Skip to content

Commit 05907ed

Browse files
Simplify build and versioning
1 parent 9cd8bb0 commit 05907ed

16 files changed

+1239
-241
lines changed

.editorconfig

Lines changed: 387 additions & 114 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 449 additions & 3 deletions
Large diffs are not rendered by default.

.globalconfig

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
is_global = true
2+
3+
##########################################
4+
# StyleCopAnalyzers Settings
5+
##########################################
6+
7+
# All constant fields must be PascalCase
8+
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md
9+
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
10+
dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const
11+
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field
12+
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group
13+
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
14+
15+
# All static readonly fields must be PascalCase
16+
# Ajusted to ignore private fields.
17+
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md
18+
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected
19+
dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly
20+
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field
21+
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group
22+
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
23+
24+
# No non-private instance fields are allowed
25+
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md
26+
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected
27+
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field
28+
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group
29+
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style
30+
31+
# Local variables must be camelCase
32+
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1312.md
33+
dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local
34+
dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local
35+
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group
36+
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style
37+
38+
##########################################
39+
# StyleCopAnalyzers rule severity
40+
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
41+
##########################################
42+
43+
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = suggestion
44+
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.ReadabilityRules.severity = suggestion
45+
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.NamingRules.severity = suggestion
46+
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpacingRules.severity = suggestion
47+
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = suggestion
48+
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.MaintainabilityRules.severity = suggestion
49+
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = suggestion
50+
51+
dotnet_diagnostic.SA1101.severity = none # PrefixLocalCallsWithThis - stylecop appears to be ignoring dotnet_style_qualification_for_*
52+
dotnet_diagnostic.SA1309.severity = none # FieldNamesMustNotBeginWithUnderscore
53+
dotnet_diagnostic.SA1413.severity = none # UseTrailingCommasInMultiLineInitializers
54+
dotnet_diagnostic.SA1633.severity = none # FileMustHaveHeader
55+
dotnet_diagnostic.SA1636.severity = none # FileHeaderCopyrightTextMustMatch
56+
57+
dotnet_diagnostic.SA1503.severity = warning # BracesMustNotBeOmitted
58+
dotnet_diagnostic.SA1117.severity = warning # ParametersMustBeOnSameLineOrSeparateLines
59+
dotnet_diagnostic.SA1116.severity = warning # SplitParametersMustStartOnLineAfterDeclaration
60+
dotnet_diagnostic.SA1122.severity = warning # UseStringEmptyForEmptyStrings
61+
dotnet_diagnostic.SA1028.severity = warning # CodeMustNotContainTrailingWhitespace
62+
dotnet_diagnostic.SA1500.severity = warning # BracesForMultiLineStatementsMustNotShareLine
63+
dotnet_diagnostic.SA1401.severity = warning # FieldsMustBePrivate
64+
dotnet_diagnostic.SA1519.severity = warning # BracesMustNotBeOmittedFromMultiLineChildStatement
65+
dotnet_diagnostic.SA1111.severity = warning # ClosingParenthesisMustBeOnLineOfLastParameter
66+
dotnet_diagnostic.SA1520.severity = warning # UseBracesConsistently
67+
dotnet_diagnostic.SA1407.severity = warning # ArithmeticExpressionsMustDeclarePrecedence
68+
dotnet_diagnostic.SA1400.severity = warning # AccessModifierMustBeDeclared
69+
dotnet_diagnostic.SA1119.severity = warning # StatementMustNotUseUnnecessaryParenthesis
70+
dotnet_diagnostic.SA1649.severity = warning # FileNameMustMatchTypeName
71+
dotnet_diagnostic.SA1121.severity = warning # UseBuiltInTypeAlias
72+
dotnet_diagnostic.SA1132.severity = warning # DoNotCombineFields
73+
dotnet_diagnostic.SA1134.severity = warning # AttributesMustNotShareLine
74+
dotnet_diagnostic.SA1106.severity = warning # CodeMustNotContainEmptyStatements
75+
dotnet_diagnostic.SA1312.severity = warning # VariableNamesMustBeginWithLowerCaseLetter
76+
dotnet_diagnostic.SA1310.severity = warning # FieldNamesMustNotContainUnderscore
77+
dotnet_diagnostic.SA1303.severity = warning # ConstFieldNamesMustBeginWithUpperCaseLetter
78+
dotnet_diagnostic.SA1130.severity = warning # UseLambdaSyntax
79+
dotnet_diagnostic.SA1405.severity = warning # DebugAssertMustProvideMessageText
80+
dotnet_diagnostic.SA1205.severity = warning # PartialElementsMustDeclareAccess
81+
dotnet_diagnostic.SA1306.severity = warning # FieldNamesMustBeginWithLowerCaseLetter
82+
dotnet_diagnostic.SA1209.severity = warning # UsingAliasDirectivesMustBePlacedAfterOtherUsingDirectives
83+
dotnet_diagnostic.SA1216.severity = warning # UsingStaticDirectivesMustBePlacedAtTheCorrectLocation
84+
dotnet_diagnostic.SA1133.severity = warning # DoNotCombineAttributes
85+
dotnet_diagnostic.SA1135.severity = warning # UsingDirectivesMustBeQualified
86+
87+
# IDE0058: Expression value is never used
88+
dotnet_diagnostic.IDE0058.severity = none

Directory.Build.props

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<Project>
2+
<PropertyGroup>
3+
<TargetFramework>net6.0</TargetFramework>
4+
<Company>Umbraco HQ</Company>
5+
<Authors>Umbraco</Authors>
6+
<Copyright>Copyright © Umbraco $([System.DateTime]::Today.ToString('yyyy'))</Copyright>
7+
<Product>Umbraco Cloud Storage Providers</Product>
8+
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cloud.StorageProviders.AzureBlob</PackageProjectUrl>
9+
<PackageIconUrl>https://umbraco.com/dist/nuget/logo-small.png</PackageIconUrl>
10+
<PackageIcon>icon.png</PackageIcon>
11+
<PackageTags>umbraco cloud storage</PackageTags>
12+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
13+
<NeutralLanguage>en-US</NeutralLanguage>
14+
<ImplicitUsings>enable</ImplicitUsings>
15+
<Nullable>enable</Nullable>
16+
<WarningsAsErrors>Nullable</WarningsAsErrors>
17+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
18+
<AnalysisMode>All</AnalysisMode>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="all" />
23+
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="all" />
24+
<PackageReference Include="Umbraco.Code" PrivateAssets="all" />
25+
<PackageReference Include="Umbraco.GitVersioning.Extensions" PrivateAssets="all" />
26+
</ItemGroup>
27+
28+
<!-- NuGet packages lock -->
29+
<PropertyGroup>
30+
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
31+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
32+
<DefaultItemExcludes>$(DefaultItemExcludes);packages.lock.json</DefaultItemExcludes>
33+
</PropertyGroup>
34+
35+
<!-- SourceLink -->
36+
<PropertyGroup>
37+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
38+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
39+
<IncludeSymbols>true</IncludeSymbols>
40+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
41+
</PropertyGroup>
42+
<ItemGroup>
43+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
44+
</ItemGroup>
45+
46+
<ItemGroup>
47+
<Content Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="" Visible="false" />
48+
</ItemGroup>
49+
50+
<PropertyGroup>
51+
<GitVersionBaseDirectory>$(MSBuildThisFileDirectory)</GitVersionBaseDirectory>
52+
</PropertyGroup>
53+
</Project>

Directory.Packages.props

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageVersion Include="Umbraco.StorageProviders.AzureBlob" Version="[10.0.0, 11)" />
7+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
8+
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
9+
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
10+
<PackageVersion Include="Umbraco.Code" Version="2.1.0" />
11+
<PackageVersion Include="Umbraco.GitVersioning.Extensions" Version="0.2.0" />
12+
</ItemGroup>
13+
</Project>

NuGet.config

Lines changed: 0 additions & 8 deletions
This file was deleted.

Umbraco.Cloud.StorageProviders.AzureBlob.sln

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1010
.editorconfig = .editorconfig
1111
.gitattributes = .gitattributes
1212
.gitignore = .gitignore
13+
.globalconfig = .globalconfig
1314
azure-pipelines.yml = azure-pipelines.yml
14-
src\Directory.Build.props = src\Directory.Build.props
15+
Directory.Build.props = Directory.Build.props
16+
Directory.Packages.props = Directory.Packages.props
17+
global.json = global.json
18+
icon.png = icon.png
1519
LICENSE = LICENSE
16-
NuGet.config = NuGet.config
1720
README.md = README.md
21+
nuget.config = nuget.config
22+
version.json = version.json
1823
EndProjectSection
1924
EndProject
2025
Global

azure-pipelines.yml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
2+
13
parameters:
24
- name: cache_nuget
35
displayName: Cache NuGet packages
@@ -7,38 +9,55 @@ parameters:
79
variables:
810
solution: Umbraco.Cloud.StorageProviders.AzureBlob.sln
911
buildConfiguration: Release
10-
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
1112
DOTNET_NOLOGO: true
1213
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
1314
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
15+
DOTNET_CLI_TELEMETRY_OPTOUT: true
1416

1517
stages:
16-
- stage: Artifacts
18+
- stage: Build
19+
variables:
20+
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
1721
jobs:
1822
- job: Build
1923
pool:
20-
vmImage: windows-latest
24+
vmImage: 'ubuntu-latest'
2125
steps:
26+
# Checkout source (avoid shallow clone to calculate version height)
27+
- checkout: self
28+
fetchDepth: 0
29+
30+
# Setup build environment
31+
- task: UseDotNet@2
32+
displayName: Use .NET SDK from global.json
33+
inputs:
34+
useGlobalJson: true
35+
36+
# Cache and restore NuGet packages
2237
- task: Cache@2
23-
condition: ${{parameters.cache_nuget}}
38+
condition: ${{ parameters.cache_nuget }}
39+
displayName: Cache NuGet packages
2440
inputs:
25-
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json'
41+
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json, !**/bin/**, !**/obj/**'
2642
restoreKeys: |
2743
nuget | "$(Agent.OS)"
2844
nuget
2945
path: $(NUGET_PACKAGES)
30-
displayName: Cache NuGet packages
3146

3247
- script: dotnet restore $(solution) --locked-mode
3348
displayName: Restore NuGet packages
3449

35-
- script: dotnet build $(solution) -c $(buildConfiguration) -p:ContinuousIntegrationBuild=true --no-restore
36-
displayName: Build
50+
# Build
51+
- script: dotnet build $(solution) --configuration $(buildConfiguration) --no-restore -p:ContinuousIntegrationBuild=true
52+
displayName: Run dotnet build
3753

38-
- script: dotnet pack $(solution) -c $(buildConfiguration) -o $(Build.ArtifactStagingDirectory) --no-restore --no-build
39-
displayName: Pack
54+
# Pack
55+
- script: dotnet pack $(solution) --configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)/nupkg
56+
displayName: Run dotnet pack
4057

41-
- task: PublishBuildArtifacts@1
42-
inputs:
43-
ArtifactName: nupkg
58+
# Publish
59+
- task: PublishPipelineArtifact@1
4460
displayName: Publish NuGet packages
61+
inputs:
62+
targetPath: $(Build.ArtifactStagingDirectory)/nupkg
63+
artifactName: nupkg

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sdk": {
3+
"version": "6.0.100",
4+
"rollForward": "latestFeature"
5+
}
6+
}

icon.png

-372 Bytes
Loading

0 commit comments

Comments
 (0)