-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (84 loc) · 2.67 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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