Skip to content

Commit

Permalink
Merge pull request #51 from Archomeda/0.9
Browse files Browse the repository at this point in the history
Merge version 0.9
  • Loading branch information
Archomeda authored Mar 21, 2020
2 parents 6237185 + 07a0163 commit 6994ecf
Show file tree
Hide file tree
Showing 124 changed files with 1,518 additions and 1,113 deletions.
153 changes: 130 additions & 23 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,57 @@
[*.cs]
# Formatting
root = true

# All files
[*]
indent_style = space
indent_size = 4
charset = utf-8

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

# JSON files
[*.json]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

# Markdown files
[*.md]
indent_size = 2
trim_trailing_whitespace = false
insert_final_newline = true

# Powershell files
[*.ps1]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

# Shell script files
[*.sh]
end_of_line = lf
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true


# Formatting conventions
# More information: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019
[*.cs]

# "This." and "Me." qualifiers
dotnet_style_qualification_for_field = true:warning
Expand Down Expand Up @@ -38,8 +82,8 @@ dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_return = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion

# Null-checking preferences
dotnet_style_coalesce_expression = true:warning
Expand Down Expand Up @@ -164,7 +208,7 @@ dotnet_naming_symbols.locals.applicable_kinds = local
# Async methods (suffix + pascal)
dotnet_naming_rule.async_methods_require_suffix.symbols = async_methods
dotnet_naming_rule.async_methods_require_suffix.style = async_suffix
dotnet_naming_rule.async_methods_require_suffix.severity = error
dotnet_naming_rule.async_methods_require_suffix.severity = warning
dotnet_naming_symbols.async_methods.kinds = method
dotnet_naming_symbols.async_methods.required_modifiers = async
dotnet_naming_style.async_suffix.capitalization = pascal_case
Expand All @@ -182,6 +226,86 @@ dotnet_naming_style.upper.capitalization = all_upper


# Rule overrides
# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none
# CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = none
# CS8073: The result of the expression is always the same since a value of this type is never equal to 'null'.
dotnet_diagnostic.CS8073.severity = warning
# CS8597: Thrown value may be null.
dotnet_diagnostic.CS8597.severity = error
# CS8600: Converting null literal or possible null value to non-nullable type.
dotnet_diagnostic.CS8600.severity = error
# CS8601: Possible null reference assignment.
dotnet_diagnostic.CS8601.severity = error
# CS8602: Possible dereference of a null reference.
dotnet_diagnostic.CS8602.severity = error
# CS8603: Possible null reference return.
dotnet_diagnostic.CS8603.severity = error
# CS8604: Possible null reference argument for a parameter.
dotnet_diagnostic.CS8604.severity = error
# CS8608: Nullability of reference types in type doesn't match overridden member.
dotnet_diagnostic.CS8608.severity = error
# CS8609: Nullability of reference types in return type doesn't match overridden member.
dotnet_diagnostic.CS8609.severity = error
# CS8610: Nullability of reference types in type of parameter doesn't match overridden member.
dotnet_diagnostic.CS8610.severity = error
# CS8611: Nullability of reference types in type of parameter doesn't match partial method declaration.
dotnet_diagnostic.CS8611.severity = error
# CS8612: Nullability of reference types in type doesn't match implicitly implemented member.
dotnet_diagnostic.CS8612.severity = error
# CS8613: Nullability of reference types in return type doesn't match implicitly implemented member.
dotnet_diagnostic.CS8613.severity = error
# CS8614: Nullability of reference types in type of parameter doesn't match implicitly implemented member.
dotnet_diagnostic.CS8614.severity = error
# CS8615: Nullability of reference types in type doesn't match implemented member.
dotnet_diagnostic.CS8615.severity = error
# CS8616: Nullability of reference types in return type doesn't match implemented member.
dotnet_diagnostic.CS8616.severity = error
# CS8617: Nullability of reference types in type of parameter doesn't match implemented member.
dotnet_diagnostic.CS8617.severity = error
# CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
dotnet_diagnostic.CS8618.severity = error
# CS8619: Nullability of reference types in value doesn't match target type.
dotnet_diagnostic.CS8619.severity = error
# CS8620: Nullability of reference types in argument doesn't match parameter type.
dotnet_diagnostic.CS8620.severity = error
# CS8621: Nullability of reference types in return type doesn't match the target delegate.
dotnet_diagnostic.CS8621.severity = error
# CS8622: Nullability of reference types in type of a parameter doesn't match the target delegate.
dotnet_diagnostic.CS8622.severity = error
# CS8625: Cannot convert null literal to non-nullable reference or unconstrained type parameter.
dotnet_diagnostic.CS8625.severity = error
# CS8629: Nullable value type may be null.
dotnet_diagnostic.CS8629.severity = error
# CS8631: The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match constraint type.
dotnet_diagnostic.CS8631.severity = error
# CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
dotnet_diagnostic.CS8632.severity = error
# CS8633: Nullability in constraints for type parameter doesn't match the constraints for type parameter in implicitly implemented interface method.
dotnet_diagnostic.CS8633.severity = error
# CS8634: The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'class' constraint.
dotnet_diagnostic.CS8634.severity = error
# CS8638: Conditional access may produce a null value for a type parameter.
dotnet_diagnostic.CS8638.severity = error
# CS8643: Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.
dotnet_diagnostic.CS8643.severity = error
# CS8644: Type does not implement interface member. Nullability of reference types in interface implemented by the base type doesn't match.
dotnet_diagnostic.CS8644.severity = error
# CS8645: Interface is already listed in the interface list with different nullability of reference types.
dotnet_diagnostic.CS8645.severity = error
# CS8653: A default expression introduces a null value for a type parameter.
dotnet_diagnostic.CS8653.severity = error
# CS8654: A null literal introduces a null value for a type parameter.
dotnet_diagnostic.CS8654.severity = error
# CS8655: The switch expression does not handle some null inputs.
dotnet_diagnostic.CS8655.severity = error
# CS8667: Partial method declarations have inconsistent nullability in constraints for type parameter.
dotnet_diagnostic.CS8667.severity = error
# CS8714: The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'notnull' constraint.
dotnet_diagnostic.CS8714.severity = error
# IDE0069: Disposable fields should be disposed
dotnet_diagnostic.IDE0069.severity = warning
# S1117: Local variables should not shadow class fields
dotnet_diagnostic.S1117.severity = silent
# S2342: Enumeration types should comply with a naming convention
Expand All @@ -190,20 +314,3 @@ dotnet_diagnostic.S2342.severity = silent
dotnet_diagnostic.S3966.severity = silent
# S4136: Method overloads should be grouped together
dotnet_diagnostic.S4136.severity = silent


