| 1 |
efrain |
1 |
name: Moodle Plugin CI
|
|
|
2 |
|
|
|
3 |
on: [push, pull_request]
|
|
|
4 |
|
|
|
5 |
jobs:
|
|
|
6 |
test:
|
|
|
7 |
runs-on: ubuntu-22.04
|
|
|
8 |
|
|
|
9 |
services:
|
|
|
10 |
postgres:
|
|
|
11 |
image: postgres:13
|
|
|
12 |
env:
|
|
|
13 |
POSTGRES_USER: 'postgres'
|
|
|
14 |
POSTGRES_HOST_AUTH_METHOD: 'trust'
|
|
|
15 |
ports:
|
|
|
16 |
- 5432:5432
|
|
|
17 |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
|
|
18 |
|
|
|
19 |
strategy:
|
|
|
20 |
fail-fast: false
|
|
|
21 |
matrix:
|
|
|
22 |
php: ['8.0', '8.1', '8.2']
|
|
|
23 |
moodle-branch: ['MOODLE_403_STABLE']
|
|
|
24 |
database: [pgsql]
|
|
|
25 |
|
|
|
26 |
steps:
|
|
|
27 |
- name: Check out repository code
|
|
|
28 |
uses: actions/checkout@v3
|
|
|
29 |
with:
|
|
|
30 |
path: plugin
|
|
|
31 |
|
|
|
32 |
- name: Setup PHP ${{ matrix.php }}
|
|
|
33 |
uses: shivammathur/setup-php@v2
|
|
|
34 |
with:
|
|
|
35 |
php-version: ${{ matrix.php }}
|
|
|
36 |
extensions: ${{ matrix.extensions }}
|
|
|
37 |
ini-values: max_input_vars=5000
|
|
|
38 |
coverage: none
|
|
|
39 |
|
|
|
40 |
- name: Initialise moodle-plugin-ci
|
|
|
41 |
run: |
|
|
|
42 |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
|
|
|
43 |
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
|
|
|
44 |
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
|
|
|
45 |
sudo locale-gen en_AU.UTF-8
|
|
|
46 |
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
|
|
|
47 |
|
|
|
48 |
- name: Install moodle-plugin-ci
|
|
|
49 |
run: |
|
|
|
50 |
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
|
|
|
51 |
env:
|
|
|
52 |
DB: ${{ matrix.database }}
|
|
|
53 |
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
|
|
|
54 |
|
|
|
55 |
- name: PHP Lint
|
|
|
56 |
if: ${{ always() }}
|
|
|
57 |
run: moodle-plugin-ci phplint
|
|
|
58 |
|
|
|
59 |
- name: PHP Copy/Paste Detector
|
|
|
60 |
continue-on-error: true # This step will show errors but will not fail
|
|
|
61 |
if: ${{ always() }}
|
|
|
62 |
run: moodle-plugin-ci phpcpd
|
|
|
63 |
|
|
|
64 |
- name: PHP Mess Detector
|
|
|
65 |
continue-on-error: true # This step will show errors but will not fail
|
|
|
66 |
if: ${{ always() }}
|
|
|
67 |
run: moodle-plugin-ci phpmd
|
|
|
68 |
|
|
|
69 |
- name: Moodle Code Checker
|
|
|
70 |
if: ${{ always() }}
|
|
|
71 |
run: moodle-plugin-ci phpcs --max-warnings 0
|
|
|
72 |
|
|
|
73 |
- name: Moodle PHPDoc Checker
|
|
|
74 |
if: ${{ always() }}
|
|
|
75 |
run: moodle-plugin-ci phpdoc --max-warnings 0
|
|
|
76 |
|
|
|
77 |
- name: Validating
|
|
|
78 |
if: ${{ always() }}
|
|
|
79 |
run: moodle-plugin-ci validate
|
|
|
80 |
|
|
|
81 |
- name: Check upgrade savepoints
|
|
|
82 |
if: ${{ always() }}
|
|
|
83 |
run: moodle-plugin-ci savepoints
|
|
|
84 |
|
|
|
85 |
- name: Mustache Lint
|
|
|
86 |
if: ${{ always() }}
|
|
|
87 |
run: moodle-plugin-ci mustache
|
|
|
88 |
|
|
|
89 |
- name: Grunt
|
|
|
90 |
if: ${{ always() }}
|
|
|
91 |
run: moodle-plugin-ci grunt --max-lint-warnings 0
|
|
|
92 |
|
|
|
93 |
- name: PHPUnit tests
|
|
|
94 |
if: ${{ always() }}
|
|
|
95 |
run: moodle-plugin-ci phpunit --fail-on-warning
|
|
|
96 |
|
|
|
97 |
- name: Behat features
|
|
|
98 |
if: ${{ always() }}
|
|
|
99 |
run: moodle-plugin-ci behat --profile chrome
|