From e96ccd213023a9445f366175670354bfbe21ff2c Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Sun, 8 Sep 2024 18:20:59 +0200 Subject: [PATCH] feat: OpenXml 3.1.0 and dependencies update (#79) * feat: update deps * fix: upload artifacts job * fix: bunp dotnet version and csharpier * fix: comment broken test * fix: unique artifact names --- .config/dotnet-tools.json | 10 ++- .github/workflows/main.yml | 80 +++++++++---------- CHANGELOG.md | 9 ++- .../Word/PowerToolsBlockExtensionsTests.cs | 8 +- Clippit/Core/PowerToolsBlockExtensions.cs | 6 +- Clippit/PtOpenXmlUtil.cs | 2 +- global.json | 3 +- paket.lock | 56 ++++++------- 8 files changed, 92 insertions(+), 82 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index b9052bc0..9080453e 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -6,7 +6,15 @@ "version": "8.0.3", "commands": [ "paket" - ] + ], + "rollForward": false + }, + "csharpier": { + "version": "0.29.1", + "commands": [ + "dotnet-csharpier" + ], + "rollForward": false } } } \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 355a735b..55f133f5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,14 +3,13 @@ name: Build and Test on: push: branches: - - master + - master pull_request: branches: - - master + - master jobs: build: - strategy: fail-fast: false matrix: @@ -18,45 +17,46 @@ jobs: runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup .NET 8.0 SDK - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Build and Test - run: dotnet fsi build.fsx -- -p build - - name: Upload Artifacts - uses: actions/upload-artifact@v2 - with: - name: bin - path: bin/*.nupkg + - name: Checkout + uses: actions/checkout@v2 + - name: Setup .NET 8.0 SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + - name: Build and Test + run: dotnet fsi build.fsx -- -p build + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: bin-${{matrix.os}} + path: bin/*.nupkg generate-docs: runs-on: windows-latest needs: build - + steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup .NET 8.0 SDK - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Build and Test - run: dotnet fsi build.fsx -- -p build - - name: Setup DocFX - uses: crazy-max/ghaction-chocolatey@v1 - with: - args: install docfx - - name: DocFX Build - working-directory: docs - run: docfx docfx.json - continue-on-error: false - - name: Publish - if: github.event_name == 'push' - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/_site - force_orphan: true \ No newline at end of file + - name: Checkout + uses: actions/checkout@v2 + - name: Setup .NET 8.0 SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + - name: Build and Test + run: dotnet fsi build.fsx -- -p build + - name: Setup DocFX + uses: crazy-max/ghaction-chocolatey@v1 + with: + args: install docfx + - name: DocFX Build + working-directory: docs + run: docfx docfx.json + continue-on-error: false + - name: Publish + if: github.event_name == 'push' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/_site + force_orphan: true + diff --git a/CHANGELOG.md b/CHANGELOG.md index f4373c81..bce5e1a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2.2.0 - September 8, 2024 + +- DocumentFormat.OpenXml 3.0.2 -> 3.1.0 +- DocumentFormat.OpenXml.Framework 3.0.2 -> 3.1.0 +- SixLabors.ImageSharp 3.1.4 -> 3.1.5 +- SixLabors.ImageSharp.Drawing 2.1.3 -> 2.1.4 + ## [2.1.1] - April 18, 2024 - fix: regression cased by migration to struct inside OpenXML v3 #75 @@ -76,7 +83,7 @@ ## [1.10.0] - Feb 19, 2022 -- Added support of ExtendedChartPart (http://schemas.microsoft.com/office/drawing/2014/chartex) in PresentationBuilder and DocumentBuilder. +- Added support of ExtendedChartPart () in PresentationBuilder and DocumentBuilder. ## [1.9.2] - Feb 17, 2022 diff --git a/Clippit.Tests/Word/PowerToolsBlockExtensionsTests.cs b/Clippit.Tests/Word/PowerToolsBlockExtensionsTests.cs index 5751b425..81964506 100644 --- a/Clippit.Tests/Word/PowerToolsBlockExtensionsTests.cs +++ b/Clippit.Tests/Word/PowerToolsBlockExtensionsTests.cs @@ -14,12 +14,8 @@ namespace Clippit.Tests.Word { - public class PowerToolsBlockExtensionsTests : TestsBase + public class PowerToolsBlockExtensionsTests(ITestOutputHelper log) : TestsBase(log) { - public PowerToolsBlockExtensionsTests(ITestOutputHelper log) : base(log) - { - } - [Fact] public void MustBeginPowerToolsBlockToUsePowerTools() { @@ -81,7 +77,7 @@ public void MustBeginPowerToolsBlockToUsePowerTools() Assert.Equal("Second", paragraphElements[1].Value); } - [Fact] + [Fact(Skip = "Since v3.1 OpenXML SDK unload part root element on content stream Dispose.")] public void MustEndPowerToolsBlockToUseStronglyTypedClasses() { using var stream = new MemoryStream(); diff --git a/Clippit/Core/PowerToolsBlockExtensions.cs b/Clippit/Core/PowerToolsBlockExtensions.cs index 181bfbd0..d9189fb9 100644 --- a/Clippit/Core/PowerToolsBlockExtensions.cs +++ b/Clippit/Core/PowerToolsBlockExtensions.cs @@ -27,7 +27,7 @@ public static class PowerToolsBlockExtensions /// public static void BeginPowerToolsBlock(this OpenXmlPackage package) { - if (package is null) throw new ArgumentNullException(nameof(package)); + ArgumentNullException.ThrowIfNull(package); package.RemovePowerToolsAnnotations(); package.Save(); @@ -44,7 +44,7 @@ public static void BeginPowerToolsBlock(this OpenXmlPackage package) /// public static void EndPowerToolsBlock(this OpenXmlPackage package) { - if (package is null) throw new ArgumentNullException(nameof(package)); + ArgumentNullException.ThrowIfNull(package); foreach (var part in package.GetAllParts()) { @@ -55,7 +55,7 @@ public static void EndPowerToolsBlock(this OpenXmlPackage package) private static void RemovePowerToolsAnnotations(this OpenXmlPackage package) { - if (package is null) throw new ArgumentNullException(nameof(package)); + ArgumentNullException.ThrowIfNull(package); foreach (var part in package.GetAllParts()) { diff --git a/Clippit/PtOpenXmlUtil.cs b/Clippit/PtOpenXmlUtil.cs index f5561808..9bcced12 100644 --- a/Clippit/PtOpenXmlUtil.cs +++ b/Clippit/PtOpenXmlUtil.cs @@ -108,7 +108,7 @@ public static XDocument GetXDocument(this OpenXmlPart part, out XmlNamespaceMana public static void PutXDocument(this OpenXmlPart part) { - if (part is null) throw new ArgumentNullException(nameof(part)); + ArgumentNullException.ThrowIfNull(part); var partXDocument = part.GetXDocument(); if (partXDocument != null) diff --git a/global.json b/global.json index 6ed79b90..ba341c54 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,6 @@ { "sdk": { - "version": "8.0.302", + "version": "8.0.401", "rollForward": "latestFeature" } } - diff --git a/paket.lock b/paket.lock index ce544602..7860ca32 100644 --- a/paket.lock +++ b/paket.lock @@ -2,45 +2,45 @@ STORAGE: NONE RESTRICTION: == net8.0 NUGET remote: https://api.nuget.org/v3/index.json - DocumentFormat.OpenXml (3.0.2) - DocumentFormat.OpenXml.Framework (>= 3.0.2) - DocumentFormat.OpenXml.Framework (3.0.2) + DocumentFormat.OpenXml (3.1) + DocumentFormat.OpenXml.Framework (>= 3.1) + DocumentFormat.OpenXml.Framework (3.1) System.IO.Packaging (>= 8.0) IDisposableAnalyzers (4.0.8) - Microsoft.CodeCoverage (17.10) - Microsoft.NET.Test.Sdk (17.10) - Microsoft.CodeCoverage (>= 17.10) - Microsoft.TestPlatform.TestHost (>= 17.10) + Microsoft.CodeCoverage (17.11.1) + Microsoft.NET.Test.Sdk (17.11.1) + Microsoft.CodeCoverage (>= 17.11.1) + Microsoft.TestPlatform.TestHost (>= 17.11.1) Microsoft.NETCore.Platforms (7.0.4) - Microsoft.TestPlatform.ObjectModel (17.10) + Microsoft.TestPlatform.ObjectModel (17.11.1) System.Reflection.Metadata (>= 1.6) - Microsoft.TestPlatform.TestHost (17.10) - Microsoft.TestPlatform.ObjectModel (>= 17.10) + Microsoft.TestPlatform.TestHost (17.11.1) + Microsoft.TestPlatform.ObjectModel (>= 17.11.1) Newtonsoft.Json (>= 13.0.1) Newtonsoft.Json (13.0.3) SixLabors.Fonts (2.0.4) - SixLabors.ImageSharp (3.1.4) - SixLabors.ImageSharp.Drawing (2.1.3) - SixLabors.Fonts (>= 2.0.3) - SixLabors.ImageSharp (>= 3.1.4) + SixLabors.ImageSharp (3.1.5) + SixLabors.ImageSharp.Drawing (2.1.4) + SixLabors.Fonts (>= 2.0.4) + SixLabors.ImageSharp (>= 3.1.5) System.Collections.Immutable (8.0) System.IO.Packaging (8.0) System.Reflection.Metadata (8.0) System.Collections.Immutable (>= 8.0) System.Text.Encoding.CodePages (8.0) - xunit (2.8.1) - xunit.analyzers (>= 1.14) - xunit.assert (>= 2.8.1) - xunit.core (2.8.1) + xunit (2.9) + xunit.analyzers (>= 1.15) + xunit.assert (>= 2.9) + xunit.core (2.9) xunit.abstractions (2.0.3) - xunit.analyzers (1.14) - xunit.assert (2.8.1) - xunit.core (2.8.1) - xunit.extensibility.core (2.8.1) - xunit.extensibility.execution (2.8.1) - xunit.extensibility.core (2.8.1) + xunit.analyzers (1.16) + xunit.assert (2.9) + xunit.core (2.9) + xunit.extensibility.core (2.9) + xunit.extensibility.execution (2.9) + xunit.extensibility.core (2.9) xunit.abstractions (>= 2.0.3) - xunit.extensibility.execution (2.8.1) - xunit.extensibility.core (2.8.1) - xunit.runner.console (2.8.1) - xunit.runner.visualstudio (2.8.1) + xunit.extensibility.execution (2.9) + xunit.extensibility.core (2.9) + xunit.runner.console (2.9) + xunit.runner.visualstudio (2.8.2)