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

feat: added min duaration checking in RepositoryConfig #164

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

sriganeshres
Copy link
Contributor

@sriganeshres sriganeshres commented Oct 14, 2024

Fixes: #84

I have added a serilazed min_ci_duartion field which takes care that atleast 60 seconds of testing is being done.

@Kobzol
Copy link
Contributor

Kobzol commented Oct 14, 2024

Hi! This is a good start, but the bot should actually use this value, and check that the CI workflow has not in fact completed in a shorter time than this.

@sriganeshres
Copy link
Contributor Author

sriganeshres commented Oct 14, 2024

I will check on that. So i think we need to write a test and ensure that min_ci_time is maintained or not right?
Or a new struct which takes every workflows start and end time and then verifes that it is under minum time or over minimum time.

Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, it's a good start. Left one comment about the actual logic that should happen on failure.

We should also add some basic tests for this. You can check the existing tests to see how we define them.

src/bors/handlers/workflow.rs Outdated Show resolved Hide resolved
@sriganeshres sriganeshres changed the title chore: added min duaration checking in RepositorConfig feat: added min duaration checking in RepositorConfig Oct 19, 2024
@sriganeshres sriganeshres force-pushed the chore-add-min-ci-duration branch from e7c106e to 380d43b Compare October 19, 2024 14:53
Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

I left a few more comments. You can find tests e.g. at the bottom of the workflow.rs file.

To run tests locally, you'll need to setup a DB, which I tried to describe in docs/development.md. Let me know if you have any questions about that.

src/config.rs Outdated Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
src/bors/event.rs Show resolved Hide resolved
src/bors/handlers/workflow.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Sorry for the long review time, I was (and still am) very busy.

Left a few comments, and we still need tests. If you don't want to work on them, it's fine, I can add them later.

src/config.rs Outdated Show resolved Hide resolved
src/bors/handlers/workflow.rs Outdated Show resolved Hide resolved
src/bors/handlers/workflow.rs Outdated Show resolved Hide resolved
@sriganeshres sriganeshres force-pushed the chore-add-min-ci-duration branch from df9a8b9 to c0228b8 Compare November 30, 2024 12:57
@sriganeshres
Copy link
Contributor Author

@Kobzol I have made the changes can you review them and can you give me a idea of tests to write regarding this.

@Kobzol Kobzol changed the title feat: added min duaration checking in RepositorConfig feat: added min duaration checking in RepositoryConfig Dec 9, 2024
Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

I implemented a simple test, that also changed internal logic for determining if a check suite was failed or not.

In the future, we should also generalize the workflow status to have explicit information about running for too short, as the error message in this case is confusing. But let's not do that in this PR.

src/bors/handlers/workflow.rs Outdated Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
@sriganeshres sriganeshres force-pushed the chore-add-min-ci-duration branch from cf5c3bf to 403e140 Compare December 9, 2024 15:36
@Kobzol
Copy link
Contributor

Kobzol commented Dec 10, 2024

It seems like your forcep ush removed my commit, but that doesn't matter, I will add the tests in another PR. Could you please squash the commits? I will merge this PR after that. Thank you!

 Changes to be committed:
	modified:   src/bors/event.rs
	modified:   src/bors/handlers/workflow.rs
	modified:   src/config.rs
	modified:   src/github/webhook.rs
@sriganeshres sriganeshres force-pushed the chore-add-min-ci-duration branch from 403e140 to 34b52b3 Compare December 10, 2024 13:36
@Kobzol
Copy link
Contributor

Kobzol commented Dec 10, 2024

Thank you! :)

@Kobzol Kobzol added this pull request to the merge queue Dec 10, 2024
Merged via the queue into rust-lang:main with commit 7a2b8dc Dec 10, 2024
2 checks passed
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.

Add a minimum CI run duration
2 participants