You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugin/unit-testing.md
+11-24Lines changed: 11 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,11 +128,13 @@ In general, your automation should do the following:
128
128
- Install all Composer dependencies.
129
129
- Run the [`winter:test`](../console/utilities#run-unit-tests) Artisan command for your plugin.
130
130
131
-
### Example GitHub Actions configuration
131
+
### GitHub Actions
132
132
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.
134
134
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
136
138
name: Tests
137
139
138
140
on:
@@ -144,29 +146,14 @@ jobs:
144
146
runs-on: ubuntu-latest
145
147
name: Unit Tests
146
148
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
155
151
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
plugin-author: myauthor # change this to your author name in lowercase
153
+
plugin-name: myplugin # change this to your plugin name in lowercase
169
154
170
155
- name: Run unit tests
171
156
run: php artisan winter:test -p MyAuthor.MyPlugin # change this to the correct plugin code
172
157
```
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