-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (62 loc) · 2.13 KB
/
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
on:
pull_request:
branches:
- main
- develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Tests:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repositiory
uses: actions/checkout@v2
- name: Set Github Credentials
run: |
git config user.name searchspring-machine
git config user.email machine@searchspring.com
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install packages
run: npm ci
- name: Build
run: npm run build
- name: Eslint
run: npm run lint
- name: Tests
env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: npm run test
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.SNAPFU_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SNAPFU_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Copy Files to S3
shell: bash
run: |
aws s3 sync --acl public-read packages/snap-preact-demo/dist s3://${{ secrets.SNAPFU_AWS_BUCKET }}/snap/${{ github.head_ref }}
aws s3 sync --acl public-read packages/snap-preact-demo/public s3://${{ secrets.SNAPFU_AWS_BUCKET }}/snap/${{ github.head_ref }}
- name: Invalidate CDN Files
shell: bash
env:
AWS_MAX_ATTEMPTS: 9
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.SNAPFU_AWS_DISTRIBUTION_ID }} --paths "/snap/${{ github.head_ref }}/*"