-
Notifications
You must be signed in to change notification settings - Fork 1
138 lines (112 loc) · 3.69 KB
/
ci.yml
File metadata and controls
138 lines (112 loc) · 3.69 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
name: CI
on:
pull_request:
push:
branches:
- main
- feature/**
jobs:
js-build:
name: JS Build (Node 22)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Compile production assets
run: npm run compile:production
- name: List gulp tasks
run: npm run gulp -- --tasks-simple
php-checks:
name: PHP Checks (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["8.1", "8.2"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- name: Validate composer.json
run: composer validate --strict
- name: Install composer dependencies (no scripts)
run: composer install --no-interaction --prefer-dist --no-scripts
- name: Build optimized autoloader (no-dev)
run: composer dump-autoload --no-dev --optimize
zip-build:
name: Zip Build Artifact
runs-on: ubuntu-latest
needs:
- js-build
- php-checks
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
tools: composer:v2
coverage: none
- name: Install rsync
run: sudo apt-get update && sudo apt-get install -y rsync
- name: Install WP-CLI
run: |
curl -fsSL -o wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info
- name: Install dependencies
run: npm ci
- name: Build release zip
run: npm run zip
- name: Verify production autoload integrity
run: node ./node-tasks/verify_release_autoload.js
- name: Validate zip contents
run: |
ZIP_PATH="$(ls -1 ../style-manager-*.zip | head -n 1)"
unzip -l "$ZIP_PATH" > /tmp/style-manager-zip-list.txt
if grep -Eq 'vendor/(phpstan|rector|brain|mockery|phpunit|symfony|psr|pimple|cedaro|nikic|phpcsstandards)/' /tmp/style-manager-zip-list.txt; then
echo "Zip contains stripped/dev vendor references."
exit 1
fi
if grep -Eq 'dist/js/[0-9]+\.js' /tmp/style-manager-zip-list.txt; then
echo "Zip contains numeric chunk names in dist/js. Expected deterministic chunk naming."
exit 1
fi
if ! grep -Eq 'dist/js/customizer-worker\.js' /tmp/style-manager-zip-list.txt; then
echo "Expected dist/js/customizer-worker.js in zip output."
exit 1
fi
if grep -Eq '(\.csslintrc|\.eslintrc|plans/)' /tmp/style-manager-zip-list.txt; then
echo "Zip contains development-only root files or plans."
exit 1
fi
- name: Stage zip artifact
run: |
ZIP_PATH="$(ls -1 ../style-manager-*.zip | head -n 1)"
cp "$ZIP_PATH" "./$(basename "$ZIP_PATH")"
- name: Upload zip artifact
uses: actions/upload-artifact@v4
with:
name: style-manager-zip
path: style-manager-*.zip
if-no-files-found: error