-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from mpkelly/trunk
Add code checks and unit tests + workflow script
- Loading branch information
Showing
10 changed files
with
1,817 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,25 @@ | ||
name: Publish Website | ||
|
||
on: | ||
push: | ||
branches: | ||
- trunk | ||
workflow_dispatch: | ||
jobs: | ||
Build-Artifact-Action: | ||
name: Build-Artifact-Action | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: php-actions/composer@v6 | ||
- uses: php-actions/composer@v6 | ||
with: | ||
command: check-code | ||
- uses: php-actions/composer@v6 | ||
with: | ||
command: test | ||
- name: Upload the artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wpcom | ||
path: . |
This file contains 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 @@ | ||
/vendor/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,2 +1,10 @@ | ||
# githubdeployments-phpunit-phpcs-example | ||
An example plugin repository with a workflow script that runs PHP CodeSniffer and PHPUnit | ||
An example plugin repository with a workflow script that runs PHP CodeSniffer and PHPUnit. | ||
|
||
The [workflow](.github/workflows/wpcom.yml) does the following: | ||
|
||
- Checkout the repository | ||
- Runs the composer action which executes the default command, `composter install`. | ||
- Runs the composer action again with a custom command that runs PHPCodeSniffer | ||
- Runs the composer action again with a custom command that runs PHPUnit | ||
- If all previous actions completely withotu error, it creates a build artifact with name "wpcom" which is required for WordPress.com's GitHub Deployment feature |
This file contains 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,7 @@ | ||
<?php | ||
|
||
namespace Adder; | ||
|
||
function add( $a, $b ) { | ||
return $a + $b; | ||
} |
This file contains 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,10 @@ | ||
{ | ||
"require-dev": { | ||
"squizlabs/php_codesniffer": "*", | ||
"phpunit/phpunit": "^11.0" | ||
}, | ||
"scripts": { | ||
"check-code": "phpcs -s ./index.php", | ||
"test": "phpunit ./tests" | ||
} | ||
} |
Oops, something went wrong.