diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f416b2b5..3079ddb7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,8 +1,5 @@
name: ci
-env:
- PROJECT_NAME: Markdig
-
on:
push:
paths-ignore:
@@ -19,46 +16,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
- name: Install .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- - name: Build (Release)
- run: dotnet build src -c Release
-
- - name: SpecFileGen
- run: dotnet src/SpecFileGen/bin/Release/net6.0/SpecFileGen.dll
-
- - name: Test (Release)
- run: dotnet test src -c Release
-
- - name: Build & Test (Debug)
- run: dotnet test src -c Debug
-
- - name: Coverlet
- run: dotnet test src -c Release -f net6.0 /p:Include=\"[${{env.PROJECT_NAME}}]*\" /p:CollectCoverage=true /p:CoverletOutputFormat=lcov
-
- - name: Coveralls Upload
- uses: coverallsapp/github-action@1.1.3
- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- path-to-lcov: src/${{env.PROJECT_NAME}}.Tests/coverage.info
-
- - name: Pack
- run: dotnet pack src -c Release
-
- - name: Pack Signed
- run: dotnet pack -c Release src/${{env.PROJECT_NAME}}.Signed/${{env.PROJECT_NAME}}.Signed.csproj
-
- - name: Publish
- if: github.event_name == 'push'
- run: |
- if ( "${{github.ref}}" -match "^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$" ) {
- dotnet nuget push src\${{env.PROJECT_NAME}}\bin\Release\*.nupkg -s nuget.org -k ${{secrets.NUGET_TOKEN}}
- dotnet nuget push src\${{env.PROJECT_NAME}}.Signed\bin\Release\*.nupkg -s nuget.org -k ${{secrets.NUGET_TOKEN}}
- } else {
- echo "publish is only enabled by tagging with a release tag"
- }
+ - name: Build, Test, Pack, Publish
+ run: |
+ dotnet tool install -g dotnet-releaser
+ dotnet-releaser run --nuget-token ${{secrets.NUGET_TOKEN}} --github-token ${{secrets.GITHUB_TOKEN}} src/dotnet-releaser.toml
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index ff554453..bc09fdd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -239,3 +239,6 @@ _Pvt_Extensions
**/.idea/**/*.iml
**/.idea/**/contentModel.xml
**/.idea/**/modules.xml
+
+# Remove artifacts produced by dotnet-releaser
+artifacts-dotnet-releaser/
diff --git a/src/Markdig.Tests/Markdig.Tests.csproj b/src/Markdig.Tests/Markdig.Tests.csproj
index dbebf475..ae12199d 100644
--- a/src/Markdig.Tests/Markdig.Tests.csproj
+++ b/src/Markdig.Tests/Markdig.Tests.csproj
@@ -5,6 +5,8 @@
Exe
false
Markdig.Tests.Program
+ $(MSBuildProjectDirectory)\..\SpecFileGen\bin\$(Configuration)\net6.0\SpecFileGen.dll
+ $(MSBuildProjectDirectory)\..\SpecFileGen\bin\$(Configuration)\net6.0\SpecFileGen.timestamp
@@ -19,6 +21,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_GeneratedSpecsFile Include="Specs\*.generated.cs" />
+ <_GeneratedSpecsFile Include="NormalizeSpecs\*.generated.cs" />
+ <_GeneratedSpecsFile Include="PlainTextSpecs\*.generated.cs" />
+ <_GeneratedSpecsFile Include="RoundtripSpecs\*.generated.cs" />
+ <_GeneratedSpecsFile Remove="@(Compile)" />
+
+
+
\ No newline at end of file
diff --git a/src/Markdig/Markdig.targets b/src/Markdig/Markdig.targets
index 688bb733..c66f23dc 100644
--- a/src/Markdig/Markdig.targets
+++ b/src/Markdig/Markdig.targets
@@ -4,7 +4,6 @@
A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET with 20+ builtin extensions (pipetables, footnotes, definition lists... etc.)
Alexandre Mutel
en-US
- 0.27.0
Alexandre Mutel
@@ -38,6 +37,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/src/SpecFileGen/Program.cs b/src/SpecFileGen/Program.cs
index cb7d2a05..943afe2d 100644
--- a/src/SpecFileGen/Program.cs
+++ b/src/SpecFileGen/Program.cs
@@ -99,17 +99,15 @@ namespace SpecFileGen
static void Main()
{
- Console.WriteLine("Generating {0} specs ...", Specs.Length);
-
- bool anyChanged = false;
- List missingSpecs = new List();
int totalTests = 0;
+ bool hasErrors = false;
foreach (var spec in Specs)
{
if (!File.Exists(spec.Path))
{
- missingSpecs.Add(spec);
+ EmitError("Could not find the specification file at " + spec.Path);
+ hasErrors = true;
continue;
}
@@ -119,31 +117,22 @@ namespace SpecFileGen
if (File.Exists(spec.OutputPath)) // If the source hasn't changed, don't bump the generated tag
{
string previousSource = File.ReadAllText(spec.OutputPath).Replace("\r\n", "\n", StringComparison.Ordinal);
- if (previousSource == source)
+ if (previousSource == source && File.GetLastWriteTime(spec.OutputPath) > File.GetLastWriteTime(spec.Path))
{
continue;
}
+ Console.WriteLine($"Spec changed {spec.Path}. Need to regenerate");
}
+ Console.WriteLine($"Generating spec {spec.Name} to {spec.OutputPath}...");
File.WriteAllText(spec.OutputPath, source);
- anyChanged = true;
}
- if (missingSpecs.Count != 0)
+ if (hasErrors)
{
- foreach (var spec in missingSpecs)
- {
- EmitError("Could not find the specification file at " + spec.Path);
- }
Environment.Exit(1);
}
- if (anyChanged && Environment.GetEnvironmentVariable("CI") != null)
- {
- EmitError("Error - Specification files have changed. You must run SpecFileGen when changing specification files.");
- Environment.Exit(1);
- }
-
- Console.WriteLine("There are {0} tests in total", totalTests);
+ Console.WriteLine("There are {0} spec tests in total", totalTests);
}
static void EmitError(string error)
{
diff --git a/src/dotnet-releaser.toml b/src/dotnet-releaser.toml
new file mode 100644
index 00000000..27e25732
--- /dev/null
+++ b/src/dotnet-releaser.toml
@@ -0,0 +1,10 @@
+[msbuild]
+project = ["markdig.sln", "./Markdig.Signed/Markdig.Signed.csproj"]
+build_debug = true
+[github]
+user = "xoofx"
+repo = "markdig"
+[test]
+run_tests_for_debug = true
+[coverage]
+exclude = "[SpecFileGen*]*"
\ No newline at end of file
diff --git a/src/markdig.sln b/src/markdig.sln
index 8b69d730..03a6b2f7 100644
--- a/src/markdig.sln
+++ b/src/markdig.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.28407.52
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{061866E2-005C-4D13-A338-EA464BBEC60F}"
ProjectSection(SolutionItems) = preProject