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