-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (121 loc) · 3.36 KB
/
pipeline.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
153
154
name: Pipeline
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
env:
BROKENROBOT_PORT: 8080
jobs:
verify:
name: 'Verify'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Format check
run: npm run format:check
- name: Lint check
run: npm run lint:check
- name: Type check
run: npm run type:check
- name: Set up TerraForm
uses: hashicorp/setup-terraform@v3
- name: Go to infra/aws
run: cd infra/aws
- name: TerraForm format check
run: terraform fmt -check
- name: TerraForm init
run: terraform init
- name: TerraForm validate
run: terraform validate -no-color
build:
name: 'Build'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 3
test:
name: 'Test'
runs-on: ubuntu-24.04
needs: build
timeout-minutes: 10
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npm run install:playwright
- name: E2E test check
run: npm run test:e2e:check
- name: Upload e2e test reports
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-test-reports
path: reports/tests/e2e/
retention-days: 3
deploy:
name: 'Deploy'
runs-on: ubuntu-24.04
needs: [verify, build, test]
if: github.ref == 'refs/heads/main'
timeout-minutes: 10
environment: Production
concurrency:
group: Production
cancel-in-progress: true
steps:
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Deploy to AWS S3
run: aws s3 sync dist/ s3://${{ secrets.AWS_S3_BUCKET_NAME }} --delete
- name: Invalidate AWS CloudFront cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"