From 6f8d586860e1eb6ef5ab6c8c21390c1ca134ca3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atakan=20Ya=C5=9Far?= Date: Wed, 1 May 2024 02:26:01 +0300 Subject: [PATCH] chore(devops): build backend with actions --- .github/workflows/backend_build.yml | 59 +++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/backend_build.yml 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 + + +