This repository was archived by the owner on Aug 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (119 loc) · 4.06 KB
/
Copy pathgithub-actions-ci.yml
File metadata and controls
143 lines (119 loc) · 4.06 KB
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
name: Github Actions CI
on: [push]
# CONFIGURATION
# For help, go to https://github.com/Azure/Actions
#
# 1. Set up the following secrets in your repository:
# AZURE_WEBAPP_PUBLISH_PROFILE
#
# 2. Change these variables for your configuration:
env:
AZURE_WEBAPP_NAME: lazztechhubdev # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: './back-end' # set this to the path to your web app project, defaults to the repository root
NODE_VERSION: '12.x' # set this to the node version to use
DEPLOYMENT_URL: 'https://lazztechhubdev.azurewebsites.net/graphql'
jobs:
ionic-ci:
name: ionic-ci
runs-on: ubuntu-latest
steps:
- name: checkout latest commit
uses: actions/checkout@master
- name: npm install & build
working-directory: ./ionic
run: |
npm install
npm run build
# - name: npm lint
# working-directory: ./ionic
# run: |
# npm run lint
# - name: npm test
# working-directory: ./ionic
# run: |
# npm run test
# - name: npm e2e
# working-directory: ./ionic
# run: |
# npm run e2e
- name: npm generate
working-directory: ./ionic
run: |
npm run generate
back-end-ci:
name: back-end-ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
# - name: graphql-inspector
# uses: kamilkisiela/graphql-inspector@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# schema: 'back-end/schema.gql' # important to define a path to schema file, without a branch
# endpoint: ${{ env.DEPLOYMENT_URL }}
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
# - name: start postgresql db
# uses: harmon758/postgresql-action@v1
# with:
# postgresql version: '11' # See https://hub.docker.com/_/postgres for available versions
# postgresql db: 'postgres-test'
# postgresql user: 'test'
# postgresql password: 'Password123'
- name: npm install & build
working-directory: ./back-end
run: |
npm install
npm run build
- name: npm format:check
working-directory: ./back-end
run: |
npm run format:check
# - name: npm lint
# working-directory: ./back-end
# run: |
# npm run lint
- name: npm test:cov
working-directory: ./back-end
run: |
npm run test:cov
# - name: npm test:e2e
# working-directory: ./back-end
# run: |
# npm run test:e2e
- name: npm start & health check
working-directory: ./back-end
# 'nohup npm run start:prod >> app.log 2>&1 &' runs the command as a background job: https://stackoverflow.com/a/46732894/848396
# 'timeout 30 bash -c 'until echo > /dev/tcp/localhost/13000; do sleep 0.5; done' wait for server to start up or timeout with error: https://unix.stackexchange.com/a/349138
# 'kill %1' kills background job: https://unix.stackexchange.com/a/104822
run: |
nohup npm run start:prod >> app.log 2>&1 &
timeout 30 bash -c 'until echo > /dev/tcp/localhost/8080; do sleep 0.5; done'
kill %1
env:
CI: true
ACCESS_TOKEN_SECRET: SecretKey
deploy:
name: deploy-cd-master
runs-on: ubuntu-latest
needs: back-end-ci
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@master
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: npm install & build
working-directory: ./back-end
run: |
npm install
npm run build
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}