Continuous Integration And Deployment On Push to DEV #296
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration And Deployment On Push to DEV | |
on: | |
workflow_dispatch: # TODO this is there for testing purposes, once the pipelines are all done, remove this | |
push: | |
branches: | |
- 'dev' | |
paths: | |
- 'backend/**' | |
- 'frontend/**' | |
- '.github/workflows/ci-cd-openshift-dev.yaml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
builds: | |
name: Builds | |
uses: ./.github/workflows/_build.yml | |
strategy: | |
matrix: | |
component: [backend/applications, backend/gateway, backend/legacy, backend/users, frontend] | |
include: | |
- component: backend/applications | |
triggers: ('backend/applications/') | |
- component: backend/gateway | |
triggers: ('backend/gateway/') | |
- component: backend/legacy | |
triggers: ('backend/legacy/') | |
- component: backend/users | |
triggers: ('backend/users/') | |
- component: frontend | |
triggers: ('frontend/') | |
secrets: | |
gh_token: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
component: ${{ matrix.component }} | |
img_build: "dev" # ask the team dev or latest | |
img_fallback: dev | |
triggers: ${{ matrix.triggers }} | |
# TODO - REIMPLMENET BEFORE MERGING, JUST TESTING WITHOUT THESE TO VERIFY DEPLOYS | |
tests: | |
name: Unit Tests | |
uses: ./.github/workflows/_code-cov.yml | |
strategy: | |
matrix: | |
component: [backend/applications, backend/gateway, backend/users, frontend] | |
secrets: | |
gh_token: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
component: ${{ matrix.component }} | |
lcov_file: ${{ matrix.component }}/coverage/lcov.info | |
test_cmd: npm run test:cov | |
deploys: | |
name: Deploys | |
needs: | |
- builds | |
# If any of the previous created a build, then deploy | |
# TODO - RE-ENABLE IF COMMAND BELOW, DISABLED DURING EXPERIMENTAL DEV | |
if: contains(needs.*.outputs.build, 'true') | |
uses: ./.github/workflows/_deploy.yml | |
strategy: | |
matrix: | |
component: [backend/applications, backend/gateway, backend/legacy, backend/users, database, frontend] | |
include: | |
- component: database | |
overwrite: false | |
template_file: .github/openshift/deploy.database.yml | |
template_vars: -p DB_PVC_SIZE=200Mi | |
- component: backend/applications | |
overwrite: true | |
template_file: .github/openshift/deploy.backend-applications.yml | |
template_vars: -p PROMOTE=${{ github.repository }}/backend/applications -p CONTAINER_PORT=4006 -p ENV=dev -p IMAGE_TAG=dev | |
- component: backend/gateway | |
overwrite: true | |
template_file: .github/openshift/deploy.backend-gateway.yml | |
template_vars: -p PROMOTE=${{ github.repository }}/backend/gateway -p CONTAINER_PORT=4010 -p ENV=dev -p IMAGE_TAG=dev | |
- component: backend/legacy | |
overwrite: true | |
template_file: .github/openshift/deploy.backend-legacy.yml | |
template_vars: -p PROMOTE=${{ github.repository }}/backend/legacy -p CONTAINER_PORT=4011 -p ENV=dev -p IMAGE_TAG=dev | |
- component: backend/users | |
overwrite: true | |
template_file: .github/openshift/deploy.backend-users.yml | |
template_vars: -p PROMOTE=${{ github.repository }}/backend/users -p CONTAINER_PORT=4005 -p ENV=dev -p IMAGE_TAG=dev | |
- component: frontend | |
overwrite: true | |
template_file: .github/openshift/deploy.frontend.yml | |
template_vars: -p PROMOTE=${{ github.repository }}/frontend -p CONTAINER_PORT=8080 -p ENV=dev -p IMAGE_TAG=dev | |
secrets: | |
oc_namespace: ${{ secrets.OC_NAMESPACE }} | |
oc_server: ${{ secrets.OC_SERVER }} | |
oc_token: ${{ secrets.OC_TOKEN }} | |
with: | |
environment: dev | |
component: ${{ matrix.component }} | |
overwrite: ${{ matrix.overwrite }} | |
template_file: ${{ matrix.template_file }} | |
template_vars: ${{ matrix.template_vars }} |