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:12
|
|
|
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 |
mariadb:
|
|
|
19 |
image: mariadb:10
|
|
|
20 |
env:
|
|
|
21 |
MYSQL_USER: 'root'
|
|
|
22 |
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
|
|
|
23 |
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
|
|
|
24 |
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
|
|
|
25 |
|
|
|
26 |
ports:
|
|
|
27 |
- 3306:3306
|
|
|
28 |
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
|
|
|
29 |
|
|
|
30 |
strategy:
|
|
|
31 |
fail-fast: false
|
|
|
32 |
matrix:
|
|
|
33 |
php: ['7.4']
|
|
|
34 |
moodle-branch: ['MOODLE_39_STABLE','MOODLE_311_STABLE','MOODLE_401_STABLE']
|
|
|
35 |
database: [pgsql, mariadb]
|
|
|
36 |
|
|
|
37 |
steps:
|
|
|
38 |
- name: Check out repository code
|
|
|
39 |
uses: actions/checkout@v2
|
|
|
40 |
with:
|
|
|
41 |
path: plugin
|
|
|
42 |
|
|
|
43 |
- name: Setup PHP ${{ matrix.php }}
|
|
|
44 |
uses: shivammathur/setup-php@v2
|
|
|
45 |
with:
|
|
|
46 |
php-version: ${{ matrix.php }}
|
|
|
47 |
extensions: ${{ matrix.extensions }}
|
|
|
48 |
ini-values: max_input_vars=5000
|
|
|
49 |
# none to use phpdbg fallback. Specify pcov (Moodle 3.10 and up) or xdebug to use them instead.
|
|
|
50 |
coverage: none
|
|
|
51 |
|
|
|
52 |
- name: Initialise moodle-plugin-ci
|
|
|
53 |
run: |
|
|
|
54 |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
|
|
|
55 |
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
|
|
|
56 |
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
|
|
|
57 |
sudo locale-gen en_AU.UTF-8
|
|
|
58 |
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
|
|
|
59 |
|
|
|
60 |
- name: Install moodle-plugin-ci
|
|
|
61 |
run: |
|
|
|
62 |
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
|
|
|
63 |
env:
|
|
|
64 |
DB: ${{ matrix.database }}
|
|
|
65 |
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
|
|
|
66 |
|
|
|
67 |
- name: PHP Lint
|
|
|
68 |
if: ${{ always() }}
|
|
|
69 |
run: moodle-plugin-ci phplint
|
|
|
70 |
|
|
|
71 |
- name: PHP Copy/Paste Detector
|
|
|
72 |
continue-on-error: true # This step will show errors but will not fail
|
|
|
73 |
if: ${{ always() }}
|
|
|
74 |
run: moodle-plugin-ci phpcpd
|
|
|
75 |
|
|
|
76 |
- name: PHP Mess Detector
|
|
|
77 |
continue-on-error: true # This step will show errors but will not fail
|
|
|
78 |
if: ${{ always() }}
|
|
|
79 |
run: moodle-plugin-ci phpmd
|
|
|
80 |
|
|
|
81 |
- name: Moodle Code Checker
|
|
|
82 |
if: ${{ always() }}
|
|
|
83 |
run: moodle-plugin-ci codechecker --max-warnings 0
|
|
|
84 |
|
|
|
85 |
- name: Moodle PHPDoc Checker
|
|
|
86 |
if: ${{ always() }}
|
|
|
87 |
run: moodle-plugin-ci phpdoc
|
|
|
88 |
|
|
|
89 |
- name: Validating
|
|
|
90 |
if: ${{ always() }}
|
|
|
91 |
run: moodle-plugin-ci validate
|
|
|
92 |
|
|
|
93 |
- name: Check upgrade savepoints
|
|
|
94 |
if: ${{ always() }}
|
|
|
95 |
run: moodle-plugin-ci savepoints
|
|
|
96 |
|
|
|
97 |
- name: Mustache Lint
|
|
|
98 |
if: ${{ always() }}
|
|
|
99 |
run: moodle-plugin-ci mustache
|
|
|
100 |
|
|
|
101 |
- name: Grunt
|
|
|
102 |
if: ${{ always() }}
|
|
|
103 |
run: moodle-plugin-ci grunt --max-lint-warnings 0
|
|
|
104 |
|
|
|
105 |
- name: PHPUnit tests
|
|
|
106 |
if: ${{ always() }}
|
|
|
107 |
run: moodle-plugin-ci phpunit --fail-on-warning
|
|
|
108 |
|
|
|
109 |
- name: Behat features
|
|
|
110 |
if: ${{ always() }}
|
|
|
111 |
run: moodle-plugin-ci behat --profile chrome
|