-
Notifications
You must be signed in to change notification settings - Fork 23
Fresh build improvements #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
mikepapadim
wants to merge
2
commits into
beehive-lab:main
from
mikepapadim:fresh-build-improvements
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| # 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" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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'.