-
Notifications
You must be signed in to change notification settings - Fork 7
96 lines (80 loc) · 3.05 KB
/
develop-build-check.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: build + eslint
on:
pull_request:
branches:
- develop
jobs:
check:
name: lint + build checking
runs-on: ubuntu-latest
outputs:
frontend: ${{steps.filter.outputs.frontend}}
backend: ${{steps.filter.outputs.backend}}
steps:
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
frontend:
- 'frontend/**'
backend:
- 'backend/**'
frontend:
needs: check
if: ${{needs.check.outputs.frontend=='true'}}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Nodejs Setup
uses: actions/setup-node@v2
- name: Cache frontend node modules
id: cache-frontend
uses: actions/cache@v3
with:
path: frontend/node_modules
key: npm-packages-frontend-${{hashFiles('frontend/package-lock.json')}}
restore-keys: |
npm-packages-frontend-
- name: Cache backend node modules
id: cache-backend
uses: actions/cache@v3
with:
path: backend/node_modules
key: npm-packages-backend-${{hashFiles('backend/package-lock.json')}}
restore-keys: |
npm-packages-backend-
- name: Install backend dependencies
if: ${{steps.cache-backend.outputs.cache-hit != 'true'}}
run: cd backend && npm install
- name: Install frontend dependencies
if: ${{steps.cache-frontend.outputs.cache-hit != 'true'}}
run: cd frontend && npm install
- name: Client eslint check
run: ./frontend/node_modules/.bin/eslint frontend/src --ext .ts,.tsx
- name: Run frontend build check
run: cd frontend && CI='' npm run build
backend:
needs: check
if: ${{needs.check.outputs.backend=='true'}}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Nodejs Setup
uses: actions/setup-node@v2
- name: Cache backend node modules
id: cache-backend
uses: actions/cache@v3
with:
path: backend/node_modules
key: npm-packages-backend-${{hashFiles('backend/package-lock.json')}}
restore-keys: |
npm-packages-backend-
- name: Install backend dependencies
if: ${{steps.cache-backend.outputs.cache-hit != 'true'}}
run: cd backend && npm install
- name: backend eslint check
run: ./backend/node_modules/.bin/eslint backend/src --ext .ts,.tsx
- name: Run backend build check
run: cd backend && npm run build