Skip to content

Commit 363e422

Browse files
committed
Initial commit
1 parent a07d59f commit 363e422

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+6008
-0
lines changed

.editorconfig

Lines changed: 1572 additions & 0 deletions
Large diffs are not rendered by default.

.gitattributes

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
### Header #########################################################################################
2+
3+
# Author: Florian Bernd
4+
# Source: https://github.com/zysharp/templates
5+
6+
### Git Line Endings ###############################################################################
7+
8+
# Set default behavior to automatically normalize line endings
9+
* text=auto
10+
11+
# Documents
12+
*.md text diff=markdown
13+
*.mdx text diff=markdown
14+
15+
# Serialization
16+
*.json text
17+
*.toml text
18+
*.xml text
19+
*.yaml text
20+
*.yml text
21+
22+
# Graphics
23+
*.eps binary
24+
*.gif binary
25+
*.ico binary
26+
*.jpg binary
27+
*.jpeg binary
28+
*.png binary
29+
*.tif binary
30+
*.tiff binary
31+
32+
# Force batch scripts to always use CRLF line endings
33+
*.bat text eol=crlf
34+
*.cmd text eol=crlf
35+
*.ps1 text eol=crlf
36+
37+
# Force bash scripts to always use LF line endings
38+
*.bash text eol=lf
39+
*.fish text eol=lf
40+
*.sh text eol=lf
41+
*.zsh text eol=lf
42+
43+
# Text files where line endings should be preserved
44+
*.patch -text
45+
46+
### .NET ###########################################################################################
47+
48+
*.sln text
49+
50+
### C# #############################################################################################
51+
52+
*.cs text diff=csharp
53+
*.csx text diff=csharp
54+
*.cshtml text diff=html
55+
*.csproj text
56+
57+
### F# #############################################################################################
58+
59+
*.fs text diff=fsharp
60+
*.fsx text diff=fsharp
61+
*.fsproj text
62+
63+
### Exclude files from exporting ###################################################################
64+
65+
.gitattributes export-ignore
66+
.gitignore export-ignore
67+
.gitkeep export-ignore
68+
69+
### License ########################################################################################
70+
71+
# The MIT License (MIT)
72+
#
73+
# Copyright (c) 2023 Florian Bernd
74+
#
75+
# Permission is hereby granted, free of charge, to any person obtaining a copy
76+
# of this software and associated documentation files (the "Software"), to deal
77+
# in the Software without restriction, including without limitation the rights
78+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
79+
# copies of the Software, and to permit persons to whom the Software is
80+
# furnished to do so, subject to the following conditions:
81+
#
82+
# The above copyright notice and this permission notice shall be included in all
83+
# copies or substantial portions of the Software.
84+
#
85+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
86+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
87+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
88+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
89+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
90+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
91+
# SOFTWARE.
92+
93+
####################################################################################################

.github/workflows/ci.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
main:
16+
name: CI
17+
uses: ./.github/workflows/ci_template.yaml

