Skip to content

Commit

Permalink
🖆 Apply kzu/oss template via dotnet-file
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Dec 10, 2020
1 parent c7bdc5e commit 9dc2cb5
Show file tree
Hide file tree
Showing 41 changed files with 708 additions and 323 deletions.
24 changes: 15 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ indent_style = space
indent_size = 4

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj,nuproj}]
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj,props,targets}]
indent_size = 2

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

# YAML files
[*.{yaml,yml}]
indent_size = 2
indent_style = space

# JSON files
[*.json]
Expand Down Expand Up @@ -51,25 +50,32 @@ dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion

# CSharp code style settings:

# IDE0040: Add accessibility modifiers
dotnet_style_require_accessibility_modifiers = omit_if_default:error

# IDE0040: Add accessibility modifiers
dotnet_diagnostic.IDE0040.severity = error

[*.cs]
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
# Prefer method-like constructs to have an expression-body
csharp_style_expression_bodied_methods = true:none
csharp_style_expression_bodied_constructors = true:none
csharp_style_expression_bodied_operators = true:none

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:error
csharp_style_pattern_matching_over_as_with_null_check = true:error
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
Expand Down
81 changes: 21 additions & 60 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,63 +1,24 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
# sln, csproj files (and friends) are always CRLF, even on linux
*.sln text eol=crlf
*.proj text eol=crlf
*.csproj text eol=crlf

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
# These are windows specific files which we may as well ensure are
# always crlf on checkout
*.bat text eol=crlf
*.cmd text eol=crlf

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
# Opt in known filetypes to always normalize line endings on checkin
# and always use native endings on checkout
*.c text
*.config text
*.h text
*.cs text
*.md text
*.tt text
*.txt text

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
# Some must always be checked out as lf so enforce that for those files
# If these are not lf then bash/cygwin on windows will not be able to
# excute the files
*.sh text eol=lf
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
custom: https://paypal.me/kzu
patreon: danielkzu
open_collective: kzu
liberapay: kzu
50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: Bug Report
about: Create a report to help us fix a problem.
title: ''
labels: 'bug'
assignees: ''
---

## Describe the Bug

<!-- A clear and concise description of what the bug is. -->

## Steps to Reproduce

<!-- Tell us how to reproduce the issue. Ideally provide a failing unit test. -->

```c#
public class ReproTest
{
[Fact]
public void Repro()
{
// arrange
// act
// assert
}
}
```

## Expected Behavior

<!-- Describe what you expected to happen. -->

## Exception with Stack Trace

<!-- If you see an exception, put the WHOLE THING here. -->

```text
Put the exception with stack trace here.
```

## Version Info

<!-- Main project version and other relevant dependencies you are using. -->

## Additional Info

<!-- Add any other context about the problem here. -->
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Feature Request
about: Suggest an idea to make the project better.
title: ''
labels: 'enhancement'
assignees: ''
---

## Problem Statement

<!--
A clear and concise description of what the problem is that this feature would
solve, e.g.: It's really difficult to [...]
-->

## Desired Solution

<!--
A clear and concise description of what you want to happen. If this is an API
change or improvement, include some pseudocode to illustrate how you think it
should work.
-->

## Alternatives You've Considered

<!--
A clear and concise description of any alternative solutions or features
you've considered.
-->

## Additional Context

<!-- Add any other context or information about the feature request here. -->
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: nuget
directory: /
schedule:
interval: weekly
63 changes: 41 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: build
on: push
# Builds and runs tests in all three supported OSes
# Pushes CI feed if secrets.SLEET_CONNECTION is provided

name: build
on:
push:
branches: [ main, dev, 'feature/*', 'rel/*' ]
pull_request:
types: [opened, synchronize, reopened]

env:
DOTNET_NOLOGO: true
Expand All @@ -11,39 +18,51 @@ jobs:
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
- name: 🖉 version
run: echo "VERSION_SUFFIX=$(git name-rev --name-only --refs=refs/heads/* HEAD).$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
shell: bash
- name: ⚙ dotnet 5.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: ⚙ dotnet 3.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: ⚙ dotnet 2.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
- name: ⚙ dotnet 3.1.x
uses: actions/setup-dotnet@v1

- name: ✓ check formatting
run: |
dotnet tool update -g --version 4.1.* dotnet-format
dotnet format -f src --check -v:diag
- name: 🔍 msbuild
uses: microsoft/setup-msbuild@v1
with:
dotnet-version: 3.1.x
- name: 🔽 dotnet-vs
run: dotnet tool update -g dotnet-vs
- name: 🔍 vs 16.8+
run: echo "MSB=$(vs where --prop=InstallationPath --first -version 16.8)" >> $GITHUB_ENV
shell: bash
- name: 🔽 vs community
run: vs install community --quiet +Microsoft.VisualStudio.Component.ManagedDesktop.Core +Microsoft.NetCore.Component.DevelopmentTools
if: env.MSB == ''
- name: ≥ msbuild
run: echo "$(vs where --prop=InstallationPath --first -version 16.8)\MSBuild\Current\Bin" >> $GITHUB_PATH
shell: bash
vs-version: '[16.8,)'

- name: 🙏 build
run: msbuild -r -p:versionsuffix=$($env:VERSION_SUFFIX)
run: msbuild -r -m:1 -bl:build.binlog -p:VersionLabel="$($env:GITHUB_REF).$($env:GITHUB_RUN_NUMBER)"

- name: 🧪 test
run: msbuild -t:test

- name: 📦 pack
run: msbuild -t:pack -p:nobuild=true -p:versionsuffix=$($env:VERSION_SUFFIX)
run: msbuild -t:pack -p:nobuild=true -m:1 -bl:pack.binlog -p:VersionLabel="$($env:GITHUB_REF).$($env:GITHUB_RUN_NUMBER)"

- name: 🔼 logs
if: always()
uses: actions/upload-artifact@v2
with:
path: |
*.binlog
logs/**/*.*
# Only push CI package to sleet feed if building on ubuntu (fastest)
- name: 🚀 sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
if: env.SLEET_CONNECTION != ''
run: |
dotnet tool install -g --version 3.2.0 sleet
sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure"
sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure"
Loading

0 comments on commit 9dc2cb5

Please sign in to comment.