Skip to content

Commit

Permalink
chore: run coverage on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Jan 21, 2025
1 parent 92831ed commit acf0f85
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
test:
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@646899086d7aaee8e532540480f3e91e00596234 # 11 Dec 2024
with:
bazel_test_command: bazel coverage //...
folders: '[".", "e2e/smoke", "e2e/repository-rule-deps", "e2e/system-interpreter", "examples/uv_pip_compile"]'
# TODO: Build Windows tools and add to toolchain
# TODO(alex): switch the root folder to bzlmod
Expand Down
16 changes: 8 additions & 8 deletions py/private/pytest.py.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,17 @@ import os
from typing import List

import pytest
# None means coverage wasn't enabled
cov = None

if os.getenv("COVERAGE_MANIFEST"):
# Since our py_test had InstrumentedFilesInfo, we know Bazel will hand us this environment variable.
# https://bazel.build/rules/lib/providers/InstrumentedFilesInfo
if "COVERAGE_MANIFEST" in os.environ:
try:
include = []
with open(os.getenv("COVERAGE_MANIFEST"), "r") as mf:
include.extend(mf.read().splitlines())
import coverage
cov = coverage.Coverage(
# TODO :link to test encyclopedia
include = include,
)
# The lines are files that matched the --instrumentation_filter flag
with open(os.getenv("COVERAGE_MANIFEST"), "r") as mf:
cov = coverage.Coverage(include = mf.read().splitlines())
cov.start()
except Exception as e:
print("WARNING: python coverage setup failed. Do you need to include the 'coverage' library as a dependency of py_pytest_main?", e)
Expand Down Expand Up @@ -75,6 +74,7 @@ if __name__ == "__main__":
print("Ran pytest.main with " + str(args), file=sys.stderr)
elif cov:
cov.stop()
# https://bazel.build/configure/coverage
cov.lcov_report(outfile = os.getenv("COVERAGE_OUTPUT_FILE"))
cov.save()

Expand Down
4 changes: 2 additions & 2 deletions tools/integrity.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ The checked in content is only here to allow load() statements in the sources to

# TEST DATA extracted from tools/integrity.bzl file within https://github.com/aspect-build/rules_py/releases/download/v0.7.4/rules_py-v0.7.4.tar.gz
RELEASED_BINARY_INTEGRITY = {
"unpack-aarch64-apple-darwin": "791c711bba95829118920553489537d156c320163876f2435e017c07bfcbd30a",
"unpack-aarch64-apple-darwin": "e973717a34f3bc19a111d2326ca573bd310660851024217e057d276346fc0f6a",
"unpack-x86_64-apple-darwin": "2a060c679e376e951877c4179824fa3bb8edd8674b7ec430585a4f83650ad910",
"venv-aarch64-apple-darwin": "a355e4338e7c2312d8366386ad981ed6864a65214d38ed6bd756ba19b532aa05",
"venv-aarch64-apple-darwin": "2f07120fc0a8bbc1ca7ce8b10d5df1b0637c235f66d2f7ad95105ada0792acb1",
"venv-x86_64-apple-darwin": "af56a742e79d64a30bae422c46a9d6c7edc77df107a8bb96f826967059eff96b",
"unpack-aarch64-unknown-linux-gnu": "84a2603b5c521346c22431f73af54c54ebed50ddcb19740fa958c8ad870723dc",
"unpack-x86_64-unknown-linux-gnu": "4e21607baa25108b7ca322b57dcf5fd94545e0960e8d7f2b449e84c5e68ec9cc",
Expand Down
2 changes: 1 addition & 1 deletion tools/version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Automagically "stamped" by git during `git archive` thanks to `export-subst` line in .gitattributes.
# See https://git-scm.com/docs/git-archive#Documentation/git-archive.txt-export-subst
_VERSION_PRIVATE = "$Format:%(describe:tags=true)$"
_VERSION_PRIVATE = "v1.1.0"

VERSION = "0.0.0" if _VERSION_PRIVATE.startswith("$Format") else _VERSION_PRIVATE.replace("v", "", 1)

Expand Down

0 comments on commit acf0f85

Please sign in to comment.