Add GitHub Actions workflow for coverage reporting

This commit is contained in:
Hoshiumi Arata
2024-11-18 23:19:28 +09:00
parent b437b1da24
commit 6028be193c
+38
View File
@@ -0,0 +1,38 @@
name: Coverage
on: [push]
jobs:
coverage:
name: Coverage
runs-on: ubuntu-24.04
env:
MRUBY_CONFIG: ci/gcc-clang
CC: gcc
CXX: g++
LD: gcc
CFLAGS: -O0 -g --coverage
LDFLAGS: --coverage
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v4
- name: Ruby version
run: ruby -v
- name: Compiler version
run: ${{ env.CC }} --version
- name: Build and test
run: rake test
- name: Install gcovr
run: pip install gcovr
- name: Generate coverage report
run: |
echo "# Coverage report" > $GITHUB_STEP_SUMMARY
echo \`\`\` >> $GITHUB_STEP_SUMMARY
gcovr -e ".*_test.c" -e ".*/test/.*" -s --html-details -o coverage/ build >> $GITHUB_STEP_SUMMARY
echo \`\`\` >> $GITHUB_STEP_SUMMARY
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-${{ github.sha }}
path: coverage/
retention-days: 14