From 29e8915f624a95e29e281f1f02bec4c67826eea1 Mon Sep 17 00:00:00 2001 From: Blaise Taylor Date: Thu, 29 Jan 2026 14:50:09 -0500 Subject: [PATCH 1/4] Initial CI workflow. --- .github/workflows/ci.yml | 73 +++++++++++++++++++ .../DesignerSerializationManagerTests.cs | 30 ++++---- ...r.ComponentModel.Design.Serialization.slnx | 1 + 3 files changed, 89 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6fba969 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,73 @@ +name: CI + +on: + # workflow_dispatch: + + # push: + # branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + packages: write + +env: + DOTNET_VERSION: "10.0.x" + NODE_VERSION: "20" + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history for better analysis + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + + - name: Restore dependencies + run: dotnet restore + + - name: Build project + run: dotnet build --no-restore --configuration Release + + - name: Run unit tests + run: dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings + + - name: Upload coverage reports + uses: codecov/codecov-action@v3 + with: + files: ./coverage.xml + fail_ci_if_error: true + + publish-github-packages: + name: Publish to GitHub Packages + runs-on: ubuntu-latest + needs: test + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Publish to GitHub Packages + run: | + dotnet pack --configuration Release --no-build -o ./nupkg + dotnet nuget push ./nupkg/*.nupkg --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/LogicBuilder.ComponentModel.Design.Serialization.Tests/DesignerSerializationManagerTests.cs b/LogicBuilder.ComponentModel.Design.Serialization.Tests/DesignerSerializationManagerTests.cs index 88c84b7..24a11b4 100644 --- a/LogicBuilder.ComponentModel.Design.Serialization.Tests/DesignerSerializationManagerTests.cs +++ b/LogicBuilder.ComponentModel.Design.Serialization.Tests/DesignerSerializationManagerTests.cs @@ -526,21 +526,21 @@ public void SetName_ThrowsExceptionWhenInstanceAlreadyHasName() } } - //[Fact] - //public void ReportError_AddsErrorToList() - //{ - // // Arrange - // var manager = (IDesignerSerializationManager)new DesignerSerializationManager(); - - // // Act & Assert - // using (((DesignerSerializationManager)manager).CreateSession()) - // { - // var error = "Test error"; - // manager.ReportError(error); - // var errors = ((DesignerSerializationManager)manager).Errors; - // Assert.Contains(error, errors); - // } - //} + [Fact] + public void ReportError_AddsErrorToList() + { + // Arrange + var manager = (IDesignerSerializationManager)new DesignerSerializationManager(); + + // Act & Assert + using (((DesignerSerializationManager)manager).CreateSession()) + { + var error = "Test error"; + manager.ReportError(error); + var errors = ((DesignerSerializationManager)manager).Errors.OfType(); + Assert.Contains(error, errors); + } + } [Fact] public void ReportError_ThrowsExceptionOutsideSession() diff --git a/LogicBuilder.ComponentModel.Design.Serialization.slnx b/LogicBuilder.ComponentModel.Design.Serialization.slnx index dcc344f..d724b77 100644 --- a/LogicBuilder.ComponentModel.Design.Serialization.slnx +++ b/LogicBuilder.ComponentModel.Design.Serialization.slnx @@ -1,5 +1,6 @@ + From c643bbe1ee15e8655b338ce16d634ba25e1a8d89 Mon Sep 17 00:00:00 2001 From: Blaise Taylor Date: Thu, 29 Jan 2026 14:57:13 -0500 Subject: [PATCH 2/4] Fixing coverage file name. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fba969..803a738 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,12 +45,12 @@ jobs: run: dotnet build --no-restore --configuration Release - name: Run unit tests - run: dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings + run: dotnet test --no-build --verbosity normal --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings - name: Upload coverage reports uses: codecov/codecov-action@v3 with: - files: ./coverage.xml + files: ./coverage.cobertura.xml fail_ci_if_error: true publish-github-packages: From a611f8a48f43740ada270a5d6735e93c42d0b341 Mon Sep 17 00:00:00 2001 From: Blaise Taylor Date: Thu, 29 Jan 2026 15:01:14 -0500 Subject: [PATCH 3/4] Set coverage file name. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 803a738..49ef409 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Upload coverage reports uses: codecov/codecov-action@v3 with: - files: ./coverage.cobertura.xml + files: '**/coverage.cobertura.xml' fail_ci_if_error: true publish-github-packages: From 64b228f1fec0dbd3c8754d533957b6dfabe43d31 Mon Sep 17 00:00:00 2001 From: Blaise Taylor Date: Thu, 29 Jan 2026 15:47:29 -0500 Subject: [PATCH 4/4] Removing upload to codecov. --- .github/workflows/ci.yml | 8 +------- ...omponentModel.Design.Serialization.Tests.csproj | 14 ++++++++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49ef409..51c870e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,13 +45,7 @@ jobs: run: dotnet build --no-restore --configuration Release - name: Run unit tests - run: dotnet test --no-build --verbosity normal --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings - - - name: Upload coverage reports - uses: codecov/codecov-action@v3 - with: - files: '**/coverage.cobertura.xml' - fail_ci_if_error: true + run: dotnet test --no-build --verbosity normal --configuration Release /p:CollectCoverage=true /p:Threshold=50 /p:ThresholdType=line /p:ThresholdStat=Average /p:CoverletOutput=./TestResults/ /p:ExcludeByAttribute="GeneratedCodeAttribute" publish-github-packages: name: Publish to GitHub Packages diff --git a/LogicBuilder.ComponentModel.Design.Serialization.Tests/LogicBuilder.ComponentModel.Design.Serialization.Tests.csproj b/LogicBuilder.ComponentModel.Design.Serialization.Tests/LogicBuilder.ComponentModel.Design.Serialization.Tests.csproj index 0cd57e7..109544f 100644 --- a/LogicBuilder.ComponentModel.Design.Serialization.Tests/LogicBuilder.ComponentModel.Design.Serialization.Tests.csproj +++ b/LogicBuilder.ComponentModel.Design.Serialization.Tests/LogicBuilder.ComponentModel.Design.Serialization.Tests.csproj @@ -10,10 +10,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + +