-
-
Notifications
You must be signed in to change notification settings - Fork 4
Unit tests and CI / Release workflows #142
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5dcf37c
Remove vendor and add on gitignore
mgiannopoulos24 dc2125a
Installed PHPunit and added a lot of unit tests.
mgiannopoulos24 96c8649
Add code tags on some bullet points
mgiannopoulos24 ca06409
Add shell support on wp-env
mgiannopoulos24 c1c4984
Update documentation
mgiannopoulos24 689026a
Remove 8.2 since not supported
mgiannopoulos24 abe9616
Add uninstall hooks to a separate file.
mgiannopoulos24 a3ea88c
Minor instruction fixes
mgiannopoulos24 e7b5ca1
Add text domain and custom capabilities lint.
mgiannopoulos24 f438473
Add links to readme, fix inline code and add donation link.
mgiannopoulos24 416313e
Add PHPStan configuration and workflow
mgiannopoulos24 d0999fa
Revert back to nxp 2.3.2 to ensure compatibility and add more php ver…
mgiannopoulos24 c655be6
Change PHP version from 8.2 to 7.4
mgiannopoulos24 ffc636d
Bump version number to 1.15.0
mgiannopoulos24 3f19022
Merge branch 'develop' into ci/unit-tests-workflows
mgiannopoulos24 c5b50bd
Add embed-icons-font script to package.json
mgiannopoulos24 a1d3177
Version updates
mgiannopoulos24 61b1428
PHPCS fixes.
mgiannopoulos24 01b64f3
Move csv outside of `tests` in order to implement issue #145 easier.
mgiannopoulos24 e96f0e9
Update release workflows.
mgiannopoulos24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # .editorconfig | ||
| root = true | ||
|
|
||
| [*.php] | ||
| indent_style = tab | ||
| indent_size = 4 | ||
| tab_width = 4 | ||
| end_of_line = lf | ||
| charset = utf-8 | ||
| trim_trailing_whitespace = true | ||
| insert_final_newline = true | ||
|
|
||
| [*.md] | ||
| trim_trailing_whitespace = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: "GitHub Release" | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Tag name to release (e.g., v1.14.0)' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| release: | ||
| name: "Release" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.inputs.tag }} | ||
|
|
||
| - name: Verify tag is on main branch | ||
| run: | | ||
| git fetch origin main | ||
| if git merge-base --is-ancestor ${{ github.event.inputs.tag }} origin/main; then | ||
| echo "Success: Tag is on the main branch." | ||
| else | ||
| echo "Error: Tag was not pushed to the main branch. Skipping release." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Get tag message for release body | ||
| id: tag_message | ||
| run: | | ||
| MESSAGE=$(git tag -l --format='%(contents)' ${{ github.event.inputs.tag }}) | ||
| if [ -z "$MESSAGE" ]; then | ||
| MESSAGE=$(git log -1 --format=%s ${{ github.event.inputs.tag }}) | ||
| fi | ||
| MESSAGE="${MESSAGE//'%'/'%25'}" | ||
| MESSAGE="${MESSAGE//$'\n'/'%0A'}" | ||
| MESSAGE="${MESSAGE//$'\r'/'%0D'}" | ||
| echo "body=$MESSAGE" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Set up Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Build the project | ||
| run: bun install && bun run build | ||
|
|
||
| - name: Set up PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.2' | ||
| tools: composer | ||
| coverage: none | ||
|
|
||
| - name: Install production Composer dependencies | ||
| run: composer install --no-dev --optimize-autoloader --no-interaction --prefer-dist --no-progress | ||
|
|
||
| - name: Create plugin zip | ||
| run: bunx bestzip build/cooked.zip cooked.php LICENSE readme.txt wpml-config.xml assets/ includes/ languages/ templates/ vendor/ | ||
|
|
||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ github.event.inputs.tag }} | ||
| body: ${{ steps.tag_message.outputs.body }} | ||
| files: build/cooked.zip | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: PHP Lint | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: [8.5, 8.4, 8.3, 8.2, 8.1, 8.0, 7.4] | ||
|
|
||
| name: PHP ${{ matrix.php }} | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| tools: composer | ||
|
|
||
| - name: Lint PHP | ||
| run: php -l includes/ templates/ tests/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: PHPCS | ||
|
|
||
| on: | ||
| # push: | ||
| # branches: [ main, develop ] | ||
| # pull_request: | ||
| # branches: [ main, develop ] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| phpcs: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: [8.5, 8.4, 8.3, 8.2, 8.1, 8.0, 7.4] | ||
|
|
||
| name: PHP ${{ matrix.php }} | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| tools: composer | ||
|
|
||
| - name: Install dependencies | ||
| run: composer install --no-interaction --no-progress | ||
|
|
||
| - name: Run PHPCS | ||
| run: vendor/bin/phpcs --standard=phpcs.xml . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: PHPStan | ||
|
|
||
| on: | ||
| # push: | ||
| # branches: [ main, develop ] | ||
| # pull_request: | ||
| # branches: [ main, develop ] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| phpstan: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: [8.5, 8.4, 8.3, 8.2, 8.1, 8.0, 7.4] | ||
|
|
||
| name: PHP ${{ matrix.php }} | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| tools: composer | ||
|
|
||
| - name: Install dependencies | ||
| run: composer install --no-interaction --no-progress | ||
|
|
||
| - name: Run PHPStan | ||
| run: ./vendor/bin/phpstan analyse --memory-limit=512M --no-progress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: PHPUnit Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| phpunit: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: [8.5, 8.4, 8.3, 8.2, 8.1, 8.0, 7.4] | ||
|
|
||
| name: PHP ${{ matrix.php }} | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| tools: composer | ||
|
|
||
| - name: Install dependencies | ||
| run: composer install --no-interaction --no-progress | ||
|
|
||
| - name: Run PHPUnit | ||
| run: ./vendor/bin/phpunit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: "Wordpress.org Release" | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Tag name to deploy to WordPress.org (e.g., v1.14.0)' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| tag: | ||
| name: "build" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.inputs.tag }} | ||
|
|
||
| - name: Verify tag is on main branch | ||
| run: | | ||
| git fetch origin main | ||
| if git merge-base --is-ancestor ${{ github.event.inputs.tag }} origin/main; then | ||
| echo "Success: Tag is on the main branch." | ||
| else | ||
| echo "Error: Tag was not pushed to the main branch. Skipping release." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Set up Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Build the project | ||
| run: bun install && bun run build | ||
|
|
||
| - name: Set up PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.2' | ||
| tools: composer | ||
| coverage: none | ||
|
|
||
| - name: Install production Composer dependencies | ||
| run: composer install --no-dev --optimize-autoloader --no-interaction --prefer-dist --no-progress | ||
|
|
||
| - name: Install SVN | ||
| run: sudo apt-get update && sudo apt-get install -y subversion | ||
|
|
||
| - name: WordPress Plugin Deploy | ||
| uses: 10up/action-wordpress-plugin-deploy@stable | ||
| env: | ||
| SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | ||
| SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | ||
| SLUG: "cooked" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,4 +13,4 @@ | |
| "WP_ENVIRONMENT_TYPE": "local", | ||
| "DISALLOW_FILE_EDIT": false | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.