|
| 1 | +# Tools |
| 2 | + |
| 3 | +This directory contains automation scripts for the Keyple Java BOM project. |
| 4 | + |
| 5 | +--- |
| 6 | + |
1 | 7 | # Automatic CHANGELOG Update Script |
2 | 8 |
|
3 | 9 | ## Description |
@@ -166,4 +172,137 @@ The script also automatically updates the links at the bottom of the file: |
166 | 172 | - Only components whose version has changed will have a status and a value in "Prev. Version" |
167 | 173 | - New dependencies (🆕) and version changes (🟢🔵🔴) appear in the order of the `build.gradle.kts` file |
168 | 174 | - Removed dependencies (❌) appear after the current dependencies of their original category |
169 | | -- If an entire category is removed, it appears at the end of the table with its dependencies marked ❌ |
| 175 | +- If an entire category is removed, it appears at the end of the table with its dependencies marked ❌ |
| 176 | + |
| 177 | +--- |
| 178 | + |
| 179 | +# BOM Version Check Script |
| 180 | + |
| 181 | +## Description |
| 182 | + |
| 183 | +`check_versions.py` is a Python script that **verifies BOM dependency versions** by checking: |
| 184 | +1. Whether dependencies are up-to-date with their latest GitHub releases |
| 185 | +2. Whether dependencies have unreleased changes in their CHANGELOG.md files |
| 186 | + |
| 187 | +## Features |
| 188 | + |
| 189 | +- **Automatic version verification** against GitHub releases |
| 190 | +- **CHANGELOG.md analysis** to detect unreleased changes |
| 191 | +- **Comprehensive reporting** with: |
| 192 | + - List of outdated dependencies |
| 193 | + - List of dependencies with unreleased changes |
| 194 | + - Summary statistics |
| 195 | + - Error reporting |
| 196 | +- Exit code 0 if everything is up-to-date, exit code 1 otherwise |
| 197 | + |
| 198 | +----- |
| 199 | + |
| 200 | +## Prerequisites |
| 201 | + |
| 202 | +- Python 3.7 or higher |
| 203 | +- **Python package**: `requests` (install with `pip install requests`) |
| 204 | +- A `user.properties` file at the project root containing a valid GitHub token: |
| 205 | + ```properties |
| 206 | + githubToken=your_github_personal_access_token |
| 207 | + ``` |
| 208 | +- The `build.gradle.kts` file must be located at the project root |
| 209 | + |
| 210 | +----- |
| 211 | + |
| 212 | +## Usage |
| 213 | + |
| 214 | +**Important**: The script must be executed from the project root directory. |
| 215 | + |
| 216 | +### Basic Usage |
| 217 | + |
| 218 | +```bash |
| 219 | +# On Windows |
| 220 | +.\tools\check_versions.bat |
| 221 | + |
| 222 | +# On Linux/Mac |
| 223 | +./tools/check_versions.sh |
| 224 | + |
| 225 | +# With Python directly (all systems) |
| 226 | +python tools/check_versions.py |
| 227 | +``` |
| 228 | + |
| 229 | +----- |
| 230 | + |
| 231 | +## Behavior |
| 232 | + |
| 233 | +1. **Token Verification**: Validates the GitHub token from `user.properties` |
| 234 | +2. **Dependency Parsing**: Extracts all dependencies from `build.gradle.kts` |
| 235 | +3. **Version Check**: For each dependency: |
| 236 | + - Fetches the latest release from GitHub |
| 237 | + - Compares with the current version in BOM |
| 238 | + - Checks if the Unreleased section in CHANGELOG.md is empty |
| 239 | +4. **Report Generation**: Displays a comprehensive report with: |
| 240 | + - Outdated dependencies (current vs. latest version) |
| 241 | + - Dependencies with unreleased changes |
| 242 | + - Errors encountered |
| 243 | + - Summary statistics |
| 244 | + |
| 245 | +----- |
| 246 | + |
| 247 | +## Example Output |
| 248 | + |
| 249 | +``` |
| 250 | +Starting BOM version check... |
| 251 | +
|
| 252 | +Verifying GitHub token... |
| 253 | +GitHub token is valid. |
| 254 | +
|
| 255 | +Found 23 dependencies to check |
| 256 | +
|
| 257 | +[1/23] Checking org.eclipse.keypop:keypop-reader-java-api:2.0.1 |
| 258 | +[2/23] Checking org.eclipse.keyple:keyple-service-java-lib:3.4.0 |
| 259 | +... |
| 260 | +
|
| 261 | +================================================================================ |
| 262 | +BOM VERSION CHECK REPORT |
| 263 | +================================================================================ |
| 264 | +
|
| 265 | +[!] OUTDATED DEPENDENCIES: |
| 266 | +-------------------------------------------------------------------------------- |
| 267 | + org.eclipse.keyple:keyple-service-java-lib |
| 268 | + Current: 3.3.6 |
| 269 | + Latest: 3.4.0 |
| 270 | +
|
| 271 | +[!] DEPENDENCIES WITH UNRELEASED CHANGES: |
| 272 | +-------------------------------------------------------------------------------- |
| 273 | + org.eclipse.keypop:keypop-reader-java-api |
| 274 | + Has unreleased changes (234 chars) |
| 275 | +
|
| 276 | +[OK] All other dependencies are up-to-date |
| 277 | +
|
| 278 | +================================================================================ |
| 279 | +SUMMARY: |
| 280 | +-------------------------------------------------------------------------------- |
| 281 | + Total dependencies: 23 |
| 282 | + Up-to-date: 21 |
| 283 | + Outdated: 1 |
| 284 | + With unreleased changes: 1 |
| 285 | + Errors: 0 |
| 286 | +================================================================================ |
| 287 | +``` |
| 288 | + |
| 289 | +----- |
| 290 | + |
| 291 | +## Exit Codes |
| 292 | + |
| 293 | +- **0**: All dependencies are up-to-date and have empty Unreleased sections |
| 294 | +- **1**: At least one of the following: |
| 295 | + - Outdated dependency found |
| 296 | + - Dependency with unreleased changes found |
| 297 | + - Error occurred during verification |
| 298 | + |
| 299 | +----- |
| 300 | + |
| 301 | +## Notes |
| 302 | + |
| 303 | +- The script requires a valid GitHub Personal Access Token to avoid API rate limits |
| 304 | +- Dependencies are mapped from Maven coordinates to GitHub repositories: |
| 305 | + - `org.eclipse.keypop:*` → `eclipse-keypop/*` |
| 306 | + - `org.eclipse.keyple:*` → `eclipse-keyple/*` |
| 307 | +- The script checks the `[Unreleased]` section of each dependency's CHANGELOG.md |
| 308 | +- Useful for CI/CD pipelines to ensure all dependencies are up-to-date before release |
0 commit comments