Skip to content

Commit ae4ccfb

Browse files
authored
Merge branch 'main' into feature/extensibility
2 parents 616ae39 + 243ddcb commit ae4ccfb

File tree

3 files changed

+72
-9
lines changed

3 files changed

+72
-9
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @SonOfSardaar @MehdiK

.github/workflows/build.yml

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,23 @@ on:
1010
default: false
1111
type: boolean
1212

13+
publishWhichNuget:
14+
description: 'Which Nuget ?'
15+
required: true
16+
default: 'Only Changed'
17+
type: choice
18+
options:
19+
- Only Changed
20+
- All
21+
1322
jobs:
1423
build:
1524
runs-on: ubuntu-latest
1625
outputs:
1726
semver: ${{ steps.gitversion.outputs.semVer }}
1827
fullsemver: ${{ steps.gitversion.outputs.fullSemVer }}
1928
nugetversion: ${{ steps.gitversion.outputs.fullSemVer }}
20-
29+
publishNuget: ${{ steps.changes.outputs.BddfyUpdated == 'true' || steps.changes.outputs.SamplesUpdated == 'true' || github.event.inputs.publishWhichNuget == 'All' }}
2130
steps:
2231
- name: Checkout code
2332
uses: actions/checkout@v5
@@ -144,10 +153,43 @@ jobs:
144153
name: release-notes
145154
path: release-notes.md
146155

