Skip to main content

push.py

push.py automates the complete build, test, and deployment workflow for Juneau, ensuring code quality before pushing changes to the remote repository.

What It Does​

The script executes the following steps in order:

  1. Run Tests - Executes mvn test to ensure all tests pass (optional with --skip-tests)
  2. Build and Install - Runs mvn clean package install to build the project
  3. Git Commit - Stages all changes and commits with the provided message
  4. Git Push - Pushes the commit to the remote repository

If any step fails, the script stops immediately and reports the failure.

Usage​

Basic Usage​

cd /Users/james.bognar/git/juneau
python3 scripts/push.py "Your commit message here"

Skip Tests (for documentation-only changes)​

python3 scripts/push.py "Updated README" --skip-tests

Dry Run (see what would happen without actually doing it)​

python3 scripts/push.py "Testing changes" --dry-run

Command-Line Options​

Required Arguments​

  • message - The Git commit message (must be provided)

Optional Flags​

  • --skip-tests - Skip running tests (useful for documentation-only changes)
  • --dry-run - Show what would be done without actually executing commands

When to Use​

Use the full script when:​

  • Making code changes that affect functionality
  • Adding new features
  • Fixing bugs
  • Refactoring code

Use --skip-tests when:​

  • Only updating documentation (README, markdown files)
  • Making cosmetic changes (formatting, comments)
  • Tests have already been run successfully in another context

Use --dry-run when:​

  • Testing the script itself
  • Verifying what steps will be executed
  • Learning how the script works

Requirements​

  • Python 3.6 or higher
  • Maven (mvn command must be in PATH)
  • Git (git command must be in PATH)
  • No external Python dependencies (uses only standard library)

Exit Codes​

  • 0 - Success, all operations completed
  • 1 - Failure at any step

Safety Features​

  1. No Changes Detection - If there are no changes to commit, the script skips commit and push steps
  2. Fail-Fast - Stops immediately on any error to prevent incomplete deployments
  3. Clear Output - Each step is clearly marked with emojis and status indicators
  4. Dry Run Mode - Preview what will happen without making any changes
Discussion

Share feedback or follow-up questions for this page directly through GitHub.