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

Bazel #194

Merged
merged 5 commits into from
Sep 2, 2022
Merged

Bazel #194

merged 5 commits into from
Sep 2, 2022

Conversation

fmorency
Copy link
Contributor

@fmorency fmorency commented Aug 31, 2022

MVP

Bazel files are generated from the Cargo.toml manifests.

Uses rules_rust v0.10.0. Tested using Bazel 5.2.0.

Supported features

  • Build many-rs
  • Test many-rs (HSM and cucumber included)
  • Generate many-rs code coverage
  • Run fmt
  • Run clippy
  • Generate rust-analyzer JSON project file

Supported configurations

  • build:rustfmt : Enable rustfmt for all targets
  • build:clippy : Enable clippy for all targets
  • build:rust-analyzer : Generate RA project JSON

TODO

  • DRY (w/ macros)
  • Update README
  • Adjust rustfmt
  • Toggle features from the CLI
  • Create a release package

How-to

  • Sync crates: CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
  • Build: bazel build //...:all-targets
  • Test: bazel test //...:all-targets
  • Rustfmt: bazel build --config=rustfmt //...:all-targets
  • Clippy: bazel build --config=clippy //...:all-targets
  • Rust-analyzer: bazel build --config=rust-analyzer //...:all-targets
  • Code coverage
$ bazel coverage --combined_report=lcov //...:all-targets 
$ genhtml --output genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat"

Notes

  • I enabled ecdsa and ed25519 by default in many-identity
  • Each library has a "normal" and a "test" version. Tests always use the "test" version which enables more features

Bazel files are generated from the `Cargo.toml` manifests.

Uses `rules_rust` v0.10.0.

Supported features
- Build `many-rs`
- Test `many-rs`
- Generate `many-rs` code coverage
- Run fmt
- Run clippy
- Generate rust-analyzer JSON project file

Supported configurations
- build:rustfmt         : Enable rustfmt for all targets
- build:clippy          : Enable clippy for all targets
- build:rust-analyzer   : Generate RA project JSON
@fmorency fmorency added the enhancement New feature or request label Aug 31, 2022
@fmorency fmorency self-assigned this Aug 31, 2022
@fmorency fmorency mentioned this pull request Aug 31, 2022
@fmorency fmorency linked an issue Aug 31, 2022 that may be closed by this pull request
.bazelrc Outdated

# This import should always be last to allow users to override
# settings for local development.
try-import %workspace%/user.bazelrc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end of line.

src/many-identity-hsm/BUILD.bazel Show resolved Hide resolved
Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming you add a newline at the end of .bazelrc.

@codecov-commenter
Copy link

Codecov Report

Merging #194 (c80bf7c) into main (647b729) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #194      +/-   ##
==========================================
+ Coverage   68.57%   68.58%   +0.01%     
==========================================
  Files          68       68              
  Lines        7854     7860       +6     
==========================================
+ Hits         5386     5391       +5     
- Misses       2468     2469       +1     
Impacted Files Coverage Δ
src/many-mock/tests/integration.rs 100.00% <100.00%> (ø)
src/many-identity-webauthn/src/lib.rs 96.71% <0.00%> (-0.55%) ⬇️
src/many-identity/src/address.rs 80.20% <0.00%> (+0.26%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@fmorency fmorency enabled auto-merge (squash) September 2, 2022 13:54
@fmorency fmorency enabled auto-merge (squash) September 2, 2022 13:55
@fmorency fmorency merged commit d97a272 into liftedinit:main Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tracking] Add Bazel support
4 participants