diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 537a7a325..3191681fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,39 +54,52 @@ jobs: - name: Build all projects run: ./scripts/build.sh ${{ env.CI_VERSION }} Release - - name: Test + - name: Test (.NET - TRX) run: dotnet test --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults - - name: Run cycodt tests + - name: Run cycodt tests (JUnit) run: | export PATH=$PATH:$(pwd)/src/cycod/bin/Release/net9.0:$(pwd)/src/cycodt/bin/Release/net9.0:$(pwd)/src/cycodmd/bin/Release/net9.0 which cycod which cycodmd which cycodt - cycodt run --log ./TestResults/test-results-cycodt.log --output-file ./TestResults/test-results-cycodt.trx + cycodt run --log ./TestResults/test-results-cycodt.log --output-file ./TestResults/test-results-cycodt.xml --output-format junit - - name: Clean up inception test TRX files + - name: Clean up inception test result files run: | - # Remove TRX files created by inception tests to avoid interference with CI reporting - rm -f tests/cycodt-yaml/inception-layer-1/*.trx - echo "Cleaned up inception test TRX files" + # Remove TRX files created by inception tests (still may exist) and any stray trx + rm -f tests/cycodt-yaml/inception-layer-1/*.trx || true + echo "Cleaned up inception test legacy TRX files" + - name: Convert TRX to JUnit XML + if: always() + run: | + echo "Installing trx2junit global tool" + dotnet tool install --global trx2junit || echo "Tool already installed" + export PATH="$PATH:$HOME/.dotnet/tools" + echo "Converting TRX files to JUnit XML" + ls -1 ./TestResults/*.trx || echo "No TRX files found" + trx2junit ./TestResults/*.trx || echo "Conversion produced warnings" + echo "Post-conversion listing:" + ls -lh ./TestResults/*.xml || echo "No XML files yet" + - name: Upload test results uses: actions/upload-artifact@v4 - if: always() # Upload test results even if tests fail + if: always() with: name: test-results path: | ./TestResults/*.trx + ./TestResults/*.xml ./TestResults/test-results-cycodt.log - - - name: Publish test results + + - name: Publish JUnit results uses: dorny/test-reporter@v2.2.0 - if: always() # Run this step even if previous steps failed + if: always() with: - name: .NET Tests - path: ./TestResults/*.trx - reporter: dotnet-trx + name: .NET Tests (JUnit) + path: ./TestResults/*.xml + reporter: java-junit fail-on-error: false - name: Upload cycod build artifacts @@ -99,6 +112,15 @@ jobs: src/cycod/bin/Release/net9.0/linux-x64/publish/ src/cycod/bin/Release/net9.0/osx-x64/publish/ + - name: Publish .NET TRX results + uses: dorny/test-reporter@v2.2.0 + if: always() + with: + name: .NET Tests (TRX) + path: ./TestResults/*.trx + reporter: dotnet-trx + fail-on-error: false + - name: Upload cycodt build artifacts uses: actions/upload-artifact@v4 with: diff --git a/tests/cycod/Helpers/DirectoryHelpersTests.cs b/tests/cycod/Helpers/DirectoryHelpersTests.cs index 953d32faf..1a0f72eb0 100644 --- a/tests/cycod/Helpers/DirectoryHelpersTests.cs +++ b/tests/cycod/Helpers/DirectoryHelpersTests.cs @@ -18,6 +18,9 @@ public void Setup() _testRootPath = Path.Combine(Path.GetTempPath(), $"DirectoryHelpersTests_{Guid.NewGuid()}"); Directory.CreateDirectory(_testRootPath!); Directory.SetCurrentDirectory(_testRootPath!); + // Normalize path to the canonical resolved form to avoid /var vs /private/var differences on macOS + _testRootPath = Directory.GetCurrentDirectory(); + } [TestCleanup]