Repository navigation
Add CI workflow to publish backtrace after a push to main - #165802
Conversation
|
Set the environment variables and updated the message. |
|
|
||
| gh pr comment ${HEAD_PR} -F output.log | ||
| else | ||
| echo "Nothing was published. Either there is no version update or some error has occurred." |
There was a problem hiding this comment.
If errors occur, the CI workflow is green. Will anyone notice and fix the issue?
My preference would be to catch these errors and fail the workflow, but I leave the choice to the author and the reviewer of this PR the final saying. 👍
There was a problem hiding this comment.
Perhaps it's worth doing cargo publish --dry-run as part of PR CI? That probably catches the most likely failures, other than transients.
There was a problem hiding this comment.
Does that do something more interesting other than just building the crate (which we should do as a part of our normal CI)?
There was a problem hiding this comment.
Don't quote me on this but I believe it packages a .crate and attempts to build from that, which catches things like incorrect include/exclude in the manifest
There was a problem hiding this comment.
Should we comment on the PR if the publish failed for a reason other than whatever the "already published" message is?
There was a problem hiding this comment.
Don't quote me on this but I believe it packages a
.crateand attempts to build from that, which catches things like incorrectinclude/excludein the manifest
AFAIK this sounds about right (https://doc.rust-lang.org/cargo/commands/cargo-publish.html#publish-options is a bit light on specifics). In particular it'd check Cargo.toml manifest. (Also use cargo published --locked --dry-run.)
We might want to also cargo package --locked --list to list all the files that goes to the final published artifact eventually.
There was a problem hiding this comment.
My preference would be to catch these errors and fail the workflow
I share this sentiment, IMO we should fail hard here.
|
Making sure I review this soonish, probably still want our friendly local proto for the actual CI code. |
asked the things that produce inscrutable code for inscrutable code. fair play. |
|
|
||
| gh pr comment ${HEAD_PR} -F output.log | ||
| else | ||
| echo "Nothing was published. Either there is no version update or some error has occurred." |
There was a problem hiding this comment.
My preference would be to catch these errors and fail the workflow
I share this sentiment, IMO we should fail hard here.
|
I'm not sure how to reliably detect whether the publish failed because the version is already published, or because of something else. Both seems to return exit code 101. |
|
I guess that we could either:
|
Hm... I feel like (1) might be worth trying. (2) is essentially fragile to unstable cargo wording, (3) seems to swallow the errors we care about anyway... |
|
Ok, added the check. |
|
In particular my desire would be "I would prefer my PR is not automatically closed by GH's process if it has not actually gone off and published the crate." Even if that means something wildly unintuitive! I would be fine if I have to manually check and confirm that an "error" in the workflow is Actually Success, then close my own PR. I'm good with that. It seems we're trying to do something more clever than that, which is fine as long as the item doesn't leave "my desk" (open PRs) before it Actually Succeeds. |
|
I could make the adjustment of checking "already-merged" PRs more and more often than I already do, but I don't want to increase the neuroticism of my interactions with GitHub, for everyone's sake. |
There was a problem hiding this comment.
honestly my eyes glazed over a bit reading "bash-in-yaml"... I actually consider myself bash-proficient but for some reason this embedding just throws me, is it really just the lack of syntax highlighting or something...? ...but to the extent I understand this it seems good.
| echo "backtrace \`${VERSION}\` could not be published to crates.io" > comment.txt | ||
| printf "<details>\n<summary>Cargo publish log</summary>\n\n" >> comment.txt | ||
| printf '```\n' >> comment.txt | ||
| cat "${RUNNER_TEMP}/cargo-log.txt" >> comment.txt | ||
| printf '\n```\n' >> comment.txt | ||
| printf "</details>\n\n" >> comment.txt |
There was a problem hiding this comment.
me, to me: "could this be replaced by a heredoc?"
me, to me: "would that actually make it more legible?"
me, to me: "uhmmm... lol?"
|
We could move the publish from the post-merge workflow to the main CI workflow, near the publish toolstate step. Of course the danger there is that if publishing fails (even spuriously), it will cancel the whole bors merge. |
|
Hm. Technically we could say, if stdarch needs publishing it should rollup=never so if it fails main CI it's fine? |
|
I don't follow what would be the difference between the thing being rolled up or not 🤔 "it's fine", as in, at least it won't cancel the merge of other PRs? |
|
Yeah. But probably doesn't matter though, was just thinking. |
This comment has been minimized.
This comment has been minimized.
3300dc6 to
c657c93
Compare
Co-authored-by: Jubilee <[email protected]>
|
Yeah, I would be very surprised if this works on the first try. I'd suggest merging this, then merging rust-lang/team#2941, and then trying to do a release from this PR (will need a backtrace submodule sync). |
|
@bors r+ rollup |
|
@bors r- |
|
This pull request was unapproved. |
|
@bors r=workingjubilee,jieyouxu |
…bilee,jieyouxu Add CI workflow to publish backtrace after a push to main This PR implements crate publishing, which is required for rust-lang/backtrace-rs#778, and would be useful also for other use-cases in the future. To keep things simple, I reused the existing post-merge workflow, and implemented the publishing in bash. To make this work, we will also need to make changes in team: rust-lang/team#2941 I think that we could start by moving the publishing to `rust-lang/rust`, while still keeping the submodule, and test whether the publishing works as expected. Then we can get rid of the submodule and inline `backtrace` into `rust-lang/rust`. CC @workingjubilee I used a chatbot to generate the if condition line in bash (lol), and the `cargo metadata` command. r? jieyouxu
Rollup of 21 pull requests Successful merges: - #165707 (bootstrap: Make low priority the default) - #165716 (Refactor split_block in check_pointers to avoid Terminator: None) - #165934 (Avoid using Terminator:None in simplify_cfg) - #166050 (Use attribute parser for lang attributes in `LateResolutionVisitor`) - #166069 (bootstrap: fix keep-stage-std) - #166117 (Remove ebadf handling from stdio) - #166119 (Avoid an ICE on re-exports of private imports without a DefId) - #165094 (reflection: doc attributes from adts, fields, and variants) - #165216 (Clearer diagnostics when `&FnOnce` was provided when `FnOnce` was expected) - #165694 (view-types: make sure view types are !Sized) - #165802 (Add CI workflow to publish backtrace after a push to main) - #165883 (Report a recursion limit error instead of delaying a bug in RPITIT collector) - #165906 (fix ICE when a forced keyword follows a parameter pattern) - #166064 (Add const generic transmute min support) - #166136 (Move ub_checks() inside the const_eval_select branch.) - #166158 (bump some tools' `toml` dependency) - #166166 (Don't recover if not allowed in `parse_seq_to_before_tokens`) - #166176 (compiletest: Move all code out of the crate root) - #166185 (simd-test: Fix cfg syntax in the test macro) - #166194 (std: Unstably constify `std::process::abort`) - #166210 (Avoid terminator: None in insert_direct_enum_check) Failed merges: - #166150 (Reflection: refactor Type and TypeKind) - #166160 (refactor CTFE-specific intrinsics to different file)
Rollup of 20 pull requests Successful merges: - #165716 (Refactor split_block in check_pointers to avoid Terminator: None) - #165934 (Avoid using Terminator:None in simplify_cfg) - #166050 (Use attribute parser for lang attributes in `LateResolutionVisitor`) - #166069 (bootstrap: fix keep-stage-std) - #166117 (Remove ebadf handling from stdio) - #166119 (Avoid an ICE on re-exports of private imports without a DefId) - #165094 (reflection: doc attributes from adts, fields, and variants) - #165216 (Clearer diagnostics when `&FnOnce` was provided when `FnOnce` was expected) - #165694 (view-types: make sure view types are !Sized) - #165802 (Add CI workflow to publish backtrace after a push to main) - #165883 (Report a recursion limit error instead of delaying a bug in RPITIT collector) - #165906 (fix ICE when a forced keyword follows a parameter pattern) - #166064 (Add const generic transmute min support) - #166136 (Move ub_checks() inside the const_eval_select branch.) - #166158 (bump some tools' `toml` dependency) - #166166 (Don't recover if not allowed in `parse_seq_to_before_tokens`) - #166176 (compiletest: Move all code out of the crate root) - #166185 (simd-test: Fix cfg syntax in the test macro) - #166194 (std: Unstably constify `std::process::abort`) - #166210 (Avoid terminator: None in insert_direct_enum_check) Failed merges: - #166150 (Reflection: refactor Type and TypeKind) - #166160 (refactor CTFE-specific intrinsics to different file)
|
If #166230 happens to fail then could this get some history cleanup / squash? |
Rollup merge of #165802 - Kobzol:publish-crates, r=workingjubilee,jieyouxu Add CI workflow to publish backtrace after a push to main This PR implements crate publishing, which is required for rust-lang/backtrace-rs#778, and would be useful also for other use-cases in the future. To keep things simple, I reused the existing post-merge workflow, and implemented the publishing in bash. To make this work, we will also need to make changes in team: rust-lang/team#2941 I think that we could start by moving the publishing to `rust-lang/rust`, while still keeping the submodule, and test whether the publishing works as expected. Then we can get rid of the submodule and inline `backtrace` into `rust-lang/rust`. CC @workingjubilee I used a chatbot to generate the if condition line in bash (lol), and the `cargo metadata` command. r? jieyouxu
Rollup of 20 pull requests Successful merges: - rust-lang/rust#165716 (Refactor split_block in check_pointers to avoid Terminator: None) - rust-lang/rust#165934 (Avoid using Terminator:None in simplify_cfg) - rust-lang/rust#166050 (Use attribute parser for lang attributes in `LateResolutionVisitor`) - rust-lang/rust#166069 (bootstrap: fix keep-stage-std) - rust-lang/rust#166117 (Remove ebadf handling from stdio) - rust-lang/rust#166119 (Avoid an ICE on re-exports of private imports without a DefId) - rust-lang/rust#165094 (reflection: doc attributes from adts, fields, and variants) - rust-lang/rust#165216 (Clearer diagnostics when `&FnOnce` was provided when `FnOnce` was expected) - rust-lang/rust#165694 (view-types: make sure view types are !Sized) - rust-lang/rust#165802 (Add CI workflow to publish backtrace after a push to main) - rust-lang/rust#165883 (Report a recursion limit error instead of delaying a bug in RPITIT collector) - rust-lang/rust#165906 (fix ICE when a forced keyword follows a parameter pattern) - rust-lang/rust#166064 (Add const generic transmute min support) - rust-lang/rust#166136 (Move ub_checks() inside the const_eval_select branch.) - rust-lang/rust#166158 (bump some tools' `toml` dependency) - rust-lang/rust#166166 (Don't recover if not allowed in `parse_seq_to_before_tokens`) - rust-lang/rust#166176 (compiletest: Move all code out of the crate root) - rust-lang/rust#166185 (simd-test: Fix cfg syntax in the test macro) - rust-lang/rust#166194 (std: Unstably constify `std::process::abort`) - rust-lang/rust#166210 (Avoid terminator: None in insert_direct_enum_check) Failed merges: - rust-lang/rust#166150 (Reflection: refactor Type and TypeKind) - rust-lang/rust#166160 (refactor CTFE-specific intrinsics to different file)
View all comments
This PR implements crate publishing, which is required for rust-lang/backtrace-rs#778, and would be useful also for other use-cases in the future.
To keep things simple, I reused the existing post-merge workflow, and implemented the publishing in bash.
To make this work, we will also need to make changes in team: rust-lang/team#2941
I think that we could start by moving the publishing to
rust-lang/rust, while still keeping the submodule, and test whether the publishing works as expected. Then we can get rid of the submodule and inlinebacktraceintorust-lang/rust.CC @workingjubilee
I used a chatbot to generate the if condition line in bash (lol), and the
cargo metadatacommand.r? jieyouxu