Skip to content

Commit a761e90

Browse files
committed
GitHub tests: Add coverage report
1 parent 1c757b3 commit a761e90

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

.github/workflows/debian.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,55 @@
11
name: 🍥GitHub Action Debian
22
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
3-
on: [push]
3+
on: [pull_request]
44
jobs:
55
Run-Tests:
66
runs-on: ubuntu-latest
77
steps:
8-
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
8+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event to ${{ github.head_ref }}."
99
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
1010
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
11-
- name: Check out repository code
11+
- name: 📨 Check out the base branch
1212
uses: actions/checkout@v4
13+
with:
14+
path: base
15+
ref: ${{ github.base_ref }}
16+
- name: 📨 Check out repository code
17+
uses: actions/checkout@v4
18+
with:
19+
path: current
1320
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
1421
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
15-
- name: 🧐 List files in the repository
16-
run: |
17-
cd ${{ github.workspace }}
18-
ls
1922
- name: 🧰 Install tools
2023
run: |
2124
sudo apt-get update
22-
sudo apt-get install libtest-cmd-perl
25+
sudo apt-get install libtest-cmd-perl lcov librrd-dev valgrind sed
2326
- name: 🏗️ Build the stuff
2427
run: |
25-
make
28+
for dir in ${{ github.workspace }}/base ${{ github.workspace }}/current ; do
29+
cd $dir
30+
sed -i -e s/[.]ao\\\>/.lo/g lib/test/Module.mk # Need only one kind of object in all binaries for gcov
31+
CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS=-lgcov make PROG_EXTRA=sensord BUILD_STATIC_LIB=0
32+
done
2633
- name: 🧫 Run tests
2734
run: |
35+
for dir in ${{ github.workspace }}/base ${{ github.workspace }}/current ; do
36+
cd $dir
2837
make check
38+
done
39+
- name: 🌨️Coverage report
40+
run: |
41+
for dir in ${{ github.workspace }}/base ${{ github.workspace }}/current ; do
42+
cd $dir
43+
gcov $(find . -name \*.c)
44+
lcov --capture --base $(pwd) --no-external --directory . --output-file coverage.info
45+
lcov --summary coverage.info
46+
done
47+
- name: 🏔️Coverage report
48+
uses: romeovs/[email protected]
49+
with:
50+
lcov-file: "${{ github.workspace }}/current/coverage.info"
51+
lcov-base: "${{ github.workspace }}/base/coverage.info"
52+
github-token: "${{ secrets.token }}"
53+
delete-old-comments: true
54+
2955
- run: echo "🍏 This job's status is ${{ job.status }}."

0 commit comments

Comments
 (0)