|
1 | 1 | name: 🍥GitHub Action Debian |
2 | 2 | run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 |
3 | | -on: [push] |
| 3 | +on: [pull_request] |
4 | 4 | jobs: |
5 | 5 | Run-Tests: |
6 | 6 | runs-on: ubuntu-latest |
7 | 7 | 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 }}." |
9 | 9 | - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" |
10 | 10 | - 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 |
12 | 12 | 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 |
13 | 20 | - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." |
14 | 21 | - 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 |
19 | 22 | - name: 🧰 Install tools |
20 | 23 | run: | |
21 | 24 | 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 |
23 | 26 | - name: 🏗️ Build the stuff |
24 | 27 | 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 |
26 | 33 | - name: 🧫 Run tests |
27 | 34 | run: | |
| 35 | + for dir in ${{ github.workspace }}/base ${{ github.workspace }}/current ; do |
| 36 | + cd $dir |
28 | 37 | 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 --directory . --output-file coverage.info |
| 45 | + lcov --summary coverage.info |
| 46 | + done |
| 47 | + - name: 🏔️Coverage report |
| 48 | + |
| 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 | + |
29 | 55 | - run: echo "🍏 This job's status is ${{ job.status }}." |
0 commit comments