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

chore: generate rust-sdk github action with build.rs #67

Closed
wants to merge 24 commits into from

Conversation

leoromanovsky
Copy link
Member

@leoromanovsky leoromanovsky commented Nov 9, 2024

Observation

  • Developed github actions is tedious and slow - validating correctness and behavior has to happen by pushing to remote and waiting for the test to run.
  • The yaml syntax needs to be learned.

Desired behavior

  • Local validation
  • Compiler-guided rule building

Changes proposed

Use the gh_workflow crate in build.rs to automatically keep the github workflow files updated.

Rust's buildscripts (https://doc.rust-lang.org/cargo/reference/build-scripts.html) run on compilation; this PR generates no new work for developers.

Testing

@@ -21,3 +21,8 @@ name = "simple"
[dev-dependencies]
chrono = "0.4.38"
env_logger = { version = "0.11.3", features = ["unstable-kv"] }

[build-dependencies]
gh-workflow = "0.3.0"
Copy link
Member Author

@leoromanovsky leoromanovsky Nov 12, 2024

Choose a reason for hiding this comment

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

❌ A dependency in this package has a MSRV of 1.75 which blocks us from using it: JelteF/derive_more#389

I will fiddle around with it to see if we can overcome the blocker.

@rasendubi
Copy link
Collaborator

I'm actually not a fan of this approach.

It might be cool but it doesn't seem to solve any real issue:

  • It doesn't help you to get away from learning yaml and github actions. It just adds a layer of indirection.
  • It doesn't help with debugging workflow besides syntax. There doesn't seem to be a command to run it locally — you still need to push your changes to a branch and see if CI passes

and adds a few new:

  • Idiomatically, build.rs is designed to configure the compiler and generate source files (which are not commited). It is not designed for generating arbitrary files. One outcome of that is that build.rs runs for users of our library when they install it.
  • As yml file is now generated, this adds a bunch of downsides like possible sync issues, people accidentally modifying generated files, slowing down editing (as you have to run it through an additional tool), etc.
  • Github actions yaml is more widely known and this is a new tool that everybody has to learn

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.

2 participants