feat: Added new features #91
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: Build CI | |
on: | |
push: | |
branches: '**' | |
pull_request: | |
branches: '**' | |
env: | |
BASE_REGISTRY: ${{ secrets.BASE_REGISTRY }} | |
REGISTRY: '${{ secrets.BASE_REGISTRY }}/sro' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build --if-present | |
- run: | | |
export DISPLAY=:99 | |
chromedriver --url-base=/wd/hub & | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
npm test -- --code-coverage --no-watch | |
- uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
flags: unittests # optional | |
verbose: true # optional (default = false) | |
deploy: | |
needs: test | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: | | |
contains(' | |
refs/heads/dev | |
refs/heads/qa | |
refs/heads/main | |
', github.ref) && | |
github.event_name == 'push' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_SRO_ECR }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SRO_ECR }} | |
aws-region: ${{ secrets.AWS_REGION_SRO_ECR }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon Dev ECR | |
if: github.ref == 'refs/heads/dev' | |
id: build-dev-image | |
run: make push-dev | |
- name: Build, tag, and push image to Amazon Dev ECR | |
if: github.ref == 'refs/heads/qa' | |
id: build-qa-image | |
run: make push-qa | |
- name: Build, tag, and push image to Amazon Dev ECR | |
if: github.ref == 'refs/heads/main' | |
id: build-image | |
run: make push-prod | |
# - name: Deploy dev to cluster | |
# uses: kodermax/kubectl-aws-eks@master | |
# if: github.ref == 'refs/heads/dev' | |
# with: | |
# args: rollout restart deployment/frontend -n sro-dev | |
# - name: Deploy qa to cluster | |
# uses: kodermax/kubectl-aws-eks@master | |
# if: github.ref == 'refs/heads/qa' | |
# with: | |
# args: rollout restart deployment/frontend -n sro-qa | |
# - name: Deploy prod to cluster | |
# uses: kodermax/kubectl-aws-eks@master | |
# if: github.ref == 'refs/heads/main' | |
# with: | |
# args: rollout restart deployment/frontend -n sro |