-
Notifications
You must be signed in to change notification settings - Fork 0
203 lines (167 loc) · 5.85 KB
/
e2e-test.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# WARNING
# This workflow does not check for 'pull_request' event_name
# Do not use it for on:push
name: E2E Test
on:
pull_request:
branches:
- staging
- main
env:
NODE_VERSION: 22.9.0
jobs:
build-base-image-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image and export
uses: docker/build-push-action@v5
with:
context: .
build-args: NODE_ENV=development
push: false
tags: pocnestjs-base-dev:latest
outputs: type=docker,dest=/tmp/pocnestjs-base-dev.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp/pocnestjs-base-dev.tar
build-base-image-prod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image and export
uses: docker/build-push-action@v5
with:
context: .
build-args: NODE_ENV=production
push: false
tags: pocnestjs-base-prod:latest
outputs: type=docker,dest=/tmp/pocnestjs-base-prod.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp/pocnestjs-base-prod.tar
setup:
needs:
- build-base-image-dev
- build-base-image-prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Cache NPM
uses: actions/cache/save@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install --no-audit
auth-service-e2e:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Download development base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp
- name: Load development base docker image
run: |
docker load --input /tmp/pocnestjs-base-dev.tar
docker image ls -a
- name: Download production base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp
- name: Load production base docker image
run: |
docker load --input /tmp/pocnestjs-base-prod.tar
docker image ls -a
- name: Restore npm cache
uses: actions/cache/restore@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
fail-on-cache-miss: true
- name: Install dependencies
run: npm install --no-audit
- name: Load .env variables
id: dotenv
uses: falti/dotenv-action@v1.1.4
- name: Testing
run: npx nx e2e auth-service-e2e
env:
AUTH_SERVICE_PORT: ${{ steps.dotenv.outputs.AUTH_SERVICE_PORT }}
DATABASE_AUTH_HOST: ${{ steps.dotenv.outputs.DATABASE_AUTH_HOST }}
DATABASE_AUTH_PORT: ${{ steps.dotenv.outputs.DATABASE_AUTH_PORT }}
DATABASE_AUTH_USERNAME: ${{ steps.dotenv.outputs.DATABASE_AUTH_USERNAME }}
DATABASE_AUTH_PASSWORD: ${{ steps.dotenv.outputs.DATABASE_AUTH_PASSWORD }}
DATABASE_AUTH_DBNAME: ${{ steps.dotenv.outputs.DATABASE_AUTH_DBNAME }}
JWT_SECRET_KEY: ${{ steps.dotenv.outputs.JWT_SECRET_KEY }}
JWT_EXPIRES_IN: ${{ steps.dotenv.outputs.JWT_EXPIRES_IN }}
financial-service-e2e:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Download development base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp
- name: Load development base docker image
run: |
docker load --input /tmp/pocnestjs-base-dev.tar
docker image ls -a
- name: Download production base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp
- name: Load production base docker image
run: |
docker load --input /tmp/pocnestjs-base-prod.tar
docker image ls -a
- name: Restore npm cache
uses: actions/cache/restore@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
fail-on-cache-miss: true
- name: Install dependencies
run: npm install --no-audit
- name: Load .env variables
id: dotenv
uses: falti/dotenv-action@v1.1.4
- name: Testing
run: npx nx e2e financial-service-e2e
env:
FINANCIAL_SERVICE_PORT: ${{ steps.dotenv.outputs.FINANCIAL_SERVICE_PORT }}
DATABASE_FINANCIAL_HOST: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_HOST }}
DATABASE_FINANCIAL_PORT: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_PORT }}
DATABASE_FINANCIAL_USERNAME: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_USERNAME }}
DATABASE_FINANCIAL_PASSWORD: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_PASSWORD }}
DATABASE_FINANCIAL_DBNAME: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_DBNAME }}
JWT_SECRET_KEY: ${{ steps.dotenv.outputs.JWT_SECRET_KEY }}
JWT_MAX_AGE: ${{ steps.dotenv.outputs.JWT_MAX_AGE }}