147-
- name: Create NuGet package
156+
- name: Check for changes in project paths
157+
id: changes
158+
run: |
159+
latestTag=$(git describe --tags --abbrev=0)
160+
161+
if git diff --quiet "$latestTag" HEAD -- src/Samples/; then
162+
echo "SamplesUpdated=false" >> $GITHUB_OUTPUT
163+
else
164+
echo "SamplesUpdated=true" >> $GITHUB_OUTPUT
165+
fi
166+
167+
if git diff --quiet "$latestTag" HEAD -- src/TestStack.BDDfy/; then
168+
echo "BddfyUpdated=false" >> $GITHUB_OUTPUT
169+
else
170+
echo "BddfyUpdated=true" >> $GITHUB_OUTPUT
171+
fi
172+
173+
- name: Print changed paths
174+
run: |
175+
echo "SamplesUpdated: ${{ steps.changes.outputs.SamplesUpdated }}"
176+
echo "BddfyUpdated: ${{ steps.changes.outputs.BddfyUpdated }}"
177+
178+
- name: Create Samples package
179+
working-directory: src
180+
if: steps.changes.outputs.SamplesUpdated == 'true' || github.event.inputs.publishWhichNuget == 'All'
181+
run: >-
182+
dotnet pack ./Samples/TestStack.BDDfy.Samples/*.csproj
183+
--configuration Release
184+
--no-build
185+
/p:PackageVersion=${{ steps.formatversion.outputs.packageVersion }}
186+
--output ../packages
187+
188+
- name: Create Bddfy package
148189
working-directory: src
190+
if: steps.changes.outputs.BddfyUpdated == 'true' || github.event.inputs.publishWhichNuget == 'All'
149191
run: >-
150-
dotnet pack
192+
dotnet pack ./TestStack.BDDfy/*.csproj
151193
--configuration Release
152194
--no-build
153195
/p:PackageVersion=${{ steps.formatversion.outputs.packageVersion }}
@@ -168,7 +210,7 @@ jobs:
168210
publish-nuget:
169211
runs-on: ubuntu-latest
170212
needs: build
171-
if: github.event.inputs.runPublish == 'true' || github.ref_name == github.event.repository.default_branch
213+
if: needs.build.outputs.publishNuget == 'true' && (github.event.inputs.runPublish == 'true' || github.ref_name == github.event.repository.default_branch)
172214
environment:
173215
name: Publish
174216
url: https://www.nuget.org/packages/TestStack.BDDfy/

src/Samples/TestStack.BDDfy.Samples/AssemblySetupFixture.cs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ protected override ITestFrameworkExecutor CreateExecutor(AssemblyName assemblyNa
4545
}
4646

4747
public class XunitTestFrameworkExecutorWithAssemblyFixture(AssemblyName assemblyName,
48-
ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink): XunitTestFrameworkExecutor(assemblyName, sourceInformationProvider, diagnosticMessageSink)
48+
ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink):
49+
XunitTestFrameworkExecutor(assemblyName, sourceInformationProvider, diagnosticMessageSink)
4950
{
5051
protected override async void RunTestCases(IEnumerable<IXunitTestCase> testCases,
5152
IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions)
@@ -60,7 +61,8 @@ public class XunitTestAssemblyRunnerWithAssemblyFixture(ITestAssembly testAssemb
6061
IEnumerable<IXunitTestCase> testCases,
6162
IMessageSink diagnosticMessageSink,
6263
IMessageSink executionMessageSink,
63-
ITestFrameworkExecutionOptions executionOptions): XunitTestAssemblyRunner(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
64+
ITestFrameworkExecutionOptions executionOptions):
65+
XunitTestAssemblyRunner(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
6466
{
6567
readonly Dictionary<Type, object> assemblyFixtureMappings = new();
6668

@@ -96,7 +98,15 @@ protected override Task<RunSummary> RunTestCollectionAsync(IMessageBus messageBu
9698
ITestCollection testCollection,
9799
IEnumerable<IXunitTestCase> testCases,
98100
CancellationTokenSource cancellationTokenSource)
99-
=> new XunitTestCollectionRunnerWithAssemblyFixture(assemblyFixtureMappings, testCollection, testCases, DiagnosticMessageSink, messageBus, TestCaseOrderer, new ExceptionAggregator(Aggregator), cancellationTokenSource).RunAsync();
101+
=> new XunitTestCollectionRunnerWithAssemblyFixture(
102+
assemblyFixtureMappings,
103+
testCollection,
104+
testCases,
105+
DiagnosticMessageSink,
106+
messageBus,
107+
TestCaseOrderer,
108+
new ExceptionAggregator(Aggregator),
109+
cancellationTokenSource).RunAsync();
100110
}
101111

102112
public class XunitTestCollectionRunnerWithAssemblyFixture(Dictionary<Type, object> assemblyFixtureMappings,
@@ -106,7 +116,8 @@ public class XunitTestCollectionRunnerWithAssemblyFixture(Dictionary<Type, objec
106116
IMessageBus messageBus,
107117
ITestCaseOrderer testCaseOrderer,
108118
ExceptionAggregator aggregator,
109-
CancellationTokenSource cancellationTokenSource): XunitTestCollectionRunner(testCollection, testCases, diagnosticMessageSink, messageBus, testCaseOrderer, aggregator, cancellationTokenSource)
119+
CancellationTokenSource cancellationTokenSource):
120+
XunitTestCollectionRunner(testCollection, testCases, diagnosticMessageSink, messageBus, testCaseOrderer, aggregator, cancellationTokenSource)
110121
{
111122
readonly Dictionary<Type, object> assemblyFixtureMappings = assemblyFixtureMappings;
112123
readonly IMessageSink diagnosticMessageSink = diagnosticMessageSink;
@@ -120,7 +131,16 @@ protected override Task<RunSummary> RunTestClassAsync(ITestClass testClass, IRef
120131
combinedFixtures[kvp.Key] = kvp.Value;
121132

122133
// We've done everything we need, so let the built-in types do the rest of the heavy lifting
123-
return new XunitTestClassRunner(testClass, @class, testCases, diagnosticMessageSink, MessageBus, TestCaseOrderer, new ExceptionAggregator(Aggregator), CancellationTokenSource, combinedFixtures).RunAsync();
134+
return new XunitTestClassRunner(
135+
testClass,
136+
@class,
137+
testCases,
138+
diagnosticMessageSink,
139+
MessageBus,
140+
TestCaseOrderer,
141+
new ExceptionAggregator(Aggregator),
142+
CancellationTokenSource,
143+
combinedFixtures).RunAsync();
124144
}
125145
}
126146

0 commit comments

Comments
 (0)