diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 82af4a9..5fc10fd 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,7 +1,7 @@ # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: project cicd flow +name: CI-CD on: push: @@ -22,15 +22,19 @@ jobs: java-version: '1.8' distribution: 'adopt' cache: maven + - name: Build with Maven run: mvn clean install - - - name: Build & push Docker image - uses: mr-smithers-excellent/docker-build-push@v5 - with: - image: javatechie/springboot-images-new - tags: latest - registry: docker.io - dockerfile: Dockerfile - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} \ No newline at end of file + - name: Unit Tests + run: mvn -B test --file pom.xml + docker: + uses: devopsnishu/Reusable-Action/.github/workflows/reusable.yml@main + with: + + image_name: Javafile1 + + + secrets: + DOCKERHUB_USERNAME: ${{secrets.DOCKERHUB_USERNAME}} + DOCKERHUB_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}} + diff --git a/Dockerfile b/Dockerfile index f7cd959..704befd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM openjdk:8 EXPOSE 8080 ADD target/springboot-images-new.jar springboot-images-new.jar -ENTRYPOINT ["java","-jar","/springboot-images-new.jar"] \ No newline at end of file +ENTRYPOINT ["java","-jar","/springboot-images-new.jar"] diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..b3f691d --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,4 @@ +sonar.projectKey=devopsnishu_JAVA +sonar.organization=devopsnishu +sonar.sources=. +# Create a configuration file