diff --git a/.github/workflows/backend_build.yml b/.github/workflows/backend_build.yml new file mode 100644 index 00000000..238e0f94 --- /dev/null +++ b/.github/workflows/backend_build.yml @@ -0,0 +1,59 @@ +name: backend-worklow + +on: + push: + paths: + - 'backend/**' + - docker-compose.yml + - docker-compose.dev.yml + - '.github/workflows/backend_build.yml' + + pull_request: + branches: + - main + - staging + - develop + + +jobs: + build: + runs-on: ubuntu-latest + env: + working-directory: + backend + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Maven + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + + - name: Build Docker backend-dev Image + run: docker-compose -f docker-compose.dev.yml build db-dev + + - name: Run Docker backend-dev Container + run: docker-compose -f docker-compose.dev.yml up -d db-dev + + - name: Run Tests + run: mvn clean test + + - name: Stop Docker backend-dev Container + run: docker-compose -f docker-compose.dev.yml down + + - name: Build Docker backend-prod Image + run: docker-compose -f docker-compose.yml build db + + - name: Run Docker backend-prod Container + run: docker-compose -f docker-compose.yml up -d db + + - name: Run Tests + run: mvn clean test + + - name: Stop Docker backend-prod Container + run: docker-compose -f docker-compose.yml down + + +