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

[Enhancement] Add Special Handling of Rust Project Files; fixes #390 #413

Merged
merged 31 commits into from
Jun 30, 2023

Conversation

kevinmatthes
Copy link
Owner

No description provided.

@kevinmatthes kevinmatthes added the enhancement New feature or request label Jun 28, 2023
@kevinmatthes kevinmatthes added this to the v3.0.0 milestone Jun 28, 2023
@kevinmatthes kevinmatthes self-assigned this Jun 28, 2023
@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  -----------------------------
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  65      65  0.00%    59-177
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
TOTAL                                   1056     419  60.32%

Copy link
Owner Author

@kevinmatthes kevinmatthes left a comment

Choose a reason for hiding this comment

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

@AmmarAbouZor

Please tell me if you agree with this behaviour of Aeruginous for Cargo.lock and Cargo.toml files.

src/increment_version.rs Outdated Show resolved Hide resolved
src/increment_version.rs Outdated Show resolved Hide resolved
src/increment_version.rs Outdated Show resolved Hide resolved
@kevinmatthes
Copy link
Owner Author

@AmmarAbouZor

As you already mentioned in #390, some warning messages should be printed in case that the version increment should fail. I agree with you and will add them, in the following.

But in contrast to exiting with code zero for "okay", I would prefer to make the workflow calling Aeruginous fail as any of the of the reasons for the version increment to fail indicates major problems which should be solved even before generating the RONLOG / CHANGELOG because their resolution might be relevant enough for being documented in there. Thus, I would like to suggest to leave the non-zero exiting behaviour in as a feature. Furthermore, this would prevent the tracked files from becoming out of sync as the code base will be left in an undefined state if the version increment should fail; it is not always possible to check for the version increment to succeed beforehand as some error conditions are rather random. Having to restart the entire workflow in case of an error will make sure that the code base will always be in a defined and known state.

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  -----------------------------
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  65      65  0.00%    59-177
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
TOTAL                                   1056     419  60.32%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  -----------------------------
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  65      65  0.00%    59-177
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
TOTAL                                   1056     419  60.32%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  -----------------------------
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  65      65  0.00%    59-177
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
TOTAL                                   1056     419  60.32%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ----------------------------------
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  66      13  80.30%   135-136, 142-149, 162-165, 179-182
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
TOTAL                                   1057     367  65.28%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ----------------------------------
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  66      13  80.30%   135-136, 142-149, 162-165, 179-182
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
TOTAL                                   1057     367  65.28%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ----------------------------------
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  66      13  80.30%   135-136, 142-149, 162-165, 179-182
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
TOTAL                                   1057     367  65.28%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ----------------------------------
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  74      21  71.62%   135-141, 148-155, 168-173, 187-196
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
TOTAL                                   1065     375  64.79%

@kevinmatthes
Copy link
Owner Author

@AmmarAbouZor

I added error messages to the logic; the keywords are highlighted in red.

@AmmarAbouZor
Copy link

@kevinmatthes
I agree that having a problem here should be reported as an error with exit code. I would then suggest adding an option to skip increasing the version besides the current options major, minor, patch like keep or skip.

Blocking the pipeline because Aeruginous can't increase the version without giving an option to increase the version manually could block a release until changing the release pipeline itself and removing increase-version command from within the .yml file and the bring it back after that.

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ----------------------------------
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  72      21  70.83%   135-141, 148-155, 168-173, 187-196
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
TOTAL                                   1063     375  64.72%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ---------------------------------------
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  97      22  77.32%   124-130, 137-144, 157-162, 226, 243-252
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
TOTAL                                   1088     376  65.44%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ---------------------------------------
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  97      22  77.32%   124-130, 137-144, 157-162, 226, 243-252
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
TOTAL                                   1088     376  65.44%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ---------------------------------------
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  97      22  77.32%   124-130, 137-144, 157-162, 226, 243-252
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
TOTAL                                   1088     376  65.44%

@github-actions
Copy link
Contributor

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ---------------------------------------
src/application.rs                        42      42  0.00%    100-172
src/cffreference.rs                       68       0  100.00%
src/increment_version.rs                  94      19  79.79%   124-125, 131-138, 151-156, 220, 237-246
src/macros.rs                             17       0  100.00%
src/running.rs                             4       0  100.00%
src/version.rs                            47       0  100.00%
src/pattern/buffer.rs                     21       0  100.00%
src/pattern/io_processor.rs               19      19  0.00%    72-160
src/pattern/reader.rs                     32      21  34.38%   57-58, 75-79, 90-109, 123-140
src/pattern/writer.rs                     75      30  60.00%   133-152, 187-197, 229-257
src/changelog/comment_changes.rs         168     168  0.00%    110-414
src/changelog/fragment.rs                 21       0  100.00%
src/changelog/ronlog.rs                  122      74  39.34%   48-242
src/traits/append_as_line.rs               9       0  100.00%
src/traits/colour_message.rs               8       0  100.00%
src/traits/convert_buffer.rs              21       0  100.00%
src/traits/prefer.rs                       3       0  100.00%
src/traits/rusty_object_notation.rs        8       0  100.00%
src/traits/to_stderr.rs                    4       0  100.00%
src/graphing/agd.rs                      156       0  100.00%
src/graphing/graph.rs                    146       0  100.00%
TOTAL                                   1085     373  65.62%

@kevinmatthes
Copy link
Owner Author

@AmmarAbouZor

I implemented the changes you requested regarding the updating logic; you are now free to choose whether you would like to update or to rewrite the Cargo.toml, defaulting to a simple update without reformatting the file.


Regarding the exit codes in error cases, I disagree with you. If Aeruginous should consider the situation impossible to continue, it is most likely that either:

  • the Cargo.toml is invalid TOML (upload to crates.io would fail anyway; immediate fix required);
  • the Cargo.lock is invalid (just recreate it to fix this); or
  • there is a typo in the name of the Rust package you need to give to Aeruginous to make it update Cargo.lock, as well (fix the typo in the workflow file and git grep for the typo to find similar mistakes before releasing the next version with mistakes in the documentation).

These reasons are nearly impossibly rare if:

  • the Cargo.toml is only edited manually with utmost caution as well as cargo to add further dependencies;
  • the Cargo.lock is only edited with cargo, Dependabot and / or Renovate (a bot quite similar to Dependabot); and
  • the crate's name is not changed over and over again.

Since these three conditions can be safely expected to be the normal style of developing a Rust project, the version increment on Cargo.lock and Cargo.toml would only fail if there are fundamental problems with the project's code base which require urgent fixes. In addition to the error conditions named above, there are also the usual file IO errors which can happen with any software and the simplest way fixing them is to check if the software is called correctly and to try again. Everything else is a bug which requires a bug report and deserves a fix.

@kevinmatthes kevinmatthes marked this pull request as ready for review June 30, 2023 00:26
@kevinmatthes kevinmatthes merged commit 9811ff5 into main Jun 30, 2023
@kevinmatthes kevinmatthes deleted the feature/390 branch June 30, 2023 00:27
@kevinmatthes
Copy link
Owner Author

@AmmarAbouZor

If you would like to continue the discussion on possible error causes during the release preparations, i.e. the RONLOG assembly, which might cause Aeruginous to block the release pipeline, please create a discussion of type "General" in the "Discussions" tab and explain the challenges you see with a concrete example.

@AmmarAbouZor
Copy link

@kevinmatthes
Thanks for fixing it. We can try it out and gather more infos from the experience with it.
For now I think it should work as intended and for all use-cases I have in mind 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] Automatic Version increase overwrite the version from all crates in cargo.lock
2 participants