forked from dima117/unit-demo-cra
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (117 loc) · 3.25 KB
/
pull-request.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
name: pull_request
on:
pull_request:
types: [opened, reopened, synchronize]
paths-ignore:
- '.github/**/*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.build.outcome }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/cache@v3
with:
path: ~/.npm
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Установка зависимостей
run: npm ci
- name: Build
id: build
run: npm run build
linter:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.linter.outcome }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/cache@v3
with:
path: ~/.npm
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Установка зависимостей
run: npm ci
- name: Запуски линтеров
id: linter
run: npm run lint
e2e:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.e2e.outcome }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Get short SHA
id: short_sha
run: |
SHORT_SHA=$(git rev-parse --short ${{ github.sha }})
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
shell: bash
- uses: actions/cache@v3
with:
path: ~/.npm
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Установка зависимостей
run: |
npm ci
npx playwright install --with-deps
npm run build
- name: Запуск e2e тестов
id: e2e
run: npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: "e2e-tests-report_${{ steps.short_sha.outputs.short_sha}}"
path: playwright-report/
retention-days: 30
unit:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.unit.outcome }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Get short SHA
id: short_sha
run: |
SHORT_SHA=$(git rev-parse --short ${{ GITHUB.SHA }})
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
shell: bash
- uses: actions/cache@v3
with:
path: ~/.npm
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Установка зависимостей и сборка
run: |
npm ci
npm run build
- name: Запуск unit тестов
id: unit
run: npm run test-ci
- uses: actions/upload-artifact@v3
if: always()
with:
name: "unit-tests-report_${{ steps.short_sha.outputs.short_sha}}"
path: test-report.html
retention-days: 30