Skip to content

Commit

Permalink
Add end-to-end test
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll committed Oct 16, 2023
1 parent 349bf42 commit a709a91
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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
10 changes: 2 additions & 8 deletions examples/quickstart-cpp/fedavg_cpp.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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):
Expand Down

0 comments on commit a709a91

Please sign in to comment.