Skip to content

Commit 683c55a

Browse files
Add issue templates for contributors []
1 parent 4036ffc commit 683c55a

7 files changed

Lines changed: 352 additions & 0 deletions

File tree

‎.github/DISCUSSION_TEMPLATE/issue-triage-compilation.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Mirrored by .github/ISSUE_TEMPLATE/issue-triage-compilation.yml: keep the body:
2+
# sections identical (dev_tools/bin/edg-check-issue-templates checks this).
13
body:
24
- type: textarea
35
attributes:

‎.github/DISCUSSION_TEMPLATE/issue-triage-general.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Mirrored by .github/ISSUE_TEMPLATE/issue-triage-general.yml: keep the body:
2+
# sections identical, apart from links to the other form
3+
# (dev_tools/bin/edg-check-issue-templates checks this).
14
body:
25
- type: markdown
36
attributes:

‎.github/ISSUE_TEMPLATE/config.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# The issue template chooser. Collaborators may still open a blank issue (e.g.
2+
# for a task or feature); everyone else can report problems through the
3+
# Discussions triage categories.
4+
blank_issues_enabled: true
5+
contact_links:
6+
- name: Compilation issue triage (Discussions)
7+
url: https://github.com/edgcpp/compiler/discussions/categories/issue-triage-compilation
8+
about: Report a compilation problem for triage if you can't file issues directly.
9+
- name: General issue triage (Discussions)
10+
url: https://github.com/edgcpp/compiler/discussions/categories/issue-triage-general
11+
about: Report any other problem for triage if you can't file issues directly.
12+
- name: Questions (Discussions)
13+
url: https://github.com/edgcpp/compiler/discussions/categories/q-a
14+
about: Ask questions about using or contributing to the project.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Mirrors .github/DISCUSSION_TEMPLATE/issue-triage-compilation.yml: keep the
2+
# body: sections identical (dev_tools/bin/edg-check-issue-templates checks
3+
# this).
4+
name: Compilation issue
5+
description: The front end mis-compiles, rejects, accepts, or crashes on source code (most issues).
6+
type: Bug
7+
body:
8+
- type: textarea
9+
attributes:
10+
label: Issue Summary
11+
description: Provide a high level description of what you believe is going wrong and how it is impacting you.
12+
placeholder: In rare instances when using lambdas inside of class templates, the front end refuses to instantiate the template. This code compiles fine with GCC and Clang. I had to adapt the code to work around the issue, but I prefer the implementation strategy I am sharing in this report.
13+
validations:
14+
required: true
15+
- type: textarea
16+
attributes:
17+
label: Reproducing Source Code
18+
description: |
19+
Provide the source code reproducing the issue.
20+
21+
*Please*:
22+
1. Reduce the translation unit to the smallest possible reproducing case.
23+
2. Upload the source code file(s) as a: `.cpp`, `.zip`, or `.tar.gz`.
24+
3. DO NOT paste a large code block here (a small legally-unencumbered code block is okay in place of an upload).
25+
26+
> [!TIP]
27+
> If you would like to reduce the issue but do not know how, checkout the [cvise](https://github.com/marxin/cvise/) project as this is VERY helpful for automatic issue reduction. Additionally, in many cases AI agents can successfully create a reduced test case (that is similar enough to still reproduce the problem) in a fraction of the time.
28+
29+
> [!IMPORTANT]
30+
> If this source code is not compatible with the [project license](https://edgcpp.org/LICENSE.txt), please include a LICENSE.txt file or license disclosure comment at the start of all relevant files.
31+
placeholder: |
32+
[reproducer.zip](https://github.com/user-attachments/files/...)
33+
validations:
34+
required: true
35+
- type: input
36+
attributes:
37+
label: Command-line Options
38+
description: Provide the command-line options needed for reproducing the problem.
39+
placeholder: cpfe --c++26 test.cpp
40+
validations:
41+
required: true
42+
- type: dropdown
43+
attributes:
44+
label: Type of Issue
45+
options:
46+
- |
47+
[Front End] This code *SHOULD* compile with these options.
48+
- |
49+
[Front End] This code *SHOULD NOT* compile with these options.
50+
- |
51+
[Front End] I do not care but this code *CRASHES* the compiler.
52+
- |
53+
[Back End] There is a problem with the generated C code.
54+
- |
55+
[Back End] There is a problem with the generated C++ code.
56+
validations:
57+
required: true
58+
- type: textarea
59+
attributes:
60+
label: Additional Details
61+
description: Provide any additional clarifying details that might help us better understand what is currently happening and what you expect to happen.
62+
placeholder: The generated C code does not compile with gcc 14.
63+
- type: dropdown
64+
attributes:
65+
label: Reproducing (Standard) Configuration(s)
66+
description: |
67+
What CMake preset-based configurations have you observed reproducing this issue (if any)?
68+
69+
> [!NOTE]
70+
> While you can select any configuration you know to reproduce the problem, you do not need to check every configuration.
71+
multiple: true
72+
options:
73+
- macos-arm-clang-debug
74+
- macos-arm-clang-release
75+
- macos-x86-clang-debug
76+
- macos-x86-clang-multi-thread-debug
77+
- macos-x86-clang-release
78+
- linux-clang-debug
79+
- linux-clang-lsp
80+
- linux-clang-release
81+
- linux-clang-debuggable-release
82+
- linux-gcc-debug
83+
- linux-i686-gcc-debug
84+
- linux-gcc-multi-thread-debug
85+
- linux-gcc-multi-thread-release
86+
- linux-gcc-release
87+
- linux-gcc-debuggable-release
88+
- linux-gcc-reflection-release
89+
- windows-msvc-debug
90+
- windows-msvc-release
91+
- type: textarea
92+
attributes:
93+
label: Reproducing (Non-standard) Configuration
94+
description: |
95+
If this problem does not reproduce in one of the above "standard" configurations, please provide the output obtained when using the `--dump_configuration` command-line option with the EDG front end you are using.
96+
97+
> [!TIP]
98+
> Consider contributing a new build & testing configuration to increase coverage and make it easier to report (and reproduce) any future issues.
99+
placeholder: |
100+
[config.txt](https://github.com/user-attachments/files/...)
101+
- type: checkboxes
102+
attributes:
103+
label: "I acknowledge that:"
104+
options:
105+
- label: I have checked open issues and existing discussions before filing this report.
106+
required: true
107+
- label: The reproducing source code that I have provided does not depend on headers that I have not included with my submission.
108+
required: true
109+
- label: I have reduced the reproducing source code to the best of my ability.
110+
required: true
111+
- label: I have selected at least one standard configuration or uploaded a non-standard configuration dump.
112+
required: true
113+
- label: I understand code shared via this form is NOT confidential.
114+
required: true
115+
- label: I have permission to share the reproducing source code and grant permission for the project to use the source code (or derivatives of the source code) to create tests.
116+
required: true
117+
- label: I agree that any tests created using the reproducing source code (or deriatives of it) will be licensed under [project license](https://edgcpp.org/LICENSE.txt) unless I included a `LICENSE.txt` file in my `.zip` or `.tar.gz` upload. If I included a `LICENSE.txt` file, any tests created using the reproducing source code will be governed by the terms of the license I provided instead.
118+
required: true
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Mirrors .github/DISCUSSION_TEMPLATE/issue-triage-general.yml: keep the body:
2+
# sections identical, apart from links to the other form
3+
# (dev_tools/bin/edg-check-issue-templates checks this).
4+
name: General issue
5+
description: Tooling, build, documentation, or other problems not involving compiling source code.
6+
type: Bug
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: Please use the [compilation issue triage](https://github.com/edgcpp/compiler/issues/new?template=issue-triage-compilation.yml) for filing issues involving source code compilation (i.e., most issues).
11+
- type: textarea
12+
attributes:
13+
label: Issue Summary
14+
description: Provide a high level description of what you believe is going wrong and how it is impacting you.
15+
placeholder: |
16+
`edg-docker-test` is printing the incorrect host path for some of the log files when run on MacOS Monterey. This is making it difficult for me to test my changes.
17+
validations:
18+
required: true
19+
- type: textarea
20+
attributes:
21+
label: Observed Behavior
22+
description: Please provide the behavior observed.
23+
placeholder: When I run `edg-docker-test` I see the following log lines printed ... note how the second log is printed with its container path rather than a host path.
24+
validations:
25+
required: true
26+
- type: textarea
27+
attributes:
28+
label: Expected Behavior
29+
description: Please provide a description of how you would like things to work.
30+
placeholder: All printed paths should be host paths.
31+
validations:
32+
required: true
33+
- type: textarea
34+
attributes:
35+
label: Additional Details
36+
description: Provide any additional details that you think may be helpful.
37+
placeholder: I tried setting EDG_DOCKER_HOST_PATHS to 1 explicity and that did not help. However, setting EDG_DOCKER_HOST_PATHS to 2 does print the host and container path as expected. This makes me think the issue is specific to setting EDG_DOCKER_HOST_PATHS to 1.
38+
- type: checkboxes
39+
attributes:
40+
label: "I acknowledge that:"
41+
options:
42+
- label: I have checked open issues and existing discussions before filing this report.
43+
required: true
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM
2+
# Exceptions.
3+
# See https://edgcpp.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
# Check that the issue forms (.github/ISSUE_TEMPLATE) and the discussion forms
7+
# (.github/DISCUSSION_TEMPLATE) they mirror haven't drifted apart.
8+
9+
name: Issue Templates
10+
11+
on:
12+
push:
13+
branches:
14+
- main
15+
paths:
16+
- .github/ISSUE_TEMPLATE/**
17+
- .github/DISCUSSION_TEMPLATE/**
18+
- .github/workflows/issue-templates.yml
19+
- dev_tools/bin/edg-check-issue-templates
20+
pull_request:
21+
paths:
22+
- .github/ISSUE_TEMPLATE/**
23+
- .github/DISCUSSION_TEMPLATE/**
24+
- .github/workflows/issue-templates.yml
25+
- dev_tools/bin/edg-check-issue-templates
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
check:
32+
name: check-issue-templates
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 5
35+
steps:
36+
- name: Check out repository
37+
uses: actions/checkout@v7
38+
39+
- name: Compare issue and discussion forms
40+
run: python3 dev_tools/bin/edg-check-issue-templates
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#!/usr/bin/env python3
2+
3+
# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM
4+
# Exceptions.
5+
# See https://edgcpp.org/LICENSE.txt for license information.
6+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
8+
'''Check that the issue forms and the discussion forms match.
9+
10+
Every form in .github/DISCUSSION_TEMPLATE has a twin of the same name in
11+
.github/ISSUE_TEMPLATE, so contributors who can file issues use the same form
12+
as everyone else. GitHub can't share one file between the two (issue forms
13+
need name/description keys discussion forms don't allow), so the two copies
14+
are kept by hand and this checks that their body: sections are identical,
15+
apart from links to the other forms (a discussion category in one, an issue
16+
form in the other).
17+
'''
18+
19+
import argparse
20+
import difflib
21+
import re
22+
import sys
23+
24+
from pathlib import Path
25+
from typing import List, Optional
26+
27+
REPOSITORY_URL = 'https://github.com/edgcpp/compiler'
28+
29+
# Links to another form, which differ between the twins by design.
30+
FORM_LINK_PATTERNS = [
31+
re.compile(re.escape(REPOSITORY_URL) +
32+
r'/discussions/categories/([A-Za-z0-9_-]+)'),
33+
re.compile(re.escape(REPOSITORY_URL) +
34+
r'/issues/new\?template=([A-Za-z0-9_-]+)\.yml'),
35+
]
36+
37+
# Files in ISSUE_TEMPLATE that aren't forms.
38+
NON_FORMS = {'config.yml'}
39+
40+
# Top-level keys an issue form requires before its body.
41+
ISSUE_FORM_KEYS = ['name', 'description']
42+
43+
44+
def form_body(path: Path) -> Optional[List[str]]:
45+
'''Return the lines from the body: key on, with form links normalized.'''
46+
lines = path.read_text(encoding = 'utf-8').splitlines(keepends = True)
47+
for index, line in enumerate(lines):
48+
if line.startswith('body:'):
49+
body = lines[index:]
50+
for pattern in FORM_LINK_PATTERNS:
51+
body = [pattern.sub(r'<form \1>', text) for text in body]
52+
return body
53+
return None
54+
55+
56+
def missing_issue_form_keys(path: Path) -> List[str]:
57+
'''Return the required top-level keys path lacks before its body.'''
58+
header = []
59+
for line in path.read_text(encoding = 'utf-8').splitlines():
60+
if line.startswith('body:'):
61+
break
62+
header.append(line)
63+
return [
64+
key for key in ISSUE_FORM_KEYS
65+
if not any(line.startswith(key + ':') for line in header)
66+
]
67+
68+
69+
def main() -> int:
70+
parser = argparse.ArgumentParser(description = __doc__.splitlines()[0])
71+
parser.add_argument(
72+
'--github-dir',
73+
type = Path,
74+
default = Path(__file__).resolve().parents[2] / '.github',
75+
help = 'the .github directory to check (default: this repository\'s)'
76+
)
77+
args = parser.parse_args()
78+
79+
discussion_dir = args.github_dir / 'DISCUSSION_TEMPLATE'
80+
issue_dir = args.github_dir / 'ISSUE_TEMPLATE'
81+
discussion_forms = {path.name for path in discussion_dir.glob('*.yml')}
82+
issue_forms = {
83+
path.name for path in issue_dir.glob('*.yml')
84+
if path.name not in NON_FORMS
85+
}
86+
87+
errors = 0
88+
for name in sorted(discussion_forms - issue_forms):
89+
print(f"error: {discussion_dir / name} has no twin in {issue_dir}",
90+
file = sys.stderr)
91+
errors += 1
92+
for name in sorted(issue_forms - discussion_forms):
93+
print(f"error: {issue_dir / name} has no twin in {discussion_dir}",
94+
file = sys.stderr)
95+
errors += 1
96+
97+
for name in sorted(discussion_forms & issue_forms):
98+
discussion_form = discussion_dir / name
99+
issue_form = issue_dir / name
100+
missing = missing_issue_form_keys(issue_form)
101+
if len(missing) != 0:
102+
print(f"error: {issue_form} lacks the top-level key(s) "
103+
f"{', '.join(missing)}", file = sys.stderr)
104+
errors += 1
105+
discussion_body = form_body(discussion_form)
106+
issue_body = form_body(issue_form)
107+
if discussion_body is None or issue_body is None:
108+
for path, body in ((discussion_form, discussion_body),
109+
(issue_form, issue_body)):
110+
if body is None:
111+
print(f"error: {path} has no body: key", file = sys.stderr)
112+
errors += 1
113+
continue
114+
if discussion_body != issue_body:
115+
print(f"error: the body: sections of {discussion_form} and "
116+
f"{issue_form} differ:", file = sys.stderr)
117+
sys.stderr.writelines(difflib.unified_diff(
118+
discussion_body,
119+
issue_body,
120+
fromfile = str(discussion_form),
121+
tofile = str(issue_form)
122+
))
123+
errors += 1
124+
125+
if errors != 0:
126+
return 1
127+
print(f"{len(discussion_forms & issue_forms)} form(s) match.")
128+
return 0
129+
130+
131+
if __name__ == '__main__':
132+
sys.exit(main())

0 commit comments

Comments
 (0)