diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d58a34d..1c90012 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,11 +5,17 @@ on:
branches:
- main
- master
+ tags:
+ - "*"
pull_request:
jobs:
build-test:
runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ env:
+ DOTNET_NOLOGO: true
steps:
- name: Check out repository
@@ -20,11 +26,31 @@ jobs:
with:
global-json-file: global.json
+ - name: Compute package version
+ shell: bash
+ run: |
+ if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
+ version="${GITHUB_REF_NAME#v}"
+ else
+ version="1.0.0-ci.${GITHUB_RUN_NUMBER}"
+ fi
+ echo "PACKAGE_VERSION=${version}" >> "${GITHUB_ENV}"
+
- name: Restore
run: dotnet restore Pixie.sln
- name: Build
- run: dotnet build Pixie.sln --configuration Release --no-restore
+ run: dotnet build Pixie.sln --configuration Release --no-restore -p:Version=${{ env.PACKAGE_VERSION }}
+
+ - name: Run examples
+ shell: bash
+ run: |
+ dotnet ./Examples/CaretDiagnostics/bin/Release/net10.0/CaretDiagnostics.dll
+ dotnet ./Examples/FormattedList/bin/Release/net10.0/FormattedList.dll
+ dotnet ./Examples/LoycInterop/bin/Release/net10.0/LoycInterop.dll
+ dotnet ./Examples/ParseOptions/bin/Release/net10.0/ParseOptions.dll a.txt -fno-syntax-only --files -O1 -Ofast b.txt --files=c.txt - -- -v
+ dotnet ./Examples/PrintHelp/bin/Release/net10.0/PrintHelp.dll
+ dotnet ./Examples/SimpleErrorMessage/bin/Release/net10.0/SimpleErrorMessage.dll
- name: Run tests
run: dotnet test Tests/Tests.csproj --configuration Release --no-build --logger "trx;LogFileName=TestResults.trx" --collect:"XPlat Code Coverage"
@@ -37,3 +63,31 @@ jobs:
path: |
Tests/TestResults/**/*.trx
Tests/TestResults/**/coverage.cobertura.xml
+
+ - name: Pack NuGet packages
+ if: startsWith(github.ref, 'refs/tags/')
+ run: |
+ dotnet pack Pixie/Pixie.csproj --configuration Release --no-build --output ./artifacts/packages -p:PackageVersion=${{ env.PACKAGE_VERSION }}
+ dotnet pack Pixie.Loyc/Pixie.Loyc.csproj --configuration Release --no-build --output ./artifacts/packages -p:PackageVersion=${{ env.PACKAGE_VERSION }}
+
+ - name: Upload packages
+ if: startsWith(github.ref, 'refs/tags/')
+ uses: actions/upload-artifact@v4
+ with:
+ name: nuget-packages
+ path: |
+ artifacts/packages/*.nupkg
+
+ - name: Publish to NuGet
+ if: startsWith(github.ref, 'refs/tags/')
+ env:
+ NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
+ run: |
+ if [[ -z "${NUGET_API_KEY}" ]]; then
+ echo "NUGET_API_KEY secret is not configured." >&2
+ exit 1
+ fi
+ dotnet nuget push "artifacts/packages/*.nupkg" \
+ --api-key "${NUGET_API_KEY}" \
+ --source "https://api.nuget.org/v3/index.json" \
+ --skip-duplicate
diff --git a/Examples/LoycInterop/LoycInterop.csproj b/Examples/LoycInterop/LoycInterop.csproj
index 0e6dd74..ad09f0f 100644
--- a/Examples/LoycInterop/LoycInterop.csproj
+++ b/Examples/LoycInterop/LoycInterop.csproj
@@ -10,9 +10,9 @@
-
-
-
-
+
+
+
+
diff --git a/Pixie.Loyc.nuspec b/Pixie.Loyc.nuspec
deleted file mode 100644
index 2d379c9..0000000
--- a/Pixie.Loyc.nuspec
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
- Pixie.Loyc
- $version$
- Jonathan Van der Cruysse
- Jonathan Van der Cruysse
- https://github.com/jonathanvdc/pixie
-
- false
- A Loyc interop library for Pixie.
- Pixie is a C# library that prints beautifully formatted output to the console.
-
- You describe your layout using a high-level API and Pixie turns it into neatly-formatted text.
-
- This package contains Pixie.Loyc, a library that translates Loyc diagnostics to Pixie markup nodes.
-
- Copyright 2019
- terminal console output formatting loyc ecsharp
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Pixie.Loyc/LoycSourceDocument.cs b/Pixie.Loyc/LoycSourceDocument.cs
index a7b12a9..49e2e68 100644
--- a/Pixie.Loyc/LoycSourceDocument.cs
+++ b/Pixie.Loyc/LoycSourceDocument.cs
@@ -39,7 +39,7 @@ private int ComputeLineCount()
public override GridPosition GetGridPosition(int offset)
{
var linePos = source.IndexToLine(offset);
- return new GridPosition(linePos.Line - 1, linePos.PosInLine - 1);
+ return new GridPosition(linePos.Line - 1, linePos.Column - 1);
}
///
@@ -67,4 +67,3 @@ public override TextReader Open(int offset)
}
}
}
-
diff --git a/Pixie.Loyc/Pixie.Loyc.csproj b/Pixie.Loyc/Pixie.Loyc.csproj
index 727daf4..5ae6902 100644
--- a/Pixie.Loyc/Pixie.Loyc.csproj
+++ b/Pixie.Loyc/Pixie.Loyc.csproj
@@ -7,6 +7,17 @@
Pixie.Loyc
1.0
netstandard2.0;net10.0
+ Pixie.Loyc
+ Jonathan Van der Cruysse
+ https://github.com/jonathanvdc/Pixie
+ https://github.com/jonathanvdc/Pixie
+ git
+ README.md
+ LICENSE
+ false
+ Pixie is a C# library that prints beautifully formatted output to the console. This package contains Pixie.Loyc, a library that translates Loyc diagnostics to Pixie markup nodes.
+ terminal;console;output;formatting;loyc;ecsharp
+ true
true
@@ -29,8 +40,12 @@
-
-
-
+
+
+
+
+
+
+
diff --git a/Pixie.Loyc/PixieMessageSink.cs b/Pixie.Loyc/PixieMessageSink.cs
index 5c68222..05f0f97 100644
--- a/Pixie.Loyc/PixieMessageSink.cs
+++ b/Pixie.Loyc/PixieMessageSink.cs
@@ -110,9 +110,9 @@ private MarkupNode FormatContext(object context)
{
return FormatContext(((LNode)context).Range);
}
- else if (context is IHasLocation)
+ else if (context is ILocation)
{
- return FormatContext(((IHasLocation)context).Location);
+ return FormatContext(((ILocation)context).Location);
}
else if (context is SourcePos)
{
@@ -134,7 +134,7 @@ private MarkupNode FormatContext(object context)
// OTOH, we're not even use if the message we're
// generating is a diagnostic.
return "At " + pos.FileName + ":" + pos.Line +
- ":" + pos.PosInLine + ".";
+ ":" + pos.Column + ".";
}
}
else if (context == null)
@@ -160,7 +160,7 @@ private bool TryIndexSourceDocumentCache(SourcePos pos, out SourceRegion result)
if (DocumentCache.TryGetDocument(pos.FileName, out document))
{
int lineOffset = document.GetLineOffset(pos.Line - 1);
- int offset = lineOffset + pos.PosInLine - 1;
+ int offset = lineOffset + pos.Column - 1;
result = new SourceRegion(new SourceSpan(document, offset, 1));
return true;
}
@@ -188,4 +188,4 @@ public static Severity ToPixieSeverity(LoycSeverity severity)
return Severity.Info;
}
}
-}
\ No newline at end of file
+}
diff --git a/Pixie.Terminal/Pixie.Terminal.csproj b/Pixie.Terminal/Pixie.Terminal.csproj
index bd4f57e..cdf8071 100644
--- a/Pixie.Terminal/Pixie.Terminal.csproj
+++ b/Pixie.Terminal/Pixie.Terminal.csproj
@@ -7,6 +7,7 @@
Pixie.Terminal
1.0
netstandard2.0;net10.0
+ false
true
diff --git a/Pixie.nuspec b/Pixie.nuspec
deleted file mode 100644
index 8941149..0000000
--- a/Pixie.nuspec
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
- Pixie
- $version$
- Jonathan Van der Cruysse
- Jonathan Van der Cruysse
- https://github.com/jonathanvdc/pixie
-
- false
- A library for pretty console output formatting.
- Pixie is a C# library that prints beautifully formatted output to the console.
-
- You describe your layout using a high-level API and Pixie turns it into neatly-formatted text.
-
- Copyright 2019
- terminal console output formatting
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Pixie/Pixie.csproj b/Pixie/Pixie.csproj
index 2961e59..d78eaf1 100644
--- a/Pixie/Pixie.csproj
+++ b/Pixie/Pixie.csproj
@@ -7,6 +7,18 @@
Pixie
1.0
netstandard2.0;net10.0
+ Pixie
+ Jonathan Van der Cruysse
+ https://github.com/jonathanvdc/Pixie
+ https://github.com/jonathanvdc/Pixie
+ git
+ README.md
+ LICENSE
+ false
+ Pixie is a C# library that prints beautifully formatted output to the console. You describe your layout using a high-level API and Pixie turns it into neatly-formatted text.
+ terminal;console;output;formatting
+ true
+ $(TargetsForTfmSpecificBuildOutput);IncludeTerminalAssembly
true
@@ -27,4 +39,19 @@
false
bin\Release\Pixie.xml
+
+
+
+
+
+
+
+ Pixie.Terminal.dll
+
+
+ Pixie.Terminal.xml
+
+
+
diff --git a/Tests/NUnitCompatibilityAsserts.cs b/Tests/NUnitCompatibilityAsserts.cs
new file mode 100644
index 0000000..f81f9c9
--- /dev/null
+++ b/Tests/NUnitCompatibilityAsserts.cs
@@ -0,0 +1,30 @@
+using System.Collections;
+
+namespace NUnit.Framework
+{
+ internal static class StringAssert
+ {
+ public static void Contains(string expected, string actual)
+ {
+ Assert.That(actual, Does.Contain(expected));
+ }
+
+ public static void StartsWith(string expected, string actual)
+ {
+ Assert.That(actual, Does.StartWith(expected));
+ }
+
+ public static void EndsWith(string expected, string actual)
+ {
+ Assert.That(actual, Does.EndWith(expected));
+ }
+ }
+
+ internal static class CollectionAssert
+ {
+ public static void AreEqual(IEnumerable expected, IEnumerable actual)
+ {
+ Assert.That(actual, Is.EqualTo(expected));
+ }
+ }
+}
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 94f0ae8..b5fac62 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -10,13 +10,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index dc4920d..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,56 +0,0 @@
-version: 0.1.9.{build}
-
-image:
- - Visual Studio 2022
-
-dotnet_csproj:
- patch: true
- file: '**\*.csproj'
- version: '{version}'
- package_version: '{version}'
- assembly_version: '{version}'
- file_version: '{version}'
- informational_version: '{version}'
-
-build_script:
- # Generate a NuGet package version number.
- - echo %APPVEYOR_REPO_TAG%
- - C:\Python34\python.exe Tools\CI\version-number.py %APPVEYOR_BUILD_VERSION% > pkg-version.txt
- - set /p PKG_VERSION=