Merge pull request #649 from bcgov/dev #185
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 test | |
on: | |
workflow_dispatch: # TODO this is there for testing purposes, once the pipelines are all done, remove this | |
push: | |
branches: | |
- 'main' | |
#- 'dev'1 | |
paths: | |
- 'backend/**' | |
- 'frontend/**' | |
- '.github/workflows/cd-openshift-test.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: "test" # ask the team test or latest | |
img_fallback: test | |
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 test | |
# 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=test -p IMAGE_TAG=test | |
- 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=test -p IMAGE_TAG=test | |
- 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=test -p IMAGE_TAG=test | |
- 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=test -p IMAGE_TAG=test | |
- component: frontend | |
overwrite: true | |
template_file: .github/openshift/deploy.frontend.yml | |
template_vars: -p PROMOTE=${{ github.repository }}/frontend -p CONTAINER_PORT=8080 -p ENV=test -p IMAGE_TAG=test | |
secrets: | |
oc_namespace: ${{ secrets.OC_NAMESPACE }} | |
oc_server: ${{ secrets.OC_SERVER }} | |
oc_token: ${{ secrets.OC_TOKEN }} | |
with: | |
environment: test | |
component: ${{ matrix.component }} | |
overwrite: ${{ matrix.overwrite }} | |
template_file: ${{ matrix.template_file }} | |
template_vars: ${{ matrix.template_vars }} | |
forms-flow-root-config-and-microfrontends-bpm-changes: | |
runs-on: ubuntu-20.04 | |
if: github.repository == 'bcgov/nr-epd-digital-services' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set ENV variables | |
id: set-variable | |
# make sure to update the TOOLS_NAME once all the environment for forms-flow-ai-web is ready | |
run: | | |
echo "For ${{ github.ref_name }} branch for TEST" | |
echo "TOOLS_NAME=${{secrets.OC_NAMESPACE_NAMEPLATE}}" >> $GITHUB_ENV | |
echo "TAG_NAME="test"" >> $GITHUB_ENV | |
echo "BRANCH_NAME="main"" >> $GITHUB_ENV | |
echo "ENV_NAME="test"" >> $GITHUB_ENV | |
shell: bash | |
- name: Login Openshift | |
shell: bash | |
run: | | |
oc login --server=${{secrets.OC_SERVER}} --token=${{secrets.OC_TOKEN}} | |
- name: Tools project | |
shell: bash | |
run: | | |
oc project ${{ secrets.OC_NAMESPACE_NAMEPLATE }}-tools | |
- name: Tag Microfrontends from Dev | |
shell: bash | |
run: | | |
oc tag forms-flow-nav:dev forms-flow-nav:test | |
oc tag forms-flow-theme:dev forms-flow-theme:test | |
oc tag forms-flow-web-ee:dev forms-flow-web-ee:test | |
oc tag forms-flow-bpm:dev forms-flow-bpm:test | |
- name: Start Build Openshift | |
shell: bash | |
run: | | |
oc start-build forms-flow-web-root-config-test-build --wait |