Skip to content

Commit ef7fcd5

Browse files
committed
Run Phan against Woo versions
1 parent edc342c commit ef7fcd5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,3 +539,41 @@ jobs:
539539
echo "::error::Phan baselines have changed (good job!). Run \`jetpack phan --update-baseline ${PROJECTS[*]}\` to update them."
540540
fi
541541
exit 1
542+
543+
phan-woocommerce:
544+
name: Static analysis (WooCommerce)
545+
runs-on: ubuntu-latest
546+
timeout-minutes: 20
547+
steps:
548+
- uses: actions/checkout@v5
549+
- name: Setup tools
550+
uses: ./.github/actions/tool-setup
551+
- name: Pnpm install
552+
run: pnpm install
553+
- name: Add back removed packages in case of a release branch.
554+
run: |
555+
echo "Checking for non-mirrored require-dev packages, in case this is testing a release branch"
556+
for FILE in projects/*/*/composer.json; do
557+
PKGS=()
558+
readarray -t PKGS < <( jq -r '.extra["non-mirrored-require-dev"] // empty | .[] | . += "=@dev"' "$FILE" )
559+
if [[ ${#PKGS[@]} -gt 0 ]]; then
560+
echo "::group::Adding packages for $FILE: ${PKGS[*]}"
561+
# Make sure monorepo repositories entry is present.
562+
JSON=$( jq --tab '.repositories //= [] | if any( .repositories[]; .type == "path" and ( .url | startswith( "../" ) ) and .options?.monorepo? ) then . else .repositories += [ { type: "path", url: "../../packages/*", options: { monorepo: true } } ] end' "$FILE" )
563+
echo "$JSON" > "$FILE"
564+
composer require --working-dir="${FILE%/composer.json}" --dev "${PKGS[@]}"
565+
echo "::endgroup::"
566+
fi
567+
done
568+
- name: Run Phan against WooCommerce 7.0 stubs
569+
env:
570+
WOO_VERSION: '7.0'
571+
run: |
572+
composer require --dev "php-stubs/woocommerce-stubs:${WOO_VERSION}"
573+
pnpm jetpack phan --all -v --format github
574+
- name: Run Phan against WooCommerce 7.0 stubs
575+
env:
576+
WOO_VERSION: '10.*'
577+
run: |
578+
composer require --dev "php-stubs/woocommerce-stubs:${WOO_VERSION}"
579+
pnpm jetpack phan --all -v --format github

0 commit comments

Comments
 (0)