Skip to content

feat: require Desktop Mode 0.7.2+, migrate hooks and selectors #234

feat: require Desktop Mode 0.7.2+, migrate hooks and selectors

feat: require Desktop Mode 0.7.2+, migrate hooks and selectors #234

Workflow file for this run

name: ci
on:
pull_request:
push:
branches: [main]
workflow_call:
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- run: odd/bin/check-version
- run: odd/bin/check-plugin-metadata
# Build the remote catalog from _tools/catalog-sources/ and enforce
# byte-for-byte determinism, schema validity, SHA256/size matches,
# and that every starter-pack slug resolves. Also exercises the
# builder so a broken template or missing asset is caught on PR
# rather than at publish time.
catalog-build-and-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Build catalog from _tools/catalog-sources/
run: python3 _tools/build-catalog.py
- name: Validate catalog (determinism + schema + hashes)
env:
ODD_VALIDATE_REBUILD: '1'
run: odd/bin/validate-catalog
- name: Validate cursor set sources
run: odd/bin/validate-cursor-sets
json-valid:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Parse every JSON file
run: |
set -e
# Manifests live with each bundle source in catalog-sources/.
MANIFESTS=$(find _tools/catalog-sources -name manifest.json -type f)
METAS=$(find _tools/catalog-sources -name meta.json -type f)
for f in blueprint.json $MANIFESTS $METAS; do
echo " $f"
python3 -c "import json,sys; json.load(open('$f'))"
done
# blueprint.json is the public Playground demo entry point. We
# enforce that it doesn't regress to CORS-fragile release URLs or
# unpinned plugin installs — both make first-run fatals common
# for new users. See odd/bin/validate-blueprint for the full rule
# list.
blueprint-valid:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- run: odd/bin/validate-blueprint
check-licenses:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- run: odd/bin/check-licenses
manifest-schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install jsonschema
run: python -m pip install --quiet jsonschema
- name: Validate good manifest fixtures (must pass)
env:
ODD_REQUIRE_JSONSCHEMA: '1'
run: |
odd/bin/validate-manifest \
odd/tests/fixtures/manifests/scene-ok.json \
odd/tests/fixtures/manifests/iconset-ok.json \
odd/tests/fixtures/manifests/cursorset-ok.json \
odd/tests/fixtures/manifests/widget-ok.json \
odd/tests/fixtures/manifests/app-ok.json
- name: Validate bad manifest fixture (must fail)
env:
ODD_REQUIRE_JSONSCHEMA: '1'
run: |
if odd/bin/validate-manifest odd/tests/fixtures/manifests/scene-bad.json; then
echo "schema failed to catch known-bad manifest" >&2
exit 1
fi
echo "bad manifest was rejected as expected"
vitest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- run: npm ci --no-audit --no-fund
- run: npm test
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer:v2
- name: Cache composer deps
uses: actions/cache@v5
with:
path: vendor
key: composer-${{ hashFiles('composer.lock', 'composer.json') }}
restore-keys: composer-
- run: composer install --no-progress --no-interaction --prefer-dist
- run: composer phpcs
phpunit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Matrix is PHP-only: wp-phpunit/wp-phpunit is locked against
# modern WP core (it expects wp-includes/class-wpdb.php) so
# testing against WP 6.0 here would require per-matrix
# version juggling. install-smoke.yml already boots the
# plugin against real, live WordPress end-to-end, so the
# value of a WP-version matrix dimension on PHPUnit is low.
php: ['7.4', '8.0', '8.2']
wp: ['latest']
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress_test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -u root -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysqli, zip, dom
coverage: none
tools: composer:v2
- name: Cache composer deps
uses: actions/cache@v5
with:
path: vendor
key: composer-${{ matrix.php }}-${{ hashFiles('composer.lock', 'composer.json') }}
restore-keys: composer-${{ matrix.php }}-
- name: Wait for MySQL
run: |
for i in $(seq 1 30); do
if mysqladmin ping -h 127.0.0.1 -u root -proot --silent; then
echo "mysql ready"; exit 0
fi
sleep 2
done
echo "mysql never came up"; exit 1
- run: composer install --no-progress --no-interaction --prefer-dist
- name: Install WordPress test scaffolding
env:
WP_VERSION: ${{ matrix.wp }}
run: |
bash odd/tests/php/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 "$WP_VERSION"
- run: composer phpunit
site-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '20'
# `html-validate` via npx keeps us off a second lockfile; the
# site is one static page so a fresh install per CI run is
# cheap. Rules are tuned in .htmlvalidate.json at the repo
# root (we keep WCAG h30 + inline-style off; everything else
# is the html-validate recommended baseline).
- name: Validate site/index.html
run: npx --yes html-validate@latest site/index.html
zip-budget:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- run: odd/bin/build-zip
- run: odd/bin/check-zip-contents --list
- uses: actions/upload-artifact@v7
with:
name: odd-zip
path: dist/odd.zip
if-no-files-found: error
retention-days: 14
plugin-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Build release package
run: odd/bin/build-zip
- name: Validate release package contents
run: odd/bin/check-zip-contents
- name: Expand release package for Plugin Check
run: |
set -e
rm -rf dist/plugin
mkdir -p dist/plugin
unzip -q dist/odd.zip -d dist/plugin
- name: Run WordPress Plugin Check
uses: WordPress/plugin-check-action@v1
with:
build-dir: './dist/plugin/odd'