Skip to content

Bazel module support #335

Bazel module support

Bazel module support #335

Workflow file for this run

# 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
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 c++17
run: |
bazel test --config=ci --test_output=all //...
- name: Run bazel test with CLANG c++17
run: |
bazel test --config=ci --test_output=all -c opt --config=clang //...
- name: Checkout skywalking-data-collect-protocol
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: apache/skywalking-data-collect-protocol
ref: a9ee9b1b2b9b3e74a152ebb8b61aac50934ac9ed
path: 3rdparty/skywalking-data-collect-protocol
- name: Checkout grpc
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: grpc/grpc
ref: v1.74.1
path: grpc
submodules: true
- name: Install cmake
run: |
sudo apt update && sudo apt -y install cmake build-essential
- name: Build grpc
run: |
sudo cmake -S ./grpc -B ./grpc/build
sudo cmake --build ./grpc/build --parallel 8 --target install
- name: Build main project
run: |
sudo cmake -S . -B ./build
sudo cmake --build ./build
- name: Install lcov and genhtml and link llvm
run: |
sudo apt update
sudo apt -y install lcov
sudo ln -s /usr/bin/llvm-profdata-11 /usr/bin/llvm-profdata
sudo ln -s /usr/bin/llvm-cov-11 /usr/bin/llvm-cov
- name: Run coverage test
run: |
./coverage.sh
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