-
-
Notifications
You must be signed in to change notification settings - Fork 173
141 lines (122 loc) · 4.53 KB
/
frontend.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# To upgrade pinned actions: Use https://github.com/mheap/pin-github-action
name: CI - Frontend
on:
push:
branches-ignore:
- "main"
- "release/**"
paths:
- ".github/workflows/frontend.yml"
- "panel/**"
- "!panel/scripts/**"
pull_request:
branches-ignore:
- "main"
- "release/**"
paths:
- ".github/workflows/frontend.yml"
- "panel/**"
- "!panel/scripts/**"
workflow_call:
workflow_dispatch:
jobs:
tests:
name: "Unit tests"
# run job only under the following conditions:
# - can be triggered manually from any repository
# - if on pull request, only run if from a fork
# (our own repo is covered by the push event)
# - if on push, only run CI automatically for the
# main getkirby/kirby repo and for forks
if: >
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
) ||
(
github.event_name == 'push' &&
(github.repository == 'getkirby/kirby' || github.repository_owner != 'getkirby')
)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3
- name: Set up Node.js problem matchers and cache npm dependencies
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # pin@v3
with:
cache: "npm"
cache-dependency-path: panel/package-lock.json
- name: Install npm dependencies
id: finishPrepare
run: npm ci
working-directory: panel
- name: Run JavaScript unit tests
if: always() && steps.finishPrepare.outcome == 'success'
run: npm run test:unit
working-directory: panel
coding-style:
name: "Coding Style"
# run job only under the following conditions:
# - can be triggered manually from any repository
# - if on pull request, only run if from a fork
# (our own repo is covered by the push event)
# - if on push, only run CI automatically for the
# main getkirby/kirby repo and for forks
if: >
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
) ||
(
github.event_name == 'push' &&
(github.repository == 'getkirby/kirby' || github.repository_owner != 'getkirby')
)
runs-on: ubuntu-latest
timeout-minutes: 5
env:
php: "8.1"
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3
- name: Set up Node.js problem matchers and cache npm dependencies
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # pin@v3
with:
cache: "npm"
cache-dependency-path: panel/package-lock.json
- name: Install npm dependencies
id: finishPrepare
run: npm ci
working-directory: panel
- name: Check for JavaScript coding style violations (ESLint)
if: always() && steps.finishPrepare.outcome == 'success'
# Use the --no-fix flag in push builds to get a failed CI status
run: >
npm run lint -- --max-warnings 0 --format stylish
${{ github.event_name != 'pull_request' && '--no-fix' || '' }}
working-directory: panel
- name: Create code suggestions from the coding style changes (on PR only)
if: >
always() && steps.finishPrepare.outcome == 'success' &&
github.event_name == 'pull_request'
uses: reviewdog/action-suggester@3f60d0e826f0873905e0eeca522d562a6e67afbd # pin@v1
with:
tool_name: ESLint
fail_on_error: "true"
- name: Check for JavaScript coding style violations (Prettier)
if: always() && steps.finishPrepare.outcome == 'success'
# Use the --check flag in push builds to get a failed CI status
run: >
npm run format --
${{ github.event_name != 'pull_request' && '--check' || '--write' }}
working-directory: panel
- name: Create code suggestions from the coding style changes (on PR only)
if: >
always() && steps.finishPrepare.outcome == 'success' &&
github.event_name == 'pull_request'
uses: reviewdog/action-suggester@3f60d0e826f0873905e0eeca522d562a6e67afbd # pin@v1
with:
tool_name: Prettier
fail_on_error: "true"