Skip to content

Commit 80f0763

Browse files
committed
Simplify GitHub Action example
1 parent ff33d9b commit 80f0763

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

plugin/unit-testing.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -137,43 +137,34 @@ name: Tests
137137

138138
on:
139139
push:
140+
pull_request:
140141

141142
jobs:
142143
unitTests:
143144
runs-on: ubuntu-latest
144145
name: Unit Tests
145146
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+
146153
- name: Checkout code
147154
uses: actions/checkout@v4
148155
with:
149-
path: my-plugin
156+
path: plugins/my-author/my-plugin # change this to the correct folder for your plugin
150157

151-
- name: Setup PHP and extensions
158+
- name: Install PHP
152159
uses: shivammathur/setup-php@v2
153160
with:
154-
php-version: 8.1
161+
php-version: 8.3 # change this if you wish to test a different PHP version
155162
extensions: mbstring, intl, gd, xml, sqlite
156163
tools: composer:v2
157164

158-
- name: Install Winter
159-
run: |
160-
wget https://github.com/wintercms/winter/archive/develop.zip
161-
unzip develop.zip
162-
rm develop.zip
163-
164-
# Move Winter CMS into place
165-
shopt -s dotglob
166-
mv winter-develop/* ./
167-
rmdir winter-develop
168-
shopt -u dotglob
169-
mv config/cms.php config/testing/cms.php
170-
171-
# Move plugin into place (note that the paths below should be changed to match your plugin path)
172-
mkdir -p plugins/myauthor
173-
mv my-plugin plugins/myauthor/myplugin
174-
175165
- name: Install Composer dependencies
176-
run: composer install --no-interaction --no-progress
166+
run: composer install --no-interaction --no-progress --no-scripts
177167

178168
- name: Run unit tests
179-
run: php artisan winter:test -p MyAuthor.MyPlugin
169+
run: php artisan winter:test -p MyAuthor.MyPlugin # change this to the correct plugin code
170+
```

0 commit comments

Comments
 (0)