coverage.yml 1.6 KB

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