Skip to content

Commit 270a3ee

Browse files
Added unit tests and code coverage reports to workflow and PR
1 parent 487351b commit 270a3ee

File tree

8 files changed

+57
-14
lines changed

8 files changed

+57
-14
lines changed

.github/actions/build-native-binary/action.yaml

+22-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ runs:
6666
-DSUA_BUILD_NUMBER=${{ inputs.run_number }} \
6767
-DSUA_BUILD_TESTS=NO \
6868
..
69-
make
69+
make -j
7070
make install
7171
shell: bash
7272

@@ -82,7 +82,7 @@ runs:
8282
-DSUA_BUILD_NUMBER=${{ inputs.run_number }} \
8383
-DSUA_BUILD_TESTS=YES \
8484
..
85-
make
85+
make -j
8686
make install
8787
shell: bash
8888

@@ -91,9 +91,29 @@ runs:
9191
run: |
9292
cd dist_${{ inputs.arch }}_testing/utest
9393
./TestSelfUpdateAgent > ../../unit_tests_report.txt
94+
shell: bash
95+
96+
- name: Generate reports
97+
if: ${{ (inputs.arch=='amd64') && (success() || failure()) }}
98+
run: |
99+
cd dist_${{ inputs.arch }}_testing/utest
100+
94101
mkdir report
95102
gcovr --root ../.. --html --html-details --output report/coverage.html -e ../../3rdparty -e ../../utest -e ../../src/main.cpp
103+
gcovr --root ../.. --txt --output report/coverage.txt -e ../../3rdparty -e ../../utest -e ../../src/main.cpp
96104
tar -czvf ../../code-coverage.tar.gz report
105+
106+
echo -e "### Code Coverage Summary\n" >> report.md
107+
echo -e "\`\`\`" >> report.md
108+
cat report/coverage.txt >> report.md
109+
echo -e "\n\`\`\`\n" >> report.md
110+
111+
echo -e "### Unit Tests Results\n" >> report.md
112+
echo -e "\`\`\`" >> report.md
113+
cat ../../unit_tests_report.txt >> report.md
114+
echo -e "\n\`\`\`\n" >> report.md
115+
116+
cat report.md > $GITHUB_STEP_SUMMARY
97117
shell: bash
98118

99119
- name: Compress artifacts

.github/workflows/main.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
contents: read
3030
packages: write
3131
id-token: write
32+
pull-requests: write
3233
strategy:
3334
matrix:
3435
arch: [ amd64, arm64 ]

Dockerfile.amd64

+14-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ COPY CMakeLists.txt /work/CMakeLists.txt
2828
RUN cd /work \
2929
&& mkdir -p build_amd64/3rdparty/openssl \
3030
&& mkdir -p dist_amd64 \
31-
&& ./scripts/build_openssl_amd64.sh > /dev/null \
32-
&& ./scripts/build_glib_amd64.sh > /dev/null \
31+
&& ./scripts/build_openssl_amd64.sh > /dev/null
32+
33+
RUN cd /work \
34+
&& ./scripts/build_glib_amd64.sh > /dev/null
35+
36+
RUN cd /work \
3337
&& cd build_amd64 \
3438
&& cmake \
3539
-DCMAKE_INSTALL_PREFIX=../dist_amd64 \
@@ -39,8 +43,14 @@ RUN cd /work \
3943
-DCMAKE_BUILD_TYPE="Release" \
4044
-DSUA_BUILD_NUMBER=$GITHUB_RUN_NUMBER \
4145
-DSUA_COMMIT_HASH=$GITHUB_COMMIT_HASH \
42-
.. \
43-
&& make \
46+
..
47+
48+
RUN cd /work \
49+
&& cd build_amd64 \
50+
&& make -j
51+
52+
RUN cd /work \
53+
&& cd build_amd64 \
4454
&& make install
4555

4656
#Define RUNTIME environment, the final image

Dockerfile.arm64

+14-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ COPY CMakeLists.txt /work/CMakeLists.txt
2828
RUN cd /work \
2929
&& mkdir -p build_arm64/3rdparty/openssl \
3030
&& mkdir -p dist_arm64 \
31-
&& ./scripts/build_openssl_arm64.sh > /dev/null \
32-
&& ./scripts/build_glib_arm64.sh > /dev/null \
31+
&& ./scripts/build_openssl_arm64.sh > /dev/null
32+
33+
RUN cd /work \
34+
&& ./scripts/build_glib_arm64.sh > /dev/null
35+
36+
RUN cd /work \
3337
&& cd build_arm64 \
3438
&& cmake \
3539
-DCMAKE_INSTALL_PREFIX=../dist_arm64 \
@@ -39,8 +43,14 @@ RUN cd /work \
3943
-DCMAKE_BUILD_TYPE="Release" \
4044
-DSUA_BUILD_NUMBER=$GITHUB_RUN_NUMBER \
4145
-DSUA_COMMIT_HASH=$GITHUB_COMMIT_HASH \
42-
.. \
43-
&& make \
46+
..
47+
48+
RUN cd /work \
49+
&& cd build_arm64 \
50+
&& make -j
51+
52+
RUN cd /work \
53+
&& cd build_arm64 \
4454
&& make install
4555

4656
#Define RUNTIME environment, the final image

scripts/build_glib_amd64.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
cd 3rdparty/glib
44
meson subprojects download
55
meson setup -Dwrap_mode=forcefallback ../../build_amd64/glib
6-
meson compile -C ../../build_amd64/glib
6+
meson compile -j `nproc` -C ../../build_amd64/glib

scripts/build_glib_arm64.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
cd 3rdparty/glib
44
meson subprojects download
55
meson setup -Dwrap_mode=forcefallback --cross-file=../meson-cross-file-aarch64.txt ../../build_arm64/glib
6-
meson compile -C ../../build_arm64/glib
6+
meson compile -j `nproc` -C ../../build_arm64/glib

scripts/build_openssl_amd64.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ cd build_amd64/3rdparty/openssl
1010
shared \
1111
-Wl,-rpath=$rootdir/build_amd64/lib \
1212
-Wl,--enable-new-dtags
13-
make install_sw
13+
make -j
14+
make install_sw

scripts/build_openssl_arm64.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ RANLIB=aarch64-linux-gnu-ranlib \
1515
shared \
1616
-Wl,-rpath=$rootdir/build_arm64/lib \
1717
-Wl,--enable-new-dtags
18-
make install_sw
18+
make -j
19+
make install_sw

0 commit comments

Comments
 (0)