Skip to content

Commit 156ddad

Browse files
authored
Merge branch 'main' into Issue-257_InvalidOperationException-in-FluentScanner
2 parents f0b073f + 04ca53c commit 156ddad

File tree

99 files changed

+763
-920
lines changed

Some content is hidden

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

99 files changed

+763
-920
lines changed

.github/workflows/build.yml

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
name: Build and Test
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
runPublish:
8+
description: 'Publish Nuget ?'
9+
required: true
10+
default: 'false'
11+
type: boolean
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
semver: ${{ steps.gitversion.outputs.semVer }}
18+
fullsemver: ${{ steps.gitversion.outputs.fullSemVer }}
19+
nugetversion: ${{ steps.gitversion.outputs.fullSemVer }}
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v5
24+
with:
25+
fetch-depth: 0 # Required for GitVersion
26+
27+
- name: Install GitVersion
28+
uses: gittools/actions/gitversion/[email protected]
29+
with:
30+
versionSpec: '6.x'
31+
32+
- name: Determine Version
33+
uses: gittools/actions/gitversion/[email protected]
34+
id: gitversion
35+
36+
- name: Format NuGet version
37+
run: |
38+
packageVersion="${{ steps.gitversion.outputs.majorMinorPatch }}.${{steps.gitversion.outputs.preReleaseNumber}}"
39+
echo "packageVersion=$packageVersion" >> $GITHUB_OUTPUT
40+
id: formatversion
41+
42+
- name: Display GitVersion outputs
43+
run: |
44+
echo "Version: ${{ steps.gitversion.outputs.semVer }}"
45+
echo "AssemblyVersion: ${{ steps.gitversion.outputs.assemblySemVer }}"
46+
echo "FileVersion: ${{ steps.gitversion.outputs.assemblySemFileVer }}"
47+
echo "NuGet Version: ${{ steps.gitversion.outputs.fullSemVer }}"
48+
echo "Package Version: ${{ steps.formatversion.outputs.packageVersion }}"
49+
50+
- name: Setup .NET
51+
uses: actions/setup-dotnet@v5
52+
with:
53+
dotnet-version: '8.0.x'
54+
55+
- name: Build project
56+
working-directory: src
57+
run: >-
58+
dotnet build --configuration Release
59+
/p:Version=${{ steps.gitversion.outputs.assemblySemVer }}
60+
/p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemVer }}
61+
/p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }}
62+
/p:PackageVersion=${{ steps.formatversion.outputs.packageVersion }}
63+
64+
- name: Run tests with coverage
65+
working-directory: src
66+
run: >-
67+
dotnet test
68+
--configuration Release
69+
--collect:"XPlat Code Coverage"
70+
--results-directory ../coverage
71+
72+
- name: Generate coverage report
73+
uses: danielpalme/[email protected]
74+
with:
75+
reports: 'coverage/**/coverage.cobertura.xml'
76+
targetdir: 'coverage-report'
77+
reporttypes: 'Html;Cobertura;TextSummary'
78+
79+
- name: Display Code Coverage Summary
80+
run: |
81+
echo "## 📊 Code Coverage Summary" >> $GITHUB_STEP_SUMMARY
82+
if [ -f "coverage-report/Summary.txt" ]; then
83+
echo '```' >> $GITHUB_STEP_SUMMARY
84+
cat coverage-report/Summary.txt >> $GITHUB_STEP_SUMMARY
85+
echo '```' >> $GITHUB_STEP_SUMMARY
86+
echo "### Build Log Coverage Summary:"
87+
cat coverage-report/Summary.txt
88+
else
89+
echo "⚠️ Coverage summary file not found"
90+
echo "⚠️ Coverage summary file not found" >> $GITHUB_STEP_SUMMARY
91+
fi
92+
93+
- name: Generate Rich Release Notes
94+
id: release_notes
95+
uses: mikepenz/[email protected]
96+
with:
97+
configuration: |
98+
{
99+
"template": "## 🚀 Release ${{ steps.gitversion.outputs.semVer }}\n\n### 📅 Release Information\n- **Version**: ${{ steps.gitversion.outputs.semVer }}\n- **NuGet Version**: ${{ steps.gitversion.outputs.fullSemVer }}\n- **Build Date**: $(date -u +'%Y-%m-%d %H:%M:%S UTC')\n- **Commit**: ${{ github.sha }}\n\n#{{CHANGELOG}}\n\n### 📊 Statistics\n- **Total Changes**: #{{UNCATEGORIZED_COUNT}} commits\n- **Contributors**: #{{CONTRIBUTORS}}\n\n---\n*Generated automatically by GitHub Actions*",
100+
"categories": [
101+
{
102+
"title": "## 🚀 Features",
103+
"labels": ["feature", "enhancement", "feat"]
104+
},
105+
{
106+
"title": "## 🐛 Bug Fixes",
107+
"labels": ["bug", "fix", "bugfix"]
108+
},
109+
{
110+
"title": "## 📚 Documentation",
111+
"labels": ["documentation", "docs"]
112+
},
113+
{
114+
"title": "## 🔧 Maintenance",
115+
"labels": ["maintenance", "chore", "refactor"]
116+
},
117+
{
118+
"title": "## ⚠️ Breaking Changes",
119+
"labels": ["breaking", "breaking-change"]
120+
}
121+
],
122+
"pr_template": "- #{{TITLE}} (#{{NUMBER}}) by @#{{AUTHOR}}",
123+
"empty_template": "- #{{TITLE}} (#{{HASH}}) by @#{{AUTHOR}}",
124+
"max_pull_requests": 200,
125+
"max_back_track_time_days": 365
126+
}
127+
env:
128+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129+
130+
- name: Save Release Notes to File
131+
run: echo "${{ steps.release_notes.outputs.changelog }}" > release-notes.md
132+
133+
- name: Upload Release Notes as artifact
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: release-notes
137+
path: release-notes.md
138+
139+
- name: Create NuGet package
140+
working-directory: src
141+
run: >-
142+
dotnet pack
143+
--configuration Release
144+
--no-build
145+
/p:PackageVersion=${{ steps.formatversion.outputs.packageVersion }}
146+
--output ../packages
147+
148+
- name: Upload NuGet package as artifact
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: nuget-package
152+
path: packages/*.nupkg
153+
154+
- name: Publish coverage report as artifact
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: coverage-report
158+
path: coverage-report/
159+
160+
publish-nuget:
161+
runs-on: ubuntu-latest
162+
needs: build
163+
if: github.event.inputs.runPublish == 'true' && github.ref_name == github.event.repository.default_branch
164+
environment:
165+
name: Publish
166+
url: https://www.nuget.org/packages/TestStack.BDDfy/
167+
168+
steps:
169+
- name: Download NuGet package
170+
uses: actions/download-artifact@v5
171+
with:
172+
name: nuget-package
173+
path: packages
174+
175+
- name: Setup .NET
176+
uses: actions/setup-dotnet@v5
177+
with:
178+
dotnet-version: '8.0.x'
179+
180+
- name: Publish to NuGet
181+
run: dotnet nuget push packages/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
182+
183+
create-release-tag:
184+
runs-on: ubuntu-latest
185+
needs: [build, publish-nuget]
186+
if: github.event.inputs.runPublish == 'true' && github.ref_name == github.event.repository.default_branch
187+
permissions:
188+
contents: write
189+
190+
steps:
191+
- name: Checkout code
192+
uses: actions/checkout@v5
193+
with:
194+
fetch-depth: 0
195+
token: ${{ secrets.GITHUB_TOKEN }}
196+
197+
- name: Check if tag already exists
198+
id: check_tag
199+
run: |
200+
TAG="v${{ needs.build.outputs.semver }}"
201+
if git rev-parse "$TAG" >/dev/null 2>&1; then
202+
echo "Tag $TAG already exists"
203+
echo "tag_exists=true" >> $GITHUB_OUTPUT
204+
else
205+
echo "Creating new tag: $TAG"
206+
echo "tag_exists=false" >> $GITHUB_OUTPUT
207+
echo "new_tag=$TAG" >> $GITHUB_OUTPUT
208+
fi
209+
210+
- name: Download Release Notes
211+
if: steps.check_tag.outputs.tag_exists == 'false'
212+
uses: actions/download-artifact@v5
213+
with:
214+
name: release-notes
215+
path: .
216+
217+
- name: Create Git Tag and GitHub Release
218+
if: steps.check_tag.outputs.tag_exists == 'false'
219+
run: |
220+
TAG="${{ steps.check_tag.outputs.new_tag }}"
221+
222+
# Configure git
223+
git config user.name "github-actions[bot]"
224+
git config user.email "github-actions[bot]@users.noreply.github.com"
225+
226+
# Create and push tag
227+
git tag -a "$TAG" -m "Release $TAG"
228+
git push origin "$TAG"
229+
230+
# Create GitHub release
231+
gh release create "$TAG" \
232+
--title "Release $TAG" \
233+
--notes-file release-notes.md \
234+
--generate-notes
235+
env:
236+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ obj/
1111
*.crunchproject.local.xml
1212
*.crunchsolution.local.xml
1313
*.cache
14+
*.userprefs
15+
.DS_Store
1416
packages/*
1517
PackageBuild/*
1618
Build/*
@@ -20,7 +22,11 @@ _NCrunch_TestStack.BDDfy/
2022
TestStack.BDDfy.sln.ide/
2123
src/packages/
2224
src/.vs/
25+
.vs/
2326
project.lock.json
2427
tools/Cake/
2528
tools/GitReleaseNotes/
29+
tools/gitversion.commandline/
2630
artifacts/
31+
*.code-workspace
32+
**/coverage

