92 lines
2.4 KiB
YAML
92 lines
2.4 KiB
YAML
name: Code coverage
|
|
|
|
on:
|
|
push:
|
|
branches: ["master"]
|
|
paths-ignore:
|
|
- 'docker-compose/**'
|
|
- 'docs/**'
|
|
- 'README.md'
|
|
|
|
pull_request:
|
|
|
|
jobs:
|
|
coverage:
|
|
|
|
timeout-minutes: 60
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev lcov xz-utils
|
|
|
|
- name: Install clang
|
|
run: |
|
|
wget https://apt.llvm.org/llvm.sh
|
|
chmod +x llvm.sh
|
|
sudo ./llvm.sh 20 all
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Build tests
|
|
run: |
|
|
cd tests
|
|
mkdir build
|
|
cd build
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DDEV_DEBUG=ON -DWITH_COVERAGE=ON -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
|
make -j$(nproc) p2pool_tests
|
|
|
|
- name: Run tests
|
|
run: |
|
|
cd tests/build
|
|
unxz *.xz
|
|
LLVM_PROFILE_FILE="p2pool_tests.profraw" ./p2pool_tests
|
|
|
|
- name: Merge profile data
|
|
run: |
|
|
cd tests/build
|
|
llvm-profdata-20 merge -sparse ./p2pool_tests.profraw -o ./p2pool_tests.profdata
|
|
|
|
- name: Export profile data
|
|
run: |
|
|
cd tests/build
|
|
llvm-cov-20 export ./p2pool_tests -format=lcov -instr-profile=./p2pool_tests.profdata > coverage.info
|
|
|
|
- name: Run genhtml
|
|
run: |
|
|
cd tests/build
|
|
genhtml --demangle-cpp -o coverage coverage.info
|
|
|
|
- name: Checkout GitHub Pages repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: SChernykh/SChernykh.github.io
|
|
token: ${{ secrets.PAGES_DEPLOY_TOKEN }}
|
|
path: gh-pages
|
|
|
|
- name: Copy coverage report to GitHub Pages repo
|
|
run: |
|
|
rm -rf gh-pages/p2pool-coverage
|
|
cp -r tests/build/coverage gh-pages/p2pool-coverage
|
|
|
|
- name: Commit and push coverage report
|
|
run: |
|
|
cd gh-pages
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add p2pool-coverage
|
|
git commit -m "Update p2pool coverage report"
|
|
git push
|
|
|
|
- name: Archive coverage data
|
|
if: '!cancelled()'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: p2pool-coverage
|
|
path: tests/build/coverage
|