Skip to content

Commit 3233963

Browse files
committed
Merge branch '1.2' into develop
2 parents a5760f3 + 87a8e41 commit 3233963

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

plugin/unit-testing.md

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,13 @@ In general, your automation should do the following:
128128
- Install all Composer dependencies.
129129
- Run the [`winter:test`](../console/utilities#run-unit-tests) Artisan command for your plugin.
130130

131-
### Example GitHub Actions configuration
131+
### GitHub Actions
132132

133-
This is an example of a configuration that you can use for GitHub Actions to test a Winter plugin whenever a new commit is added to your repository. Feel free to use this and adjust as necessary for your specific requirements.
133+
We have released a GitHub Action on the GitHub Actions Marketplace - [Setup Winter Action](https://github.com/marketplace/actions/setup-winter) - that streamlines the setup of a PHP environment and installs a fresh copy of Winter when running a Github Actions workflow. It can also be configured to check out your repository as a plugin, placing it inside the `plugins` folder. This makes it incredibly easy to run automated tests for your plugins.
134134

135-
```yaml
135+
You can use this in your plugin repository by creating a `.github/workflows/tests.yml` file in the root folder of your repository and adding the following configuration:
136+
137+
```yml
136138
name: Tests
137139

138140
on:
@@ -144,29 +146,14 @@ jobs:
144146
runs-on: ubuntu-latest
145147
name: Unit Tests
146148
steps:
147-
- name: Checkout Winter CMS
148-
uses: actions/checkout@v4
149-
with:
150-
repository: wintercms/winter
151-
ref: develop # change this to a different branch or tag name if you wish to test with a specific version of Winter CMS
152-
153-
- name: Checkout code
154-
uses: actions/checkout@v4
149+
- name: Setup Winter
150+
uses: wintercms/setup-winter-action@v1
155151
with:
156-
path: plugins/my-author/my-plugin # change this to the correct folder for your plugin
157-
158-
- name: Install PHP
159-
uses: shivammathur/setup-php@v2
160-
with:
161-
php-version: 8.3 # change this if you wish to test a different PHP version
162-
extensions: mbstring, intl, gd, xml, sqlite
163-
tools: composer:v2
164-
165-
- name: Install Composer dependencies
166-
run: |
167-
sed -i 's|plugins/myauthor/\*/composer.json|plugins/*/*/composer.json|g' composer.json
168-
composer install --no-interaction --no-progress --no-scripts
152+
plugin-author: myauthor # change this to your author name in lowercase
153+
plugin-name: myplugin # change this to your plugin name in lowercase
169154

170155
- name: Run unit tests
171156
run: php artisan winter:test -p MyAuthor.MyPlugin # change this to the correct plugin code
172157
```
158+
159+
For more information on using this Action, please view [Setup Winter Action](https://github.com/marketplace/actions/setup-winter) in the Github Actions marketplace.

0 commit comments

Comments
 (0)