Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
78 changes: 69 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,91 @@
# Simple Makefile for Maven build without tests
.PHONY: build clean package help
.PHONY: build clean package validate test release release-prepare release-perform deploy help

# Maven wrapper
MVN = ./mvnw

# Default target
all: package

# Validate environment setup
validate:
@echo "Running environment validation..."
@./scripts/validate-setup.sh

# Build the project (clean and package without tests)
build: clean package

# Clean the project
clean:
mvn clean
$(MVN) clean
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MVN variable should be checked for existence before use. If ./mvnw doesn't exist (e.g., fresh checkout before wrapper setup), this will fail silently. Consider adding a validation or fallback to 'mvn'.

Copilot uses AI. Check for mistakes.

# Package the project without running tests
package:
mvn package -DskipTests
$(MVN) package -DskipTests

# Run tests
test:
$(MVN) test

# Combined clean and package
package-with-clean:
mvn clean package -DskipTests
$(MVN) clean package -DskipTests

# Validate then build
safe-build: validate build

# Deploy to repository
deploy:
$(MVN) clean deploy

# Deploy without running tests
deploy-skip-tests:
$(MVN) clean deploy -DskipTests

# Prepare release (version bump and tag)
release-prepare:
@echo "Preparing release..."
$(MVN) release:prepare

# Perform release (build and deploy)
release-perform:
@echo "Performing release..."
$(MVN) release:perform

# Full release (prepare + perform)
release: release-prepare release-perform

# Rollback failed release
release-rollback:
@echo "Rolling back release..."
$(MVN) release:rollback

# Clean release artifacts
release-clean:
@echo "Cleaning release artifacts..."
$(MVN) release:clean

# Display help
help:
@echo "Available targets:"
@echo " all - Same as 'package' (default)"
@echo " build - Clean and package (without tests)"
@echo " clean - Clean the project"
@echo " package - Package without running tests"
@echo " all - Same as 'package' (default)"
@echo " validate - Validate environment setup"
@echo " build - Clean and package (without tests)"
@echo " clean - Clean the project"
@echo " package - Package without running tests"
@echo " test - Run tests"
@echo " package-with-clean - Clean and package in one command"
@echo " help - Show this help message"
@echo " safe-build - Validate environment then build"
@echo ""
@echo "Deployment targets:"
@echo " deploy - Deploy artifacts to repository"
@echo " deploy-skip-tests - Deploy without running tests"
@echo ""
@echo "Release targets:"
@echo " release-prepare - Prepare release (version bump, tag)"
@echo " release-perform - Perform release (build and deploy)"
@echo " release - Full release (prepare + perform)"
@echo " release-rollback - Rollback a failed release"
@echo " release-clean - Clean release artifacts"
@echo ""
@echo " help - Show this help message"
250 changes: 250 additions & 0 deletions docs/RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
# Release Process

This document describes how to create and publish releases for GPULlama3.java.

## Prerequisites

Before creating a release, ensure you have:

1. **Git access** - Push access to the repository
2. **GPG key** - For signing artifacts (releases only)
3. **Maven credentials** - Configured in `~/.m2/settings.xml` for publishing
4. **Clean working directory** - All changes committed

## Quick Start

### Option 1: Using Makefile (Recommended)

```bash
# Full automated release
make release

# Or step by step:
make release-prepare # Version bump + git tag
make release-perform # Build + deploy
```

### Option 2: Using Maven directly

```bash
# Full automated release
./mvnw release:prepare release:perform

# Or step by step:
./mvnw release:prepare
./mvnw release:perform
```

## What Happens During Release

### Step 1: release:prepare

The `release:prepare` command:
1. Runs tests to verify the build
2. Removes `-SNAPSHOT` from version (e.g., `0.2.2-SNAPSHOT` → `0.2.2`)
3. Commits the release version to git with `[release] prepare release v0.2.2`
4. Creates a git tag (e.g., `v0.2.2`)
5. Bumps version to next development version (e.g., `0.2.3-SNAPSHOT`)
6. Commits the new snapshot version with `[release] prepare for next development iteration`

**Example:**
```bash
$ ./mvnw release:prepare
What is the release version for "GPU Llama3"? (io.github.beehive-lab:gpu-llama3) 0.2.2: :
What is SCM release tag or label for "GPU Llama3"? (io.github.beehive-lab:gpu-llama3) v0.2.2: :
What is the new development version for "GPU Llama3"? (io.github.beehive-lab:gpu-llama3) 0.2.3-SNAPSHOT: :
```

