Skip to content

Commit

Permalink
fix: job workflow as per circleci existing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-naxa committed Sep 17, 2024
1 parent f6658b2 commit 5eca227
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 32 deletions.
70 changes: 42 additions & 28 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,6 @@ on:
workflow_dispatch:

jobs:
backend-test:
uses: naxa-developers/tasking-manager/.github/workflows/test_compose.yml@ci-gh-workflows
with:
image_name: ghcr.io/${{ github.repository }}/backend
pre_command: |
docker compose --file docker-compose.yml up -d
sleep 15
docker compose --file docker-compose.yml logs tm-backend
compose_service: tm-backend
build_target: prod
compose_command: curl -i http://localhost:5000/api/v2/
tag_override: ci-${{ github.ref_name }}
# coverage: true
example_env_file_path: example.env
env_file_path: tasking-manager.env
secrets: inherit

backend-build:
uses: hotosm/gh-workflows/.github/workflows/[email protected]
with:
context: .
build_target: prod
image_name: ghcr.io/${{ github.repository }}/backend
dockerfile: Dockerfile
scan_image: false
secrets: inherit

frontend-test:
uses: naxa-developers/tasking-manager/.github/workflows/frontend-test.yml@ci-gh-workflows
Expand All @@ -51,6 +25,7 @@ jobs:
context: ./frontend
cache-key-file: ./frontend/yarn.lock
package-manager: yarn
# TODO: Verify this with frontend team
test_frontend_command: |
CI=true yarn test -w 1
# test_frontend_build: false
Expand Down Expand Up @@ -85,11 +60,50 @@ jobs:
ls -alh
ls -alh build
backend-test:
uses: naxa-developers/tasking-manager/.github/workflows/test_compose.yml@ci-gh-workflows
with:
image_name: ghcr.io/${{ github.repository }}/backend
pre_command: |
docker compose --file docker-compose.yml up -d
sleep 15
docker compose --file docker-compose.yml logs tm-backend
compose_service: tm-backend
build_target: prod
# TODO: Compose command to be updated once dev have test setup running. For now just a simple curl command.
compose_command: curl -i http://localhost:5000/api/v2/
tag_override: ci-${{ github.ref_name }}
# coverage: true
example_env_file_path: example.env
env_file_path: tasking-manager.env
secrets: inherit

backend-build:
uses: hotosm/gh-workflows/.github/workflows/[email protected]
with:
context: .
build_target: prod
image_name: ghcr.io/${{ github.repository }}/backend
dockerfile: Dockerfile
scan_image: false
secrets: inherit

backup-database:
runs-on: ubuntu-latest
needs:
- backend-build
- backend-test
name: Backup Database before deployment
steps:
- name: Create Snapshot
run:
echo " TODO Database backup Steps; See CircleCI"
#TODO: Check circleci for references

backend_deploy_to_vm:
name: Deploy Backend to VM
needs:
- backend-test
- backend-build
- backup-database
uses: naxa-developers/tasking-manager/.github/workflows/remote_deploy_compose.yml@ci-gh-workflows
with:
docker_compose_file: docker-compose.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/frontend-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ on:
outputs:
artifact-name:
description: "Node built artifact"
value: ${{ jobs.node-build.outputs.artifact-name }}
value: ${{ jobs.frontend-build.outputs.artifact-name }}

jobs:
node-build:
frontend-build:
runs-on: ${{ inputs.runner-class }}

environment:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ on:


jobs:
node-build:
frontend-test:
runs-on: ${{ inputs.runner-class }}

environment:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test-img-build]
# Ensure it runs, even if test-img-build does not run
if: always()
# if: always()
environment:
name: ${{ inputs.environment }}

Expand Down

0 comments on commit 5eca227

Please sign in to comment.