diff --git a/.github/workflows/Pester.yml b/.github/workflows/Pester.yml index b392b58..cc90004 100644 --- a/.github/workflows/Pester.yml +++ b/.github/workflows/Pester.yml @@ -2,15 +2,9 @@ name: Pester Tests on: push: - branches: - - main - - dev - - master + branches: ["dev", "main"] pull_request: - branches: - - main - - dev - - master + branches: ["dev"] workflow_dispatch: jobs: @@ -20,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-latest, macos-latest] + os: [windows-latest, ubuntu-latest, macos-latest, macos-26-intel] shell: [pwsh] include: - os: windows-latest @@ -30,6 +24,8 @@ jobs: shell: powershell - os: macos-latest shell: powershell + - os: macos-26-intel + shell: powershell defaults: run: @@ -39,17 +35,23 @@ jobs: - name: Checkout repository uses: actions/checkout@v7 - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v6 with: dotnet-version: "8.0.x" - name: Restore dependencies run: dotnet restore ./Sources - - name: Build the library for MacOS + - name: Build the library for MacOS ARM64 run: dotnet publish ./Sources -c Release -r osx-arm64 if: matrix.os == 'macos-latest' - - name: Copy the library for MacOS + - name: Copy the library for MacOS ARM64 run: Copy-Item -Path ./Sources/bin/Release/netstandard2.0/osx-arm64/publish/* -Destination ./AsBuiltReport.Chart/Src/Assemblies/Core/mac-osx/osx-arm64 -Recurse if: matrix.os == 'macos-latest' + - name: Build the library for MacOS Intel + run: dotnet publish ./Sources -c Release -r osx-x64 + if: matrix.os == 'macos-26-intel' + - name: Copy the library for MacOS Intel + run: Copy-Item -Path ./Sources/bin/Release/netstandard2.0/osx-x64/publish/* -Destination ./AsBuiltReport.Chart/Src/Assemblies/Core/mac-osx/osx-x64 -Recurse + if: matrix.os == 'macos-26-intel' - name: Build the library for Linux run: dotnet publish ./Sources -c Release -r linux-x64 if: matrix.os == 'ubuntu-latest' @@ -75,10 +77,6 @@ jobs: run: | Set-PSRepository -Name PSGallery -InstallationPolicy Trusted - - name: Install Pester - run: | - Install-Module -Name Pester -MinimumVersion 5.0.0 -Repository PSGallery -Force -AllowClobber -Scope CurrentUser - - name: Run Pester Tests run: | $CodeCoverageParam = @{} diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 64d7daf..f7448cc 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v6 with: dotnet-version: "8.0.x" - name: Restore dependencies diff --git a/.github/workflows/Stale.yml b/.github/workflows/Stale.yml index be3ca59..54dac57 100644 --- a/.github/workflows/Stale.yml +++ b/.github/workflows/Stale.yml @@ -7,7 +7,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v9 + - uses: actions/stale@v11 with: stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions." days-before-stale: 60 diff --git a/AsBuiltReport.Chart/AsBuiltReport.Chart.psd1 b/AsBuiltReport.Chart/AsBuiltReport.Chart.psd1 index af8b0b7..0d300dc 100644 --- a/AsBuiltReport.Chart/AsBuiltReport.Chart.psd1 +++ b/AsBuiltReport.Chart/AsBuiltReport.Chart.psd1 @@ -12,7 +12,7 @@ RootModule = 'AsBuiltReport.Chart.psm1' # Version number of this module. - ModuleVersion = '0.3.4' + ModuleVersion = '0.3.5' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/AsBuiltReport.Chart/AsBuiltReport.Chart.psm1 b/AsBuiltReport.Chart/AsBuiltReport.Chart.psm1 index 1aa45ab..a8b62e2 100644 --- a/AsBuiltReport.Chart/AsBuiltReport.Chart.psm1 +++ b/AsBuiltReport.Chart/AsBuiltReport.Chart.psm1 @@ -1,30 +1,51 @@ -# Get assemblies files and import them -switch ($PSVersionTable.PSEdition) { - 'Core' { - if ($IsMacOS) { - $architecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture - if ($architecture -eq "Arm64" -or $architecture -eq "Arm") { - Write-Verbose "Architecture: ARM (Apple Silicon)" - Import-Module ("$PSScriptRoot{0}Src{0}Assemblies{0}Core{0}mac-osx{0}osx-arm64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar) +function Get-ChartAssemblyPath { + $separator = [System.IO.Path]::DirectorySeparatorChar + $assemblyRoot = "$PSScriptRoot{0}Src{0}Assemblies" -f $separator - } elseif ($architecture -eq "X64" -or $architecture -eq "X86") { - Write-Verbose "Architecture: x86 (Intel)" - Import-Module ("$PSScriptRoot{0}Src{0}Assemblies{0}Core{0}mac-osx{0}osx-x64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar) + switch ($PSVersionTable.PSEdition) { + 'Core' { + if ($IsMacOS) { + $architecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture - } else { - Write-Verbose "Architecture: Unknown or other architecture" - Import-Module ("$PSScriptRoot{0}Src{0}Assemblies{0}Core{0}mac-osx{0}osx-arm64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar) + if ($architecture -in @('Arm64', 'Arm')) { + Write-Verbose 'Architecture: ARM (Apple Silicon)' + $path = "$assemblyRoot{0}Core{0}mac-osx{0}osx-arm64{0}AsBuiltReportChart.dll" -f $separator + } + elseif ($architecture -in @('X64', 'X86')) { + Write-Verbose 'Architecture: x86 (Intel)' + $path = "$assemblyRoot{0}Core{0}mac-osx{0}osx-x64{0}AsBuiltReportChart.dll" -f $separator + } + else { + throw "Unsupported macOS architecture '$architecture'. Supported architectures: Arm64, X64, X86." + } + } + elseif ($IsLinux) { + Write-Verbose 'Architecture: Linux x64' + $path = "$assemblyRoot{0}Core{0}linux-x64{0}AsBuiltReportChart.dll" -f $separator + } + elseif ($IsWindows) { + Write-Verbose 'Architecture: Windows x64' + $path = "$assemblyRoot{0}Core{0}windows-x64{0}AsBuiltReportChart.dll" -f $separator + } + else { + throw 'Unable to determine a supported platform for the Core PowerShell edition.' } - } elseif ($IsLinux) { - Import-Module ("$PSScriptRoot{0}Src{0}Assemblies{0}Core{0}linux-x64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar) - } elseif ($IsWindows) { - Import-Module ("$PSScriptRoot{0}Src{0}Assemblies{0}Core{0}windows-x64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar) + } + 'Desktop' { + Write-Verbose 'Architecture: Windows x64 (PowerShell 5.1)' + $path = "$assemblyRoot{0}Desktop{0}windows-x64{0}AsBuiltReportChart.dll" -f $separator + } + default { + throw "Unsupported PowerShell edition '$($PSVersionTable.PSEdition)'. Supported editions: Core, Desktop." } } - 'Desktop' { - Import-Module ("$PSScriptRoot{0}Src{0}Assemblies{0}Desktop{0}windows-x64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar) - } - default { - Write-Verbose -Message 'Unable to find compatible assemblies.' + + if (-not (Test-Path -LiteralPath $path)) { + throw "Unable to locate the AsBuiltReportChart assembly for this environment: $path" } -} \ No newline at end of file + + return $path +} + +$assemblyPath = Get-ChartAssemblyPath +Import-Module -Name $assemblyPath -Force \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c2f3df..c77acd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.5] - Unreleased + +### Added + +- Add SkiaSharp.NativeAssets.macOS dependency to the module to support macOS platform +- Add support for macOS intel in the Pester workflow to test the module on macOS intel platform +- Add Pester test for missing OutputFolderPath in New-PieChart + +### Changed + +- Update module v0.3.5 +- Update Pester workflow to use the latest version of the Pester module +- Update workflows to use the latest action version +- Enhance Get-ChartAssemblyPath function for better architecture handling + ## [0.3.4] - 2026-06-25 ### Changed diff --git a/Sources/AsBuiltReportChart.csproj b/Sources/AsBuiltReportChart.csproj index ada18d0..77d5f89 100644 --- a/Sources/AsBuiltReportChart.csproj +++ b/Sources/AsBuiltReportChart.csproj @@ -3,7 +3,7 @@ netstandard2.0 - 0.3.4 + 0.3.5 @@ -12,6 +12,7 @@ + diff --git a/Sources/Chart.cs b/Sources/Chart.cs index 318caa5..01e7b15 100644 --- a/Sources/Chart.cs +++ b/Sources/Chart.cs @@ -445,7 +445,7 @@ internal static void Reset() LabelBold = false; LabelYAxis = "Count"; LabelXAxis = "Values"; - _labelDistance = 0.6; + LabelDistance = 0.6; AreaOrientation = Orientations.Vertical; _areaExplodeFraction = 0; EnableLegend = false; @@ -482,6 +482,7 @@ internal static void Reset() WatermarkColor = BasicColors.Gray; _watermarkOpacity = 0.3; DonutFraction = 0.5; + DonutCenterText = null; HideValues = false; SpokesLength = 10; } diff --git a/Tests/AsBuiltReport.Chart.Functions.Tests.ps1 b/Tests/AsBuiltReport.Chart.Functions.Tests.ps1 index 3264829..f77bdc1 100644 --- a/Tests/AsBuiltReport.Chart.Functions.Tests.ps1 +++ b/Tests/AsBuiltReport.Chart.Functions.Tests.ps1 @@ -45,6 +45,10 @@ Describe 'AsBuiltReport.Chart Exported Functions' { It 'Should throw error for mismatched Values and Labels' { { New-PieChart -Title 'Test' -Values @(1, 2) -Labels @('A') -Format 'png' -OutputFolderPath $TestDrive } | Should -Throw -ExpectedMessage "Error: Values and labels must be equal." } + It 'Should throw when OutputFolderPath does not exist' { + $missingPath = Join-Path -Path $TestDrive -ChildPath 'missing-folder' + { New-PieChart -Title 'Test' -Values @(1, 2) -Labels @('A', 'B') -Format 'png' -OutputFolderPath $missingPath } | Should -Throw + } } Context 'New-DonutChart' { diff --git a/Tests/Invoke-Tests.ps1 b/Tests/Invoke-Tests.ps1 index 7996873..5e60577 100644 --- a/Tests/Invoke-Tests.ps1 +++ b/Tests/Invoke-Tests.ps1 @@ -57,7 +57,7 @@ if ($PSVersion.Major -lt 7) { Write-Host "`nInstalling required modules..." -ForegroundColor Yellow $RequiredModules = @( - @{ Name = 'Pester'; MinimumVersion = '5.0.0' } + @{ Name = 'Pester'; MinimumVersion = '6.2.0' } ) foreach ($Module in $RequiredModules) { @@ -75,7 +75,7 @@ foreach ($Module in $RequiredModules) { } # Import Pester -Import-Module Pester -MinimumVersion 5.0.0 -Force +Import-Module Pester -MinimumVersion 6.2.0 -Force # Configure Pester $PesterConfiguration = New-PesterConfiguration diff --git a/Todo.md b/Todo.md index eef8804..98fbe79 100644 --- a/Todo.md +++ b/Todo.md @@ -1 +1 @@ -- [] Add support for ScottPlot 5.1.59 +- [Done] Add support for ScottPlot 5.1.59