[*.{csproj,json,yml}]
# Formatting
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
# Formatting
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
147 changes: 41 additions & 106 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,132 +1,67 @@
name: CI

on: [push]
on:
push:
branches:
- '**'
tags-ignore:
- v*

jobs:
# Determine the build number
buildnumber:
name: Build number
runs-on: ubuntu-latest
steps:
- uses: einaregilsson/build-number@v1
name: Generate build number
id: buildnumber
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v1
name: Upload build number
with:
name: BUILD_NUMBER
path: BUILD_NUMBER

# Unit tests
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
dotnet:
- "3.1.102"
os:
- ubuntu-latest
- windows-latest
dotnet:
- netcoreapp3.1
- netcoreapp2.1
- net461
exclude:
- os: ubuntu-latest
dotnet: net461
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v1
name: Install .NET Core ${{ matrix.dotnet }}
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Run dotnet build
run: dotnet build Gw2Sharp -c Release
- uses: actions/checkout@v2
- name: Run dotnet test
run: dotnet test -c Release
run: dotnet test -c Release -f ${{ matrix.dotnet }}

# Nightly packaged builds
nightly:
name: Nightly build
name: Nightly
runs-on: windows-latest
needs: [buildnumber, test]
strategy:
fail-fast: false
matrix:
dotnet:
- "3.1.102"
needs: [test]
steps:
- uses: actions/checkout@v1
- uses: actions/download-artifact@v1
name: Download build number
with:
name: BUILD_NUMBER
- uses: einaregilsson/build-number@v1
name: Restore build number
id: buildnumber
- uses: actions/setup-dotnet@v1
name: Install .NET Core ${{ matrix.dotnet }}
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Install GitVersion
run: choco install GitVersion.Portable -y
- name: Patch assembly version
run: GitVersion /updateassemblyinfo Gw2Sharp/Properties/AssemblyVersionInfo.cs /ensureassemblyinfo
- name: Patch package version
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Install InheritDocTool
shell: powershell
run: dotnet tool install --global InheritDocTool
- name: Patch nightly version
shell: powershell
run: |
$version = (GitVersion /output json | ConvertFrom-Json).AssemblySemFileVer -replace "origin/","" -replace "[^a-zA-Z0-9-_.]","-" -replace "(\d+\.\d+\.\d+)(.*)","`$1.$env:BUILD_NUMBER`$2"
Write-Output "NuGet package version: $version"
$version = GitVersion /output json /updateassemblyinfo Gw2Sharp/Properties/AssemblyVersionInfo.cs /ensureassemblyinfo
Write-Output $version
$version = $version | ConvertFrom-Json
(Get-Content Gw2Sharp/Gw2Sharp.csproj) `
-replace '<Version>([^<]*)</Version>', "<Version>$version</Version>" |
Out-File Gw2Sharp/Gw2Sharp.csproj
$nuget = $version.SemVer
if ($version.BranchName -eq "master") {
$nuget += "-master.$($version.CommitsSinceVersionSource)"
}
Write-Output "Assembly version: $($version.AssemblySemVer)"
Write-Output "Assembly file version: $($version.AssemblySemFileVer)"
Write-Output "Informational version: $($version.InformationalVersion)"
Write-Output "NuGet version: $nuget"
echo "::set-env name=VERSION::$nuget"
- name: Run dotnet build
run: dotnet build -c Debug -p:VERSIONED_BUILD=1
run: dotnet build -c Release -p:VERSIONED_BUILD=$env:VERSION
- name: Run InheritDocTool
shell: powershell
run: InheritDoc -o
- name: Run dotnet pack
run: dotnet pack Gw2Sharp -c Debug --no-build -p:VERSIONED_BUILD=1
run: dotnet pack Gw2Sharp -c Release --no-build -p:VERSIONED_BUILD=$env:VERSION
- name: Run dotnet nuget push
run: dotnet nuget push **/*.symbols.nupkg -s "https://www.myget.org/F/gw2sharp/api/v2/package" -k "${{ secrets.MYGET_TOKEN }}"

# SonarCloud analysis
sonarcloud:
name: SonarCloud analysis
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
dotnet:
- "3.1.102"
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v1
name: Install .NET Core ${{ matrix.dotnet }}
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Install Coverlet
run: dotnet tool install --global coverlet.console
- name: Install SonarScanner
run: dotnet tool install --global dotnet-sonarscanner
- name: Start SonarScanner
shell: powershell
run: |
if ($env:GITHUB_REF -match "refs/([^/]*)/(.*)") {
if ($matches[1] -eq "tags") {
dotnet sonarscanner begin /k:"Archomeda_Gw2Sharp" /o:"archomeda-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.opencover.reportsPaths="coverage.xml" /v:"$($matches[2])"
} elseif ($matches[1] -eq "heads") {
dotnet sonarscanner begin /k:"Archomeda_Gw2Sharp" /o:"archomeda-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.opencover.reportsPaths="coverage.xml" /d:sonar.branch.name="$($matches[2])"
} else {
Write-Error "No valid ref found in $env:GITHUB_REF"
exit 1
}
} else {
Write-Error "No valid ref found in $env:GITHUB_REF"
exit 1
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run dotnet build
run: dotnet build -c Debug
- name: Run Coverlet
run: coverlet Gw2Sharp.Tests/bin/Debug/netcoreapp3.0/Gw2Sharp.Tests.dll --target "dotnet.exe" --targetargs "test -c Debug --no-build" --format opencover --output "coverage.xml"
- name: End SonarScanner
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 9 additions & 11 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@ name: PR
on: [pull_request]

jobs:
# Unit tests
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
dotnet:
- "3.1.102"
os:
- ubuntu-latest
- windows-latest
dotnet:
- netcoreapp3.1
- netcoreapp2.1
- net461
exclude:
- os: ubuntu-latest
dotnet: net461
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v1
name: Install .NET Core ${{ matrix.dotnet }}
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Run dotnet build
run: dotnet build Gw2Sharp -c Release
- uses: actions/checkout@v2
- name: Run dotnet test
run: dotnet test -c Release
run: dotnet test -c Release -f ${{ matrix.dotnet }}
Loading

0 comments on commit 6994ecf

Please sign in to comment.