-
Notifications
You must be signed in to change notification settings - Fork 11
74 lines (65 loc) · 1.91 KB
/
on-pr.yaml
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
name: Run Tests
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
defaults:
run:
working-directory: "./arSam"
steps:
- name: Checkout
uses: actions/checkout@v3
# Install if no cache exists
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache-dependency-path: "arSam/yarn.lock"
- run: yarn install --silent --frozen-lockfile
# Setup AWS SAM
- name: Setup AWS SAM
uses: aws-actions/setup-sam@v2
with:
use-installer: true
# SAM Build
- name: Cache SAM Build
id: cache-sam-build
uses: actions/cache@v3
with:
path: |
arSam/.aws-sam
key: ${{ github.sha }}-ar-api-sam-cache
- name: Run sam build
if: steps.cache-sam-build.outputs.cache-hit != 'true'
run: |
sam build --cached --parallel
# Set up DynamoDB local
- name: Setup DynamoDB Local
uses: rrainn/dynamodb-action@v3.0.0
with:
sharedDb: true
port: 8000
cors: '*'
- name: Sleep so DynamoDB has time to wake up
uses: GuillaumeFalourd/wait-sleep-action@v1
with:
time: '15' # for 15 seconds
- name: List Jest Binary
run: ls ${{ github.workspace }}/arSam/node_modules/.bin
# Run Tests
- name: Run Tests
env:
TABLE_NAME: ParksAr-tests
IS_OFFLINE: true
ENDPOINT: http://localhost:8000
REGION: local
CONFIG_TABLE_NAME: ConfigAr-tests
NAME_CACHE_TABLE_NAME: NameCacheAr-tests
AWS_ACCESS_KEY_ID: notused
AWS_SECRET_ACCESS_KEY: notused
run: ./node_modules/jest/bin/jest.js --coverage --runInBand
working-directory: ./arSam