GitVersion.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
mode: ContinuousDelivery
2+
next-version: 8.0.0
3+
branches:
4+
main:
5+
increment: Patch
6+
regex: ^main$
7+
is-release-branch: true
8+
ignore:
9+
sha: []

GitVersionConfig.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ configuration:
88
- Release
99

1010
build_script:
11-
- ps: .\build.ps1
11+
- powershell .\build.ps1
1212

1313
test: off
1414
skip_tags: true

build.cake

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#tool "nuget:?package=GitReleaseNotes"
2+
#tool "nuget:?package=GitVersion.CommandLine"
23

34
var target = Argument("target", "Default");
4-
var bddfyProj = "./src/TestStack.BDDfy/project.json";
5+
var bddfyProj = "./src/TestStack.BDDfy/TestStack.BDDfy.csproj";
56
var outputDir = "./artifacts/";
67

78
Task("Clean")
@@ -24,12 +25,7 @@ Task("Version")
2425
UpdateAssemblyInfo = true,
2526
OutputType = GitVersionOutput.BuildServer
2627
});
27-
versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json });
28-
// Update project.json
29-
var updatedProjectJson = System.IO.File.ReadAllText(bddfyProj)
30-
.Replace("1.0.0-*", versionInfo.NuGetVersion);
31-
32-
System.IO.File.WriteAllText(bddfyProj, updatedProjectJson);
28+
versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json });
3329
});
3430

3531
Task("Build")
@@ -52,6 +48,7 @@ Task("Package")
5248
.Does(() => {
5349
var settings = new DotNetCorePackSettings
5450
{
51+
ArgumentCustomization = args=> args.Append(" --include-symbols /p:PackageVersion=" + versionInfo.NuGetVersion),
5552
OutputDirectory = outputDir,
5653
NoBuild = true
5754
};
@@ -61,6 +58,7 @@ Task("Package")
6158
var releaseNotesExitCode = StartProcess(
6259
@"tools\GitReleaseNotes\tools\gitreleasenotes.exe",
6360
new ProcessSettings { Arguments = ". /o artifacts/releasenotes.md" });
61+
6462
if (string.IsNullOrEmpty(System.IO.File.ReadAllText("./artifacts/releasenotes.md")))
6563
System.IO.File.WriteAllText("./artifacts/releasenotes.md", "No issues closed since last release");
6664

src/.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.cs]
2+
3+
# Default severity for analyzer diagnostics with category 'Style'
4+
dotnet_analyzer_diagnostic.category-Style.severity = none

src/Directory.build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<TargetFrameworks>net8.0</TargetFrameworks>
4+
</PropertyGroup>
5+
</Project>

src/NuGet.config

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)