forked from OpenModelica/OMWebEdit_archived
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (92 loc) · 3.1 KB
/
ci-cd.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
name: CI-CD
on:
push:
branches: [master]
pull_request:
branches: [master]
types: [opened, synchronize, reopened, edited]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- 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: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: npm install
- name: Run static checks (compile, lint, formatting)
run: npm run test:static
- name: Run tests (integrattion, component and unit)
run: npm run test:nowatch
- name: Run E2E tests
run: npm run test:e2e
env:
CYPRESS_BASE_URL: http://localhost:5000
- name: Save cypress test video
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-videos
path: /home/runner/work/OMWebEdit/OMWebEdit/cypress/videos
deploy:
name: deploy
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- 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: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: npm install
- name: Git config
run: git config --global user.email "anurag@perpetuallabs.io" && git config --global user.name "Deployment Bot"
- name: Bump version and tag
run: npm version minor && git push && git push --tags
- name: Build for production
run: npm run build
- name: Serverless deploy
uses: serverless/github-action@v1.53.0
with:
args: deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Serverless S3 deploy
uses: serverless/github-action@v1.53.0
with:
args: s3deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}