-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (182 loc) · 5.68 KB
/
ci.yml
File metadata and controls
198 lines (182 loc) · 5.68 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- release/**
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
permissions:
contents: read
jobs:
detect:
name: Detect Changes
runs-on: [public-repo]
container:
image: ubuntu:24.04
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
permissions:
contents: read
pull-requests: read
outputs:
php: ${{ steps.filter.outputs.php }}
phpcs: ${{ steps.filter.outputs.phpcs }}
phpstan: ${{ steps.filter.outputs.phpstan }}
phpunit: ${{ steps.filter.outputs.phpunit }}
js: ${{ steps.filter.outputs.js }}
css: ${{ steps.filter.outputs.css }}
e2e: ${{ steps.filter.outputs.e2e }}
jest: ${{ steps.filter.outputs.jest }}
steps:
- name: Install system dependencies
run: |
apt-get update
apt-get install -y git
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Configure Git for Safe Directory
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Detect file changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
php:
- '**.php'
- 'composer.*'
phpcs:
- '.phpcs.xml.dist'
- '.github/workflows/reusable-phpcs.yml'
phpstan:
- 'phpstan.neon.dist'
- '.github/workflows/reusable-phpstan.yml'
phpunit:
- 'tests/**/*.php'
- 'phpunit.xml.dist'
- '.github/workflows/reusable-phpunit.yml'
- 'package*.json'
js:
- '**.cjs'
- '**.js'
- '**.jsx'
- '**.mjs'
- '**.cts'
- '**.mts'
- '**.ts'
- '**.tsx'
- 'package*.json'
- '.eslintrc*'
- 'tsconfig*.json'
css:
- '**.css'
- '**.scss'
- '.stylelintignore'
- '.stylelintrc*'
e2e:
- 'tests/e2e/**/*'
- '.github/workflows/reusable-e2e.yml'
jest:
- 'tests/js/**/*'
- 'src/**/__tests__/**/*'
- 'src/**/*.test.ts'
- 'src/**/*.test.tsx'
- 'src/**/*.spec.ts'
- 'src/**/*.spec.tsx'
- 'jest.config.js'
- '.github/workflows/reusable-jest.yml'
- 'package*.json'
phpcs:
name: PHPCS
needs: detect
if: needs.detect.outputs.php == 'true' || needs.detect.outputs.phpcs == 'true'
uses: ./.github/workflows/reusable-phpcs.yml
permissions:
contents: read
with:
php-version: '8.2'
phpstan:
name: PHPStan
needs: detect
if: needs.detect.outputs.php == 'true' || needs.detect.outputs.phpstan == 'true'
uses: ./.github/workflows/reusable-phpstan.yml
permissions:
contents: read
with:
php-version: '8.2'
lint-css-js:
name: CSS/JS Lint
needs: detect
if: needs.detect.outputs.css == 'true' || needs.detect.outputs.js == 'true'
uses: ./.github/workflows/reusable-lint-css-js.yml
permissions:
contents: read
jest:
name: Jest Unit Tests
needs: detect
if: needs.detect.outputs.js == 'true' || needs.detect.outputs.jest == 'true'
uses: ./.github/workflows/reusable-jest.yml
permissions:
contents: read
with:
coverage: true
phpunit:
name: PHPUnit (PHP ${{ matrix.php }}, WP ${{ matrix.wp }})
needs: detect
if: needs.detect.outputs.php == 'true' || needs.detect.outputs.phpunit == 'true'
uses: ./.github/workflows/reusable-phpunit.yml
permissions:
contents: read
strategy:
fail-fast: false
max-parallel: 1
matrix:
php: ['8.4', '8.3', '8.2']
wp: ['latest']
include:
- php: '8.4'
wp: 'latest'
coverage: true
with:
php-version: ${{ matrix.php }}
wp-version: ${{ matrix.wp }}
coverage: ${{ matrix.coverage == true }}
secrets: inherit
e2e:
name: E2E Tests
needs: [detect, phpunit]
if: needs.detect.result == 'success' && (needs.phpunit.result == 'success' || needs.phpunit.result == 'skipped') && (needs.detect.outputs.php == 'true' || needs.detect.outputs.e2e == 'true' || needs.detect.outputs.js == 'true' || needs.detect.outputs.css == 'true')
uses: ./.github/workflows/reusable-e2e.yml
permissions:
contents: read
with:
php-version: '8.2'
build-plugin-zip:
name: Build Plugin Zip
needs: [e2e]
if: needs.e2e.result == 'success' || needs.e2e.result == 'skipped'
permissions:
contents: read
uses: ./.github/workflows/reusable-build.yml
with:
php-version: '8.2'
artifact-name: plugin-skeleton-d-pr${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
secrets: inherit
playground-preview:
name: Playground Preview
needs: build-plugin-zip
if: github.event_name == 'pull_request'
uses: ./.github/workflows/reusable-wp-playground-pr-preview.yml
permissions:
actions: read
contents: write
pull-requests: write
with:
run-id: ${{ github.run_id }}
artifact-prefix: 'plugin-skeleton-d-pr'
artifact-filename: 'plugin-skeleton-d.zip'