Skip to content

Commit

Permalink
Merge pull request #27 from nevilm-lt/master
Browse files Browse the repository at this point in the history
added support for CI/CD
  • Loading branch information
Shahid-LT authored Feb 28, 2022
2 parents 1581e79 + 50a60de commit f312349
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ on:
push:
branches:
- master
- beta
- stage
tags: [ 'v*.*.*' ]


pull_request:
branches:
- master
- beta
- stage

env:
REGISTRY_NAME: lambdatest

jobs:
Unit_Test_Cases:
Expand Down Expand Up @@ -55,6 +62,7 @@ jobs:
run: |
go test -parallel 4 -coverpkg=./... -coverprofile=profile.cov ./...
go tool cover -func profile.cov
Go_Report_Card:
runs-on: ubuntu-latest
needs: [ Unit_Test_Cases, Performance_Test_Cases ]
Expand Down Expand Up @@ -115,3 +123,47 @@ jobs:
else
exit 0
fi
Build_To_Deploy:
if: ${{ github.ref == 'refs/heads/stage' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs: [ Test_Coverage, Go_Report_Card ]
steps:
- name: Checkout
uses: actions/checkout@v2.4.0

- name: Setup Docker Image Tags
run: |
if [ ${GITHUB_REF_SLUG} == "master" ] ; then
echo "NUCLEUS_TAGS=${REGISTRY_NAME}/nucleus:latest","${REGISTRY_NAME}/nucleus:prod" >> $GITHUB_ENV
echo "SYNAPSE_TAGS=${REGISTRY_NAME}/synapse:latest","${REGISTRY_NAME}/synapse:prod" >> $GITHUB_ENV
else
echo "NUCLEUS_TAGS=${REGISTRY_NAME}/nucleus:${GITHUB_REF_SLUG}" >> $GITHUB_ENV
echo "SYNAPSE_TAGS=${REGISTRY_NAME}/synapse:${GITHUB_REF_SLUG}" >> $GITHUB_ENV
fi
- name: Docker Login
uses: docker/login-action@v1.13.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
logout: true

- name: Build and push Nucleus images
if: ${{ github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/stage' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
uses: docker/build-push-action@v2.9.0
with:
context: .
tags: ${{ env.NUCLEUS_TAGS }}
file: build/nucleus/Dockerfile
push: true

- name: Build and push Synapse images
if: ${{ github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/stage' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
uses: docker/build-push-action@v2.9.0
with:
context: .
tags: ${{ env.SYNAPSE_TAGS }}
file: build/synapse/Dockerfile
push: true

0 comments on commit f312349

Please sign in to comment.