Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(coverage): Register coverage.py to hermetic toolchains #977

Merged
merged 27 commits into from
Jan 31, 2023

Commits on Jan 30, 2023

  1. Configuration menu
    Copy the full SHA
    8faed9b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b9c0988 View commit details
    Browse the repository at this point in the history
  3. feat(coverage): Add a script to manage coverage.py dependencies

    This is managing the URL, names and sha256 value for the registered
    repositories.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    f4e48dc View commit details
    Browse the repository at this point in the history
  4. feat(coverage): register coverage for supported python toolchain vers…

    …ions
    
    Use coverage.py v6.5.0 because the latest has `types.py` in the package
    directory, which imports from Python's stdlib `types` [1]. Somehow the
    Python interpreter is thinking that the `from types import FrameType` is
    referring to the currently interpreted file and everything breaks. I
    would have expected the package to use absolute imports and only attempt
    to import from `coverage.types` if we use `coverage.types` and not just
    a plain `types` import.
    
    [1]: https://github.com/nedbat/coveragepy/blob/master/coverage/types.py
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    f952e68 View commit details
    Browse the repository at this point in the history
  5. feat(toolchain): Allow to set coverage_tool for a python toolchain

    - Only set the tooling if it is actually needed.
    - By default it is set to None.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    13b5fe1 View commit details
    Browse the repository at this point in the history
  6. feat(toolchain): allow automatically setting up coverage_tool

    The user can turn the coverage_tool setting by passing
    `register_coverage_tool=(True|False)` to `python_register_toolchains` or
    `python_register_multi_toolchains` call or specifying the
    `coverage_tool` label as described in the `versions.bzl` file.
    
    Update tests to:
    - ensure that we can still use the toolchain as previously.
    - ensure that we are not downloading extra deps if they are not needed.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    f7787d7 View commit details
    Browse the repository at this point in the history
  7. feat(coverage): use exec_compatible_with

    This hopefully makes everything more watertight and will help
    avoid bugs with misconfiguration.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    1a5f8cb View commit details
    Browse the repository at this point in the history
  8. feat(coverage): limit support of coverage to non Windows platforms

    It seems that the support is missing upstream [3].
    
    [3]: bazelbuild/bazel#15835
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    c2c6ad5 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    c329959 View commit details
    Browse the repository at this point in the history
  10. refactor(example/bzlmod): mv __init__.py lib.py

    The `__init__.py` files in the root of the WORKSPACE in `bzlmod` is
    breaking, when running under `bazel coverage //:test`. However, it
    started working when I renamed `__init__.py` to `lib.py`. I am
    suspecting that this has to do with the fact that the layer of
    indirection that `coverage` introduces could be something to do with
    that.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    3000ec2 View commit details
    Browse the repository at this point in the history
  11. feat(example): coverage config for multi_python_versions

    The `multi_python_versions` example cannot show coverage for the more
    complex tests that are using `subprocess`. I am wondering if this is
    related to the fact that we are including `coverage.py` via the
    toolchain and not through other mechanisms [2].
    
    [2]: https://bazel.build/configure/coverage
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    537af93 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    fd1c48f View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    a6c66dc View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    20e62cf View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    ca97b1d View commit details
    Browse the repository at this point in the history
  16. address comment: remove the compatible_with

    I am not sure how I can translate the config constraint to a build
    environment here.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    52cc5b3 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    d741b92 View commit details
    Browse the repository at this point in the history
  18. address comment: fix a bug in windows handling

    The logic should be that we set the `coverage_tool` to None if it is
    Windows or the tool has been not set.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    40bd804 View commit details
    Browse the repository at this point in the history
  19. feat(coverage): Set visibility to the toolchain repo only for non-bzlmod

    This changes how we install the coverage dependencies and allows us to
    set the visibility for the coverage tool correctly by passing the name
    of the toolchain repo during the repository function execution.
    
    bzlmod does not have this due to the fact that the dependency
    registering is happening in a different way/order.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    7e48bd6 View commit details
    Browse the repository at this point in the history
  20. fixup: Simplify the supported coverage binary lookup

    Now we store everything in a nested dict of tuples, which makes the
    lookup of supported versions slightly cleaner.
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    4eba78f View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    5572799 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    f704efa View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    0af2036 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    a7bbb2b View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    9628610 View commit details
    Browse the repository at this point in the history
  26. revert: rollback changes to toolchain tests

    We rely now on the bazelci config instead
    aignas committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    f02a1b2 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    480ed99 View commit details
    Browse the repository at this point in the history