Skip to content

Commit 67f9e7f

Browse files
committed
Let's run the integration tests using the generated PHAR
It's enough to run the tests once per supported PHP version. Also, update the CHANGELOG to share about these new tests. Closes #71
1 parent f9c7381 commit 67f9e7f

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

.github/workflows/test.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,96 @@ jobs:
163163
run: |
164164
make build
165165
php build/moodle-plugin-ci.phar list
166+
167+
- name: Upload PHAR artifact
168+
uses: actions/upload-artifact@v3
169+
with:
170+
name: moodle-plugin-ci.phar
171+
path: build/moodle-plugin-ci.phar
172+
173+
phartest:
174+
name: Integration tests (PHAR)
175+
needs: buildphar
176+
runs-on: ubuntu-22.04
177+
178+
services:
179+
postgres:
180+
image: postgres:13
181+
env:
182+
POSTGRES_USER: 'postgres'
183+
POSTGRES_HOST_AUTH_METHOD: 'trust'
184+
# Health check to wait for postgres to start.
185+
ports:
186+
- 5432:5432
187+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
188+
189+
strategy:
190+
fail-fast: false
191+
matrix:
192+
include:
193+
# Each supported PHP version once. That's enough.
194+
- php: '8.2'
195+
moodle-branch: 'master'
196+
- php: '8.1'
197+
moodle-branch: 'MOODLE_402_STABLE'
198+
- php: '8.0'
199+
moodle-branch: 'MOODLE_401_STABLE'
200+
- php: '7.4'
201+
moodle-branch: 'MOODLE_400_STABLE'
202+
203+
steps:
204+
- name: Check out repository code
205+
uses: actions/checkout@v3
206+
207+
- name: Setup PHP ${{ matrix.php }}
208+
uses: shivammathur/setup-php@v2
209+
with:
210+
php-version: ${{ matrix.php }}
211+
extensions: pgsql, zip, gd, xmlrpc, soap
212+
ini-values: max_input_vars=5000
213+
coverage: pcov
214+
215+
- name: Initialise moodle-plugin-ci
216+
run: |
217+
make init
218+
cp -R tests/Fixture/moodle-local_ci ../moodle-local_ci
219+
echo $(cd bin; pwd) >> $GITHUB_PATH
220+
echo $(cd vendor/bin; pwd) >> $GITHUB_PATH
221+
echo "CI_BUILD_DIR="$(cd ../moodle-local_ci; pwd) >> $GITHUB_ENV
222+
# PHPUnit depends on en_AU.UTF-8 locale
223+
sudo locale-gen en_AU.UTF-8
224+
# Define NVM_DIR pointing to nvm installation.
225+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
226+
227+
- name: Download PHAR artifact
228+
uses: actions/download-artifact@v3
229+
with:
230+
name: moodle-plugin-ci.phar
231+
path: build
232+
233+
- name: Install moodle-plugin-ci (PHAR)
234+
run: php build/moodle-plugin-ci.phar install -vvv
235+
env:
236+
DB: 'pgsql'
237+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
238+
IGNORE_PATHS: 'ignore'
239+
IGNORE_NAMES: 'ignore_name.php'
240+
MUSTACHE_IGNORE_NAMES: 'broken.mustache'
241+
242+
- name: Run Integration tests (PHAR)
243+
env:
244+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
245+
run: |
246+
php build/moodle-plugin-ci.phar phplint
247+
php build/moodle-plugin-ci.phar phpcpd
248+
php build/moodle-plugin-ci.phar phpmd
249+
php build/moodle-plugin-ci.phar phpcs
250+
php build/moodle-plugin-ci.phar phpcbf
251+
php build/moodle-plugin-ci.phar validate
252+
php build/moodle-plugin-ci.phar savepoints
253+
php build/moodle-plugin-ci.phar mustache
254+
php build/moodle-plugin-ci.phar grunt
255+
php build/moodle-plugin-ci.phar phpdoc
256+
php build/moodle-plugin-ci.phar phpunit --verbose --coverage-text --fail-on-warning
257+
php build/moodle-plugin-ci.phar behat --profile default
258+
php build/moodle-plugin-ci.phar behat --profile chrome

docs/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
99
The format of this change log follows the advice given at [Keep a CHANGELOG](http://keepachangelog.com).
1010

1111
## [Unreleased]
12+
### Added
13+
- Covered the PHAR package with some new integration tests.
14+
1215
### Changed
1316
- Reduced the number of own CI tests (internal change) executed with Travis.
1417
- Updated project dependencies to current [moodle-cs](https://github.com/moodlehq/moodle-cs).

0 commit comments

Comments
 (0)