diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 3f59edee191d..abc7e9b58a11 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -14,8 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Bootstrap + uses: ./.github/actions/bootstrap - name: Install Dependencies run: | @@ -43,3 +44,22 @@ jobs: run: | cd build cppcheck --enable=all --inline-suppr --suppress=missingIncludeSystem -I../src/cc/flwr/include ../src/cc/flwr/src + + - name: End-to-end test + run: | + cd examples/quickstart-cpp + cmake -S . -B build + cmake --build build + pip install ../.. + timeout 2m python server.py & + pid=$! + sleep 3 + build/flwr_client 0 127.0.0.1:8080 & + sleep 3 + build/flwr_client 1 127.0.0.1:8080 & + wait $pid + res=$? + if [[ "$res" = "0" ]]; + then echo "Training worked correctly"; + else echo "Training had an issue" && exit 1; + fi diff --git a/examples/quickstart-cpp/fedavg_cpp.py b/examples/quickstart-cpp/fedavg_cpp.py index 263fcf8cabcd..672858fb8c48 100644 --- a/examples/quickstart-cpp/fedavg_cpp.py +++ b/examples/quickstart-cpp/fedavg_cpp.py @@ -1,11 +1,8 @@ -from ast import Bytes -from collections import OrderedDict -from io import BytesIO import struct -from typing import Callable, Dict, List, Tuple, Union +from ast import Bytes +from typing import Callable, Dict, List, Optional, Tuple, Union import numpy as np - from flwr.server.strategy import FedAvg from flwr.common import ( EvaluateRes, @@ -14,11 +11,8 @@ Scalar, NDArrays, ) -from typing import Optional -from flwr.server.client_manager import ClientManager from flwr.server.client_proxy import ClientProxy from flwr.server.strategy.aggregate import aggregate, weighted_loss_avg -from numpy import bytes_, numarray class FedAvgCpp(FedAvg):