diff --git a/.github/workflows/test_sonarcloud.yml b/.github/workflows/test_sonarcloud.yml index 530e6e6..65d93fe 100644 --- a/.github/workflows/test_sonarcloud.yml +++ b/.github/workflows/test_sonarcloud.yml @@ -21,7 +21,8 @@ jobs: run: | sudo apt update sudo apt install -y \ - gcovr + gcovr \ + libxml2-utils - name: "Dependencies: Sonar" run: | @@ -39,6 +40,18 @@ jobs: -o /tmp/sonar/build-wrapper-linux-x86.zip \ -d /tmp/sonar/ + - name: "Dependencies: Report.CI" + run: | + curl https://report.ci/report.py \ + > /tmp/report.py + sed \ + -i /tmp/report.py \ + -e '459a\ "job" : env.get("GITHUB_JOB"),' + sed \ + -i /tmp/report.py \ + -e '459a\ "job-name" : env.get("GITHUB_JOB"),' + cat /tmp/report.py + - name: "Dependencies: Catch2" run: | git clone https://github.com/catchorg/Catch2.git @@ -78,3 +91,35 @@ jobs: -Dsonar.host.url="https://sonarcloud.io" \ -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ -Dsonar.cfamily.cache.enabled=false + + - name: Produce test report + run: | + build/test/unit/openemsh_unittest \ + -r xml::out=build/test/unit/openemsh_unittest_result.catch.xml \ + || true + + - name: Downgrade Catch XML format + run: | + sed \ + -i build/test/unit/openemsh_unittest_result.catch.xml \ + -e 's/' \ + -e "s/^<\/Catch2TestRun>/<\/Group>/" + cat build/test/unit/openemsh_unittest_result.catch.xml \ + | tail -3 \ + | head -1 \ + >> build/test/unit/openemsh_unittest_result.catch.xml + sed \ + -i build/test/unit/openemsh_unittest_result.catch.xml \ + -e '$a\' + xmllint \ + build/test/unit/openemsh_unittest_result.catch.xml \ + -o build/test/unit/openemsh_unittest_result.catch.xml \ + --format + + - name: Export test report + run: | + python /tmp/report.py \ + --name "Unittest" + --token ${{ secrets.REPORT_CI_TOKEN }} \ + --include-as-catch build/test/unit/*.catch.xml