.github/workflows/ci_template.yaml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: CI
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
path:
7+
description: The path to look for a Visual Studio Solution file (without a trailing slash).
8+
type: string
9+
required: false
10+
default: ''
11+
12+
env:
13+
BUILD_CONFIG: Debug
14+
DOTNET_GLOBAL_JSON: ${{ inputs.path != '' && format('{0}/global.json', inputs.path) || 'global.json' }}
15+
RESTORE_PATTERN: ${{ inputs.path != '' && format('{0}/**/packages.lock.json', inputs.path) || '**/packages.lock.json' }}
16+
TESTS_PATTERN: ${{ inputs.path != '' && format('{0}/**/*.Test*.csproj', inputs.path) || '**/*.Test*.csproj' }}
17+
18+
jobs:
19+
lint:
20+
name: Lint
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
# Retrieve the preceding commit to enable 'changed-files' to create a diff.
27+
fetch-depth: 2
28+
29+
- name: .NET Setup
30+
uses: zyactions/dotnet-setup@v1
31+
with:
32+
global-json-file: ${{ env.DOTNET_GLOBAL_JSON }}
33+
problem-matcher: false
34+
35+
- name: Install latest .NET Format tool
36+
shell: bash
37+
run: |
38+
dotnet tool install -g dotnet-format --version "8.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
39+
40+
- name: Get Changed Files
41+
id: changed-files
42+
uses: tj-actions/changed-files@729c70475c2976c3d4ca8897d34d9df975a4d05c
43+
with:
44+
files: ${{ inputs.path != '' && format('{0}/**', inputs.path) || '' }}
45+
46+
- name: .NET Cache Packages
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.nuget/packages
50+
key: ${{ runner.os }}-nuget-${{ hashFiles(env.RESTORE_PATTERN) }}
51+
restore-keys: ${{ runner.os }}-nuget-
52+
53+
- name: .NET Restore
54+
uses: zyactions/dotnet-restore@v1
55+
with:
56+
working-directory: ${{ inputs.path }}
57+
58+
# TODO: Add additional generic '.editorconfig' linting, e.g. for `*.csproj` files
59+
# TODO: Always lint all files, if '.editorconfig' has changed
60+
61+
- name: .NET Lint
62+
uses: zyactions/dotnet-lint@v1
63+
with:
64+
working-directory: ${{ inputs.path }}
65+
# This list is empty for the initial commit. NET Lint will lint all files in this case.
66+
include: ${{ steps.changed-files.outputs.all_changed_files }}
67+
use-standalone-tool: true
68+
69+
test:
70+
name: Run Tests
71+
runs-on: ubuntu-latest
72+
env:
73+
FILTERED_SOLUTION: ${{ inputs.path != '' && format('{0}/Tests.slnf', inputs.path) || 'Tests.slnf' }}
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
78+
- name: Find Solution
79+
id: find
80+
uses: flobernd/actions/dotnet/find-solution@master
81+
with:
82+
directory: ${{ inputs.path }}
83+
84+
- name: Filter Solution
85+
uses: flobernd/actions/dotnet/filter-solution@master
86+
with:
87+
solution: ${{ steps.find.outputs.solution }}
88+
# This pattern is relative to the solution file and does not need to be prefixed with
89+
# the 'directory' input value
90+
pattern: '**/*.Test*.csproj'
91+
output: ${{ env.FILTERED_SOLUTION }}
92+
93+
- name: .NET Setup
94+
uses: zyactions/dotnet-setup@v1
95+
with:
96+
global-json-file: ${{ env.DOTNET_GLOBAL_JSON }}
97+
problem-matcher: false
98+
99+
- name: .NET Cache Packages
100+
uses: actions/cache@v4
101+
with:
102+
path: ~/.nuget/packages
103+
key: ${{ runner.os }}-nuget-${{ hashFiles(env.RESTORE_PATTERN) }}
104+
restore-keys: ${{ runner.os }}-nuget-
105+
106+
- name: .NET Restore
107+
uses: zyactions/dotnet-restore@v1
108+
with:
109+
workspace: ${{ env.FILTERED_SOLUTION }}
110+
111+
- name: .NET Build
112+
uses: flobernd/actions/dotnet/build@master
113+
with:
114+
workspace: ${{ env.FILTERED_SOLUTION }}
115+
configuration: ${{ env.BUILD_CONFIG }}
116+
117+
# - name: .NET Test
118+
# uses: flobernd/actions/dotnet/test@master
119+
# with:
120+
# projects: ${{ env.TESTS_PATTERN }}
121+
# fail-on-error: false
122+
# log-results: true
123+
# collect-coverage: false
124+
# maxdop: 4
125+
126+
# - name: Generate Test Report
127+
# uses: zyactions/test-reporter@main
128+
# with:
129+
# name: Test Results
130+
# path: ${{ inputs.path != '' && format('{0}/**/TestResults/*.trx', inputs.path) || '**/TestResults/*.trx' }}
131+
# reporter: dotnet-trx
132+
# fail-on-error: true
133+
# only-summary: false
134+
# max-annotations: 30

0 commit comments

Comments
 (0)