forked from sabidev2021/angular-prime-template
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (51 loc) · 1.5 KB
/
ci.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
name: CI
on:
push:
branches:
- '*'
- '*/*'
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
env:
CI_DEPENDENCIES: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache Node.js dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: 16.20.2
- name: Install dependencies
run: npm install --force
- name: Build of code
run: npm run build
- name: Set build status
run: echo "build_status=${{ job.status }}" >> $GITHUB_ENV
- name: Check build status
run: exit 1
if: ${{ success() == false }}
- name: Run unit tests
id: unit-tests
run: |
if npm run test:ci; then
echo "AWESOME UNIT TEST IS PASSED !"
echo "unit_test_status=success" >> $GITHUB_ENV
else
echo "PLEASE BE AWARE TEST HAS BEEN FAILED !"
echo "unit_test_status=failure" >> $GITHUB_ENV
fi
- name: Check test status
run: exit 1
if: ${{ steps.unit-tests.outputs.unit_test_status == 'failure' }}