### Step 2: release:perform

The `release:perform` command:
1. Checks out the release tag
2. Builds the project with the `release` profile
- Enables GPG signing
- Generates Javadocs
- Creates sources JAR
3. Deploys artifacts to Maven Central
4. Cleans up temporary files

## Release Profiles

The project has a `release` profile that is automatically activated during `release:perform`:

```xml
<profile>
<id>release</id>
<properties>
<gpg.skip>false</gpg.skip> <!-- Enable signing -->
<maven.javadoc.skip>false</maven.javadoc.skip> <!-- Generate docs -->
</properties>
</profile>
```

## Configuration

### Maven Settings (~/.m2/settings.xml)

You need credentials configured for publishing:

```xml
<settings>
<servers>
<server>
<id>central</id>
<username>YOUR_USERNAME</username>
<password>YOUR_PASSWORD</password>
</server>
</servers>
</settings>
```

### GPG Configuration

For signing artifacts, you need:

```bash
# Generate a GPG key (if you don't have one)
gpg --gen-key

# List your keys
gpg --list-keys

# Export public key to keyserver
gpg --keyserver keyserver.ubuntu.com --send-keys YOUR_KEY_ID
```

Configure Maven to use your key in `~/.m2/settings.xml`:

```xml
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>YOUR_PASSPHRASE</gpg.passphrase>
</properties>
</profile>
</profiles>

<activeProfiles>
<activeProfile>gpg</activeProfile>
</activeProfiles>
```

## Troubleshooting

### Release Fails - How to Rollback

If `release:prepare` fails:

```bash
make release-rollback
# or
./mvnw release:rollback
```

This will:
- Remove the release tag from git
- Revert version changes in pom.xml

### Clean Up After Failed Release

```bash
make release-clean
# or
./mvnw release:clean
```

This removes temporary files created during the release process:
- `release.properties`
- `pom.xml.releaseBackup`

### Common Issues

#### Issue: "Working directory is not clean"
**Solution:** Commit all changes before releasing
```bash
git status
git add .
git commit -m "Prepare for release"
```

#### Issue: "GPG signing failed"
**Solution:** Ensure GPG key is configured and passphrase is correct
```bash
gpg --list-secret-keys
```

#### Issue: "Authentication failed for Maven Central"
**Solution:** Check credentials in `~/.m2/settings.xml`

#### Issue: "Tests failed"
**Solution:** Run tests manually first
```bash
make test
# or
./mvnw test
```

## Release Checklist

Before releasing:

- [ ] All tests passing (`make test`)
- [ ] CHANGELOG.md updated with release notes
- [ ] README.md version references updated (if any)
- [ ] All changes committed and pushed
- [ ] Working directory clean (`git status`)
- [ ] Maven Central credentials configured
- [ ] GPG key configured for signing

During release:

- [ ] Run `make release-prepare` (or `./mvnw release:prepare`)
- [ ] Verify git tags created (`git tag -l`)
- [ ] Run `make release-perform` (or `./mvnw release:perform`)
- [ ] Verify artifacts published to Maven Central

After release:

- [ ] Push tags to remote: `git push origin --tags`
- [ ] Create GitHub release from tag
- [ ] Announce release (if applicable)

## Manual Deployment (Without Release Plugin)

If you just want to deploy without version management:

```bash
# Deploy with tests
make deploy

# Deploy without tests
make deploy-skip-tests
```

## Version Numbering

We follow [Semantic Versioning](https://semver.org/):

- **MAJOR.MINOR.PATCH** (e.g., `0.2.2`)
- Increment MAJOR for incompatible API changes
- Increment MINOR for backwards-compatible new features
- Increment PATCH for backwards-compatible bug fixes

Development versions have `-SNAPSHOT` suffix (e.g., `0.2.3-SNAPSHOT`)

## Release Schedule

Releases are created as needed. Typical triggers:

- Major new features
- Critical bug fixes
- Security updates
- Quarterly maintenance releases

## See Also

- [Maven Release Plugin Documentation](https://maven.apache.org/maven-release/maven-release-plugin/)
- [Semantic Versioning](https://semver.org/)
- [Maven Central Publishing](https://central.sonatype.org/publish/)
Loading