build-and-push.py automates the complete build, test, and deployment workflow for Juneau, ensuring code quality before pushing changes to the remote repository.
The script executes the following steps in order:
mvn test to ensure all tests passmvn clean package install to build the projectmvn javadoc:javadoc to create API documentationIf any step fails, the script stops immediately and reports the failure.
cd /Users/james.bognar/git/juneau python3 scripts/build-and-push.py "Your commit message here"
python3 scripts/build-and-push.py "Updated README" --skip-tests
python3 scripts/build-and-push.py "Minor code fix" --skip-javadoc
python3 scripts/build-and-push.py "Quick formatting fix" --skip-tests --skip-javadoc
python3 scripts/build-and-push.py "Testing changes" --dry-run
message - The Git commit message (must be provided)--skip-tests - Skip running tests (useful for documentation-only changes)--skip-javadoc - Skip Javadoc generation--dry-run - Show what would be done without actually executing commandspython3 scripts/build-and-push.py "Fixed bug in RestClient connection handling"
Output:
====================================================================== ๐ Juneau Build and Push Script ====================================================================== Working directory: /Users/james.bognar/git/juneau Commit message: 'Fixed bug in RestClient connection handling' ====================================================================== ๐งช Step 1: Running tests... Running: mvn test โ Step 1: Running tests... - SUCCESS ๐๏ธ Step 2: Building and installing project... Running: mvn clean package install โ Step 2: Building and installing project... - SUCCESS ๐ Step 3: Generating Javadocs... Running: mvn javadoc:javadoc โ Step 3: Generating Javadocs... - SUCCESS ๐ Step 4: Committing changes to Git... 4.1: Staging all changes... Running: git add . โ 4.1: Staging all changes... - SUCCESS 4.2: Creating commit... Running: git commit -m Fixed bug in RestClient connection handling โ 4.2: Creating commit... - SUCCESS โ Step 4: Git commit completed. ๐ Step 5: Pushing changes to remote repository... Running: git push โ Step 5: Pushing changes to remote repository... - SUCCESS ====================================================================== ๐ All operations completed successfully! ๐ฆ Commit message: 'Fixed bug in RestClient connection handling' ======================================================================
python3 scripts/build-and-push.py "Updated REST client documentation" --skip-tests
python3 scripts/build-and-push.py "Fixed code formatting in BeanContext" --skip-tests --skip-javadoc
python3 scripts/build-and-push.py "Testing my changes" --dry-run
Output:
๐ DRY RUN MODE - No actual changes will be made Steps that would be executed: 1. Run tests: mvn test 2. Build and install: mvn clean package install 3. Generate Javadocs: mvn javadoc:javadoc 4. Commit changes: git add . && git commit -m "Testing my changes" 5. Push to remote: git push Dry run complete. Use without --dry-run to execute.
0 - Success, all operations completed1 - Failure at any stepThe script uses a fail-fast approach:
--skip-tests when:--skip-javadoc when:--dry-run when:This Python script replaces build-and-push.sh with: