-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (44 loc) · 1.42 KB
/
Dockerfile
File metadata and controls
50 lines (44 loc) · 1.42 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
# Dockerfile for verifying CI process locally
# Mirrors the GitHub Actions workflow: format -> tidy -> build -> test
FROM fedora:42
# Install all dependencies (build + test)
RUN dnf install -y \
gcc-c++ \
clang \
clang-tools-extra \
cmake \
ninja-build \
git \
protobuf-devel \
abseil-cpp-devel \
paho-c-devel \
openssl-devel \
mosquitto \
clang-format \
&& dnf clean all
WORKDIR /workspace
# Copy source code
COPY . .
# Set compiler environment
ENV CC=clang
ENV CXX=clang++
# Run CI verification steps in order
RUN echo "=== Step 1: Format Check ===" && \
./scripts/format.sh --check && \
echo "=== Step 2: Configure CMake ===" && \
cmake --preset default && \
echo "=== Step 3: Build (for compile_commands.json) ===" && \
cmake --build build -j$(nproc) && \
echo "=== Step 4: Tidy Check ===" && \
./scripts/tidy.sh --quiet && \
echo "=== Step 5: Start Mosquitto Broker ===" && \
echo "listener 1883" > /tmp/mosquitto.conf && \
echo "allow_anonymous true" >> /tmp/mosquitto.conf && \
mosquitto -c /tmp/mosquitto.conf -d && \
sleep 2 && \
timeout 1 mosquitto_sub -h localhost -t test || true && \
echo "=== Step 6: Run Tests ===" && \
ctest --test-dir build --output-on-failure && \
echo "=== All CI steps passed! ==="
# Default command: print success message
CMD ["echo", "CI verification completed successfully. All checks passed!"]