diff --git a/.build.Nuke/Build.Test.cs b/.build.Nuke/Build.Test.cs index 7ade196f7525997fb1736ee74c88f8aca1566245..937b3f6fdd851c4352ba3fed5224d566b1403d81 100644 --- a/.build.Nuke/Build.Test.cs +++ b/.build.Nuke/Build.Test.cs @@ -18,49 +18,50 @@ namespace SuCoS; /// sealed partial class Build : NukeBuild { - AbsolutePath TestDLL => testDirectory / "bin" / "Debug" / "net7.0"; AbsolutePath testDirectory => RootDirectory / "test"; - AbsolutePath TestSiteDirectory => RootDirectory / "test" / ".TestSites"; - AbsolutePath TestOutputDirectory => TestDLL / ".TestSites"; + AbsolutePath testDLLDirectory => testDirectory / "bin" / "Debug" / "net7.0"; + AbsolutePath testSiteSourceDirectory => RootDirectory / "test" / ".TestSites"; + AbsolutePath testSiteDestinationDirectory => testDLLDirectory / ".TestSites"; + AbsolutePath testAssembly => testDLLDirectory / "test.dll"; AbsolutePath coverageDirectory => RootDirectory / "coverage-results"; - AbsolutePath ReportDirectory => coverageDirectory / "report"; - AbsolutePath CoverageResultDirectory => coverageDirectory / "coverage"; - AbsolutePath CoverageResultFile => CoverageResultDirectory / "coverage.xml"; - AbsolutePath CoverageSummaryResultFile => ReportDirectory / "Summary.txt"; + AbsolutePath coverageResultDirectory => coverageDirectory / "coverage"; + AbsolutePath coverageResultFile => coverageResultDirectory / "coverage.xml"; + AbsolutePath coverageReportDirectory => coverageDirectory / "report"; + AbsolutePath coverageReportSummaryDirectory => coverageReportDirectory / "Summary.txt"; Target PrepareTestFiles => _ => _ .After(Clean) .Executes(() => { - TestOutputDirectory.CreateOrCleanDirectory(); - CopyDirectoryRecursively(TestSiteDirectory, TestOutputDirectory, DirectoryExistsPolicy.Merge); + testSiteDestinationDirectory.CreateOrCleanDirectory(); + CopyDirectoryRecursively(testSiteSourceDirectory, testSiteDestinationDirectory, DirectoryExistsPolicy.Merge); }); Target Test => _ => _ .DependsOn(Compile, PrepareTestFiles) .Executes(() => { - CoverageResultDirectory.CreateDirectory(); + coverageResultDirectory.CreateDirectory(); Coverlet(s => s .SetTarget("dotnet") .SetTargetArgs("test --no-build --no-restore") - .SetAssembly(TestDLL / "test.dll") + .SetAssembly(testAssembly) // .SetThreshold(75) - .SetOutput(CoverageResultFile) - .SetFormat(CoverletOutputFormat.opencover)); + .SetOutput(coverageResultFile) + .SetFormat(CoverletOutputFormat.cobertura)); }); public Target TestReport => _ => _ .DependsOn(Test) .Executes(() => { - ReportDirectory.CreateDirectory(); + coverageReportDirectory.CreateDirectory(); ReportGenerator(s => s - .SetTargetDirectory(ReportDirectory) + .SetTargetDirectory(coverageReportDirectory) .SetReportTypes(new ReportTypes[] { ReportTypes.Html, ReportTypes.TextSummary }) - .SetReports(CoverageResultFile) + .SetReports(coverageResultFile) ); - var summaryText = CoverageSummaryResultFile.ReadAllLines(); + var summaryText = coverageReportSummaryDirectory.ReadAllLines(); Log.Information(string.Join(Environment.NewLine, summaryText)); }); } diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f0ab1629c752814dff4a79ed97a5ad14b0b42532..6bd07c1cdd773c5673364247a5a60c7db63039d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,9 +19,9 @@ variables: PUBLISH_SINGLE_FILE: "true" PUBLISH_TRIMMED: "false" -cache: - paths: - - "**/.nuget/packages" +# cache: +# paths: +# - "**/.nuget/packages" services: - docker:dind @@ -38,11 +38,15 @@ test: ./build.sh TestReport Publish \ --configuration "Debug" \ --publish-directory "./publish" - coverage: '/^Line coverage: (\d+.\d+)%/' + coverage: '/^ Line coverage: (\d*.\d*)%/' artifacts: paths: - coverage-results/report/* - publish/* + reports: + coverage_report: + coverage_format: cobertura + path: coverage-results/coverage/coverage.xml # check if there is new commits, if so, create a tag and a release # this will trigger the publish stage "publish" diff --git a/test/Parser/YAMLParserTests.cs b/test/Parser/YAMLParserTests.cs index 7a0250bec454108c6811c9feb8ccbb5171357004..06eb559c1d351481e78d30c8dca65f57e045e118 100644 --- a/test/Parser/YAMLParserTests.cs +++ b/test/Parser/YAMLParserTests.cs @@ -179,7 +179,7 @@ customParam: Custom Value site.Object.PostProcessFrontMatter(frontmatter!); // Asset - Assert.Equal(DateTime.Parse("2023-07-01"), frontmatter?.Date); + Assert.Equal(DateTime.Parse("2023-07-01", CultureInfo.InvariantCulture), frontmatter?.Date); } [Fact]