|
1 |
| -# Copyright 2022 Contributors to the Eclipse Foundation |
| 1 | +# Copyright 2023 Contributors to the Eclipse Foundation |
2 | 2 | #
|
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | # you may not use this file except in compliance with the License.
|
@@ -64,56 +64,92 @@ runs:
|
64 | 64 | -DOPENSSL_ROOT_DIR=../build_${{ matrix.arch }} \
|
65 | 65 | -DOPENSSL_CRYPTO_LIBRARY=../build_${{ matrix.arch }}/lib/libcrypto.so \
|
66 | 66 | -DSUA_BUILD_NUMBER=${{ inputs.run_number }} \
|
67 |
| - -DSUA_BUILD_TESTS=NO \ |
| 67 | + -DSUA_BUILD_TESTS=YES \ |
| 68 | + -DSUA_MEASURE_CODE_COVERAGE=NO \ |
68 | 69 | ..
|
69 | 70 | make -j
|
70 | 71 | make install
|
71 | 72 | shell: bash
|
72 | 73 |
|
73 |
| - - name: Build for ${{ inputs.arch }} (with code-coverage enabled) |
74 |
| - if: ${{ inputs.arch=='amd64' }} |
| 74 | + - name: Build for amd64 with code-coverage enabled |
| 75 | + if: ${{ inputs.arch == 'amd64' }} |
75 | 76 | run: |
|
76 | 77 | cd build_${{ inputs.arch }}
|
77 | 78 | cmake \
|
78 |
| - -DCMAKE_INSTALL_PREFIX=../dist_${{ inputs.arch }}_testing \ |
| 79 | + -DCMAKE_INSTALL_PREFIX=../dist_${{ inputs.arch }}_codecov \ |
79 | 80 | -DCMAKE_TOOLCHAIN_FILE=../cmake/linux/${{ matrix.arch }}/toolchain.cmake \
|
80 | 81 | -DOPENSSL_ROOT_DIR=../build_${{ matrix.arch }} \
|
81 | 82 | -DOPENSSL_CRYPTO_LIBRARY=../build_${{ matrix.arch }}/lib/libcrypto.so \
|
82 | 83 | -DSUA_BUILD_NUMBER=${{ inputs.run_number }} \
|
83 | 84 | -DSUA_BUILD_TESTS=YES \
|
| 85 | + -DSUA_MEASURE_CODE_COVERAGE=YES \ |
84 | 86 | ..
|
85 | 87 | make -j
|
86 | 88 | make install
|
87 | 89 | shell: bash
|
88 | 90 |
|
89 |
| - - name: Run unit tests |
90 |
| - if: ${{ inputs.arch=='amd64' }} |
| 91 | + - name: Run unit tests for amd64 |
| 92 | + if: ${{ inputs.arch == 'amd64' }} |
| 93 | + run: | |
| 94 | + cd dist_${{ inputs.arch }}/utest |
| 95 | + ls -la |
| 96 | + chmod +x TestSelfUpdateAgent |
| 97 | + uname -a |
| 98 | + file TestSelfUpdateAgent |
| 99 | + ./TestSelfUpdateAgent > ../../unit_tests_report_${{ inputs.arch }}.txt |
| 100 | + shell: bash |
| 101 | + |
| 102 | + - uses: uraimo/run-on-arch-action@v2 |
| 103 | + name: Run unit tests for arm64 |
| 104 | + if: ${{ inputs.arch == 'arm64' }} |
| 105 | + with: |
| 106 | + arch: aarch64 |
| 107 | + distro: ubuntu_latest |
| 108 | + dockerRunArgs: | |
| 109 | + --volume "${PWD}:/sua" |
| 110 | + shell: /bin/sh |
| 111 | + run: | |
| 112 | + cd /sua/dist_arm64/utest |
| 113 | + ls -la ../lib |
| 114 | + ldd TestSelfUpdateAgent |
| 115 | + LD_LIBRARY_PATH=../lib ./TestSelfUpdateAgent > ../../unit_tests_report_arm64.txt |
| 116 | +
|
| 117 | + - name: Collect code-coverage for amd64 |
| 118 | + if: ${{ inputs.arch == 'amd64' }} |
91 | 119 | run: |
|
92 |
| - cd dist_${{ inputs.arch }}_testing/utest |
93 |
| - ./TestSelfUpdateAgent > ../../unit_tests_report.txt |
| 120 | + cd dist_${{ inputs.arch }}_codecov/utest |
| 121 | + ./TestSelfUpdateAgent |
94 | 122 | shell: bash
|
95 | 123 |
|
96 |
| - - name: Generate reports |
97 |
| - if: ${{ (inputs.arch=='amd64') && (success() || failure()) }} |
| 124 | + - name: Generate code-coverage report |
| 125 | + if: ${{ (inputs.arch == 'amd64') && (success() || failure()) }} |
98 | 126 | run: |
|
99 |
| - cd dist_${{ inputs.arch }}_testing/utest |
| 127 | + cd dist_${{ inputs.arch }}_codecov/utest |
100 | 128 |
|
101 | 129 | mkdir report
|
102 | 130 | gcovr --root ../.. --html --html-details --output report/coverage.html -e ../../3rdparty -e ../../utest -e ../../src/main.cpp
|
103 | 131 | gcovr --root ../.. --txt --output report/coverage.txt -e ../../3rdparty -e ../../utest -e ../../src/main.cpp
|
104 | 132 | tar -czvf ../../code-coverage.tar.gz report
|
105 | 133 |
|
106 |
| - echo -e "### Code Coverage Summary\n" >> report.md |
| 134 | + echo -e "### Code-coverage summary for" ${{ inputs.arch }} "\n" >> report.md |
107 | 135 | echo -e "\`\`\`" >> report.md
|
108 | 136 | cat report/coverage.txt >> report.md
|
109 | 137 | echo -e "\n\`\`\`\n" >> report.md
|
110 | 138 |
|
111 |
| - echo -e "### Unit Tests Results\n" >> report.md |
| 139 | + cat report.md >> $GITHUB_STEP_SUMMARY |
| 140 | + shell: bash |
| 141 | + |
| 142 | + - name: Generate unit tests report for ${{ inputs.arch }} |
| 143 | + if: ${{ success() || failure() }} |
| 144 | + run: | |
| 145 | + cd dist_${{ inputs.arch }}/utest |
| 146 | +
|
| 147 | + echo -e "### Unit tests results for" ${{ inputs.arch }} "\n" >> report.md |
112 | 148 | echo -e "\`\`\`" >> report.md
|
113 |
| - cat ../../unit_tests_report.txt >> report.md |
| 149 | + cat ../../unit_tests_report_${{ inputs.arch }}.txt >> report.md |
114 | 150 | echo -e "\n\`\`\`\n" >> report.md
|
115 | 151 |
|
116 |
| - cat report.md > $GITHUB_STEP_SUMMARY |
| 152 | + cat report.md >> $GITHUB_STEP_SUMMARY |
117 | 153 | shell: bash
|
118 | 154 |
|
119 | 155 | - name: Compress artifacts
|
|
0 commit comments