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

[ANCHOR-413] Add jacoco test report to PR workflow #1062

Merged
merged 8 commits into from
Sep 5, 2023

Conversation

JiahuiWho
Copy link
Contributor

@JiahuiWho JiahuiWho commented Aug 23, 2023

Description

This is to add jacococ test report to PR workflow, to monitor test coverage change

Testing

After PR being published, there should be a github-action bot comment in your PR with test coverage.

Please see #1081 (comment) for example.
Note that this PR is published from a branch on original repo instead of a forked repo.

Known limitations

  1. For now Github only grant apps write permission (which is needed to make comment) to original repo, and read permission to forked repo, that mean this action will only works on PR created from original repo. I have created a ticket https://stellarorg.atlassian.net/browse/ANCHOR-433 to follow up on this and try to find a work around for forked repo
    For more info about github permission please refer to https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

  2. Currently the min-coverage-overall is set to 40 and min-coverage-changed-files is 60, this is just for testing, will be changed accordingly.

@JiahuiWho JiahuiWho force-pushed the anchor-413 branch 5 times, most recently from ac2c734 to f94c902 Compare August 23, 2023 17:37
@stellar stellar deleted a comment from stellar-jenkins Aug 23, 2023
@stellar stellar deleted a comment from stellar-jenkins Aug 23, 2023
@stellar stellar deleted a comment from stellar-jenkins Aug 23, 2023
@stellar stellar deleted a comment from stellar-jenkins Aug 23, 2023
@stellar stellar deleted a comment from stellar-jenkins Aug 23, 2023
@stellar stellar deleted a comment from stellar-jenkins Aug 23, 2023
@stellar stellar deleted a comment from stellar-jenkins Aug 23, 2023
@JiahuiWho JiahuiWho force-pushed the anchor-413 branch 2 times, most recently from 69fd466 to 14d926a Compare August 24, 2023 03:05
@stellar stellar deleted a comment from stellar-jenkins Aug 28, 2023
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

1 similar comment
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

1 similar comment
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

@JiahuiWho JiahuiWho changed the title add jacoco action [Anchor-413] Add jacoco test report to PR workflow Sep 1, 2023
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

@JiahuiWho JiahuiWho changed the title [Anchor-413] Add jacoco test report to PR workflow [ANCHOR-413] Add jacoco test report to PR workflow Sep 1, 2023
@JiahuiWho JiahuiWho marked this pull request as ready for review September 1, 2023 21:52
Copy link
Contributor

@philipliu philipliu left a comment

Choose a reason for hiding this comment

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

The changes look good, just a few minor comments.

Comment on lines +65 to +66
min-coverage-overall: 40
min-coverage-changed-files: 60
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this check be moved into the gradle build instead? That way, the developer can get feedback locally without publishing a PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, do we want to set coverage minimums by project? I think it would make sense to have the core project require higher coverage than the reference server, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can this check be moved into the gradle build instead? That way, the developer can get feedback locally without publishing a PR.

Yes The JacocoCoverageVerification task can be used to verify if code coverage metrics are met based on configured rules. However the build fails if any of the configured rules are not met and JaCoCo only reports the first violated rule. I will gradually implemented in the following PR.

Right now you can simply run jacocoTestReport in local to get an report but without the delta.

Also, do we want to set coverage minimums by project? I think it would make sense to have the core project require higher coverage than the reference server, for example.

I think that's part of the first question where we want enforce more granular test coverage rules.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes The JacocoCoverageVerification task can be used to verify if code coverage metrics are met based on configured rules. However the build fails if any of the configured rules are not met and JaCoCo only reports the first violated rule. I will gradually implemented in the following PR.

So once we enable JacocoCoverageVerification, do we still want to set min-coverage-overall and min-coverage-changed-files in the Github action?

build.gradle.kts Outdated Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

Copy link
Collaborator

@lijamie98 lijamie98 left a comment

Choose a reason for hiding this comment

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

LGTM

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr1062.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr1062.previews.kube001.services.stellar-ops.com/

@philipliu philipliu merged commit 8463b4b into stellar:develop Sep 5, 2023
6 checks passed
@JiahuiWho JiahuiWho deleted the anchor-413 branch October 9, 2023 18:34
@JiahuiWho JiahuiWho restored the anchor-413 branch October 9, 2023 18:35
@JiahuiWho JiahuiWho deleted the anchor-413 branch October 9, 2023 18:35
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.

5 participants