From 29a99d4c9cd795c7d17ba12ccffad78120218d56 Mon Sep 17 00:00:00 2001 From: work Date: Tue, 18 Mar 2025 22:49:38 +0100 Subject: [PATCH] checking merged pull request --- .github/workflows/check.yml | 51 +++++++++++++++++++++++++++++++++++++ pom.xml | 10 ++++---- 2 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 000000000..16da83e54 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,51 @@ +name: CI/CD pipeline for successful merge +on: + workflow_dispatch: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Setup java + uses: actions/setup-java@v4 + with: + java-version: '21' + cache: 'maven' + distribution: 'corretto' + + + - name: Maven install dependencies + run: ./mvnw clean install -Dmaven.test.skip=true + + docker: + if: ${{ github.event.pull_request.merged }} + runs-on: ubuntu-latest + needs: [build, test] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Docker Build + uses: docker/build-push-action@v6 + with: + push: false + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/apiprotector:$${{ github.sha }} + + - name: Docker Push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/apiprotector:$${{ github.sha }} diff --git a/pom.xml b/pom.xml index 1fc18f0e7..ae09aae0b 100644 --- a/pom.xml +++ b/pom.xml @@ -165,6 +165,11 @@ spring-boot-docker-compose test + + org.mockito + mockito-core + test + org.testcontainers junit-jupiter @@ -329,11 +334,6 @@ - - - org.cyclonedx - cyclonedx-maven-plugin -