Skip to content

Commit 59502fa

Browse files
authored
Merge pull request #25 from ByronMayne/24-unable-to-write-unit-tests-without-adding-refernece-to-the-source-generator
Publishing Source.Generator.Foundations.Contracts project
2 parents e7f4be9 + fd22f72 commit 59502fa

File tree

4 files changed

+62
-43
lines changed

4 files changed

+62
-43
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,51 @@ env:
1212
SolutionPath: src\SourceGenerator.Foundations.sln
1313
MSBUILDDISABLENODEREUSE: '1' # Stops MSBuild from locking MSBuild nuget package
1414
jobs:
15+
build:
16+
name: Build | All
17+
runs-on: windows-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
with:
21+
ref: ${{ github.head_ref }}
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v3
24+
with:
25+
dotnet-version: 6.0.x
26+
- name: Build Solution
27+
run: dotnet test src\SourceGenerator.Foundations.sln
28+
29+
test:
30+
name: Test | ${{ matrix.project.name }}
31+
runs-on: windows-latest
32+
needs: build
33+
strategy:
34+
matrix:
35+
project:
36+
- name: SourceGenerator.Foundations.Tests
37+
- name: ConsoleApp.SourceGenerator.Tests
38+
path: Sandbox/
39+
steps:
40+
- uses: actions/checkout@v3
41+
with:
42+
ref: ${{ github.head_ref }}
43+
- name: Setup .NET
44+
uses: actions/setup-dotnet@v3
45+
with:
46+
dotnet-version: 6.0.x
47+
- name: Test | ${{ matrix.project.name }}
48+
run: dotnet test src\${{ matrix.project.path }}${{ matrix.project.name }}\${{ matrix.project.name }}.csproj
49+
1550
publish:
16-
name: build, bundle & publish
51+
name: Publish | ${{ matrix.project.name }}
1752
runs-on: windows-latest
53+
needs:
54+
- test
55+
strategy:
56+
matrix:
57+
project:
58+
- name: SourceGenerator.Foundations
59+
- name: SourceGenerator.Foundations.Contracts
1860
steps:
1961
- uses: actions/checkout@v3
2062
with:
@@ -28,17 +70,13 @@ jobs:
2870
run: dotnet tool restore
2971
- name: GitVersion
3072
run: dotnet gitversion /output buildserver
31-
# Build Dependencies
32-
- name: Build | SourceGenerator.Foundations.MSBuild
33-
run: dotnet build src\SourceGenerator.Foundations.MSBuild\SourceGenerator.Foundations.MSBuild.csproj -p:Version=${{env.GitVersion_AssemblySemVer}}
34-
# Build Main
35-
- name: Build | SourceGenerator.Foundations\SourceGenerator.Foundations
73+
# Build
74+
- name: Build | ${{ matrix.project.name }}
3675
run: dotnet build src\SourceGenerator.Foundations\SourceGenerator.Foundations.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_SemVer}}
37-
- name: Test | Solution
38-
run: dotnet test ${{env.SolutionPath}}
39-
- name: Pack | SourceGenerator.Foundations\SourceGenerator.Foundations
40-
run: dotnet pack src\SourceGenerator.Foundations\SourceGenerator.Foundations.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_FullSemVer}}
41-
# -- Release Only --
42-
- name: Push NuGet
76+
# Pack
77+
- name: Pack | ${{ matrix.project.name }}
78+
run: dotnet pack src\${{ matrix.project.name }}\${{ matrix.project.name }}.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_FullSemVer}}
79+
# Release
80+
- name: Push | ${{ matrix.project.name }}
4381
if: github.event_name == 'release'
44-
run: dotnet nuget push ${{env.ProjectDir}}bin\${{env.Configuration}}\*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
82+
run: dotnet nuget push src\${{ matrix.project.name }}\bin\${{env.Configuration}}\*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json

src/SourceGenerator.Foundations.Tests/ScriptInjectorGeneratorTests.cs

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

src/SourceGenerator.Foundations.Tests/SourceGenerator.Foundations.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26+
<ProjectReference Include="..\SourceGenerator.Foundations.Contracts\SourceGenerator.Foundations.Contracts.csproj" />
2627
<ProjectReference Include="..\SourceGenerator.Foundations\SourceGenerator.Foundations.csproj" />
2728
</ItemGroup>
2829

src/SourceGenerator.Foundations.sln

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SourceGenerator.Foundations
3131
EndProject
3232
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp.SourceGenerator.Tests", "Sandbox\ConsoleApp.SourceGenerator.Tests\ConsoleApp.SourceGenerator.Tests.csproj", "{560C8028-2831-4697-9571-A9920FB972E7}"
3333
EndProject
34+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGenerator.Foundations.Tests", "SourceGenerator.Foundations.Tests\SourceGenerator.Foundations.Tests.csproj", "{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}"
35+
EndProject
3436
Global
3537
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3638
Debug|Any CPU = Debug|Any CPU
@@ -87,6 +89,14 @@ Global
8789
{560C8028-2831-4697-9571-A9920FB972E7}.Release|Any CPU.Build.0 = Release|Any CPU
8890
{560C8028-2831-4697-9571-A9920FB972E7}.Release|x64.ActiveCfg = Release|Any CPU
8991
{560C8028-2831-4697-9571-A9920FB972E7}.Release|x64.Build.0 = Release|Any CPU
92+
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
93+
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Debug|Any CPU.Build.0 = Debug|Any CPU
94+
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Debug|x64.ActiveCfg = Debug|Any CPU
95+
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Debug|x64.Build.0 = Debug|Any CPU
96+
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Release|Any CPU.ActiveCfg = Release|Any CPU
97+
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Release|Any CPU.Build.0 = Release|Any CPU
98+
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Release|x64.ActiveCfg = Release|Any CPU
99+
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Release|x64.Build.0 = Release|Any CPU
90100
EndGlobalSection
91101
GlobalSection(SolutionProperties) = preSolution
92102
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)