Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/rtcamp-standard.yml
Comment thread
Adi-ty marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: rtCamp Standard

on:
workflow_call:
inputs:
build-artifact-paths:
description: 'Newline-separated paths whose contents must not be committed.'
required: false
type: string
default: |
assets/build/
run-phpstan:
description: 'Whether to run the PHPStan job.'
required: false
type: boolean
default: true

permissions:
contents: read

jobs:
build-artifact-gate:
name: 'Block committed build artifacts'
if: ${{ github.event_name == 'pull_request' }}
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-build-artifact-gate.yml@ff44a8745c5360e28a5316c39b4468c6cf5e0cb6
with:
gated-paths: ${{ inputs.build-artifact-paths }}

phpstan:
name: 'PHPStan'
runs-on: ubuntu-latest
if: ${{ inputs.run-phpstan }}
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none

- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Configure Composer cache
uses: actions/cache@v5.0.3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --prefer-dist --optimize-autoloader --no-progress --no-interaction --no-scripts

- name: Run PHPStan
run: composer phpstan
10 changes: 9 additions & 1 deletion .github/workflows/test-measure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
MODIFIED_FILES_DATA=$(node .github/bin/determine-modified-files-count.js "$IGNORE_PATH_REGEX" "$MODIFIED_FILES" "all")
CSS_FILE_COUNT=$(node .github/bin/determine-modified-files-count.js ".+\.s?css|package\.json|package-lock\.json" "$MODIFIED_FILES")
JS_FILE_COUNT=$(node .github/bin/determine-modified-files-count.js ".+\.(js|snap)|package\.json|package-lock\.json" "$MODIFIED_FILES")
PHP_FILE_COUNT=$(node .github/bin/determine-modified-files-count.js ".+\.php|composer\.(json|lock)|phpstan\.neon\.dist" "$MODIFIED_FILES")
PHP_FILE_COUNT=$(node .github/bin/determine-modified-files-count.js ".+\.php|composer\.(json|lock)|phpstan\.neon\.dist|phpstan-baseline\.neon" "$MODIFIED_FILES")
GHA_WORKFLOW_COUNT=$(node .github/bin/determine-modified-files-count.js "(\.github\/(workflows|actions)\/.+\.yml)" "$MODIFIED_FILES")

echo "Changed file count: $MODIFIED_FILES_DATA"
Expand Down Expand Up @@ -218,3 +218,11 @@ jobs:
run: npm run build:prod
env:
CI: true

rtcamp-standard:
name: 'rtCamp Standard'
needs: pre-run
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/workflows/rtcamp-standard.yml
with:
run-phpstan: ${{ fromJSON(needs.pre-run.outputs.changed-php-count) > 0 }}