Skip to content

Commit 48dec64

Browse files
committed
feat: initial commit
0 parents  commit 48dec64

File tree

127 files changed

+17021
-0
lines changed

Some content is hidden

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

127 files changed

+17021
-0
lines changed

.github/workflows/ci.yml

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
DOTNET_NOLOGO: true
11+
INCLUDE_SYMBOLS: true
12+
13+
jobs:
14+
pr-checks:
15+
if: github.event_name == 'pull_request'
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
pull-requests: write
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v4
26+
with:
27+
dotnet-version: 10.0.x
28+
29+
- name: Restore
30+
run: |
31+
dotnet tool restore
32+
dotnet restore --use-lock-file
33+
34+
- name: Build (Release)
35+
run: dotnet build ExperimentFramework.slnx --configuration Release --no-restore /p:ContinuousIntegrationBuild=true
36+
37+
- name: Test with coverage
38+
run: |
39+
dotnet test ExperimentFramework.slnx \
40+
--configuration Release \
41+
--collect:"XPlat Code Coverage" \
42+
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura \
43+
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Include="[ExperimentFramework*]*" \
44+
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Exclude="[*Tests]*"
45+
46+
- name: Install ReportGenerator
47+
run: dotnet tool update -g dotnet-reportgenerator-globaltool
48+
49+
- name: Combine coverage and create reports
50+
shell: bash
51+
run: |
52+
REPORTS=$(find . -type f -path "*/TestResults/*/coverage.cobertura.xml" | tr '\n' ';')
53+
reportgenerator \
54+
-reports:"$REPORTS" \
55+
-targetdir:"coverage-report" \
56+
-reporttypes:"HtmlInline;Cobertura;TextSummary;lcov;Badges" \
57+
-assemblyfilters:"+ExperimentFramework*;-*Tests*" \
58+
-filefilters:"-**/*.Tests/*;-**/*Tests*/**"
59+
echo "COVERAGE_SUMMARY<<EOF" >> $GITHUB_ENV
60+
cat coverage-report/Summary.txt >> $GITHUB_ENV
61+
echo "EOF" >> $GITHUB_ENV
62+
63+
- name: Upload coverage HTML report
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: coverage-report
67+
path: coverage-report
68+
69+
- name: Add coverage summary to PR
70+
uses: marocchino/sticky-pull-request-comment@v2
71+
with:
72+
recreate: true
73+
message: |
74+
## Code Coverage
75+
```
76+
${{ env.COVERAGE_SUMMARY }}
77+
```
78+
79+
- name: Upload coverage to Codecov
80+
uses: codecov/codecov-action@v4
81+
with:
82+
files: |
83+
**/TestResults/*/coverage.cobertura.xml
84+
flags: unittests
85+
fail_ci_if_error: true
86+
verbose: true
87+
env:
88+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
89+
90+
release:
91+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
92+
runs-on: ubuntu-latest
93+
permissions:
94+
contents: write
95+
packages: write
96+
steps:
97+
- name: Checkout
98+
uses: actions/checkout@v4
99+
with:
100+
fetch-depth: 0
101+
102+
- name: Setup .NET
103+
uses: actions/setup-dotnet@v4
104+
with:
105+
dotnet-version: 10.0.x
106+
107+
- name: Restore
108+
run: |
109+
dotnet restore --use-lock-file
110+
dotnet tool restore
111+
112+
- name: Fetch tags
113+
run: git fetch --prune --tags
114+
115+
- name: Install GitVersion
116+
uses: gittools/actions/gitversion/setup@v1
117+
with:
118+
versionSpec: '5.x'
119+
120+
- name: Run GitVersion
121+
id: gitversion
122+
uses: gittools/actions/gitversion/execute@v1
123+
124+
- name: Set version env vars
125+
run: |
126+
echo "PACKAGE_VERSION=${{ steps.gitversion.outputs.nuGetVersionV2 }}" >> $GITHUB_ENV
127+
echo "ASSEMBLY_VERSION=${{ steps.gitversion.outputs.assemblySemVer }}" >> $GITHUB_ENV
128+
echo "FILE_VERSION=${{ steps.gitversion.outputs.assemblySemFileVer }}" >> $GITHUB_ENV
129+
130+
- name: Build (Release)
131+
run: >
132+
dotnet build ExperimentFramework.slnx
133+
--configuration Release
134+
--no-restore
135+
/p:ContinuousIntegrationBuild=true
136+
/p:Version=${{ env.PACKAGE_VERSION }}
137+
/p:AssemblyVersion=${{ env.ASSEMBLY_VERSION }}
138+
/p:FileVersion=${{ env.FILE_VERSION }}
139+
/p:PackageVersion=${{ env.PACKAGE_VERSION }}
140+
141+
- name: Test (Release)
142+
run: dotnet test ExperimentFramework.slnx --configuration Release --no-build --verbosity normal
143+
144+
- name: Pack (all packable projects)
145+
run: >
146+
dotnet pack ExperimentFramework.slnx
147+
--configuration Release
148+
--no-build
149+
--output ./artifacts
150+
/p:ContinuousIntegrationBuild=true
151+
/p:IncludeSymbols=${{ env.INCLUDE_SYMBOLS }}
152+
/p:SymbolPackageFormat=snupkg
153+
/p:Version=${{ env.PACKAGE_VERSION }}
154+
/p:AssemblyVersion=${{ env.ASSEMBLY_VERSION }}
155+
/p:FileVersion=${{ env.FILE_VERSION }}
156+
/p:PackageVersion=${{ env.PACKAGE_VERSION }}
157+
158+
- name: Upload packages as artifact
159+
uses: actions/upload-artifact@v4
160+
with:
161+
name: nuget-packages
162+
path: |
163+
./artifacts/*.nupkg
164+
./artifacts/*.snupkg
165+
166+
- name: Create and push git tag
167+
shell: bash
168+
run: |
169+
set -euo pipefail
170+
git config user.name "github-actions"
171+
git config user.email "[email protected]"
172+
if git rev-parse "v${PACKAGE_VERSION}" >/dev/null 2>&1; then
173+
echo "Tag v${PACKAGE_VERSION} already exists. Skipping tag push."
174+
else
175+
git tag "v${PACKAGE_VERSION}"
176+
git push origin "v${PACKAGE_VERSION}"
177+
fi
178+
179+
- name: Create GitHub Release
180+
uses: softprops/action-gh-release@v2
181+
with:
182+
tag_name: v${{ env.PACKAGE_VERSION }}
183+
name: Release v${{ env.PACKAGE_VERSION }}
184+
files: |
185+
./artifacts/*.nupkg
186+
./artifacts/*.snupkg
187+
generate_release_notes: true
188+
189+
- name: Push to NuGet.org
190+
env:
191+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
192+
run: |
193+
if [ -n "$NUGET_API_KEY" ]; then
194+
dotnet nuget push ./artifacts/*.nupkg \
195+
--api-key "$NUGET_API_KEY" \
196+
--source https://api.nuget.org/v3/index.json \
197+
--skip-duplicate
198+
else
199+
echo "Skipping NuGet.org push: API key not set."
200+
fi
201+
202+
- name: Push to GitHub Packages (optional)
203+
run: |
204+
dotnet nuget push "./artifacts/*.nupkg" \
205+
--source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
206+
--api-key "${{ secrets.GITHUB_TOKEN }}" \
207+
--skip-duplicate
208+
dotnet nuget push "./artifacts/*.snupkg" \
209+
--source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
210+
--api-key "${{ secrets.GITHUB_TOKEN }}" \
211+
--skip-duplicate
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '0 12 * * 0'
10+
11+
jobs:
12+
analyze:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
security-events: write
16+
actions: read
17+
contents: read
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: 10.0.x
27+
28+
- name: Initialize CodeQL
29+
uses: github/codeql-action/init@v3
30+
with:
31+
languages: csharp
32+
33+
- name: Restore
34+
run: dotnet restore ExperimentFramework.slnx --use-lock-file
35+
36+
- name: Build
37+
run: dotnet build ExperimentFramework.slnx --configuration Release --no-restore
38+
39+
- name: Perform CodeQL Analysis
40+
uses: github/codeql-action/analyze@v3

.github/workflows/docs.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
actions: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
publish-docs:
19+
environment:
20+
name: github-pages
21+
url: ${{ steps.deployment.outputs.page_url }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
- name: Dotnet Setup
27+
uses: actions/setup-dotnet@v3
28+
with:
29+
dotnet-version: 10.x
30+
31+
- run: dotnet tool update -g docfx
32+
- run: docfx docs/docfx.json
33+
34+
- name: Upload artifact
35+
uses: actions/upload-pages-artifact@v3
36+
with:
37+
path: 'docs/_site'
38+
- name: Deploy to GitHub Pages
39+
id: deployment
40+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bin/
2+
obj/
3+
*.user
4+
docs/api
5+
docs/_site
6+
BenchmarkDotNet.Artifacts/
7+
coverage.cobertura.xml
8+
TestResults/

ExperimentFramework.slnx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Solution>
2+
<Project Path="samples/ExperimentFramework.SampleWebApp/ExperimentFramework.SampleWebApp.csproj" />
3+
<Project Path="src/ExperimentFramework.Generators/ExperimentFramework.Generators.csproj" />
4+
5+
<Project Path="src/ExperimentFramework/ExperimentFramework.csproj" />
6+
<Project Path="benchmarks/ExperimentFramework.Benchmarks/ExperimentFramework.Benchmarks.csproj" />
7+
<Project Path="samples/ExperimentFramework.SampleConsole/ExperimentFramework.SampleConsole.csproj" />
8+
<Project Path="tests/ExperimentFramework.Tests/ExperimentFramework.Tests.csproj" />
9+
</Solution>

GitVersion.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mode: MainLine
2+
tag-prefix: 'v'
3+
commit-message-incrementing: Enabled
4+
5+
major-version-bump-message: '(?m)^[a-z]+(?:\([\w\s\-,/\\]+\))?!:|(?m)^\s*BREAKING CHANGE:'
6+
minor-version-bump-message: '(?m)^feat(?:\([\w\s\-,/\\]+\))?:'
7+
patch-version-bump-message: '(?m)^(?:fix|perf)(?:\([\w\s\-,/\\]+\))?:'

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 ExperimentFramework
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)