Repository navigation
177 lines (153 loc) · 4.66 KB
/
Copy pathtest.yaml
File metadata and controls
177 lines (153 loc) · 4.66 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
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
172
173
174
175
176
177
# SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0
name: Test
on:
workflow_call:
inputs:
container_image:
required: true
type: string
ref:
required: true
type: string
env:
CMAKE_BUILD_OPTS: --parallel $(nproc)
CMAKE_OPTS: -DCMAKE_INSTALL_PREFIX=${PREFIX}
CCACHE: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
CCACHE_DIR: ${{ github.workspace }}/.ccache
permissions:
contents: read
packages: read
actions: read
jobs:
python:
name: Python
runs-on: ubuntu-latest
container:
image: ${{ inputs.container_image }}/dev-fedora:${{ inputs.ref }}
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
allow-unsafe-pr-checkout: true
fetch-depth: 0
submodules: recursive
- name: Run Python tests
run: |
cd python
pytest --verbose .
- name: Check formatting
run: |
cd python
black --line-length=90 --extend-exclude=".*(\.pyi|_pb2.py)$" --check .
- name: Lint with flake8
run: |
cd python
flake8 --max-line-length=90 --extend-exclude="*.pyi,*_pb2.py" .
- name: Type check with mypy
run: |
cd python
mypy --namespace-packages --explicit-package-bases .
cppcheck:
name: CPPCheck
runs-on: ubuntu-latest
container:
image: ${{ inputs.container_image }}/dev-fedora:${{ inputs.ref }}
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
allow-unsafe-pr-checkout: true
fetch-depth: 0
submodules: recursive
- name: Run cppcheck
run: ./tools/run-cppcheck.sh | tee cppcheck.log
- name: Upload CPPCheck Log
uses: actions/upload-artifact@v7
if: failure()
with:
name: cppcheck-log
path: cppcheck.log
unit:
name: Unit Tests
runs-on: ubuntu-latest
container:
image: ${{ inputs.container_image }}/dev-fedora:${{ inputs.ref }}
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
allow-unsafe-pr-checkout: true
fetch-depth: 0
submodules: recursive
- name: Reuse compiled tree from Build Source [fedora]
uses: actions/download-artifact@v7
with:
name: build-fedora
path: build
- name: Setup ccache
uses: actions/cache/restore@v6
with:
path: ${{ github.workspace }}/.ccache
key: ccache-fedora-${{ inputs.ref }}
restore-keys: ccache-fedora-
- name: Configure
run: cmake -S . -B build ${{ env.CCACHE }}
- name: Build and run unit tests
run: LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH cmake --build build ${{ env.CMAKE_BUILD_OPTS }} --target run-unit-tests run-unit-tests-common
integration:
name: Integration Tests
runs-on: ubuntu-latest
container:
image: ${{ inputs.container_image }}/dev-fedora:${{ inputs.ref }}
options: --user root
services:
rabbitmq:
image: rwthacs/rabbitmq
redis:
image: redis:6.2
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
allow-unsafe-pr-checkout: true
fetch-depth: 0
submodules: recursive
- name: Reuse compiled tree from Build Source [fedora]
uses: actions/download-artifact@v7
with:
name: build-fedora
path: build
- name: Setup ccache
uses: actions/cache/restore@v6
with:
path: ${{ github.workspace }}/.ccache
key: ccache-fedora-${{ inputs.ref }}
restore-keys: ccache-fedora-
- name: Start Mosquitto
run: |
echo "127.0.0.1 mosquitto" >> /etc/hosts
cat > /tmp/mosquitto.conf <<'EOF'
listener 1883
allow_anonymous true
EOF
mosquitto -c /tmp/mosquitto.conf -d
- name: Configure
run: |
cmake -S . -B build ${{ env.CCACHE }}
cmake --build build --target install
- name: Build and run Integration Tests
run: cmake --build build --target run-integration-tests
- name: Upload Integration Test Artifacts
uses: actions/upload-artifact@v7
if: always()
with:
name: integration-tests
path: build/tests/integration/