|
8 | 8 | pull_request: |
9 | 9 | branches: [ main ] |
10 | 10 |
|
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +env: |
| 15 | + GRPC_VERSION: v1.74.1 |
| 16 | + SKYWALKING_PROTOCOL_REF: a9ee9b1b2b9b3e74a152ebb8b61aac50934ac9ed |
| 17 | + |
11 | 18 | jobs: |
12 | 19 | format: |
13 | | - runs-on: ubuntu-20.04 |
| 20 | + runs-on: ubuntu-22.04 |
14 | 21 | steps: |
15 | | - - uses: actions/checkout@v3 |
16 | | - - name: Setup clang-format |
17 | | - run: | |
18 | | - git clone https://github.com/Sarcasm/run-clang-format.git |
| 22 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 23 | + |
| 24 | + - name: Checkout clang-format |
| 25 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 26 | + with: |
| 27 | + repository: Sarcasm/run-clang-format |
| 28 | + path: run-clang-format |
| 29 | + |
19 | 30 | - name: Run clang-format |
20 | 31 | run: find ./ -iname "*.h" -o -iname "*.cc" | xargs ./run-clang-format/run-clang-format.py |
21 | 32 |
|
22 | 33 | unit-test: |
23 | | - runs-on: ubuntu-20.04 |
| 34 | + runs-on: ubuntu-22.04 |
24 | 35 | steps: |
25 | | - - run: | |
26 | | - echo "/opt/llvm/bin" >> $GITHUB_PATH |
27 | | - - uses: actions/checkout@v3 |
28 | | - - name: Run bazel test with GCC c++11 |
29 | | - run: | |
30 | | - bazel test --test_output=all --cxxopt=-std=c++0x //... |
31 | | - - name: Run bazel test with GCC c++17 |
32 | | - run: | |
33 | | - bazel test --test_output=all --cxxopt=-std=c++17 //... |
34 | | - - name: Run bazel test with CLANG c++11 |
35 | | - run: | |
36 | | - bazel test --test_output=all -c dbg --config=clang --cxxopt=-std=c++0x //... |
37 | | - - name: Run bazel test with CLANG c++17 |
| 36 | + - run: echo "/opt/llvm/bin" >> $GITHUB_PATH |
| 37 | + |
| 38 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 39 | + |
| 40 | + # Cache Bazel repository cache |
| 41 | + - name: Cache Bazel repository cache |
| 42 | + uses: actions/cache@v3 |
| 43 | + with: |
| 44 | + path: ~/.cache/bazel/_bazel_runner/cache/repos/v1 |
| 45 | + key: bazel-repo-cache-${{ runner.os }}-${{ hashFiles('MODULE.bazel', 'WORKSPACE', 'WORKSPACE.bzlmod') }} |
| 46 | + restore-keys: | |
| 47 | + bazel-repo-cache-${{ runner.os }}- |
| 48 | + |
| 49 | + # Cache Bazel build outputs |
| 50 | + - name: Cache Bazel build cache |
| 51 | + uses: actions/cache@v3 |
| 52 | + with: |
| 53 | + path: ~/.cache/bazel |
| 54 | + key: bazel-build-cache-${{ runner.os }}-${{ github.sha }} |
| 55 | + restore-keys: | |
| 56 | + bazel-build-cache-${{ runner.os }}-${{ github.base_ref }} |
| 57 | + bazel-build-cache-${{ runner.os }}- |
| 58 | +
|
| 59 | + - name: Run bazel test with GCC |
| 60 | + run: bazel test --config=ci --test_output=all //... |
| 61 | + |
| 62 | + - name: Run bazel test with CLANG |
| 63 | + run: bazel test --config=ci --test_output=all -c opt --config=clang //... |
| 64 | + |
| 65 | +# TODO: enable when fixed |
| 66 | +# - name: Install lcov and genhtml and link llvm |
| 67 | +# run: | |
| 68 | +# sudo apt-get update |
| 69 | +# sudo apt-get install -y lcov lld |
| 70 | +# sudo ln -s /usr/bin/llvm-profdata-16 /usr/bin/llvm-profdata |
| 71 | +# sudo ln -s /usr/bin/llvm-cov-16 /usr/bin/llvm-cov |
| 72 | + |
| 73 | +# - name: Run coverage test |
| 74 | +# run: | |
| 75 | +# ./coverage.sh |
| 76 | + |
| 77 | + cmake-build: |
| 78 | + runs-on: ubuntu-22.04 |
| 79 | + steps: |
| 80 | + - run: echo "/opt/llvm/bin" >> $GITHUB_PATH |
| 81 | + |
| 82 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 83 | + |
| 84 | + - name: Generate dependencies hash |
| 85 | + id: deps-hash |
38 | 86 | run: | |
39 | | - bazel test --test_output=all -c opt --config=clang --cxxopt=-std=c++17 //... |
| 87 | + # Create a hash from dependency names and versions |
| 88 | + DEPS_STRING="grpc:${{ env.GRPC_VERSION }}|skywalking:${{ env.SKYWALKING_PROTOCOL_REF }}" |
| 89 | + DEPS_HASH=$(echo -n "$DEPS_STRING" | sha256sum | cut -c1-8) |
| 90 | + echo "hash=$DEPS_HASH" >> $GITHUB_OUTPUT |
| 91 | + echo "Dependencies hash (first 8 chars): $DEPS_HASH" |
| 92 | +
|
| 93 | + - name: Checkout skywalking-data-collect-protocol |
| 94 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 95 | + with: |
| 96 | + repository: apache/skywalking-data-collect-protocol |
| 97 | + ref: ${{ env.SKYWALKING_PROTOCOL_REF }} |
| 98 | + path: 3rdparty/skywalking-data-collect-protocol |
| 99 | + |
| 100 | + # Cache gRPC build |
| 101 | + - name: Cache gRPC build |
| 102 | + uses: actions/cache@v3 |
| 103 | + with: |
| 104 | + path: | |
| 105 | + grpc/build |
| 106 | + /usr/local/lib/libgrpc* |
| 107 | + /usr/local/lib/libprotobuf* |
| 108 | + /usr/local/lib/cmake/grpc |
| 109 | + /usr/local/lib/cmake/protobuf |
| 110 | + /usr/local/include/grpc* |
| 111 | + /usr/local/include/google/protobuf |
| 112 | + /usr/local/bin/grpc_* |
| 113 | + /usr/local/bin/protoc |
| 114 | + key: grpc-cmake-${{ runner.os }}-${{ steps.deps-hash.outputs.hash }}-${{ hashFiles('CMakeLists.txt', 'cmake/grpc.cmake') }} |
| 115 | + restore-keys: | |
| 116 | + grpc-cmake-${{ runner.os }}-${{ steps.deps-hash.outputs.hash }}- |
| 117 | + grpc-cmake-${{ runner.os }}- |
| 118 | +
|
| 119 | + - name: Checkout grpc |
| 120 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 121 | + with: |
| 122 | + repository: grpc/grpc |
| 123 | + ref: ${{ env.GRPC_VERSION }} |
| 124 | + path: grpc |
| 125 | + submodules: true |
| 126 | + |
40 | 127 | - name: Install cmake dependencies and run cmake compile |
41 | 128 | run: | |
42 | | - sudo apt update |
43 | | - sudo apt -y install cmake |
44 | | - sudo git clone -b v9.1.0 https://github.com/apache/skywalking-data-collect-protocol.git ./3rdparty/skywalking-data-collect-protocol |
45 | | - sudo git clone -b v1.46.6 https://github.com/grpc/grpc.git --recursive |
| 129 | + sudo apt-get update |
| 130 | + sudo apt-get install -y cmake build-essential |
46 | 131 | sudo cmake -S ./grpc -B ./grpc/build |
47 | 132 | sudo cmake --build ./grpc/build --parallel 8 --target install |
48 | 133 | sudo cmake -S . -B ./build |
49 | 134 | sudo cmake --build ./build |
50 | | - - name: Install lcov and genhtml and link llvm |
51 | | - run: | |
52 | | - sudo apt update |
53 | | - sudo apt -y install lcov |
54 | | - sudo ln -s /usr/bin/llvm-profdata-11 /usr/bin/llvm-profdata |
55 | | - sudo ln -s /usr/bin/llvm-cov-11 /usr/bin/llvm-cov |
56 | | - - name: Run coverage test |
57 | | - run: | |
58 | | - ./coverage.sh |
59 | 135 |
|
60 | 136 | e2e-test: |
61 | | - runs-on: ubuntu-20.04 |
| 137 | + runs-on: ubuntu-22.04 |
62 | 138 | steps: |
63 | | - - uses: actions/checkout@v3 |
| 139 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 140 | + |
64 | 141 | - name: Prepare service container |
65 | 142 | run: | |
66 | 143 | docker compose -f test/e2e/docker/docker-compose.yml up -d |
| 144 | +
|
67 | 145 | - name: Run e2e |
68 | 146 | run: | |
69 | 147 | sleep 10 |
|
0 commit comments