forked from Bielik20/nx-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (117 loc) · 3.56 KB
/
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Check
on:
pull_request:
jobs:
install:
name: Install Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache Dependencies
id: cache
uses: actions/cache@v2
with:
path: |
node_modules
tools/src/**/*.js
key: dependencies-${{ runner.os }}-${{ hashFiles('yarn.lock', 'tools/src/**/*.ts') }}
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: Execute
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
- name: Set Variables
id: variables
run: yarn script set-pr-variables
- name: Set e2e
id: set-e2e
run: yarn script set-affected --target e2e --base ${{ steps.variables.outputs.base }}
- name: Set lint
id: set-lint
run: yarn script set-affected --target lint --base ${{ steps.variables.outputs.base }}
- name: Set test
id: set-test
run: yarn script set-affected --target test --base ${{ steps.variables.outputs.base }}
outputs:
e2e-array: ${{ steps.set-e2e.outputs.array }}
lint-comma: ${{ steps.set-lint.outputs.comma-separated }}
test-comma: ${{ steps.set-test.outputs.comma-separated }}
lint:
name: Lint
needs: install
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: Load Dependencies
uses: actions/cache@v2
with:
path: |
node_modules
tools/src/**/*.js
key: dependencies-${{ runner.os }}-${{ hashFiles('yarn.lock', 'tools/src/**/*.ts') }}
- name: Execute
if: ${{ needs.install.outputs.lint-comma }}
run: npm run nx -- run-many --projects ${{ needs.install.outputs.lint-comma }} --target lint --parallel -- --quiet
test:
name: Test
needs: install
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: Load Dependencies
uses: actions/cache@v2
with:
path: |
node_modules
tools/src/**/*.js
key: dependencies-${{ runner.os }}-${{ hashFiles('yarn.lock', 'tools/src/**/*.ts') }}
- name: Execute
if: ${{ needs.install.outputs.test-comma }}
run: yarn nx run-many --projects ${{ needs.install.outputs.test-comma }} --target test --parallel
e2e:
name: E2E
needs: [install]
runs-on: ubuntu-latest
strategy:
matrix:
project: ${{ fromJson(needs.install.outputs.e2e-array) }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: Load Dependencies
uses: actions/cache@v2
with:
path: |
node_modules
tools/src/**/*.js
key: dependencies-${{ runner.os }}-${{ hashFiles('yarn.lock', 'tools/src/**/*.ts') }}
- name: Execute
run: yarn nx run ${{ matrix.project }}:e2e
e2e-done:
name: E2E
needs: [install, e2e]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Check status
if: ${{ needs.e2e.result != 'success' && !contains(needs.install.outputs.e2e-array, '[]') }}
run: exit 1