-
Notifications
You must be signed in to change notification settings - Fork 907
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
530345e
commit fafb690
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: C++ SDK | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
paths: ['src/cc/flwr/**'] | ||
pull_request: | ||
branches: ['main'] | ||
paths: ['src/cc/flwr/**'] | ||
|
||
jobs: | ||
build_and_test: | ||
name: Build and test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Bootstrap | ||
uses: ./.github/actions/bootstrap | ||
|
||
- name: Cache SDK build | ||
uses: actions/cache@v3 | ||
with: | ||
path: build/ | ||
key: ${{ runner.os }}-sdk-build | ||
|
||
- name: Cache example build | ||
uses: actions/cache@v3 | ||
with: | ||
path: examples/quickstart-cpp/build/ | ||
key: ${{ runner.os }}-example-build | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y clang-format cmake g++ clang-tidy cppcheck | ||
- name: Check Formatting | ||
run: | | ||
find src/cc/flwr -name '*.cc' -or -name '*.h' | xargs clang-format -i | ||
git diff --exit-code | ||
- name: Build | ||
run: | | ||
mkdir -p build | ||
cd build | ||
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../src/cc/flwr | ||
make | ||
- name: Run clang-tidy | ||
run: | | ||
cd build | ||
find ../src/cc/flwr/src -name '*.cc' | xargs clang-tidy | ||
- name: Run cppcheck | ||
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 | ||