This repository has been archived by the owner on Feb 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
152 lines (152 loc) · 5.21 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: CI
on:
- push
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Format
run: terraform fmt -check
working-directory: terraform
- name: Terraform Init
run: terraform init -lock-timeout=900s
working-directory: terraform
env:
TF_IN_AUTOMATION: true
TF_WORKSPACE: main
TF_VAR_app_id: ${{ secrets.TF_VAR_APP_ID }}
TF_VAR_client_secret: ${{ secrets.ARM_CLIENT_SECRET }}
TF_VAR_tenant_id: ${{ secrets.ARM_TENANT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
- name: Terraform Validate
run: terraform validate -no-color
working-directory: terraform
env:
TF_IN_AUTOMATION: true
TF_WORKSPACE: main
TF_VAR_app_id: ${{ secrets.TF_VAR_APP_ID }}
TF_VAR_client_secret: ${{ secrets.ARM_CLIENT_SECRET }}
TF_VAR_tenant_id: ${{ secrets.ARM_TENANT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
- name: Terraform Plan
run: terraform plan -no-color -input=false -lock-timeout=900s
working-directory: terraform
env:
TF_IN_AUTOMATION: true
TF_WORKSPACE: main
TF_VAR_app_id: ${{ secrets.TF_VAR_APP_ID }}
TF_VAR_client_secret: ${{ secrets.ARM_CLIENT_SECRET }}
TF_VAR_tenant_id: ${{ secrets.ARM_TENANT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache dependencies
id: cache-dependencies-frontend
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ hashFiles('frontend/package.json') }}
path: |
frontend/node_modules
~/.npm
- name: Install dependencies
if: ${{ steps.cache-dependencies-frontend.outputs.cache-hit == false }}
run: npm i --legacy-peer-deps
working-directory: frontend
- name: Run tests
run: npm test
working-directory: frontend
- name: Save coverage report
uses: actions/upload-artifact@v3
with:
name: frontend-coverage
path: frontend/coverage/
scan:
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Restore coverage report
uses: actions/download-artifact@v3
with:
name: frontend-coverage
path: frontend/coverage/
- name: Run SonarCloud scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
build-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache dependencies
id: cache-dependencies-frontend
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ hashFiles('frontend/package.json') }}
path: |
frontend/node_modules
~/.npm
- name: Install dependencies
if: ${{ steps.cache-dependencies-frontend.outputs.cache-hit == false }}
run: npm i --legacy-peer-deps
working-directory: frontend
- name: Build the app
run: npm run build
working-directory: frontend
env:
REACT_APP_MIXPANEL_TOKEN: ${{ secrets.REACT_APP_MIXPANEL_TOKEN }}
REACT_APP_SENTRY_DSN: ${{ secrets.REACT_APP_SENTRY_DSN }}
build-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache dependencies
id: cache-dependencies-backend
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ hashFiles('backend/package.json') }}
path: |
backend/node_modules
~/.npm
- name: Install dependencies
if: ${{ steps.cache-dependencies-backend.outputs.cache-hit == false }}
run: npm i --legacy-peer-deps
working-directory: backend
- name: Build the app
run: npm run build
working-directory: backend