forked from adap/flower
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (82 loc) · 2.4 KB
/
cpp.yml
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
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-22.04
steps:
- uses: actions/checkout@v4
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Cache restore SDK build
uses: actions/cache/restore@v3
with:
path: build/
key: ${{ runner.os }}-sdk-build
- name: Cache restore example build
uses: actions/cache/restore@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 source Formatting
run: |
find src/cc/flwr/src -name '*.cc' | xargs clang-format -i
git diff --exit-code
- name: Check header Formatting
run: |
find src/cc/flwr/include -name '*.h' -not -path "src/cc/flwr/include/flwr/*" | 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 -I../src/cc/flwr/include ../src/cc/flwr/src
- name: End-to-end test
run: |
cd examples/quickstart-cpp
cmake -DUSE_LOCAL_FLWR=ON -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
- name: Cache save SDK build
uses: actions/cache/save@v3
if: github.ref_name == 'main'
with:
path: build/
key: ${{ runner.os }}-sdk-build
- name: Cache save example build
uses: actions/cache/save@v3
if: github.ref_name == 'main'
with:
path: examples/quickstart-cpp/build/
key: ${{ runner.os }}-example-build