pull_request GitHub Action triggered by hramrach π #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: π₯GitHub Action Debian | |
run-name: ${{ github.event_name }} GitHub Action triggered by ${{ github.actor }} π | |
on: [pull_request] | |
jobs: | |
Run-Tests: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "π The job was automatically triggered by a ${{ github.event_name }} event ${{ github.head_ref }} to ${{ github.base_ref }}." | |
- run: echo "π§ This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "π The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: π¨ Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
path: current | |
- name: ποΈ Check out the base branch | |
uses: actions/checkout@v4 | |
with: | |
path: base | |
ref: ${{ github.base_ref }} | |
- name: π¨οΈ checkout lcov | |
uses: actions/checkout@v4 | |
with: | |
path: lcov | |
ref: v2.0 | |
repository: linux-test-project/lcov | |
- run: echo "π‘ The ${{ github.repository }} repository has been cloned to the runner." | |
- run: echo "π₯οΈ The workflow is now ready to test your code on the runner." | |
- name: π§° Install tools | |
run: | | |
sudo apt-get update | |
sudo apt-get install libtest-cmd-perl librrd-dev valgrind sed \ | |
libcapture-tiny-perl libdatetime-perl libdevel-cover-perl libdigest-md5-perl libfile-spec-perl libjson-xs-perl libmodule-load-conditional-perl libscalar-list-utils-perl libtime-hires-perl | |
- name: ποΈ Build the stuff | |
run: | | |
cd ${{ github.workspace }}/lcov | |
make PREFIX=${{ github.workspace }}/lcov-install install | |
for dir in base current ; do | |
cd ${{ github.workspace }}/$dir | |
sed -i -e s/[.]ao\\\>/.lo/g lib/test/Module.mk # Need only one kind of object in all binaries for gcov | |
CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS=-lgcov make PROG_EXTRA=sensord BUILD_STATIC_LIB=0 | |
done | |
- name: 𧫠Run tests | |
run: | | |
for dir in base current ; do | |
cd ${{ github.workspace }}/$dir | |
${{ github.workspace }}/lcov-install/bin/lcov --capture --initial --branch-coverage --base $(pwd) --no-external --directory . --output-file coverage0.info | |
make check | |
done | |
- name: π¨οΈ Calculate coverage | |
run: | | |
for dir in base current ; do | |
cd ${{ github.workspace }}/$dir | |
${{ github.workspace }}/lcov-install/bin/lcov --capture --branch-coverage --base $(pwd) --no-external --directory . --output-file coverage1.info | |
${{ github.workspace }}/lcov-install/bin/lcov --branch-coverage --substitute 's#'$dir'/##g' --add-tracefile coverage0.info --add-tracefile coverage1.info --output-file coverage.info | |
${{ github.workspace }}/lcov-install/bin/lcov --list coverage.info | |
cp ${{ github.workspace }}/$dir/coverage.info ${{ github.workspace }}/coverage-$dir.info | |
done | |
- name: β¬ Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Coverage report | |
path: ${{ github.workspace }}/current/coverage.info | |
- name: ποΈ generate coverage report | |
uses: romeovs/[email protected] | |
with: | |
lcov-file: "${{ github.workspace }}/coverage-current.info" | |
lcov-base: "${{ github.workspace }}/coverage-base.info" | |
github-token: "${{ secrets.token }}" | |
delete-old-comments: true | |
update-comment: true | |
- run: echo "π This job's status is ${{ job.status }}." |