coverage.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ---
  2. name: coverage
  3. on:
  4. push:
  5. paths-ignore:
  6. - '**.md'
  7. pull_request:
  8. paths-ignore:
  9. - '**.md'
  10. jobs:
  11. build:
  12. runs-on: ubuntu-22.04
  13. strategy:
  14. matrix:
  15. os:
  16. - ubuntu:latest
  17. steps:
  18. - uses: actions/checkout@v4
  19. - name: Show OS information
  20. run: cat /etc/os-release 2>/dev/null || echo /etc/os-release not available
  21. - name: Install build dependencies
  22. run: bash .github/workflows/install-dependencies
  23. - name: Build tang
  24. run: |
  25. mkdir -p build && cd build
  26. export ninja=$(command -v ninja)
  27. [ -z "${ninja}" ] && export ninja=$(command -v ninja-build)
  28. meson .. -Db_coverage=true || cat meson-logs/meson-log.txt >&2
  29. ${ninja}
  30. - name: Run tests
  31. run: |
  32. cd build
  33. meson test || cat meson-logs/testlog.txt >&2
  34. - name: Show full test logs
  35. run: |
  36. if [ -r build/meson-logs/testlog.txt ]; then
  37. cat build/meson-logs/testlog.txt >&2
  38. else
  39. echo "No test log available" >&2
  40. fi
  41. - name: Create coverage report
  42. run: |
  43. cd build
  44. export ninja=$(command -v ninja)
  45. [ -z "${ninja}" ] && export ninja=$(command -v ninja-build)
  46. gcovr -r .. -f ../src -f src/ -e ../tests -e tests -x coverage.xml
  47. - uses: codecov/codecov-action@v3
  48. with:
  49. file: build/coverage.xml
  50. fail_ci_if_error: true # optional (default = false)
  51. verbose: true # optional (default = false)
  52. container:
  53. image: ${{matrix.os}}
  54. env:
  55. DISTRO: ${{matrix.os}}
  56. # vim:set ts=2 sw=2 et: