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: add githubgen tool #639

Merged
merged 67 commits into from
Dec 18, 2024

Conversation

mowies
Copy link
Member

@mowies mowies commented Dec 10, 2024

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 12.04819% with 292 lines in your changes missing coverage. Please review.

Project coverage is 47.13%. Comparing base (4f5cd22) to head (7d87860).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
githubgen/codeowners.go 0.00% 134 Missing ⚠️
githubgen/main.go 21.15% 79 Missing and 3 partials ⚠️
githubgen/issuetemplates.go 0.00% 41 Missing ⚠️
githubgen/distributions.go 0.00% 33 Missing ⚠️
githubgen/datatype/fake/mock_generator.go 90.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #639      +/-   ##
==========================================
- Coverage   51.17%   47.13%   -4.05%     
==========================================
  Files          51       56       +5     
  Lines        2882     3214     +332     
==========================================
+ Hits         1475     1515      +40     
- Misses       1260     1548     +288     
- Partials      147      151       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

const allowlistHeader = `# Code generated by githubgen. DO NOT EDIT.
#####################################################
#
# List of components in OpenTelemetry Collector Contrib
Copy link
Contributor

Choose a reason for hiding this comment

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

hardcoded to contrib

const codeownersHeader = `# Code generated by githubgen. DO NOT EDIT.
#####################################################
#
# List of codeowners for OpenTelemetry Collector Contrib
Copy link
Contributor

Choose a reason for hiding this comment

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

hardcoded, we might need to make that configurable.

# https://help.github.com/en/articles/about-code-owners
#

* @open-telemetry/collector-contrib-approvers
Copy link
Contributor

Choose a reason for hiding this comment

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

same

const distributionCodeownersHeader = `
#####################################################
#
# List of distribution maintainers for OpenTelemetry Collector Contrib
Copy link
Contributor

Choose a reason for hiding this comment

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

also hardcoded

for stability := range m.Status.Stability {
if stability == unmaintainedStatus {
unmaintainedList += key + "/\n"
unmaintainedCodeowners += fmt.Sprintf("%s/%s @open-telemetry/collector-contrib-approvers \n", key, strings.Repeat(" ", data.maxLength-len(key)))
Copy link
Contributor

Choose a reason for hiding this comment

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

hardcoded as well here.

owners += " "
owners += "@" + owner
}
codeowners += fmt.Sprintf("%s/%s @open-telemetry/collector-contrib-approvers%s\n", key, strings.Repeat(" ", data.maxLength-len(key)), owners)
Copy link
Contributor

Choose a reason for hiding this comment

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

hardcoded as well here

Copy link
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

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

LGTM as a code introduction, we can add tests right now to check doc generation and make sure to add more config to override the default group assignment and project name.

@mowies
Copy link
Member Author

mowies commented Dec 12, 2024

@atoulme thanks for the review. I will add at least a sanity check unit test in this PR which will already need some slight refactoring and then do any further changes in follow-ups.

mowies and others added 16 commits December 12, 2024 10:25
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
@mowies mowies marked this pull request as draft December 16, 2024 10:33
Signed-off-by: Moritz Wiesinger <[email protected]>
@mx-psi
Copy link
Member

mx-psi commented Dec 17, 2024

@pjanotti If you have the time, could you take a quick look at the failing CI check and try to help us figure out why it is failing?

@pjanotti
Copy link

pjanotti commented Dec 17, 2024

@mowies the issue can be solved by creating a moq.exe at the .tools directory. When in the make shell env the bash.exe takes care of that, but, I suspect that go generate (as it should) uses the Windows Shell API that requires the .exe extension. A quick (and a bit dirt 😸) workaround will be to cp .\.tools\moq .\.tools\moq.exe before calling make build ... (ducking for cover...)

Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
@mowies
Copy link
Member Author

mowies commented Dec 18, 2024

@pjanotti wow thanks for the help, I don't think I would have found that by myself at all 😅
seems like everything works now 🙌🏼

@mowies mowies marked this pull request as ready for review December 18, 2024 08:10
switch path[0] {
case "receiver", "exporter", "extension", "processor", "connector":
path[1] = strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(path[1], "internal"), "extension"), "exporter"), "connector"), "processor"), "receiver")
path[len(path)-1] = strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(path[len(path)-1], "internal"), "extension"), "exporter"), "connector"), "processor"), "receiver")
Copy link
Member

Choose a reason for hiding this comment

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

This looks like it shouldn't be hardcoded, but configurable per repository?

@mowies
Copy link
Member Author

mowies commented Dec 18, 2024

@atoulme @dmathieu thanks for the reviews! I will implement the feedback along with more unit tests in a follow up PR so that all that gets easier to review.

…low ups are implemented

Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Moritz Wiesinger <[email protected]>
Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Approving based on the comment above

@mx-psi mx-psi merged commit fcfa1a6 into open-telemetry:main Dec 18, 2024
10 of 12 checks passed
@mowies mowies deleted the add-githubgen branch December 18, 2024 10:20
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.

Extract githubgen to opentelemetry-go-build-tools
6 participants