Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions .github/workflows/junit5-reporter-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: JUnit5 Reporter Release

on:
push:
tags:
- 'junit5-reporter-v*'

jobs:
validate:
name: Validate Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- name: Extract version from tag
id: extract-version
run: |
TAG_NAME=${GITHUB_REF#refs/tags/junit5-reporter-v}
echo "version=$TAG_NAME" >> $GITHUB_OUTPUT
echo "Releasing version: $TAG_NAME"

- name: Validate semantic version
run: |
VERSION="${{ steps.extract-version.outputs.version }}"
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
echo "❌ Invalid version format: $VERSION"
echo "Expected: MAJOR.MINOR.PATCH or MAJOR.MINOR.PATCH-PRERELEASE"
exit 1
fi
echo "✅ Valid semantic version: $VERSION"

test:
name: Test JUnit5 Reporter
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Run tests
run: |
cd reporters/junit5
gradle test --no-daemon
echo "✅ Tests passed"

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: reporters/junit5/build/reports/tests/test/

build:
name: Build and Publish
runs-on: ubuntu-latest
needs: [validate, test]
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build JAR
run: |
cd reporters/junit5
gradle clean build -Pversion=${{ needs.validate.outputs.version }} --no-daemon
echo "✅ Build completed"

- name: Publish to GitHub Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.validate.outputs.version }}
run: |
cd reporters/junit5
gradle publish \
-Pversion=$VERSION \
-PgithubToken=$GITHUB_TOKEN \
--no-daemon
echo "✅ Published to GitHub Packages"

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: junit5-reporter-v${{ needs.validate.outputs.version }}
name: JUnit5 Reporter v${{ needs.validate.outputs.version }}
body: |
## TDD Guard JUnit5 Reporter v${{ needs.validate.outputs.version }}

### Installation

#### Gradle
```kotlin
dependencies {
testImplementation("com.lightspeed.tddguard:junit5:${{ needs.validate.outputs.version }}")
}
```

#### Maven
```xml
<dependency>
<groupId>com.lightspeed.tddguard</groupId>
<artifactId>junit5</artifactId>
<version>${{ needs.validate.outputs.version }}</version>
<scope>test</scope>
</dependency>
```

### Configuration

Enable TDD Guard by setting environment variable:
```
TDDGUARD_ENABLED=true
```

Or use `/setup-tdd-guard` command in Claude Code.

### What's New
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/reporters/junit5/CHANGELOG.md) for details.
files: |
reporters/junit5/build/libs/*.jar
draft: false
prerelease: ${{ contains(needs.validate.outputs.version, '-') }}

- name: Upload JAR artifacts
uses: actions/upload-artifact@v4
with:
name: junit5-reporter-${{ needs.validate.outputs.version }}
path: reporters/junit5/build/libs/*.jar
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ reporters/pytest/pytest.ini

# Claude indexer
.claude-indexer/
.code-indexer/

# Internal documentation
docs/internal/
Expand All @@ -91,3 +92,46 @@ docs/internal/
target/
**/*.rs.bk
*.pdb

# Java/Gradle
*.class
.gradle/
gradle-app.setting
!gradle-wrapper.jar
.gradletasknamecache
bin/
out/

# Maven
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

# IntelliJ IDEA
*.iml
*.ipr
*.iws
.idea/

# Eclipse
.classpath
.project
.settings/

# NetBeans
nbproject/private/
nbbuild/
nbdist/
.nb-gradle/

# Project-specific
.analysis/
.tmp/
reports/reviews/
reports/troubleshooting/
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TDD Guard ensures Claude Code follows Test-Driven Development principles. When y
- **Test-First Enforcement** - Blocks implementation without failing tests
- **Minimal Implementation** - Prevents code beyond current test requirements
- **Lint Integration** - Enforces refactoring using your linting rules
- **Multi-Language Support** - TypeScript, JavaScript, Python, PHP, Go, and Rust
- **Multi-Language Support** - TypeScript, JavaScript, Python, PHP, Go, Rust, Java, and Kotlin
- **Customizable Rules** - Adjust validation rules to match your TDD style
- **Flexible Validation** - Choose faster or more capable models for your needs
- **Session Control** - Toggle on and off mid-session
Expand All @@ -33,7 +33,7 @@ TDD Guard ensures Claude Code follows Test-Driven Development principles. When y

- Node.js 22+
- Claude Code or Anthropic API key
- Test framework (Jest, Vitest, pytest, PHPUnit, Go 1.24+, or Rust with cargo/cargo-nextest)
- Test framework (Jest, Vitest, pytest, PHPUnit, Go 1.24+, Rust with cargo/cargo-nextest, or JUnit 5)

## Quick Start

Expand Down Expand Up @@ -230,6 +230,46 @@ test:

</details>

<details>
<summary><b>Java/Kotlin (JUnit 5)</b></summary>

Download the reporter JAR from releases:

```bash
curl -L -o libs/tdd-guard-junit5.jar \
https://github.com/lightspeed/tdd-guard/releases/latest/download/junit5-0.1.0.jar
```

**Gradle**:

```kotlin
dependencies {
testImplementation(files("libs/tdd-guard-junit5.jar"))
}

tasks.test {
systemProperty("tddguard.projectRoot", project.rootDir.absolutePath)
environment("TDDGUARD_ENABLED", "true")
}
```

**Maven**:

```bash
mvn install:install-file \
-Dfile=libs/tdd-guard-junit5.jar \
-DgroupId=com.lightspeed.tddguard \
-DartifactId=junit5 \
-Dversion=0.1.0 \
-Dpackaging=jar
```

Then add dependency in pom.xml and configure Surefire plugin.

**Note:** For GitHub Packages installation with automatic dependency resolution, see [reporters/junit5/README.md](reporters/junit5/README.md). The direct JAR download method requires no authentication.

</details>

### 3. Configure Claude Code Hooks

TDD Guard uses hooks to validate operations and provide convenience features like quick toggle commands and automatic session management.
Expand Down
Loading