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: move from make to cargo xtask workflows #2297

Merged
merged 3 commits into from
Jun 8, 2023

Conversation

ErichDonGubler
Copy link
Member

@ErichDonGubler ErichDonGubler commented Mar 31, 2023

  • Is this too slow for CI? Building xtask fully every time is relatively expensive (1m30-2m00 from my most recent tests), but then the only real resolution is caching. Current stats:
    • ~360 MB (~90 MB avg. caching per job at 4 jobs) of cache storage that will only get invalidated on xtask dep. changes
    • ~45sec additional latencies for cache-warm recompilation of xtask on Windows jobs
    • 10-15sec additional latency for cache-warm recompilation of xtask on Linux (1) and Mac (2) jobs

Re-implement naga development workflows using cargo xtask. Convert make logic and shader test configuration as file with Bash variables into an xtask crate and YAML files, respectively.

Pros:

  • We now have a portable workflow everywhere, which means Windows folks and people who don't install make don't have to suffer. 😮‍💨
  • Workflow logic is now relatively easy to inspect and change. Whew! 💁🏻‍♂️💦
  • Contributors can use their existing Rust knowledge to contribute to developer experience. 🎉
  • cargo xtask is a relatively well-known convention for workflows in the ecosystem.
  • We can do fancy things like allow folks to run at different log levels for workflows, depending on their tastes.

Cons:

  • There's now a non-trivial compile step to project workflow. Incremental rebuilds seem to be pretty short, though!
  • Code is much more verbose than the (very) terse make implementation.

xtask/.gitignore Outdated Show resolved Hide resolved
@ErichDonGubler

This comment was marked as outdated.

@codecov-commenter
Copy link

codecov-commenter commented Apr 3, 2023

Codecov Report

Merging #2297 (205ee31) into master (53d62b9) will decrease coverage by 0.07%.
The diff coverage is 30.18%.

❗ Current head 205ee31 differs from pull request most recent head 87afaf8. Consider uploading reports for the commit 87afaf8 to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #2297      +/-   ##
==========================================
- Coverage   82.19%   82.13%   -0.07%     
==========================================
  Files          82       83       +1     
  Lines       44267    44324      +57     
==========================================
+ Hits        36384    36404      +20     
- Misses       7883     7920      +37     
Impacted Files Coverage Δ
xtask/hlsl-snapshots/src/lib.rs 30.18% <30.18%> (ø)

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

&mut found_err,
|file, _| {
// TODO: strip prefix to match old Makefile output?
log::info!("Validating {}", file.display());
Copy link
Member Author

@ErichDonGubler ErichDonGubler Apr 3, 2023

Choose a reason for hiding this comment

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

note: N.B. that this output is technically different from the original Makefile; it includes the full relative path parent prefix of the glob search path, instead of "just" printing the base name. I don't think anybody will care, tho, because it makes this particular branch consistent with everything else!

Makefile Show resolved Hide resolved
@ErichDonGubler

This comment was marked as resolved.

@ErichDonGubler ErichDonGubler marked this pull request as ready for review April 4, 2023 20:25
@ErichDonGubler

This comment was marked as resolved.

@ErichDonGubler
Copy link
Member Author

This PR should basically be ready for full review and merging. 😤😀

@ErichDonGubler
Copy link
Member Author

ErichDonGubler commented Jun 6, 2023

Ping for feedback on this (CC @teoxoy, @cwfitzgerald, @jimblandy); I keep rebasing, waiting for some feedback, but nobody's requesting changes or asking questions. AFAIK, there are no open questions or concerns. Merge plz?

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

Looks solid! Much easier to follow than the Makefile.

xtask/src/main.rs Outdated Show resolved Hide resolved
xtask/src/main.rs Outdated Show resolved Hide resolved
xtask/hlsl-snapshots/src/lib.rs Outdated Show resolved Hide resolved
xtask/src/main.rs Outdated Show resolved Hide resolved
xtask/src/main.rs Outdated Show resolved Hide resolved
xtask/src/glob.rs Outdated Show resolved Hide resolved
ErichDonGubler added a commit to ErichDonGubler/naga that referenced this pull request Jun 7, 2023
Originally implemented in
[`naga`gfx-rs#2297](gfx-rs#2297), but removed as
an experiment to see who actually needs the workflow.

Reverts commit 337c760.
@ErichDonGubler
Copy link
Member Author

ErichDonGubler commented Jun 7, 2023

Resolved some clippy lints with 5a659c8. Hmm…maybe we should be running clippy on xtask too? 🤔

@ErichDonGubler

This comment was marked as resolved.

@ErichDonGubler

This comment was marked as resolved.

@ErichDonGubler
Copy link
Member Author

@teoxoy: Once you've reviewed, or you have more feedback, most of the fixup!s here should squash down neatly with git rebase -i --autosquash. I've already done it locally, and can push when you're ready.

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

Ah, one last thing: Could you please add the path of the new xtask crate to the validation workflows so that the CI gets triggered if we modify it in the future? Thanks!

@ErichDonGubler
Copy link
Member Author

ErichDonGubler commented Jun 8, 2023

@teoxoy: Done with 4858ac2, already auto-squashed.

Re-implement `naga` development workflows using [`cargo xtask`]. Convert
`make` logic and shader test configuration as file with Bash variables
into an `xtask` crate and YAML files, respectively.

Pros:

* We now have a _portable_ workflow everywhere, which means Windows
  folks and people who don't install `make` don't have to suffer.
  😮‍💨
* Workflow logic is now relatively easy to inspect and change. Whew!
  💁🏻‍♂️💦
* Contributors can use their existing Rust knowledge to contribute to
  developer experience. 🎉
* `cargo xtask` is a relatively well-known convention for workflows in
  the ecosystem.
* We can do fancy things like allow folks to run at different log levels
  for workflows, depending on their tastes.

Cons:

* There's now a non-trivial compile step to project workflow.
  Incremental rebuilds seem to be pretty short, though!
* Code is much more verbose than the (very) terse `make` implementation.

[`cargo xtask`]: https://github.com/matklad/cargo-xtask
ErichDonGubler added a commit to ErichDonGubler/naga that referenced this pull request Jun 8, 2023
Originally implemented in
[`naga`gfx-rs#2297](gfx-rs#2297), but removed as
an experiment to see who actually needs the workflow.

Reverts commit 337c760.
@teoxoy teoxoy merged commit 273ff5d into gfx-rs:master Jun 8, 2023
ErichDonGubler added a commit to ErichDonGubler/naga that referenced this pull request Jun 8, 2023
Originally implemented in
[`naga`gfx-rs#2297](gfx-rs#2297), but removed as
an experiment to see who actually needs the workflow.

Reverts commit 337c760.
ErichDonGubler added a commit to ErichDonGubler/naga that referenced this pull request Jun 8, 2023
Originally implemented in
[`naga`gfx-rs#2297](gfx-rs#2297), but removed as
an experiment to see who actually needs the workflow.

Reverts commit 337c760.
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.

4 participants