-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (74 loc) · 2.11 KB
/
ui-test-deploy-dev.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
name: 'UI: tests & dev deploy'
on:
pull_request:
branches:
- main
push:
branches-ignore:
- main
paths:
- 'ui/**'
- '.github/workflows/ui-test-deploy-dev.yml'
env:
AZURE_WEBAPP_NAME: syke-prtr-d-web
AZURE_WEBAPP_PACKAGE_PATH: 'ui/build' # path to web resources
NODE_VERSION: '14.x'
jobs:
test:
name: Cypress tests (UI)
if: ${{ github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ui/package-lock.json
- name: npm ci
run: npm ci
working-directory: ui
- name: Cypress tests
run: |
npm start & npm run wait-on -- http://localhost:3000
npm run cypress:run
working-directory: ui
test-build-deploy-dev:
name: Test, Build and Deploy (dev)
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.DEV_AZURE_CREDENTIALS }}
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ui/package-lock.json
- name: npm ci
run: npm ci
working-directory: ui
- name: Cypress tests
run: |
npm start & npm run wait-on -- http://localhost:3000
npm run cypress:run
working-directory: ui
- name: npm build
run: npm run build
working-directory: ui
- name: add process.json
run: |
echo '{ script: "serve", env: { PM2_SERVE_SPA: "true", PM2_SERVE_HOMEPAGE: "/index.html" } }' >> build/process.json
working-directory: ui
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
- name: logout
run: |
az logout