Skip to content

Commit

Permalink
Merge pull request #11 from jaqx0r/bazel-cover
Browse files Browse the repository at this point in the history
build/ci: Add coverage support
  • Loading branch information
jaqx0r committed Apr 3, 2024
2 parents 1c673ab + 85126bc commit 6490c13
Show file tree
Hide file tree
Showing 9 changed files with 1,148 additions and 182 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
- uses: codecov/codecov-action@v4
with:
file: coverage.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: distcheck
run: scons distcheck
env:
Expand All @@ -60,18 +62,25 @@ jobs:
uses: actions/cache@v4
with:
path: "~/.cache/bazel"
key: bazel
key: bazel-${{ hashFiles('WORKSPACE', 'MODULE.bazel') }}
- name: install dependencies
run: |
sudo apt-get install -y \
dejagnu
- run: bazel test --test_output=errors //...
expect
- name: bazel test
run: bazel coverage --explain=explain.out -s --test_env=VERBOSE_COVERAGE=1 --test_env=DISPLAY_LCOV_CMD=1 --test_output=all --combined_report=lcov --instrument_test_targets --nocache_test_results --instrumentation_filter="^//" //...
- name: copy test results into workspace
if: always()
run: cp -Lpr $(bazel info bazel-testlogs)/ test-results
- name: publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
run: |
cp -Lpr $(bazel info bazel-testlogs)/ test-results
cp -Lpr $(bazel info output_path)/_coverage/_coverage_report.dat coverage_report.dat
- uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
test-results/**/test.xml
- uses: codecov/codecov-action@v4
with:
file: coverage_report.dat
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
12 changes: 12 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@

bazel_dep(name = "rules_bison", version = "0.2.2")
bazel_dep(name = "rules_flex", version = "0.2.1")

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "org_gnu_dejagnu",
url = "https://ftp.gnu.org/gnu/dejagnu/dejagnu-1.6.3.tar.gz",
build_file = "testsuite/dejagnu.BUILD",
integrity = "sha256-h9rvrNeVi0pp+IxoVtvRY0JhljxBQHnQw3H1ic1mouM=",
strip_prefix = "dejagnu-1.6.3",
)

bazel_dep(name = "rules_foreign_cc", version = "0.10.1")
Loading

0 comments on commit 6490c13

Please sign in to comment.