Skip to content

Commit 84c96ed

Browse files
authored
Update CONTRIBUTING.md
1 parent 88fc20d commit 84c96ed

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,31 @@ git push origin your-feature-branch
111111
```
112112
113113

114+
115+
## Unit Tests and Test Coverage
116+
117+
All contributions to `SpringUserFramework` **must include appropriate unit tests**. This ensures that the library remains stable, reliable, and maintainable as it grows.
118+
119+
### Requirements
120+
121+
- **All new features** must include unit tests that thoroughly cover the new functionality.
122+
- **Bug fixes** should include tests that demonstrate the issue and confirm the fix.
123+
- If you are **modifying existing code**, you should update or expand the relevant tests to reflect those changes.
124+
- **All tests must pass** before a pull request will be considered for merging.
125+
126+
### Running Tests Locally
127+
128+
Before submitting a PR, run the full test suite to ensure your changes do not introduce regressions:
129+
130+
```bash
131+
./gradlew test
132+
```
133+
134+
If you are using an IDE like VSCode or IntelliJ, you can also run the tests from the IDE directly.
135+
136+
We may add code coverage reporting tools in the future to help enforce this, but for now, maintainers will review tests as part of the code review process.
137+
138+
114139
## Submitting a Pull Request
115140

116141
Once your changes are pushed to your fork, submit a pull request (PR) to the original repository:
@@ -123,6 +148,71 @@ Once your changes are pushed to your fork, submit a pull request (PR) to the ori
123148

124149
Your PR will be reviewed by the maintainers. Please be responsive to feedback and willing to make adjustments as needed.
125150

151+
152+
## Contributing to the Demo Frontend
153+
154+
If your change involves a **frontend component**, or if it requires a user interface to **showcase or test the functionality** (such as login flows, authentication UIs, or session behavior), you'll also need to contribute to the companion frontend project:
155+
👉 [**SpringUserFrameworkDemoApp**](https://github.com/devondragon/SpringUserFrameworkDemoApp)
156+
157+
This project is a lightweight web application used to **demonstrate and test** features of the `SpringUserFramework` library.
158+
159+
### What You Need to Do
160+
161+
1. **Fork the `SpringUserFrameworkDemoApp` repository** as well.
162+
2. Make changes or add test pages in the demo app to support or demonstrate your backend work.
163+
3. Submit a separate pull request to the `SpringUserFrameworkDemoApp` repository.
164+
4. Reference your demo app PR in your main `SpringUserFramework` pull request description, so reviewers can test your changes end-to-end.
165+
166+
Keeping the demo app up to date with relevant examples helps others understand how to use the library and ensures that all features are properly tested in a real-world scenario.
167+
168+
169+
170+
## Testing Local Changes with the Demo App
171+
172+
Since `SpringUserFramework` is a **library**, the best way to test your changes is by using the companion project:
173+
👉 [**SpringUserFrameworkDemoApp**](https://github.com/devondragon/SpringUserFrameworkDemoApp)
174+
175+
This demo app allows you to see how the library behaves in a real application context.
176+
177+
### How to Test Your Changes Locally
178+
179+
To test updates to the library before submitting a pull request, follow these steps:
180+
181+
1. **Install Maven (if not already installed)**
182+
You'll need Maven installed locally because Gradle publishes the library into your **local Maven cache**.
183+
184+
2. **Build and publish the library locally**
185+
In your fork of `SpringUserFramework`, run:
186+
187+
```bash
188+
./gradlew publishToMavenLocal
189+
```
190+
191+
This will compile the project and publish it as a `.jar` file with a `-SNAPSHOT` version into your local Maven cache (usually located at `~/.m2/repository`).
192+
193+
3. **Update the demo app to use your local library**
194+
In your fork of [`SpringUserFrameworkDemoApp`](https://github.com/devondragon/SpringUserFrameworkDemoApp):
195+
196+
- Open `build.gradle`.
197+
- Update the library dependency to match the `SNAPSHOT` version defined in the `gradle.properties` file from your local library project.
198+
199+
Example:
200+
```groovy
201+
implementation 'com.yourgroupid:spring-user-framework:1.2.3-SNAPSHOT'
202+
```
203+
204+
4. **Build and run the demo app**
205+
Use your IDE or run from the command line:
206+
207+
```bash
208+
./gradlew bootRun
209+
```
210+
211+
The demo app should now load and use your locally built version of the library. This allows you to interactively test your changes before pushing them upstream.
212+
213+
> 💡 Make sure not to commit any version changes to `build.gradle` or `gradle.properties` as the project maintainer is the only one to update versions.
214+
215+
126216
## Code Style and Standards
127217

128218
Please adhere to the following coding standards:

0 commit comments

Comments
 (0)