-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (78 loc) · 2.61 KB
/
test_unit_cpp.yml
File metadata and controls
96 lines (78 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: 'Test Unit C++'
description: |
This workflow builds the library and runs the unit tests.
on:
workflow_call:
inputs:
artifact-name:
description: 'Name of the artifact'
required: true
type: string
jobs:
test-unit-cpp:
name: 'Test Unit C++'
runs-on: ubuntu-latest
env:
SERIAL_TEST_PORT_IN: /tmp/ttyCI_IN
SERIAL_TEST_PORT_OUT: /tmp/ttyCI_OUT
TEST_REPORT_NAME: 'test_report.xml'
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Download artifact'
uses: actions/download-artifact@v4
with:
name: ${{ github.event.inputs.artifact-name }}
path: 'artifacts'
- name: 'Setup GCC'
uses: egor-tensin/setup-gcc@v2
with:
version: '14'
platform: 'x64'
- name: 'Setup CMake'
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.31.x'
- name: 'Configure CMake'
run: |
cmake --preset linux-gcc-release
- name: 'Build'
id: 'build'
run: |
cmake --build --preset linux-gcc-release --target cpp_bindings_linux_tests
- name: 'Install test dependencies'
run: |
sudo apt-get install -y socat
- name: Start virtual serial echo (socat)
run: |
socat -d -d pty,raw,echo=0,link=$SERIAL_TEST_PORT_IN,mode=666 pty,raw,echo=0,link=$SERIAL_TEST_PORT_OUT,mode=666 &
sleep 2
stdbuf -i0 -o0 cat < $SERIAL_TEST_PORT_OUT > $SERIAL_TEST_PORT_OUT &
sleep 1
- name: 'Run tests'
working-directory: 'build'
env:
LD_LIBRARY_PATH: '${{ github.workspace }}/artifacts'
SERIAL_TEST_PORT: '${{ env.SERIAL_TEST_PORT_IN }}'
run: |
chmod +x ./cpp_bindings_linux_tests
./cpp_bindings_linux_tests \
--gtest_color=yes \
--gtest_output=xml:$TEST_REPORT_NAME
- name: 'Upload test report'
if: always()
uses: actions/upload-artifact@v4
with:
name: 'test_reports'
path: 'build/${{ env.TEST_REPORT_NAME }}'
- name: 'Publish test report'
if: always()
uses: mikepenz/action-junit-report@v5
with:
report_paths: 'build/${{ env.TEST_REPORT_NAME }}'
detailed_summary: true
group_suite: true
include_passed: true
annotate_notice: true
transformers: '[{"searchValue": "${{ github.workspace }}", "replaceValue": ""}]'
check_title_template: '{{FILE_NAME}} | {{TEST_NAME}}'