Repository navigation
185 lines (171 loc) · 5.28 KB
/
Copy pathci.yml
File metadata and controls
185 lines (171 loc) · 5.28 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
name: CI
on:
push:
branches:
- main
pull_request:
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: {}
jobs:
detect:
name: Detect Changes
runs-on: 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: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Detect file changes
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
php:
- '**.php'
- 'composer.*'
phpcs:
- '.github/workflows/reusable-phpcs.yml'
- '.phpcs.xml.dist'
phpstan:
- '.github/workflows/reusable-phpstan.yml'
- 'phpstan.neon.dist'
phpunit:
- 'tests/**/*.php'
- '.github/workflows/reusable-phpunit.yml'
- 'phpunit.xml.dist'
- 'package*.json'
js:
- .github/workflows/reusable-lint-css-js.yml
- '**.cjs'
- '**.js'
- '**.jsx'
- '**.mjs'
- '**.cts'
- '**.mts'
- '**.ts'
- '**.tsx'
- 'package*.json'
- '.eslintrc*'
- 'tsconfig*.json'
css:
- .github/workflows/reusable-lint-css-js.yml
- '**.css'
- '**.scss'
- '.stylelintignore'
- '.stylelintrc*'
e2e:
- '.github/workflows/reusable-e2e.yml'
- 'tests/e2e/**/*'
jest:
- '.github/workflows/reusable-jest.yml'
- 'assets/src/**/__tests__/**/*'
- 'assets/src/**/*.test.ts'
- 'assets/src/**/*.test.tsx'
- 'assets/src/**/*.spec.ts'
- 'assets/src/**/*.spec.tsx'
- 'tests/js/**/*'
- 'jest.config.js'
- '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.3'
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.3'
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
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
if: 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.3'
build-plugin-zip:
name: Build Plugin Zip
permissions:
contents: read
uses: ./.github/workflows/reusable-build.yml
with:
php-version: '8.3'
artifact-name: onelogs-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: 'onelogs-pr'
artifact-filename: 'onelogs.zip'