-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add orphans check with cargo-modules
Signed-off-by: Dori Medini <[email protected]>
- Loading branch information
1 parent
602ec6f
commit c2a2e55
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import subprocess | ||
from tests_utils import get_workspace_tree | ||
|
||
|
||
def verify_no_orphans(): | ||
crates = get_workspace_tree() | ||
for crate in crates: | ||
print(f"Checking for orphans in {crate}...") | ||
command = f"cargo modules orphans --all-features --cfg-test --package {crate}" | ||
try: | ||
subprocess.check_output(args=command, shell=True).decode("utf-8") | ||
except subprocess.CalledProcessError: | ||
print( | ||
"ERROR, possibly due to both binary and library in crate. Analyzing only library..." | ||
) | ||
subprocess.check_output(args=command + " --lib", shell=True).decode("utf-8") | ||
|
||
|
||
if __name__ == "__main__": | ||
verify_no_orphans() |