-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (67 loc) · 2.15 KB
/
backendCI.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
name: Backend - Continuos Integration
on:
pull_request:
branches: ["main"]
types: ["opened", "reopened", "synchronize"]
paths: ["packages/backend/**"]
push:
branches: ["main"]
paths: ["packages/backend/**"]
defaults:
run:
working-directory: packages/backend
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3.3.0
with:
node-version: "16.x"
cache: 'npm'
cache-dependency-path: packages/backend/package-lock.json
- run: npm i
- name: Unit Test
run: npm test
deploy-test-stack:
needs: [unit-test]
runs-on: ubuntu-latest
outputs:
APP_REGION: steps.deploy.outputs.APP_REGION
TABLE_NAME: steps.deploy.outputs.TABLE_NAME
LAMBDA_FUNCTION_NAME_PREFIX: steps.deploy.outputs.LAMBDA_FUNCTION_NAME_PREFIX
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3.3.0
with:
node-version: "16.x"
cache: 'npm'
cache-dependency-path: packages/backend/package-lock.json
- run: npm i
- name: Deploy Test Stack
id: deploy
run: npm run deploy:test
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
integration-test:
needs: [deploy-test-stack]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3.3.0
with:
node-version: "16.x"
cache: 'npm'
cache-dependency-path: packages/backend/package-lock.json
- run: npm i
- name: Integration Test
run: npm run test:integration
env:
APP_REGION: ${{ needs.deploy-test-stack.outputs.APP_REGION }}
TABLE_NAME: ${{ needs.deploy-test-stack.outputs.TABLE_NAME }}
LAMBDA_FUNCTION_NAME_PREFIX: ${{ needs.deploy-test-stack.outputs.LAMBDA_FUNCTION_NAME_PREFIX }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}