Skip to content

Commit

Permalink
πŸ–† Apply devlooped/oss template, nugetize and modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Aug 24, 2021
1 parent 1283ea0 commit 549629f
Show file tree
Hide file tree
Showing 45 changed files with 1,509 additions and 290 deletions.
92 changes: 80 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,21 +1,89 @@
; EditorConfig to support per-solution formatting.
; Use the EditorConfig VS add-in to make this work.
; http://editorconfig.org/
# EditorConfig is awesome:http://EditorConfig.org

; This is the default for the codeline.
# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
end_of_line = CRLF
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)

[*.{cs,fs}]
indent_style = tab
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4

[*.{sln,proj,props,targets,xaml,config,nuspec,vsixmanifest,vsct,vstemplate}]
indent_style = tab
indent_size = 4
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj,props,targets}]
indent_size = 2

[*.{csproj,ps1,resx,rst,fsproj,txt}]
indent_style = space
# Xml config files
[*.{ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

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

# JSON files
[*.json]
indent_size = 2

# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
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 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: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

# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
24 changes: 24 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# sln, csproj files (and friends) are always CRLF, even on linux
*.sln text eol=crlf
*.proj text eol=crlf
*.csproj text eol=crlf

# These are windows specific files which we may as well ensure are
# always crlf on checkout
*.bat text eol=crlf
*.cmd text eol=crlf

# 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

# 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
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: devlooped
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. -->
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
70 changes: 70 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Builds and runs tests in all three supported OSes
# Pushes CI feed if secrets.SLEET_CONNECTION is provided

name: build
on:
workflow_dispatch:
push:
branches: [ main, dev, 'feature/*', 'rel/*' ]
paths-ignore:
- changelog.md
- code-of-conduct.md
- security.md
- support.md
pull_request:
types: [opened, synchronize, reopened]

env:
DOTNET_NOLOGO: true

defaults:
run:
shell: bash

jobs:
dotnet-format:
runs-on: ubuntu-latest
steps:
- name: 🀘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0

- name: βœ“ ensure format
run: |
dotnet tool update -g dotnet-format --version 5.0.*
dotnet restore
dotnet format --check -v:diag
build:
name: build-${{ matrix.os }}
needs: dotnet-format
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: 🀘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0

- name: πŸ™ build
run: dotnet build -m:1 -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"

- name: πŸ§ͺ test
run: dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m

- name: πŸ“¦ pack
run: dotnet pack -m:1 -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"

# Only push CI package to sleet feed if building on ubuntu (fastest)
- name: πŸš€ sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
if: matrix.os == 'ubuntu-latest' && env.SLEET_CONNECTION != ''
run: |
dotnet tool install -g --version 4.0.18 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" || echo "No packages found"
37 changes: 37 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: changelog
on:
release:
types: [released]
workflow_dispatch:

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: πŸ” GH_TOKEN
if: env.GH_TOKEN == ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV

- name: 🀘 checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: main
token: ${{ env.GH_TOKEN }}

- name: βš™ changelog
uses: faberNovel/github-changelog-generator-action@master
with:
options: --token ${{ secrets.GITHUB_TOKEN }} --o changelog.md

- name: πŸš€ changelog
run: |
git config --local user.name github-actions
git config --local user.email github-actions@github.com
git add changelog.md
(git commit -m "πŸ–‰ Update changelog with ${GITHUB_REF#refs/*/}" && git push) || echo "Done"
61 changes: 61 additions & 0 deletions .github/workflows/dotnet-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Synchronizes .netconfig-configured files with dotnet-file
name: dotnet-file
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches: [ 'dotnet-file' ]

env:
DOTNET_NOLOGO: true
GH_TOKEN: ${{ secrets.GH_TOKEN }}

jobs:
sync:
runs-on: windows-latest
steps:
- name: πŸ” GH_TOKEN
if: env.GH_TOKEN == ''
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV

- name: 🀘 checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: main
token: ${{ env.GH_TOKEN }}

- name: πŸ”„ sync
run: |
dotnet tool update -g dotnet-gcm
dotnet gcm store --protocol=https --host=github.com --username=$env:GITHUB_ACTOR --password=$env:GH_TOKEN
gh auth status
dotnet tool update -g dotnet-file
dotnet file sync -c:$env:TEMP\dotnet-file.md
if (test-path $env:TEMP\dotnet-file.md) {
echo 'CHANGES<<EOF' >> $env:GITHUB_ENV
cat $env:TEMP\dotnet-file.md >> $env:GITHUB_ENV
echo 'EOF' >> $env:GITHUB_ENV
cat $env:TEMP\dotnet-file.md
} else {
echo 'No changelog was generated'
}
- name: ✍ pull request
uses: peter-evans/create-pull-request@v3
with:
base: main
branch: dotnet-file-sync
delete-branch: true
labels: dependencies
commit-message: Bump files with dotnet-file sync

${{ env.CHANGES }}
title: "Bump files with dotnet-file sync"
body: ${{ env.CHANGES }}
token: ${{ env.GH_TOKEN }}
Loading

0 comments on commit 549629f

Please sign in to comment.