Skip to content

Prepare 1.0.9 Release #249

Prepare 1.0.9 Release

Prepare 1.0.9 Release #249

Workflow file for this run

name: Tests
on:
push:
branches: [ main ]
# No base-branch filter: `pull_request.branches` matches the *base*, so
# limiting it to main skips every check on a stacked PR, which is when
# review needs them most.
pull_request:
env:
SLIC_BIN: ${{ github.workspace }}/slic/slic
jobs:
phpcs:
name: PHPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer
- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist --no-scripts
mkdir -p vendor/prefixed && echo '<?php' > vendor/prefixed/autoload.php
env:
COMPOSER_NO_AUDIT: 1
- name: Configure PHPCS standards
run: vendor/bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-paragonie,vendor/phpcompatibility/phpcompatibility-wp,vendor/phpcsstandards/phpcsextra,vendor/phpcsstandards/phpcsutils,vendor/wp-coding-standards/wpcs
- name: Run PHPCS
run: vendor/bin/phpcs
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer
coverage: none
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- name: Setup bun
uses: oven-sh/setup-bun@v2
# Composer install MUST run scripts here (unlike the PHPCS job above)
# so Strauss generates the prefixed `WorkOS\Vendor\…` classes that
# PHPStan needs to resolve types.
- name: Install PHP dependencies (with Strauss)
run: |
# Strauss boots its own Composer instance, which rejects the
# github-oauth token setup-php pre-configures from github.token
# ("contains invalid characters" when that value is empty/malformed).
# Clear it so Strauss runs unauthenticated — exactly like the
# slic-based PHP test jobs, which run Strauss without issue.
composer config --global --unset github-oauth.github.com 2>/dev/null || true
rm -f "$(composer config --global home 2>/dev/null)/auth.json" 2>/dev/null || true
composer install --no-interaction --prefer-dist
env:
COMPOSER_NO_AUDIT: 1
# Build the JS bundles so the `build/*.asset.php` files exist —
# PHPStan statically resolves the `include $asset_file` paths in
# Admin/Settings.php, UI/Controller.php, etc. and would otherwise
# fail with `path.notExists` even though every callsite is guarded
# by `file_exists()`.
- name: Install JS dependencies + build
run: |
bun install --frozen-lockfile
bun run build
- name: Run PHPStan
run: composer phpstan -- --no-progress --error-format=github
tests-php:
name: PHP Tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.0', '8.1', '8.2', '8.3' ]
steps:
- uses: actions/checkout@v6
- name: Checkout slic
uses: actions/checkout@v6
with:
repository: stellarwp/slic
ref: main
path: slic
fetch-depth: 1
- name: Start ssh-agent
run: |
mkdir -p "${HOME}/.ssh"
ssh-agent -a /tmp/ssh_agent.sock
- name: Export SSH_AUTH_SOCK
run: echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV
- name: Set up slic env vars
run: |
echo "SLIC_WP_DIR=${GITHUB_WORKSPACE}/slic/_wordpress" >> $GITHUB_ENV
echo "SLIC_WORDPRESS_DOCKERFILE=Dockerfile.base" >> $GITHUB_ENV
- name: Set run context
run: echo "SLIC=1" >> $GITHUB_ENV && echo "CI=1" >> $GITHUB_ENV
- name: Set up slic for CI
run: |
cd ${GITHUB_WORKSPACE}/..
${SLIC_BIN} here
${SLIC_BIN} interactive off
${SLIC_BIN} build-prompt off
${SLIC_BIN} build-subdir off
${SLIC_BIN} xdebug off
${SLIC_BIN} debug on
${SLIC_BIN} info
${SLIC_BIN} config
- name: Set up plugin
run: |
${SLIC_BIN} use integration-workos
${SLIC_BIN} composer install
- name: Run wpunit tests
run: ${SLIC_BIN} run wpunit --skip-group constants --ext DotReporter
- name: Run wpunit tests (constants group, isolated process)
run: ${SLIC_BIN} run wpunit --group constants --ext DotReporter
js-build:
name: JS Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- name: Setup bun
uses: oven-sh/setup-bun@v2
# Use bun (with the committed lockfile) to match every other job and
# the local workflow — `npm install` resolves peer deps differently
# and breaks on upstream @wordpress/* drift.
- name: Install dependencies + build
run: |
bun install --frozen-lockfile
bun run build