diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a82ef38..4b032a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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 diff --git a/src/SourceGenerator.Foundations.Tests/ScriptInjectorGeneratorTests.cs b/src/SourceGenerator.Foundations.Tests/ScriptInjectorGeneratorTests.cs deleted file mode 100644 index 207c3a9..0000000 --- a/src/SourceGenerator.Foundations.Tests/ScriptInjectorGeneratorTests.cs +++ /dev/null @@ -1,30 +0,0 @@ -using SGF.Generators; -using Xunit.Abstractions; - -namespace SourceGenerator.Foundations.Tests -{ - public class ScriptInjectorGeneratorTests : GeneratorTest - { - public ScriptInjectorGeneratorTests(ITestOutputHelper outputHelper) : base(outputHelper) - {} - - [Fact] - public void AssemblyResolver_AddedToProject() - => Compose("", - a => a.AnyTreeNamed("AssemblyResolver.generated.cs")); - [Fact] - public void ResourceConfiguration_AddedToProject() - => Compose("", - a => a.AnyTreeNamed("ResourceConfiguration.generated.cs")); - - [Fact] - public void ModuleInitializerAttribute_AddedToProject() - => Compose("", - a => a.AnyTreeNamed("ModuleInitializerAttribute.generated.cs")); - - [Fact] - public void IncrementalGenerator_AddedToProject() - => Compose("", - a => a.AnyTreeNamed("IncrementalGenerator.generated.cs")); - } -} diff --git a/src/SourceGenerator.Foundations.Tests/SourceGenerator.Foundations.Tests.csproj b/src/SourceGenerator.Foundations.Tests/SourceGenerator.Foundations.Tests.csproj index e62892b..d4f83a1 100644 --- a/src/SourceGenerator.Foundations.Tests/SourceGenerator.Foundations.Tests.csproj +++ b/src/SourceGenerator.Foundations.Tests/SourceGenerator.Foundations.Tests.csproj @@ -23,6 +23,7 @@ + diff --git a/src/SourceGenerator.Foundations.sln b/src/SourceGenerator.Foundations.sln index a13833d..6847b50 100644 --- a/src/SourceGenerator.Foundations.sln +++ b/src/SourceGenerator.Foundations.sln @@ -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 @@ -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