Skip to content

Commit 85dbadd

Browse files
authored
Merge pull request #30 from ioet/Refactor-CI-CD-Process
Implementation of the CI/CD processes
2 parents 47bb47c + 356211b commit 85dbadd

File tree

3 files changed

+61
-7
lines changed

3 files changed

+61
-7
lines changed

.github/workflows/master_time-tracker-ui.yml renamed to .github/workflows/CD-time-tracker-ui.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
22
# More GitHub Actions for Azure: https://github.com/Azure/actions
33

4-
name: Build and deploy Node.js app to Azure Web App - time-tracker-ui
4+
name: CD process to deploy to App-Service service
55

66
on:
7-
push:
7+
# Trigger the workflow on pull request but only for the master branch
8+
pull_request:
9+
types: [closed]
810
branches:
911
- master
1012

1113
jobs:
1214
build-and-deploy:
15+
name: Deploy to Azure
1316
runs-on: ubuntu-latest
14-
17+
timeout-minutes: 60
1518
steps:
16-
- uses: actions/checkout@master
19+
- name: Checkout of master
20+
uses: actions/checkout@master
1721

1822
- name: Set up Node.js version
1923
uses: actions/setup-node@v1
2024
with:
2125
node-version: '12.x'
2226

23-
- name: npm install, build, and test
27+
- name: 'run: npm install and build'
2428
run: |
2529
npm install
26-
npm run build --if-present
27-
# npm run test --if-present
30+
npm run build --prod --if-present
2831
2932
- name: 'Deploy to Azure Web App'
3033
uses: azure/webapps-deploy@v1
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI process for time-tracker app
2+
3+
on:
4+
# Trigger the workflow on push or pull request
5+
push:
6+
branches:
7+
- '*'
8+
- '*/*'
9+
- '!master'
10+
11+
pull_request:
12+
types: [opened, edited, reopened, synchronize]
13+
branches:
14+
- master
15+
16+
jobs:
17+
security-audit:
18+
name: Running npm audit
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 60
21+
steps:
22+
- name: Clone and checkout branch
23+
uses: actions/checkout@master
24+
25+
- name: Set up Node.js version
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: '12.x'
29+
30+
- name: Security Audit
31+
run: npm audit --audit-level=moderate
32+
33+
ci-test:
34+
name: Running unit tests
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 90
37+
steps:
38+
- name: Clone and checkout branch
39+
uses: actions/checkout@master
40+
41+
- name: Set up Node.js version
42+
uses: actions/setup-node@v1
43+
with:
44+
node-version: '12.x'
45+
46+
- name: Install dependencies
47+
run: npm install
48+
49+
- name: Run the test
50+
run: npm run ci-test --if-present

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"start": "ng serve",
77
"build": "ng build",
88
"test": "ng test",
9+
"ci-test": "ng test --no-watch --no-progress --browsers ChromeHeadless",
910
"lint": "ng lint",
1011
"e2e": "ng e2e"
1112
},

0 commit comments

Comments
 (0)