diff --git a/.github/workflows/createBundle.yml b/.github/workflows/createBundle.yml index 56e469f3..689cbe34 100644 --- a/.github/workflows/createBundle.yml +++ b/.github/workflows/createBundle.yml @@ -9,6 +9,12 @@ on: release: types: [published] +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release @@ -155,23 +161,71 @@ jobs: execute_process(COMMAND sccache --show-stats) endif() - # no ctest tests for modified cppcheck, they were just thrown away - #- name: Test - # working-directory: ${{github.workspace}}/build - # # Execute tests defined by the CMake configuration. - # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - # run: ctest -C ${{env.BUILD_TYPE}} - + - name: Upload ctrlppcheck uses: actions/upload-artifact@v3 with: name: ctrlppcheck path: ${{github.workspace}}/build/${{ matrix.config.artifact }} + buildHelp: + name: Build help + runs-on: ubuntu-20.04 + container: + image: mpokornyetm/winccoa:v3.19.8-full + options: --user root + credentials: + username: mpokornyetm + password: ${{ secrets.DOCKER_CONTAINER_REGISTRY_TOKEN }} + steps: + - name: Install doxygen + working-directory: /opt/WinCC_OA/3.19/bin/ + run: | + apt-get update + apt-get --assume-yes install -f doxygen + + - uses: actions/checkout@v1 + - name: Register Project + working-directory: ${{github.workspace}}/WinCCOA_QualityChecks/ + run: | + cwd=$(pwd) + + mkdir -p $cwd/config + cd $cwd/config + + echo "[general] + pvss_path = \"/opt/WinCC_OA/3.19\" + proj_path = \"$cwd\" + proj_version = \"3.19\" + langs = \"en_US.utf8\" + pmonPort = 5999 + " > config + + mkdir -p $cwd/log + + /opt/WinCC_OA/3.19/bin/WCCILpmon -config $cwd/config/config -n -autofreg -status -log +stderr || true + + - name: Generate help + working-directory: /opt/WinCC_OA/3.19/bin/ + run: | + ./WCCOActrl -proj WinCCOA_QualityChecks -n doxygen.ctl -log +stderr -lang en_US.utf8 + + - name: Upload html help + uses: actions/upload-artifact@v3 + with: + name: html-help + path: ${{github.workspace}}/WinCCOA_QualityChecks/help/html/* + + - name: Upload QT help + uses: actions/upload-artifact@v3 + with: + name: qt-help + path: ${{github.workspace}}/WinCCOA_QualityChecks/help/html/index.qch + package: name: Package project and binaries runs-on: ubuntu-20.04 - needs: build + needs: [build, buildHelp] steps: - uses: actions/checkout@v3 @@ -180,6 +234,9 @@ jobs: run: | mkdir -p ${{github.workspace}}/install/WinCCOA_QualityChecks/bin/ctrlppcheck cp -rp ${{github.workspace}}/WinCCOA_QualityChecks/* ${{github.workspace}}/install/WinCCOA_QualityChecks/ + mkdir -p ${{github.workspace}}/tests/WinCC_OA_Test/ + cp -rp ${{github.workspace}}/WinCC_OA_Test/* ${{github.workspace}}/tests/WinCC_OA_Test/ + mkdir -p ${{github.workspace}}/install/WinCCOA_QualityChecks/help - name: Download ctrlppcheck binaries uses: actions/download-artifact@v3 @@ -187,17 +244,106 @@ jobs: name: ctrlppcheck path: ${{github.workspace}}/install/WinCCOA_QualityChecks/bin/ctrlppcheck/ + - name: Download help + uses: actions/download-artifact@v3 + with: + name: qt-help + path: ${{github.workspace}}/install/WinCCOA_QualityChecks/help/index.qch + - name: Upload WinCCOA_QualityChecks uses: actions/upload-artifact@v3 with: name: WinCCOA_QualityChecks path: ${{github.workspace}}/install/* + - name: Upload WinCC_OA_Test + uses: actions/upload-artifact@v3 + with: + name: WinCC_OA_Test + path: ${{github.workspace}}/tests/* + + tests: + name: WinCC OA tests + runs-on: ubuntu-20.04 + container: + image: mpokornyetm/winccoa:v3.19.8-full + options: --user root + credentials: + username: mpokornyetm + password: ${{ secrets.DOCKER_CONTAINER_REGISTRY_TOKEN }} + needs: [build, package] + + steps: + - name: Print WinCC OA version + shell: bash + run: | + /opt/WinCC_OA/3.19/bin/WCCOActrl -version || true + + - name: Download WinCCOA_QualityChecks package + uses: actions/download-artifact@v3 + with: + name: WinCCOA_QualityChecks + path: ${{github.workspace}}/ + + - name: Download WinCC_OA_Test + uses: actions/download-artifact@v3 + with: + name: WinCC_OA_Test + path: ${{github.workspace}}/ + + - name: 'Echo download path' + run: echo ${{steps.download.outputs.download-path}} + + - name: Register Ctrl TestFramework + working-directory: ${{github.workspace}}/WinCC_OA_Test/ + run: | + cwd=$(pwd) + + mkdir -p $cwd/Projects/TfCustomizedQG/config + cd $cwd/Projects/TfCustomizedQG/config + + echo "[general] + pvss_path = \"/opt/WinCC_OA/3.19\" + proj_path = \"/opt/WinCC_OA/3.19/TestFramework_3.19\" + proj_path = \"$cwd/Projects/Global\" + proj_path = \"$cwd/Projects/TfCustomizedQG\" + proj_version = \"3.19\" + langs = \"de_AT.utf8\" + langs = \"en_US.utf8\" + pmonPort = 5999 + [testFramework] + installPath = \"$cwd/\" + " > config + + mkdir -p $$cwd/Projects/TfCustomizedQG/log + + /opt/WinCC_OA/3.19/bin/WCCILpmon -config $cwd/Projects/TfCustomizedQG/config/config -n -autofreg -status -log +stderr || true + + - name: Start WinCC OA tests + working-directory: /opt/WinCC_OA/3.19/bin/ + run: | + echo ****** Execute WinCC OA Tests + ls -la /opt/WinCC_OA/3.19/ + ./WCCOActrl -proj TfCustomizedQG -n testRunner.ctl {\'testRunId\':\'Regression-tests\',\'registerGlobalProject\':true,\'registerAllTools\':true,\'registerAllTemplates\':true,\'showLogViewer\':false,\'TfTestManager.checkForPossibleFreezeTests\':true} -log +stderr -lang en_US.utf8 + + - name: Convert WinCC OA tests to jUnit + working-directory: /opt/WinCC_OA/3.19/bin/ + run: | + echo ****** Convert results into jUnit format + ./WCCOActrl -proj TfCustomizedQG -n oaTestParsers/jsonToJUnit.ctl -log +stderr -lang en_US.utf8 + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + with: + fail_on_failure : true + require_tests : true + report_paths : /__w/CtrlppCheck/CtrlppCheck/WinCC_OA_Test/Results/jUnit*.xml + release: if: github.event_name == 'release' name: Release runs-on: ubuntu-20.04 - needs: package + needs: tests steps: - name: Get the version @@ -222,3 +368,24 @@ jobs: uses: softprops/action-gh-release@v1 with: files: WinCCOA_QualityChecks_${{ github.event.release.tag_name }}.zip + +# current html is not really user friendly, therefor deactivated +## inspired by https://nimblehq.co/blog/create-github-wiki-pull-request +# publish-help: +# if: github.event_name == 'release' +# name: Publish help +# runs-on: ubuntu-20.04 +# needs: tests +# steps: +# - name: Download help +# uses: actions/download-artifact@v3 +# with: +# name: html-help +# path: ${{github.workspace}}/docs/ +# +# - name: Publish GitHub pages help +# uses: peaceiris/actions-gh-pages@v3 +# with: +# github_token: ${{ secrets.WIKI_ACTION_TOKEN }} +# publish_dir: ./docs +# diff --git a/WinCC_OA_Test/TestSuites/suite_CtrlppCheck/sub_app/scripts/QgCtrlppcheckTests.ctl b/WinCC_OA_Test/TestSuites/suite_CtrlppCheck/sub_app/scripts/QgCtrlppcheckTests.ctl index 0d05ee3a..003bed27 100644 --- a/WinCC_OA_Test/TestSuites/suite_CtrlppCheck/sub_app/scripts/QgCtrlppcheckTests.ctl +++ b/WinCC_OA_Test/TestSuites/suite_CtrlppCheck/sub_app/scripts/QgCtrlppcheckTests.ctl @@ -19,11 +19,13 @@ class MockCppCheck : CppCheck { + string tcId; + public void checkFile(const string &testFile) { string s; fileToString(testFile, s, "UTF8"); - s = substr(s, 0, strpos(s, "\n")); // get fist lines + s = substr(s, 0, strpos(s, "\n")); // get first line const string key = "// start options: "; int idx = strpos(s, key); @@ -32,15 +34,15 @@ class MockCppCheck : CppCheck else s = ""; - DebugFTN("MockCppCheck", __FUNCTION__, testFile, s); + oaUnitInfo(tcId, "Start check of test file: " + testFile + ", with options:" + s); start(testFile + s); stdErrToErrList(); } public void compare(const string &refFile) { - DebugFTN("MockCppCheck", __FUNCTION__, refFile); - const string tcId = "Ctrlppcheck." + baseName(refFile); + tcId = "Ctrlppcheck." + baseName(refFile); + oaUnitInfo(tcId, "Compare result with reference file: " + refFile); string str; bool hasFailedRead = fileToString(refFile, str, "UTF8"); str.trim(); @@ -95,8 +97,6 @@ class MockCppCheck : CppCheck // DebugN(__FUNCTION__, map, expErr); oaUnitAssertGreater(tcId, dynContains(simpleErrStrings, expErrorStr), 0, map); } - - } }; @@ -169,6 +169,10 @@ class TstCtrlppcheck : OaTest mkdir(resDir); moveFile(PROJ_PATH + LOG_REL_PATH + "cppcheck-result.xml", resDir + baseName(refFile)); + + // please keep this dummy pass() here to eliminate following failure + // Can not determine test case data ('Ctrlppcheck'). Check results for 'suite_CtrlppCheck/CtrlppCheck_App_3.19' + pass("The file " + path + " has been analyzed"); return 0; } }