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

Exclude tests and testdata from published crate #57

Merged
merged 1 commit into from
May 14, 2022

Conversation

AlyoshaVasilieva
Copy link
Contributor

Reduces size of crate from 8975KB to 17KB
crates.io limits crates to 10MB max

https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields

Reduces size of crate from 8975KB to 17KB
crates.io limits crates to 10MB max
@bojand
Copy link
Owner

bojand commented Mar 6, 2022

Sigh... Hmm this was actually added in 0.7.0 to solve #47 and #54. I do think this is more appropriate (hence original implementation), and Linux distro packaging should use GitHub release archive perhaps...? But frankly I am not familiar with those processes.

@remilauzier @janbaudisch

@ghost
Copy link

ghost commented Mar 6, 2022

On fedora we use a python script that take the source from crates.io and create a .spec file for fedora to ease management. If the files are no longer in the crates source, the policy of fedora is to deactivate the tests to not have to import all the file manually.

@AlyoshaVasilieva
Copy link
Contributor Author

AlyoshaVasilieva commented Mar 6, 2022

An alternate option might be to trim the testdata files to only about as long as their header/use smaller files, to avoid hitting the crates.io limit in the future

@janbaudisch
Copy link

I can see that the crate size right now is definitely not ideal. I didn't intent to force outside guidelines onto the project (I also intend to package this crate for Fedora). It just felt right for a crate to be the complete package with everything needed, be it running it or testing it.
Maybe reducing the size of the test files could be a solution? I don't really know much about the internals but that should be possible to do, or would it break anything?

@AlyoshaVasilieva
Copy link
Contributor Author

AlyoshaVasilieva commented Mar 6, 2022

For at least some formats it should be possible. For example, the MP4 matcher currently checks 12 bytes but the test file is about 2MB. I'd guess most test files can be cut to 4KB or less without issues (but I am by no means an expert on file signatures)

edit: Truncating all test files >4KB to 4KB, except DOC/PPT/XLS, keeps all tests passing and reduces size of .crate to 154KB

@ghost
Copy link

ghost commented Mar 6, 2022

@janbaudisch
Infer is already package in fedora.
https://src.fedoraproject.org/rpms/rust-infer

@ghost
Copy link

ghost commented Mar 6, 2022

@AlyoshaVasilieva
Thanks for maintaining the test passing in crates.io!

@janbaudisch
Copy link

@remilauzier Oh, I didn't realize that you already packaged it. Thanks for the heads-up.

@bojand bojand merged commit 3e33b53 into bojand:master May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants