Skip to content

chore: DRAFT - Add test to Previews and setup test workflow for plugins #241

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

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

colinmurphy
Copy link
Member

@colinmurphy colinmurphy commented Jun 4, 2025

Description

Related Issue

Dependant PRs

Type of Change

  • ✅ Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactoring (no functional changes)
  • 📄 Example update (no functional changes)
  • 📝 Documentation update
  • 🔍 Performance improvement
  • 🧪 Test update

How Has This Been Tested?

Screenshots

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project's coding standards
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • Any dependent changes have been highlighted, merged or published

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 4, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

@moonmeister
Copy link
Member

I think it may be time for some caching optimizations. You can check out how I do this with Node on the Faust repo. Basically, I install & set up Node, install dependencies, then the disk is cached under a unique hash based on the state of package-lock.json. All other checks then depend on that setup and only have to restore the cache to have Node and its dependencies. This saves about 45 seconds on each downstream task. Rerunning things is optimized cause code might change, but as long as it's the same set of dependencies, then that initial task doesn't have to rerun, but only restore from cache.

Looks like at least composer install, if not some wider PHP config, could be configured to only happen once, and then have PHPCS, tests, and artifact creation all do cache restores.

@colinmurphy
Copy link
Member Author

Thanks @moonmeister ❤️

Thanks for the great feedback. I will have a look tomorrow at how you setup caching on Faust and look at making some optimizations.

Copy link

github-actions bot commented Jun 6, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 6, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 6, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

github-actions bot commented Jun 9, 2025

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copilot

This comment was marked as outdated.

Copy link

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

@colinmurphy colinmurphy requested a review from Copilot June 11, 2025 19:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces test enhancements and refactors the plugin’s configuration while setting up a comprehensive testing and CI/CD workflow for the HWP Previews plugin.

  • Refactored the plugin constant definitions to use individual conditional definitions with appropriate PHPCS disable/enable comments.
  • Added Docker configuration, updated composer dependencies, and introduced new GitHub Actions workflows and composite actions for Codeception tests, plugin artifact creation, and overall code quality.

Reviewed Changes

Copilot reviewed 70 out of 70 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plugins/hwp-previews/hwp-previews.php Refactored constant definitions and added PHPCS disable/enable comments
plugins/hwp-previews/docker-compose.yml Introduced Docker environment configuration for testing
plugins/hwp-previews/composer.json Updated dev dependencies and composer scripts for testing and build tasks
plugins/hwp-previews/codeception.dist.yml Added configuration for Codeception testing environment
plugins/hwp-previews/README.md Updated documentation to include testing instructions
plugins/hwp-previews/ACTIONS_AND_FILTERS.md Updated developer documentation to reflect new filters
plugins/hwp-previews/.gitignore Expanded ignore rules to cover new test directories and generated files
plugins/hwp-previews/.env.dist Added environment variable definitions for testing
plugins/hwp-previews/.docker/ (init-docker.sh, Dockerfile, .env.ci) Added scripts and Docker setup for seamless testing
.github/workflows/ (multiple YAML files) Added/updated GitHub Actions workflow triggers to support PHP-only plugin changes
.github/actions/ (composite actions) Introduced composite actions for PHP setup, Codeception tests, and plugin artifact creation
Comments suppressed due to low confidence (1)

.github/workflows/plugin-artifact-for-pr.yml:6

  • The workflow trigger pattern was updated to 'plugins/**.php', which restricts the trigger to PHP files only. Confirm that changes in non-PHP files (e.g. configuration or documentation) do not need to trigger artifact builds.
- 'plugins/**'

@@ -48,25 +48,41 @@

/**
* Define plugin constants.
*
* phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider reviewing the need to disable complexity checks in the hwp_previews_constants function; refactoring to reduce complexity could allow re-enabling these rules.

Copilot uses AI. Check for mistakes.

--env SKIP_TESTS_CLEANUP=${{ env.SKIP_TESTS_CLEANUP }} \
--env SUITES=acceptance \
$(docker compose ps -q wordpress) \
bash -c "cd wp-content/plugins/$(basename ${{ inputs.working-directory }}) && bin/run-codeception.sh"
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider verifying that using 'basename' on the working directory consistently derives the correct plugin folder, especially when the input path may include a trailing slash.

Suggested change
bash -c "cd wp-content/plugins/$(basename ${{ inputs.working-directory }}) && bin/run-codeception.sh"
bash -c "cd wp-content/plugins/$(basename $(echo ${{ inputs.working-directory }} | sed 's:/*$::')) && bin/run-codeception.sh"

Copilot uses AI. Check for mistakes.

Copy link

ℹ️ Download the hwp-previews plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants