Skip to content

Commit b428d56

Browse files
Copilotrbri
andcommitted
Add CI/CD improvements and project documentation
Co-authored-by: rbri <[email protected]>
1 parent 7dbdc3b commit b428d56

File tree

17 files changed

+456
-13
lines changed

17 files changed

+456
-13
lines changed

.editorconfig

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
13+
# Java files
14+
[*.java]
15+
indent_style = space
16+
indent_size = 4
17+
max_line_length = 120
18+
19+
# XML files (pom.xml, etc.)
20+
[*.xml]
21+
indent_style = space
22+
indent_size = 4
23+
24+
# YAML files
25+
[*.{yml,yaml}]
26+
indent_style = space
27+
indent_size = 2
28+
29+
# Markdown files
30+
[*.md]
31+
trim_trailing_whitespace = false
32+
max_line_length = off
33+
34+
# Properties files
35+
[*.properties]
36+
indent_style = space
37+
indent_size = 4
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Parse HTML with '...'
16+
2. Use parser configuration '....'
17+
3. Call method '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Code Example**
24+
```java
25+
// Minimal code example to reproduce the issue
26+
DOMParser parser = new DOMParser();
27+
// ...
28+
```
29+
30+
**HTML Sample**
31+
```html
32+
<!-- The HTML that causes the issue -->
33+
<!DOCTYPE html>
34+
<html>
35+
...
36+
</html>
37+
```
38+
39+
**Environment (please complete the following information):**
40+
- OS: [e.g. Windows 10, Ubuntu 20.04]
41+
- Java Version: [e.g. 8, 11, 17]
42+
- HtmlUnit NekoHTML Version: [e.g. 4.18.0]
43+
44+
**Stack Trace**
45+
If applicable, add the full stack trace:
46+
```
47+
Exception in thread "main" ...
48+
```
49+
50+
**Additional context**
51+
Add any other context about the problem here.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Use Case**
20+
Describe how this feature would be used in practice:
21+
```java
22+
// Example code showing how the feature would be used
23+
parser.setFeature(NEW_FEATURE, true);
24+
// ...
25+
```
26+
27+
**Additional context**
28+
Add any other context, screenshots, or examples about the feature request here.
29+
30+
**Would you be willing to implement this feature?**
31+
- [ ] Yes, I can submit a pull request
32+
- [ ] No, but I can help with testing
33+
- [ ] No, just suggesting the idea

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Description
2+
<!-- Provide a brief description of the changes in this PR -->
3+
4+
## Type of Change
5+
<!-- Mark the relevant option with an "x" -->
6+
- [ ] Bug fix (non-breaking change which fixes an issue)
7+
- [ ] New feature (non-breaking change which adds functionality)
8+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
9+
- [ ] Documentation update
10+
- [ ] Code quality improvement
11+
- [ ] Performance improvement
12+
13+
## Related Issue
14+
<!-- Link to the issue this PR addresses -->
15+
Fixes #(issue number)
16+
17+
## Changes Made
18+
<!-- Describe the changes made in this PR -->
19+
-
20+
-
21+
-
22+
23+
## Testing
24+
<!-- Describe the tests you ran to verify your changes -->
25+
- [ ] All existing tests pass (`mvn test`)
26+
- [ ] Added new tests for the changes
27+
- [ ] Tested with various Java versions (8, 11, 17, 21)
28+
- [ ] Manual testing performed
29+
30+
### Test Cases Added
31+
<!-- List any new test cases -->
32+
-
33+
-
34+
35+
## Quality Checks
36+
<!-- Mark completed checks with an "x" -->
37+
- [ ] Code follows the project's code style (`mvn checkstyle:check`)
38+
- [ ] No new SpotBugs warnings (`mvn spotbugs:check`)
39+
- [ ] No new PMD violations (`mvn pmd:check`)
40+
- [ ] JavaDoc added/updated for public APIs
41+
- [ ] README.md updated (if applicable)
42+
43+
## Screenshots (if applicable)
44+
<!-- Add screenshots to help explain your changes -->
45+
46+
## Additional Notes
47+
<!-- Add any additional notes for reviewers -->
48+
49+
## Checklist
50+
- [ ] My code follows the style guidelines of this project
51+
- [ ] I have performed a self-review of my own code
52+
- [ ] I have commented my code, particularly in hard-to-understand areas
53+
- [ ] I have made corresponding changes to the documentation
54+
- [ ] My changes generate no new warnings
55+
- [ ] I have added tests that prove my fix is effective or that my feature works
56+
- [ ] New and existing unit tests pass locally with my changes
57+
- [ ] Any dependent changes have been merged and published

.github/workflows/ci.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: CI Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
java: ['8', '11', '17', '21']
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up JDK ${{ matrix.java }}
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: ${{ matrix.java }}
26+
distribution: 'temurin'
27+
cache: 'maven'
28+
29+
- name: Build with Maven
30+
run: mvn -B clean compile --file pom.xml
31+
32+
- name: Run tests
33+
run: mvn -B test --file pom.xml
34+
35+
- name: Generate test report
36+
if: always()
37+
run: mvn surefire-report:report-only
38+
39+
- name: Upload test results
40+
if: always()
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: test-results-java-${{ matrix.java }}
44+
path: target/surefire-reports/
45+
retention-days: 7
46+
47+
quality:
48+
name: Code Quality Checks
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
55+
- name: Set up JDK 8
56+
uses: actions/setup-java@v4
57+
with:
58+
java-version: '8'
59+
distribution: 'temurin'
60+
cache: 'maven'
61+
62+
- name: Compile code
63+
run: mvn -B clean compile --file pom.xml
64+
65+
- name: Run Checkstyle
66+
run: mvn checkstyle:checkstyle --file pom.xml
67+
continue-on-error: true
68+
69+
- name: Upload Checkstyle report
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: checkstyle-report
73+
path: target/checkstyle-result.xml
74+
retention-days: 7
75+
76+
- name: Run SpotBugs
77+
run: mvn spotbugs:spotbugs --file pom.xml
78+
continue-on-error: true
79+
80+
- name: Upload SpotBugs report
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: spotbugs-report
84+
path: target/spotbugsXml.xml
85+
retention-days: 7
86+
87+
- name: Run PMD
88+
run: mvn pmd:pmd --file pom.xml
89+
continue-on-error: true
90+
91+
- name: Upload PMD report
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: pmd-report
95+
path: target/pmd.xml
96+
retention-days: 7

.github/workflows/codeql-analysis.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,18 @@ jobs:
3030

3131
steps:
3232
- name: Checkout repository
33-
uses: actions/checkout@v2
34-
with:
35-
# We must fetch at least the immediate parents so that if this is
36-
# a pull request then we can checkout the head.
37-
fetch-depth: 2
33+
uses: actions/checkout@v4
3834

39-
# If this run was triggered by a pull request event, then checkout
40-
# the head of the pull request instead of the merge commit.
41-
- run: git checkout HEAD^2
42-
if: ${{ github.event_name == 'pull_request' }}
35+
- name: Set up JDK 8
36+
uses: actions/setup-java@v4
37+
with:
38+
java-version: '8'
39+
distribution: 'temurin'
40+
cache: 'maven'
4341

4442
# Initializes the CodeQL tools for scanning.
4543
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v2
44+
uses: github/codeql-action/init@v3
4745
with:
4846
languages: ${{ matrix.language }}
4947
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +52,7 @@ jobs:
5452
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5553
# If this step fails, then you should remove it and run the build manually (see below)
5654
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v2
55+
uses: github/codeql-action/autobuild@v3
5856

5957
# ℹ️ Command-line programs to run using the OS shell.
6058
# 📚 https://git.io/JvXDl
@@ -68,4 +66,4 @@ jobs:
6866
# make release
6967

7068
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v2
69+
uses: github/codeql-action/analyze@v3

0 commit comments

Comments
 (0)