Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/add_final_status.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- Identity transform: copy everything as-is by default -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<!-- For testcase elements missing dd_tags[test.final_status] inside their properties block -->
<xsl:template match="testcase[not(properties/property[@name='dd_tags[test.final_status]'])]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:variable name="status">
<xsl:choose>
<xsl:when test="failure or error">fail</xsl:when>
<xsl:when test="skipped">skip</xsl:when>
<xsl:otherwise>pass</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="properties">
<!-- Inject into existing properties block, preserving child order -->
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="self::properties">
<properties>
<xsl:apply-templates select="@*|node()"/>
<property name="dd_tags[test.final_status]" value="{$status}"/>
</properties>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!-- No properties block: create one before other children -->
<properties>
<property name="dd_tags[test.final_status]" value="{$status}"/>
</properties>
<xsl:apply-templates select="node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
22 changes: 20 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@ jobs:
run: cd ${BUILD_DIR} && test/tests -r junit -o report.xml
env:
ASAN_OPTIONS: alloc_dealloc_mismatch=0
- name: Add final_status property
if: success() || failure()
run: |
which xsltproc || (apt-get update && apt-get install -y xsltproc)
xml_file=".build/report.xml"
echo "Fixing $xml_file"
tmp_file="$(mktemp)"
xsltproc --output "$tmp_file" ".github/workflows/add_final_status.xsl" "$xml_file"
mv "$tmp_file" "$xml_file"
- name: Upload test report to Datadog
if: success() || failure()
run: |
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-${{ matrix.arch }}" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci
datadog-ci junit upload --service dd-trace-cpp --tags test.source.file:test/*.cpp .build/report.xml
Expand Down Expand Up @@ -145,7 +155,7 @@ jobs:
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
- name: Install Dependencies
run: scoop install main/cmake@4.0.1 main/ninja
run: scoop install main/cmake@4.0.1 main/ninja main/libxslt
- name: Build
run: |
& 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\Tools\\Launch-VsDevShell.ps1' -arch ${{ matrix.arch }}
Expand All @@ -155,10 +165,18 @@ jobs:
run: |
& 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\Tools\\Launch-VsDevShell.ps1' -arch ${{ matrix.arch }}
.\build\test\tests.exe -r junit -o report.xml
- name: Add final_status property
if: success() || failure()
run: |
$xml_file = "report.xml"
$tmp_file = [System.IO.Path]::GetTempFileName()
xsltproc --output $tmp_file ".github/workflows/add_final_status.xsl" $xml_file
Move-Item -Force $tmp_file $xml_file
- name: Upload test report to Datadog
if: success() || failure()
run: |
Invoke-WebRequest -Uri "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_win-x64" -OutFile "datadog-ci.exe"
./datadog-ci.exe junit upload --service dd-trace-cpp --tags test.source.file:test/*.cpp report.xml
./datadog-ci.exe junit upload --service dd-trace-cpp --tags test.source.file:test/*.cpp report.xml

coverage:
needs: build-linux-cmake
Expand Down
Loading