Skip to content

Commit 279dd04

Browse files
committed
Fix "Build main project" job failure by updating to C++17 and optimizing CI workflow
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent 1a2bc61 commit 279dd04

2 files changed

Lines changed: 60 additions & 31 deletions

File tree

.github/workflows/main.yml

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
permissions:
1212
contents: read
1313

14+
env:
15+
GRPC_VERSION: v1.74.1
16+
SKYWALKING_PROTOCOL_REF: a9ee9b1b2b9b3e74a152ebb8b61aac50934ac9ed
17+
1418
jobs:
1519
format:
1620
runs-on: ubuntu-22.04
@@ -26,11 +30,10 @@ jobs:
2630
- name: Run clang-format
2731
run: find ./ -iname "*.h" -o -iname "*.cc" | xargs ./run-clang-format/run-clang-format.py
2832

29-
unit-test:
33+
bazel-test:
3034
runs-on: ubuntu-22.04
3135
steps:
32-
- run: |
33-
echo "/opt/llvm/bin" >> $GITHUB_PATH
36+
- run: echo "/opt/llvm/bin" >> $GITHUB_PATH
3437

3538
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3639

@@ -53,62 +56,88 @@ jobs:
5356
bazel-build-cache-${{ runner.os }}-${{ github.base_ref }}
5457
bazel-build-cache-${{ runner.os }}-
5558
56-
- name: Run bazel test with GCC c++17
57-
run: |
58-
bazel test --config=ci --test_output=all //...
59+
- name: Run bazel test with GCC
60+
run: bazel test --config=ci --test_output=all //...
5961

60-
- name: Run bazel test with CLANG c++17
62+
- name: Run bazel test with CLANG
63+
run: bazel test --config=ci --test_output=all -c opt --config=clang //...
64+
65+
- name: Install lcov and genhtml and link llvm
66+
run: |
67+
sudo apt update
68+
sudo apt -y install lcov
69+
sudo ln -s /usr/bin/llvm-profdata-11 /usr/bin/llvm-profdata
70+
sudo ln -s /usr/bin/llvm-cov-11 /usr/bin/llvm-cov
71+
72+
- name: Run coverage test
73+
run: |
74+
./coverage.sh
75+
76+
cmake-build:
77+
runs-on: ubuntu-22.04
78+
steps:
79+
- run: echo "/opt/llvm/bin" >> $GITHUB_PATH
80+
81+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
82+
83+
- name: Generate dependencies hash
84+
id: deps-hash
6185
run: |
62-
bazel test --config=ci --test_output=all -c opt --config=clang //...
86+
# Create a hash from dependency names and versions
87+
DEPS_STRING="grpc:${{ env.GRPC_VERSION }}|skywalking:${{ env.SKYWALKING_PROTOCOL_REF }}"
88+
DEPS_HASH=$(echo -n "$DEPS_STRING" | sha256sum | cut -c1-8)
89+
echo "hash=$DEPS_HASH" >> $GITHUB_OUTPUT
90+
echo "Dependencies hash (first 8 chars): $DEPS_HASH"
6391
6492
- name: Checkout skywalking-data-collect-protocol
6593
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
6694
with:
6795
repository: apache/skywalking-data-collect-protocol
68-
ref: a9ee9b1b2b9b3e74a152ebb8b61aac50934ac9ed
96+
ref: ${{ env.SKYWALKING_PROTOCOL_REF }}
6997
path: 3rdparty/skywalking-data-collect-protocol
7098

99+
# Cache gRPC build
100+
- name: Cache gRPC build
101+
uses: actions/cache@v3
102+
with:
103+
path: |
104+
grpc/build
105+
/usr/local/lib/libgrpc*
106+
/usr/local/lib/libprotobuf*
107+
/usr/local/lib/cmake/grpc
108+
/usr/local/lib/cmake/protobuf
109+
/usr/local/include/grpc*
110+
/usr/local/include/google/protobuf
111+
/usr/local/bin/grpc_*
112+
/usr/local/bin/protoc
113+
key: grpc-cmake-${{ runner.os }}-${{ steps.deps-hash.outputs.hash }}-${{ hashFiles('CMakeLists.txt', 'cmake/grpc.cmake') }}
114+
restore-keys: |
115+
grpc-cmake-${{ runner.os }}-${{ steps.deps-hash.outputs.hash }}-
116+
grpc-cmake-${{ runner.os }}-
117+
71118
- name: Checkout grpc
72119
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
73120
with:
74121
repository: grpc/grpc
75-
ref: v1.74.1
122+
ref: ${{ env.GRPC_VERSION }}
76123
path: grpc
77124
submodules: true
78125

79-
- name: Install cmake
126+
- name: Install cmake dependencies and run cmake compile
80127
run: |
81128
sudo apt update && sudo apt -y install cmake build-essential
82-
83-
- name: Build grpc
84-
run: |
85129
sudo cmake -S ./grpc -B ./grpc/build
86130
sudo cmake --build ./grpc/build --parallel 8 --target install
87-
88-
- name: Build main project
89-
run: |
90131
sudo cmake -S . -B ./build
91132
sudo cmake --build ./build
92133
93-
- name: Install lcov and genhtml and link llvm
94-
run: |
95-
sudo apt update
96-
sudo apt -y install lcov
97-
sudo ln -s /usr/bin/llvm-profdata-11 /usr/bin/llvm-profdata
98-
sudo ln -s /usr/bin/llvm-cov-11 /usr/bin/llvm-cov
99-
100-
- name: Run coverage test
101-
run: |
102-
./coverage.sh
103-
104134
e2e-test:
105135
runs-on: ubuntu-22.04
106136
steps:
107137
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
108138

109139
- name: Prepare service container
110-
run: |
111-
docker compose -f test/e2e/docker/docker-compose.yml up -d
140+
run: docker compose -f test/e2e/docker/docker-compose.yml up -d
112141

113142
- name: Run e2e
114143
run: |

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ option(GENERATE_CPP2SKY_PKGCONFIG "Generate and install pkg-config files for UN
1919

2020

2121
if(OVERRIDE_CXX_STANDARD_FLAGS)
22-
set(CMAKE_CXX_STANDARD 11)
22+
set(CMAKE_CXX_STANDARD 17)
2323
set(CMAKE_CXX_EXTENSIONS OFF)
2424
endif()
2525

0 commit comments

Comments
 (0)