You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Forbid new Groovy files
Merge branch 'master' into sarahchen6/hard-junit-test-enforcement
Add doc link to PR comment
Merge branch 'master' into sarahchen6/hard-junit-test-enforcement
Apply workflow to draft PRs as well
Co-authored-by: sarah.chen <sarah.chen@datadoghq.com>
Copy file name to clipboardExpand all lines: .github/workflows/README.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,12 +122,11 @@ _Trigger:_ When creating or updating a pull request targeting `master`, or when
122
122
123
123
_Actions:_
124
124
125
-
* Fail the PR if a new Groovy test file is added to a module listed in [`.github/g2j-migrated-modules.txt`](../g2j-migrated-modules.txt) (hard enforcement),
126
-
* Post a warning comment on the PR if a new Groovy test file is added to any other non-exempt module (soft warning). Instrumentation (`dd-java-agent/instrumentation/`) and smoke-test (`dd-smoke-tests/`) modules are exempt from this warning.
125
+
* Fail the PR if it introduces any new `.groovy` file, including added, copied, or renamed files whose previous name was not already `.groovy`.
127
126
128
-
_Recovery:_ Re-write the Groovy test files in Java / JUnit 5. To override this check entirely, add the `tag: override-groovy-enforcement` label to the PR. Remove the label to re-enable enforcement.
127
+
_Recovery:_ Re-write the new Groovy files in Java / JUnit. To override this check entirely, add the `tag: override-groovy-enforcement` label to the PR. Remove the label to re-enable enforcement.
129
128
130
-
_Notes:_ The migrated modules list is always read from `master`. Add a new entry to `.github/g2j-migrated-modules.txt` each time a module is migrated to Java / JUnit 5.
129
+
_Notes:_ The override label skips the workflow entirely.
.map(({ path, mod }) => `- \`${path}\` (module: \`${mod}\`)`)
87
+
if (introducedGroovy.length > 0) {
88
+
const fileList = introducedGroovy
89
+
.map(({ filename }) => `- \`${filename}\``)
138
90
.join('\n')
139
-
const body = `**⚠️ New Groovy Test Files Added**\n\n` +
140
-
`The following files add Groovy tests to modules that are candidates for migration to Java / JUnit 5:\n\n` +
91
+
const body = `**❌ New Groovy Files Detected**\n\n` +
92
+
`Please avoid introducing new \`.groovy\` files to this repository.\n\n` +
141
93
`${fileList}\n\n` +
142
-
`Consider writing these tests in Java / JUnit 5 instead to help with the ongoing migration effort.\n\n` +
143
-
warningMarker
144
-
if (existingWarningComment) {
94
+
`Instead, rewrite the new file(s) in Java / JUnit. See the [How to Test With JUnit Guide](https://github.com/DataDog/dd-trace-java/blob/master/docs/how_to_test_with_junit.md) for more details.\n\n` +
95
+
`If this PR needs an exception, add the \`tag: override-groovy-enforcement\` label to bypass this workflow.\n\n` +
96
+
managedMarker
97
+
if (existingComment) {
145
98
await github.rest.issues.updateComment({
146
-
comment_id: existingWarningComment.id,
99
+
comment_id: existingComment.id,
147
100
owner: context.repo.owner,
148
101
repo: context.repo.repo,
149
102
body
@@ -156,15 +109,14 @@ jobs:
156
109
body
157
110
})
158
111
}
159
-
} else if (existingWarningComment) {
112
+
} else if (existingComment) {
160
113
await github.rest.issues.deleteComment({
161
-
comment_id: existingWarningComment.id,
114
+
comment_id: existingComment.id,
162
115
owner: context.repo.owner,
163
116
repo: context.repo.repo
164
117
})
165
118
}
166
119
167
-
// Fail the check if there are regressions
168
-
if (regressions.length > 0) {
169
-
core.setFailed(`${regressions.length} Groovy regression(s) detected in migrated module(s). See PR comment for details. To skip this check entirely, add the 'tag: override-groovy-enforcement' label.`)
120
+
if (introducedGroovy.length > 0) {
121
+
core.setFailed(`${introducedGroovy.length} new Groovy file(s) detected. See PR comment for details. To bypass this workflow, add the 'tag: override-groovy-enforcement' label.`)
0 commit comments