Skip to content

Release version 2.6.2 #28

Release version 2.6.2

Release version 2.6.2 #28

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
php-lint:
name: PHP lint (${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Lint PHP files
run: php tools/lint-php.php
unit-tests:
name: PHPUnit (${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.2'
- '8.3'
- '8.4'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2
- name: Validate Composer metadata
run: composer validate --strict
- name: Install dependencies
run: composer install --no-interaction --prefer-dist --no-progress
- name: Run PHPUnit
run: composer test
plugin-check:
name: WordPress Plugin Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build runtime plugin directory
run: |
mkdir -p plugin-check-build/mikesoft-teamvault
rsync -a ./ plugin-check-build/mikesoft-teamvault/ \
--exclude='.git' \
--exclude='.github' \
--exclude='.gitignore' \
--exclude='.gitattributes' \
--exclude='.editorconfig' \
--exclude='.phpunit.cache' \
--exclude='.wordpress-org' \
--exclude='.worktrees' \
--exclude='AGENTS.md' \
--exclude='CODE_OF_CONDUCT.md' \
--exclude='CONTRIBUTING.md' \
--exclude='README.md' \
--exclude='SECURITY.md' \
--exclude='composer.json' \
--exclude='composer.lock' \
--exclude='docs' \
--exclude='plugin-check-build' \
--exclude='screenshots' \
--exclude='tests' \
--exclude='tools' \
--exclude='vendor'
# Plugin Check is run inline instead of via wordpress/plugin-check-action@v1.
# That action injects plugin-check as a URL plugin in .wp-env.json, which triggers an
# upstream @wordpress/env bug on the ubuntu-24.04 runner image (Node 24.16 / libuv
# 1.52.1): wp-env exits 0 without starting Docker, so the check reports
# "Environment not initialized". Installing plugin-check via WP-CLI after wp-env start
# avoids the broken URL-download path. See WordPress/plugin-check-action#579.
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Configure wp-env (no URL plugins)
run: |
PLUGIN_DIR="$(realpath plugin-check-build/mikesoft-teamvault)"
printf '{ "core": null, "plugins": [], "mappings": { "wp-content/plugins/mikesoft-teamvault": "%s" } }\n' "$PLUGIN_DIR" > .wp-env.json
cat .wp-env.json
npm -g --no-fund install @wordpress/env
- name: Start wp-env
uses: nick-fields/retry@v4
with:
timeout_minutes: 10
max_attempts: 3
shell: bash
command: wp-env start --update
- name: Run WordPress Plugin Check
run: |
wp-env run cli wp cli info
wp-env run cli wp plugin install plugin-check --activate
wp-env run cli wp plugin activate mikesoft-teamvault
set +e
wp-env run cli wp plugin check mikesoft-teamvault \
--format=json --slug=mikesoft-teamvault \
--require=./wp-content/plugins/plugin-check/cli.php > "$RUNNER_TEMP/pc.json"
CHECK_EXIT=$?
set -e
echo "wp plugin check exit: $CHECK_EXIT"
echo "----- Plugin Check results -----"
cat "$RUNNER_TEMP/pc.json" || true
echo ""
RESULTS="$RUNNER_TEMP/pc.json" CHECK_EXIT="$CHECK_EXIT" node <<'NODE'
const fs = require('fs');
let raw = '';
try { raw = fs.readFileSync(process.env.RESULTS, 'utf8'); } catch (e) {}
const checkExit = parseInt(process.env.CHECK_EXIT || '0', 10);
const trimmed = raw.trim();
// With --format=json WP-CLI still prints a plain "Success: ... No errors found." line
// (not a JSON array) when there are no findings. Treat that as a pass.
if (/no errors found/i.test(trimmed) || /^success:/i.test(trimmed)) {
console.log(trimmed || 'Plugin Check: no issues.');
process.exit(0);
}
if (trimmed === '') {
if (checkExit !== 0) { console.error('Plugin Check produced no output and exited ' + checkExit + ' — treating as failure.'); process.exit(2); }
console.log('Plugin Check: no issues.'); process.exit(0);
}
let data;
try { data = JSON.parse(trimmed); } catch (e) { console.error('Plugin Check output is neither a success message nor valid JSON — the check did not run correctly:'); console.error(trimmed.slice(0, 1000)); process.exit(2); }
let items = Array.isArray(data) ? data : [];
if (!Array.isArray(data) && data && typeof data === 'object') {
for (const k in data) { if (Array.isArray(data[k])) items = items.concat(data[k]); }
}
const errs = items.filter((x) => x && String(x.type || '').toUpperCase() === 'ERROR');
const warns = items.filter((x) => x && String(x.type || '').toUpperCase() === 'WARNING');
console.log('Plugin Check: ' + errs.length + ' error(s), ' + warns.length + ' warning(s).');
for (const e of errs.slice(0, 50)) { console.log('ERROR ' + (e.code || '') + ' ' + (e.file || '') + ':' + (e.line || '') + ' ' + (e.message || '')); }
if (errs.length > 0) { console.error('::error::WordPress Plugin Check reported ' + errs.length + ' error(s).'); process.exit(1); }
console.log('Plugin Check passed (no errors).');
NODE