Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using stubs for the correct version of WordPress being tested #16

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/reusable-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ jobs:
elif [ "${{ inputs.wp }}" == "nightly" ]; then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="dev-main"
elif [[ "${{ inputs.wp }}" =~ ^[0-9]\.[0-9]$ ]]; then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ inputs.wp }}.0"
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ inputs.wp }}.0" php-stubs/wordpress-stubs="~${{ inputs.wp }}.0"
else
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="${{ inputs.wp }}"
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="${{ inputs.wp }}" php-stubs/wordpress-stubs="${{ inputs.wp }}"
fi

- name: Setup node
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/reusable-coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ name: Coding Standards
on:
workflow_call:
inputs:
wp:
required: false
default: latest
type: string
description: WordPress version to use in major.minor format (e.g. 6.4), or "latest" or "nightly"
php:
required: true
type: string
description: PHP version to use in major.minor format (e.g. 8.0)

jobs:
test:
name: PHP / PHP ${{ inputs.php }}
name: WP ${{ inputs.wp }} / PHP ${{ inputs.php }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -61,7 +66,14 @@ jobs:
run: composer validate --strict --no-check-lock

- name: Install dependencies
run: composer install --prefer-dist
run: |
if [ "${{ inputs.wp }}" == "latest" ]; then
composer install --dev --prefer-dist
elif [ "${{ inputs.wp }}" == "nightly" ]; then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="dev-main"
else
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ inputs.wp }}.0" php-stubs/wordpress-stubs="~${{ inputs.wp }}.0"
fi
Comment on lines +69 to +76
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: |
if [ "${{ inputs.wp }}" == "latest" ]; then
composer install --dev --prefer-dist
elif [ "${{ inputs.wp }}" == "nightly" ]; then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="dev-main"
else
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ inputs.wp }}.0" php-stubs/wordpress-stubs="~${{ inputs.wp }}.0"
fi
if: "${{ inputs.wp == 'latest' }}"
run: "composer update --prefer-dist"
- name: "Install nightly dependencies"
if: "${{ inputs.wp == 'nightly' }}"
run: |
composer update --dev --with-all-dependencies --prefer-dist roots/wordpress-full:"dev-main"
- name: "Install dependencies"
if: "${{ inputs.wp != 'nightly' && inputs.wp != 'latest' }}"
run: |
composer update --dev --with-all-dependencies --prefer-dist roots/wordpress-full:"~${{ inputs.wp }}.0" php-stubs/wordpress-stubs:"~${{ inputs.wp }}.0"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your repos don't have lock files. So install will display a warning.


- name: Run static analysis
run: composer test:phpstan
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ jobs:
elif [ "${{ inputs.wp }}" == "nightly" ]; then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="dev-main"
elif [[ "${{ inputs.wp }}" =~ ^[0-9]\.[0-9]$ ]]; then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ inputs.wp }}.0"
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ inputs.wp }}.0" php-stubs/wordpress-stubs="~${{ inputs.wp }}.0"
else
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="${{ inputs.wp }}"
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="${{ inputs.wp }}" php-stubs/wordpress-stubs="${{ inputs.wp }}"
fi

- name: Setup node
Expand Down