-
-
Notifications
You must be signed in to change notification settings - Fork 23
69 lines (58 loc) · 2.24 KB
/
coverage.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
name: Code Coverage
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions: read-all
jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Set up Clang 15
env:
LLVM_VERSION: 15
run: |
sudo apt-get update -y -q
sudo apt-get install -y -q build-essential lsb-release wget software-properties-common gnupg
sudo wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh ${LLVM_VERSION}
sudo apt-get install -y -q libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100
- name: Set up CMake and Ninja
uses: lukka/get-cmake@latest
- name: Set up Conan
run: |
python -m pip install --upgrade pip
pip install conan
conan profile detect --force
conan export third_party/funchook --version 1.1.3
conan install . --build=missing -s compiler.cppstd=17 -s compiler.libcxx=libc++ -s build_type=Debug -c tools.cmake.cmaketoolchain:generator=Ninja
- name: Build with CMake
run: |
cmake --preset conan-debug -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON
cmake --build build/Debug
- name: Run Tests and Generate Coverage Data
run: |
pip install gcovr
ctest --test-dir build/Debug
gcovr -r . --filter src/endstone_core/ --gcov-executable "llvm-cov gcov" --xml coverage.xml build/Debug
- name: Upload Coverage Reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}