From faa138baa2e685f743935c0778b1497bd01170bd Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Fri, 4 Mar 2022 09:37:30 -0800 Subject: [PATCH] [AD-612] Publish/posting TestResults (#34) * [AD-612] uncomment code for posting test results * [AD-612] change to always upload test results * [AD-612] implement boost log * format of test results is set as JUnit * [AD-612] make macos build post test results with EnricoMi * [AD-612]make windows build post test results with EnricoMi * enable post results for win32 build * [AD-612] change keyword from path to files * files keyword is supported with EnricoMi, not path * [AD-612] change upload test result to composite action * [AD-612] modify action for win32 * modified publish unit test results from container action to composite action for win32 * [AD-612] generate test report inside /bin folder * moved code that generates test results file to odbc_test_suite.cpp, so that the code is not in a .h file. Now the test result is generated under the same folder when bin/Release/ignite-odbc-tests.exe or bin/Debug/ignite-odbc-tests.exe is called * [AD-612] modify path to test result * path to test result is set inside ODBC_BIN_PATH because that's where the file would be generated * comments added for historical records * [AD-612] refactor - remove comments * [AD-612] debug change path to test result .xml file * [AD-612] refactor * remove comments in win-build.yml * [AD-612] remove define boost_test_module * reason: the code is not reflected on the test result for unknown reasons. * [AD-612] refactor * remove empty lines and spaces * [AD-612] specify the test report filename * [AD-612] separate comments for different builds * [AD-612] separate comments for different builds * add value for check_name parameter as well * [AD-612] add OS version name to comments * [AD-612] specify environment version on Yaml * newest environments are used. Specify the version so we know what version we're working on * MacOS environment will be macOS Big Sur 11 * Windows environment will be Windows 2022 --- .github/workflows/mac-build.yml | 15 ++++++------ .github/workflows/mac-debug-build.yml | 15 ++++++------ .github/workflows/win-build.yml | 34 +++++++++++++++------------ src/odbc-test/src/odbc_test_suite.cpp | 18 ++++++++++++++ 4 files changed, 53 insertions(+), 29 deletions(-) diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index bcf1c1275..a4d960b9b 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -28,7 +28,7 @@ env: jobs: build-mac: - runs-on: macos-latest + runs-on: macos-11 steps: - uses: actions/checkout@v2 - name: Get Java distribution @@ -79,12 +79,13 @@ jobs: run: | ssh -f -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}} ./build/odbc/bin/ignite-odbc-tests - # - name: upload-test-report - # if: failure() - # uses: actions/upload-artifact@v2 - # with: - # name: test-result-macos - # path: ${{ github.workspace }}/report.xml + - name: upload-test-report + if: always() + uses: EnricoMi/publish-unit-test-result-action/composite@v1.30 + with: + check_name: "MacOS Big Sur 11 Build Unit Test Results Check" + comment_title: "MacOS Big Sur 11 Build Unit Test Results" + files: ./odbc_test_result.xml # - name: print-memory-leak-logs # if: always() # run: | diff --git a/.github/workflows/mac-debug-build.yml b/.github/workflows/mac-debug-build.yml index 0387b3d9e..7af047c98 100644 --- a/.github/workflows/mac-debug-build.yml +++ b/.github/workflows/mac-debug-build.yml @@ -12,7 +12,7 @@ env: jobs: build-mac: - runs-on: macos-latest + runs-on: macos-11 env: NOT_CONNETECD: 1 steps: @@ -48,12 +48,13 @@ jobs: # - name: run-tests # run: | # ./build/odbc/bin/tests --gtest_output="xml:report.xml" - # - name: upload-test-report - # if: failure() - # uses: actions/upload-artifact@v2 - # with: - # name: test-result-macos - # path: ${{ github.workspace }}\report.xml + - name: upload-test-report + if: always() + uses: EnricoMi/publish-unit-test-result-action/composite@v1.30 + with: + check_name: "MacOS Big Sur 11 Debug Build Unit Test Results Check" + comment_title: "MacOS Big Sur 11 Debug Build Unit Test Results" + files: ./odbc_test_result.xml # - name: print-memory-leak-logs # if: always() # run: | diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 25099aac1..dfb54cbaa 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -31,7 +31,7 @@ env: jobs: build-windows32: - runs-on: windows-latest + runs-on: windows-2022 steps: - uses: actions/checkout@v2 - name: setup-cppcheck @@ -98,12 +98,14 @@ jobs: run: | Start-Process -NoNewWindow ssh "-f -N -o UserKnownHostsFile=/temp -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}" ${{env.ODBC_BIN_PATH}}/ignite-odbc-tests.exe - # - name: upload-test-report - # if: failure() - # uses: actions/upload-artifact@v2 - # with: - # name: test-logs-win32 - # path: ${{ github.workspace }}\report.xml + + - name: upload-test-report + if: always() + uses: EnricoMi/publish-unit-test-result-action/composite@v1.30 + with: + check_name: "Windows x32 Build Unit Test Results Check" + comment_title: "Windows 2022 (x32) Build Unit Test Results" + files: ./odbc_test_result.xml # - name: build-installer # if: success() # run: | @@ -131,7 +133,7 @@ jobs: # name: windows-test-results # path: $CI_OUTPUT_PATH/test build-windows64: - runs-on: windows-latest + runs-on: windows-2022 steps: - uses: actions/checkout@v2 - name: run-cppcheck @@ -197,12 +199,14 @@ jobs: run: | Start-Process -NoNewWindow ssh "-f -N -o UserKnownHostsFile=/temp -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}" ${{env.ODBC_BIN_PATH}}/ignite-odbc-tests.exe - # - name: upload-test-report - # if: failure() - # uses: actions/upload-artifact@v2 - # with: - # name: test-logs-win64 - # path: ${{ github.workspace }}\report.xml + + - name: upload-test-report + if: always() + uses: EnricoMi/publish-unit-test-result-action/composite@v1.30 + with: + check_name: "Windows 2022 (x64) Build Unit Test Results Check" + comment_title: "Windows 2022 (x64) Build Unit Test Results" + files: ./odbc_test_result.xml # - name: build-installer # if: success() # run: | @@ -224,7 +228,7 @@ jobs: # name: windows64-installer # path: ci-output/installer build-windows64_coverage: - runs-on: windows-latest + runs-on: windows-2022 steps: - uses: actions/checkout@v2 diff --git a/src/odbc-test/src/odbc_test_suite.cpp b/src/odbc-test/src/odbc_test_suite.cpp index 7602368a9..2ee01a606 100644 --- a/src/odbc-test/src/odbc_test_suite.cpp +++ b/src/odbc-test/src/odbc_test_suite.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -31,6 +32,23 @@ using namespace ignite_test; using namespace boost::unit_test; +/** + * Test setup config for test results + */ +struct OdbcConfig { + OdbcConfig() : test_log("odbc_test_result.xml") { + unit_test_log.set_stream(test_log); + unit_test_log.set_format(OF_JUNIT); + } + ~OdbcConfig() { + unit_test_log.set_stream(std::cout); + } + + std::ofstream test_log; +}; + +BOOST_GLOBAL_FIXTURE(OdbcConfig); + namespace ignite { namespace odbc { void OdbcTestSuite::Prepare() {