forked from skunight/nestjs-redis
-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (89 loc) · 3.29 KB
/
build.yaml
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
## ---------------------------------------------------
## |\---/|
## | ,_, | !! DO NOT MODIFY !!
## \_`_/-..----. file managed by `whiskers`
## ___/ ` ' ,""+ \
## (__...' __\ |`.___.';
## (_,...'(_,.`__)/'.....+
## ---------------------------------------------------
name: build
on:
pull_request: {}
push:
branches:
- master
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: git > checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
clean: true
fetch-depth: 1
- name: node > setup
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
node-version-file: .nvmrc
cache: yarn
- name: yarn > install
run: yarn install --frozen-lockfile
- name: yarn > build
env:
NODE_ENV: production
run: yarn build
- name: ci > upload artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: dist
path: dist/
if-no-files-found: error
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: git > checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
clean: true
fetch-depth: 1
- name: node > setup
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
node-version-file: .nvmrc
cache: yarn
- name: yarn > install
run: yarn install --frozen-lockfile
- name: yarn > lint
run: yarn lint
verify_workflow:
name: verify workflow
runs-on: ubuntu-latest
if: always()
needs:
- build
- lint
steps:
- name: verify workflow success
if: always()
run: |-
# resolve statuses
BUILD_AGGREGATE=(${{ needs['build'].result }})
BUILD=unknown
BUILD=$(if [[ " ${BUILD_AGGREGATE[@]} " == *"success"* ]]; then echo "success"; else echo "$BUILD"; fi)
BUILD=$(if [[ " ${BUILD_AGGREGATE[@]} " == *"skipped"* ]]; then echo "skipped"; else echo "$BUILD"; fi)
BUILD=$(if [[ " ${BUILD_AGGREGATE[@]} " == *"cancelled"* ]]; then echo "cancelled"; else echo "$BUILD"; fi)
BUILD=$(if [[ " ${BUILD_AGGREGATE[@]} " == *"failure"* ]]; then echo "failure"; else echo "$BUILD"; fi)
LINT_AGGREGATE=(${{ needs['lint'].result }})
LINT=unknown
LINT=$(if [[ " ${LINT_AGGREGATE[@]} " == *"success"* ]]; then echo "success"; else echo "$LINT"; fi)
LINT=$(if [[ " ${LINT_AGGREGATE[@]} " == *"skipped"* ]]; then echo "skipped"; else echo "$LINT"; fi)
LINT=$(if [[ " ${LINT_AGGREGATE[@]} " == *"cancelled"* ]]; then echo "cancelled"; else echo "$LINT"; fi)
LINT=$(if [[ " ${LINT_AGGREGATE[@]} " == *"failure"* ]]; then echo "failure"; else echo "$LINT"; fi)
# echo the results of each job
echo "BUILD: $BUILD"
echo "LINT: $LINT"
# assert success
if [[ "$BUILD" != "success" ]]; then exit 1; fi
if [[ "$LINT" != "success" ]]; then exit 1; fi