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

Build test components instead of relying on pre-built binaries #2163

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

rylev
Copy link
Collaborator

@rylev rylev commented Dec 12, 2023

Until now we've been relying on pre-built test component binaries for the runtime tests. This has the advantage of being very fast (the binaries are already built, and so there is no build phase at all). However, it also has the disadvantage of potentially getting out of sync with the source. This PR changes the test components to be built as a part of building Spin.

This is not without its drawbacks: for example, the test components are a part of the workspace meaning they will be built during cargo build. This does have the counter advantage though of making the test components part of rust-analyzer builds so that things like auto-complete work.

Ultimately, I think this is the right way to go for now. In the future, we may want to reconsider whether we move these to a separate repository and pre-build the binaries with some check that those pre-built binaries do not get of sync with their source.

@rylev rylev requested a review from dicej December 12, 2023 20:25
Copy link
Contributor

@dicej dicej left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for doing this!

tests/test-components/build.rs Outdated Show resolved Hide resolved
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
@@ -87,7 +87,7 @@ jobs:
rust-cache: true

- name: Cargo Build
run: cross build --target x86_64-unknown-linux-musl --workspace --release --all-targets --features openssl/vendored
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rajatjindal FYI: I have removed these flags since they are unnecessary for building a Spin executable. I noticed this when the build was failing due to the test-components crate failing to build, but that crate does not need to be built to get a Spin executable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

thank you for the heads up. these are also used in release workflow here https://github.com/fermyon/spin/blob/d41deb9eb33faeaa069d24a3922f26406c1cd2ca/.github/workflows/release.yml#L429C14-L429C20

you may want to remove those as well in that case

@rylev rylev enabled auto-merge December 14, 2023 13:33
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
@rylev rylev merged commit 9fa3b92 into main Dec 14, 2023
11 checks passed
@rylev rylev deleted the build-test-components branch December 15, 2023 12:47
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