Skip to content

Prashantkumar477447/CI-CD-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CI-CD-Java

πŸš€ Dummy CI/CD Java Project

This is a sample Java Maven project that demonstrates how to set up a CI/CD pipeline with:

  • GitHub Actions β†’ for CI automation
  • SonarQube / SonarCloud β†’ for code quality & static analysis
  • Snyk β†’ for security vulnerability scanning

πŸ“¦ Project Structure

dummy-ci-cd-java/
β”œβ”€β”€ pom.xml                       # Maven build configuration
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ main/java/com/example/App.java   # Main Java application
β”‚   └── test/java/com/example/AppTest.java # JUnit test

βš™οΈ Technologies Used

  • Java 17
  • Maven
  • JUnit 4.13.2
  • GitHub Actions
  • SonarCloud
  • Snyk

πŸ”„ CI/CD Workflow

The pipeline is defined in .github/workflows/ci-cd.yml and includes:

  1. Build & Test

    • Compiles the project using Maven
    • Runs JUnit tests
  2. SonarQube / SonarCloud Scan

    • Runs mvn sonar:sonar
    • Uploads code quality & security analysis results
  3. Snyk Security Scan

    • Scans for vulnerabilities in dependencies
    • Fails if medium/high severity issues are found

πŸ”‘ Required GitHub Secrets

Go to your repo β†’ Settings β†’ Secrets and variables β†’ Actions and add:

Secret Name Value
SONAR_TOKEN Token from SonarCloud account
SONAR_HOST_URL https://sonarcloud.io
SNYK_TOKEN Token from Snyk account

▢️ Running the Pipeline

  1. Push any code changes (e.g., update App.java).

  2. Go to the Actions tab in GitHub.

  3. Watch the pipeline run:

    • βœ… Build β†’ compile & test
    • βœ… Sonar β†’ code quality report
    • βœ… Snyk β†’ vulnerability report

πŸ“Š Results

  • SonarCloud Dashboard β†’ Detailed code analysis (bugs, smells, coverage).
  • Snyk Reports β†’ Dependency security vulnerabilities.

πŸ›  Future Improvements

  • Add Jacoco for test coverage reports.
  • Add Docker build & push step.
  • Add deployment (e.g., AWS / Kubernetes).
  • Add notifications (Slack/MS Teams).

βœ… With this setup, every code push is automatically built, tested, analyzed, and security-checked before deployment.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages