Skip to content

Commit 2be16ce

Browse files
committed
Initial commit: BeyondNetCode.Shell.Aop library
Extracted from beyondnetcode/ums - Namespace renamed: Ums.Shell.Aop -> BeyondNetCode.Shell.Aop - Package IDs updated for NuGet: BeyondNetCode.* - GitFlow workflow, CONTRIBUTING.md, VERSIONING.md added - All tests passing Original code authorship: raulnq (https://github.com/raulnq)
0 parents  commit 2be16ce

73 files changed

Lines changed: 3919 additions & 0 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.github/workflows/build.yml

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
name: CI / CD
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
tags:
9+
- 'v*'
10+
11+
env:
12+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
13+
DOTNET_NOLOGO: true
14+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
15+
16+
jobs:
17+
build-and-test:
18+
name: Build & Test (${{ matrix.os }})
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest, windows-latest]
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v5
32+
with:
33+
dotnet-version: 10.0.x
34+
35+
- name: Cache NuGet packages
36+
uses: actions/cache@v4
37+
with:
38+
path: ${{ env.NUGET_PACKAGES }}
39+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
40+
restore-keys: ${{ runner.os }}-nuget-
41+
42+
- name: Restore
43+
run: dotnet restore BeyondNet.Aop.sln
44+
45+
- name: Build
46+
run: dotnet build BeyondNet.Aop.sln --configuration Release --no-restore
47+
48+
- name: Test
49+
run: dotnet test BeyondNet.Aop.sln --configuration Release --no-build --logger "trx;LogFileName=results.trx"
50+
51+
- name: Upload test results
52+
uses: actions/upload-artifact@v4
53+
if: always()
54+
with:
55+
name: test-results-${{ matrix.os }}
56+
path: "**/*.trx"
57+
58+
version:
59+
name: Determine Version
60+
runs-on: ubuntu-latest
61+
needs: build-and-test
62+
if: github.event_name == 'push' || github.event_name == 'tag'
63+
outputs:
64+
version: ${{ steps.version.outputs.version }}
65+
is_release: ${{ steps.version.outputs.is_release }}
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v4
69+
70+
- name: Get version from tag
71+
id: version
72+
run: |
73+
TAG="${GITHUB_REF#refs/tags/}"
74+
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
75+
VERSION="${TAG#v}"
76+
echo "version=$VERSION" >> $GITHUB_OUTPUT
77+
echo "is_release=true" >> $GITHUB_OUTPUT
78+
else
79+
HASH="${GITHUB_SHA:0:7}"
80+
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
81+
echo "version=0.0.0-$BRANCH_NAME+$HASH" >> $GITHUB_OUTPUT
82+
echo "is_release=false" >> $GITHUB_OUTPUT
83+
fi
84+
85+
pack:
86+
name: Pack NuGet Packages
87+
runs-on: ubuntu-latest
88+
needs: [build-and-test, version]
89+
if: needs.version.outputs.is_release == 'true'
90+
strategy:
91+
matrix:
92+
project:
93+
- src/BeyondNetCode.Shell.Aop/BeyondNetCode.Shell.Aop.csproj
94+
- src/BeyondNetCode.Shell.Aop.Aspects/BeyondNetCode.Shell.Aop.Aspects.csproj
95+
- src/BeyondNetCode.Shell.Aop.Aspects.Logger/BeyondNetCode.Shell.Aop.Aspects.Logger.csproj
96+
- src/BeyondNetCode.Shell.Aop.Aspects.Logger.Serilog/BeyondNetCode.Shell.Aop.Aspects.Logger.Serilog.csproj
97+
- src/BeyondNetCode.Shell.Aop.DispatchProxy/BeyondNetCode.Shell.Aop.DispatchProxy.csproj
98+
- src/BeyondNetCode.Shell.Aop.DI/BeyondNetCode.Shell.Aop.DI.csproj
99+
steps:
100+
- uses: actions/checkout@v4
101+
102+
- name: Setup .NET
103+
uses: actions/setup-dotnet@v5
104+
with:
105+
dotnet-version: 10.0.x
106+
107+
- name: Pack
108+
run: |
109+
dotnet pack "${{ matrix.project }}" \
110+
-c Release \
111+
--version:${{ needs.version.outputs.version }} \
112+
--no-build \
113+
-p:PackageOutputPath=${{ github.workspace }}/nupkgs
114+
115+
- name: Upload artifacts
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: packages-${{ matrix.project }}
119+
path: nupkgs/*.nupkg
120+
121+
publish:
122+
name: Publish to NuGet
123+
runs-on: ubuntu-latest
124+
needs: pack
125+
if: needs.pack.result == 'success' && needs.version.outputs.is_release == 'true'
126+
environment: nuget-release
127+
128+
steps:
129+
- name: Download packages
130+
uses: actions/download-artifact@v4
131+
with:
132+
pattern: packages-*
133+
path: ./nupkgs
134+
merge-multiple: true
135+
136+
- name: Setup .NET
137+
uses: actions/setup-dotnet@v5
138+
with:
139+
dotnet-version: 10.0.x
140+
141+
- name: Push to NuGet.org
142+
run: |
143+
for nupkg in $(find ./nupkgs -name '*.nupkg'); do
144+
dotnet nuget push "$nupkg" \
145+
--api-key ${{ secrets.NUGET_API_KEY }} \
146+
--source https://api.nuget.org/v3/index.json \
147+
--skip-duplicate
148+
done
149+
env:
150+
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
151+
152+
release:
153+
name: Create GitHub Release
154+
runs-on: ubuntu-latest
155+
needs: [version]
156+
if: needs.version.outputs.is_release == 'true'
157+
steps:
158+
- uses: actions/checkout@v4
159+
160+
- name: Generate Release Notes
161+
id: release-notes
162+
uses: actions/github-script@v7
163+
with:
164+
script: |
165+
const { data: commits } = await github.rest.repos.listCommits({
166+
owner: context.repo.owner,
167+
repo: context.repo.repo,
168+
per_page: 100,
169+
since: '2024-01-01'
170+
});
171+
let body = '## What\'s New\n\n';
172+
body += `**Version:** ${context.payload.ref.replace('refs/tags/', '')}\n\n`;
173+
body += '### Commits\n';
174+
commits.slice(0, 20).forEach(c => {
175+
body += `- ${c.commit.message.split('\n')[0]} (${c.sha.slice(0, 7)})\n`;
176+
});
177+
return body;
178+
179+
- name: Create Release
180+
uses: softprops/action-gh-release@v2
181+
with:
182+
tag_name: ${{ github.ref_name }}
183+
name: Release ${{ github.ref_name }}
184+
body: ${{ steps.release-notes.outputs.result }}
185+
draft: false
186+
prerelease: ${{ contains(needs.version.outputs.version, 'beta') || contains(needs.version.outputs.version, 'alpha') }}
187+
env:
188+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)