diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 99dc929e41..56462dbf03 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -43,3 +43,7 @@ jobs: run: | $env:COMPlus_gcServer=1 dotnet test --no-build Content.IntegrationTests/Content.IntegrationTests.csproj -v n + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/Content.Tests/DMTests.cs b/Content.Tests/DMTests.cs index ae246883f1..61ea7d1fe3 100644 --- a/Content.Tests/DMTests.cs +++ b/Content.Tests/DMTests.cs @@ -73,7 +73,7 @@ private static void Cleanup(string? compiledFile) { } [Test, TestCaseSource(nameof(GetTests))] - public void TestFiles(string sourceFile, string coverageFile, string coverageDirectory, DMTestFlags testFlags) { + public void TestFiles(string sourceFile, string coverageFile, DMTestFlags testFlags) { string initialDirectory = Directory.GetCurrentDirectory(); TestContext.WriteLine($"--- TEST {sourceFile} | Flags: {testFlags}"); try { @@ -88,7 +88,7 @@ public void TestFiles(string sourceFile, string coverageFile, string coverageDir Assert.IsTrue(compiledFile is not null && File.Exists(compiledFile), "Failed to compile DM source file"); Assert.IsTrue(_dreamMan.LoadJson(compiledFile), $"Failed to load {compiledFile}"); - _debugManager.InitializeCoverage(coverageFile, coverageDirectory); + _debugManager.InitializeCoverage(coverageFile); _dreamMan.StartWorld(); @@ -174,7 +174,6 @@ private static IEnumerable GetTests() yield return new object[] { sourceFile2, Path.GetFullPath($"{sourceFile[..^2]}coverage.xml"), - Path.GetFullPath(TestProject), testFlags }; } diff --git a/OpenDreamRuntime/EntryPoint.cs b/OpenDreamRuntime/EntryPoint.cs index f48b2681f6..2cafcfa36b 100644 --- a/OpenDreamRuntime/EntryPoint.cs +++ b/OpenDreamRuntime/EntryPoint.cs @@ -62,7 +62,7 @@ public override void PostInit() { var codeCoverageOutputFile = _configManager.GetCVar(OpenDreamCVars.CodeCoverage); if (!String.IsNullOrWhiteSpace(codeCoverageOutputFile)) { - _debugManager.InitializeCoverage(codeCoverageOutputFile, Path.GetFullPath(Environment.CurrentDirectory)); + _debugManager.InitializeCoverage(codeCoverageOutputFile); } int debugAdapterPort = _configManager.GetCVar(OpenDreamCVars.DebugAdapterLaunched); diff --git a/OpenDreamRuntime/Procs/DebugAdapter/DreamDebugManager.cs b/OpenDreamRuntime/Procs/DebugAdapter/DreamDebugManager.cs index 51ea1ce261..f3d96ef333 100644 --- a/OpenDreamRuntime/Procs/DebugAdapter/DreamDebugManager.cs +++ b/OpenDreamRuntime/Procs/DebugAdapter/DreamDebugManager.cs @@ -48,7 +48,6 @@ public struct ThreadStepMode { /// private ulong[][]? _coverageTracking; private string? _coverageOutputFile; - private string? _coverageInputDirectory; // Breakpoint storage private const string ExceptionFilterRuntimes = "runtimes"; @@ -180,7 +179,7 @@ public void HandleFirstResume(DMProcState state) { } } - public void InitializeCoverage(string outputFile, string inputDirectory) { + public void InitializeCoverage(string outputFile) { var allProcs = _objectTree.Procs; var coverageTracking = new ulong[allProcs.Count][]; for(var i = 0; i < allProcs.Count; ++i) { @@ -191,7 +190,6 @@ public void InitializeCoverage(string outputFile, string inputDirectory) { _coverageTracking = coverageTracking; _coverageOutputFile = outputFile; - _coverageInputDirectory = inputDirectory; } public void HandleInstruction(DMProcState state) { @@ -935,7 +933,9 @@ private void WriteOutCoverage() { .ToArray(), }, }, - sources = new string[] { _coverageInputDirectory! }, + sources = new string[] { String.Empty }, + timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(), + version = "1.9" }; var serializer = new XmlSerializer(schema.GetType()); @@ -945,12 +945,11 @@ private void WriteOutCoverage() { _coverageTracking = null; _coverageOutputFile = null; - _coverageInputDirectory = null; } } public interface IDreamDebugManager { - public void InitializeCoverage(string outputFile, string inputDirectory); + public void InitializeCoverage(string outputFile); public void InitializeDebugging(int port); public void Update(); public void Shutdown();