A simple Java CLI calculator with JUnit tests, Makefile automation, Docker support, and GitHub Actions CI/CD pipeline.
- Basic arithmetic operations:
add,sub,mul,div - JUnit 4-based unit testing
- Build automation using
Makefile - Dockerized CLI app
- GitHub Actions CI/CD workflow for:
- Automated builds and test runs
- Docker image builds
- Release tagging and artifacts
make build— Compile all sourcesmake test— Run unit testsmake run— Run the calculator CLImake clean— Clean build and release foldersmake release— Create release artifact and tagmake all— Build and test
- Put JUnit JARs in a
lib/folder (download from JUnit site):
calculator-java/
└── lib/
├── junit-4.13.2.jar
└── hamcrest-core-1.3.jarcalculator-java/
├── src/
│ ├── Calculator.java # Core calculator logic
│ └── Main.java # CLI entry point
│
├── test/
│ └── CalculatorTest.java # JUnit test cases
│
├── lib/
│ ├── junit-4.13.2.jar # (Downloaded by CI or added manually)
│ └── hamcrest-core-1.3.jar
│
├── build/ # Compiled .class files (generated)
│
├── release/ # Tagged releases (generated)
│
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions workflow for CI/CD
│
├── Dockerfile # Docker image definition
├── .dockerignore # Ignore build/release dirs in Docker context
├── Makefile # Commands: build, test, run, clean, release
├── .release-tag # Simple version tracking file
├── README.md # Project description, usage, and instructionsTo run manually:
docker build -t java-calculator .
docker run -it java-calculator