-
Notifications
You must be signed in to change notification settings - Fork 15
171 lines (148 loc) · 4.75 KB
/
hil-integration-linux.yml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: "HIL: Linux Integration"
on:
workflow_dispatch:
inputs:
api-url:
required: true
type: string
api-key-id:
required: true
type: string
coap_gateway_url:
required: true
type: string
workflow_call:
inputs:
api-url:
required: true
type: string
api-key-id:
required: true
type: string
coap_gateway_url:
required: true
type: string
jobs:
hil-matrix:
name: linux-hil-matrix
runs-on: ubuntu-24.04
outputs:
tests: ${{ steps.output-tests.outputs.tests }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare tests matrix
id: output-tests
shell: python
run: |
import json
import os
from pathlib import Path
tests = [p.name for p in Path('tests/hil/tests').iterdir()]
with open(os.environ['GITHUB_OUTPUT'], 'a') as github_output:
print('tests=' + json.dumps(tests), file=github_output)
hil:
name: linux-hil-tests
runs-on: ubuntu-24.04
needs: hil-matrix
strategy:
fail-fast: false
matrix:
test: ${{ fromJSON(needs.hil-matrix.outputs.tests) }}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
path: .
submodules: 'recursive'
- name: Compile
shell: bash
run: |
export EXTRA_BUILD_ARGS=-DCONFIG_GOLIOTH_COAP_HOST_URI=${{ inputs.coap_gateway_url }}
cmake -B build -S tests/hil/platform/linux \
$EXTRA_BUILD_ARGS -DGOLIOTH_HIL_TEST=${{ matrix.test }}
make -j$(nproc) -C build
- name: Setup Python dependencies
run: |
pip install \
gcovr \
pytest \
pytest-timeout \
tests/hil/scripts/pytest-hil \
git+https://github.com/golioth/[email protected]
- name: Run test
id: run_test
shell: bash
env:
test: ${{ matrix.test }}
run: |
rm -rf summary
mkdir summary
rm -rf allure-reports
pytest --rootdir . tests/hil/tests/$test \
--board linux \
--fw-image build/hil \
--api-url ${{ inputs.api-url }} \
--api-key ${{ secrets[inputs.api-key-id] }} \
--mask-secrets \
-rP \
--timeout=600 \
--junitxml=summary/hil-linux-${test}.xml \
--alluredir=allure-reports \
--platform linux
gcovr \
--gcov-ignore-parse-errors=negative_hits.warn_once_per_file \
--merge-mode-functions=separate \
--json coverage.json \
build
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: linux-hil-test-coverage-${{ matrix.test }}
path: |
coverage.json
- name: Safe upload CI report summary
uses: ./.github/actions/safe-upload-artifacts
if: always()
with:
name: ci-hil-linux-${{ matrix.test }}
path: summary/hil-linux-*.xml
- name: Safe upload Allure reports
if: always()
uses: ./.github/actions/safe-upload-artifacts
with:
secrets-json: ${{ toJson(secrets) }}
name: allure-reports-hil-linux-${{ matrix.test }}
path: allure-reports
hil-summary:
name: linux-hil-tests-summary
runs-on: ubuntu-24.04
needs: hil
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Collect JUnit reports
uses: actions/download-artifact@v4
with:
pattern: ci-hil-linux-*
- name: Prepare summary
if: always()
shell: bash
run: |
if ! command -v sudo; then
# Self-hosted runner docker images don't have sudo installed
mkdir -p -m 777 /tmp && apt update && apt install -y xml-twig-tools
else
sudo apt install -y xml-twig-tools
fi
xml_grep --pretty_print indented \
--wrap testsuites --descr '' \
--cond "testsuite" \
ci-hil-linux-*/*.xml \
> hil-linux.xml
- name: Safe upload CI report summary
uses: ./.github/actions/safe-upload-artifacts
if: always()
with:
name: ci-summary-hil-linux
path: hil-linux.xml