-
Notifications
You must be signed in to change notification settings - Fork 19
151 lines (126 loc) · 4.95 KB
/
main.yml
File metadata and controls
151 lines (126 loc) · 4.95 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# This is a basic workflow to help you get started with Actions
name: cpp2sky test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
env:
GRPC_VERSION: v1.74.1
SKYWALKING_PROTOCOL_REF: v10.3.0
jobs:
format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Checkout clang-format
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: Sarcasm/run-clang-format
path: run-clang-format
- name: Run clang-format
run: find ./ -iname "*.h" -o -iname "*.cc" | xargs ./run-clang-format/run-clang-format.py
unit-test:
runs-on: ubuntu-22.04
steps:
- run: echo "/opt/llvm/bin" >> $GITHUB_PATH
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
# Cache Bazel repository cache
- name: Cache Bazel repository cache
uses: actions/cache@v3
with:
path: ~/.cache/bazel/_bazel_runner/cache/repos/v1
key: bazel-repo-cache-${{ runner.os }}-${{ hashFiles('MODULE.bazel', 'WORKSPACE', 'WORKSPACE.bzlmod') }}
restore-keys: |
bazel-repo-cache-${{ runner.os }}-
# Cache Bazel build outputs
- name: Cache Bazel build cache
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: bazel-build-cache-${{ runner.os }}-${{ github.sha }}
restore-keys: |
bazel-build-cache-${{ runner.os }}-${{ github.base_ref }}
bazel-build-cache-${{ runner.os }}-
- name: Run bazel test with GCC
run: bazel test --config=ci --test_output=all //...
- name: Run bazel test with CLANG
run: bazel test --config=ci --test_output=all -c opt --config=clang //...
# TODO: enable when fixed
# - name: Install lcov and genhtml and link llvm
# run: |
# sudo apt-get update
# sudo apt-get install -y lcov lld
# sudo ln -s /usr/bin/llvm-profdata-16 /usr/bin/llvm-profdata
# sudo ln -s /usr/bin/llvm-cov-16 /usr/bin/llvm-cov
# - name: Run coverage test
# run: |
# ./coverage.sh
cmake-build:
runs-on: ubuntu-22.04
steps:
- run: echo "/opt/llvm/bin" >> $GITHUB_PATH
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Generate dependencies hash
id: deps-hash
run: |
# Create a hash from dependency names and versions
DEPS_STRING="grpc:${{ env.GRPC_VERSION }}|skywalking:${{ env.SKYWALKING_PROTOCOL_REF }}"
DEPS_HASH=$(echo -n "$DEPS_STRING" | sha256sum | cut -c1-8)
echo "hash=$DEPS_HASH" >> $GITHUB_OUTPUT
echo "Dependencies hash (first 8 chars): $DEPS_HASH"
- name: Checkout skywalking-data-collect-protocol
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: apache/skywalking-data-collect-protocol
ref: ${{ env.SKYWALKING_PROTOCOL_REF }}
path: 3rdparty/skywalking-data-collect-protocol
# Cache gRPC build
- name: Cache gRPC build
uses: actions/cache@v3
with:
path: |
grpc/build
/usr/local/lib/libgrpc*
/usr/local/lib/libprotobuf*
/usr/local/lib/cmake/grpc
/usr/local/lib/cmake/protobuf
/usr/local/include/grpc*
/usr/local/include/google/protobuf
/usr/local/bin/grpc_*
/usr/local/bin/protoc
key: grpc-cmake-${{ runner.os }}-${{ steps.deps-hash.outputs.hash }}-${{ hashFiles('CMakeLists.txt', 'cmake/grpc.cmake') }}
restore-keys: |
grpc-cmake-${{ runner.os }}-${{ steps.deps-hash.outputs.hash }}-
grpc-cmake-${{ runner.os }}-
- name: Checkout grpc
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: grpc/grpc
ref: ${{ env.GRPC_VERSION }}
path: grpc
submodules: true
- name: Install cmake dependencies and run cmake compile
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential
sudo cmake -S ./grpc -B ./grpc/build
sudo cmake --build ./grpc/build --parallel 8 --target install
sudo cmake -S . -B ./build
sudo cmake --build ./build
e2e-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Prepare service container
run: |
docker compose -f test/e2e/docker/docker-compose.yml up -d
- name: Run e2e
run: |
sleep 10
pip3 install --upgrade pip
pip3 install setuptools
pip3 install -r test/e2e/requirements.txt
python3 test/e2e/main.py --expected_file=test/e2e/data/all_expected.yaml --max_retry_times=3