Skip to content

Commit

Permalink
Merge pull request #25 from ByronMayne/24-unable-to-write-unit-tests-…
Browse files Browse the repository at this point in the history
…without-adding-refernece-to-the-source-generator

Publishing Source.Generator.Foundations.Contracts project
  • Loading branch information
ByronMayne authored Jul 28, 2024
2 parents e7f4be9 + fd22f72 commit 59502fa
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 43 deletions.
64 changes: 51 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,51 @@ env:
SolutionPath: src\SourceGenerator.Foundations.sln
MSBUILDDISABLENODEREUSE: '1' # Stops MSBuild from locking MSBuild nuget package
jobs:
build:
name: Build | All
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Build Solution
run: dotnet test src\SourceGenerator.Foundations.sln

test:
name: Test | ${{ matrix.project.name }}
runs-on: windows-latest
needs: build
strategy:
matrix:
project:
- name: SourceGenerator.Foundations.Tests
- name: ConsoleApp.SourceGenerator.Tests
path: Sandbox/
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Test | ${{ matrix.project.name }}
run: dotnet test src\${{ matrix.project.path }}${{ matrix.project.name }}\${{ matrix.project.name }}.csproj

publish:
name: build, bundle & publish
name: Publish | ${{ matrix.project.name }}
runs-on: windows-latest
needs:
- test
strategy:
matrix:
project:
- name: SourceGenerator.Foundations
- name: SourceGenerator.Foundations.Contracts
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -28,17 +70,13 @@ jobs:
run: dotnet tool restore
- name: GitVersion
run: dotnet gitversion /output buildserver
# Build Dependencies
- name: Build | SourceGenerator.Foundations.MSBuild
run: dotnet build src\SourceGenerator.Foundations.MSBuild\SourceGenerator.Foundations.MSBuild.csproj -p:Version=${{env.GitVersion_AssemblySemVer}}
# Build Main
- name: Build | SourceGenerator.Foundations\SourceGenerator.Foundations
# Build
- name: Build | ${{ matrix.project.name }}
run: dotnet build src\SourceGenerator.Foundations\SourceGenerator.Foundations.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_SemVer}}
- name: Test | Solution
run: dotnet test ${{env.SolutionPath}}
- name: Pack | SourceGenerator.Foundations\SourceGenerator.Foundations
run: dotnet pack src\SourceGenerator.Foundations\SourceGenerator.Foundations.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_FullSemVer}}
# -- Release Only --
- name: Push NuGet
# Pack
- name: Pack | ${{ matrix.project.name }}
run: dotnet pack src\${{ matrix.project.name }}\${{ matrix.project.name }}.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_FullSemVer}}
# Release
- name: Push | ${{ matrix.project.name }}
if: github.event_name == 'release'
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
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SourceGenerator.Foundations.Contracts\SourceGenerator.Foundations.Contracts.csproj" />
<ProjectReference Include="..\SourceGenerator.Foundations\SourceGenerator.Foundations.csproj" />
</ItemGroup>

Expand Down
10 changes: 10 additions & 0 deletions src/SourceGenerator.Foundations.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SourceGenerator.Foundations
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp.SourceGenerator.Tests", "Sandbox\ConsoleApp.SourceGenerator.Tests\ConsoleApp.SourceGenerator.Tests.csproj", "{560C8028-2831-4697-9571-A9920FB972E7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGenerator.Foundations.Tests", "SourceGenerator.Foundations.Tests\SourceGenerator.Foundations.Tests.csproj", "{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -87,6 +89,14 @@ Global
{560C8028-2831-4697-9571-A9920FB972E7}.Release|Any CPU.Build.0 = Release|Any CPU
{560C8028-2831-4697-9571-A9920FB972E7}.Release|x64.ActiveCfg = Release|Any CPU
{560C8028-2831-4697-9571-A9920FB972E7}.Release|x64.Build.0 = Release|Any CPU
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Debug|x64.ActiveCfg = Debug|Any CPU
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Debug|x64.Build.0 = Debug|Any CPU
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Release|Any CPU.Build.0 = Release|Any CPU
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Release|x64.ActiveCfg = Release|Any CPU
{7D1F6C4F-2A50-4706-8ECF-BA8BCE3E1C81}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 59502fa

Please sign in to comment.