1 |
efrain |
1 |
name: Tests
|
|
|
2 |
|
|
|
3 |
on: [push, pull_request]
|
|
|
4 |
|
|
|
5 |
jobs:
|
|
|
6 |
ci:
|
|
|
7 |
name: ci
|
|
|
8 |
runs-on: ubuntu-latest
|
|
|
9 |
|
|
|
10 |
services:
|
|
|
11 |
postgres:
|
|
|
12 |
image: postgres
|
|
|
13 |
env:
|
|
|
14 |
POSTGRES_USER: 'postgres'
|
|
|
15 |
POSTGRES_HOST_AUTH_METHOD: 'trust'
|
|
|
16 |
options: --health-cmd="pg_isready" --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
17 |
ports:
|
|
|
18 |
- 5432:5432
|
|
|
19 |
mariadb:
|
|
|
20 |
image: mariadb:10
|
|
|
21 |
env:
|
|
|
22 |
MYSQL_USER: 'root'
|
|
|
23 |
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
|
|
|
24 |
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
|
|
|
25 |
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
|
|
|
26 |
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
|
|
|
27 |
ports:
|
|
|
28 |
- 3306:3306
|
|
|
29 |
|
|
|
30 |
strategy:
|
|
|
31 |
fail-fast: false
|
|
|
32 |
matrix:
|
|
|
33 |
php: ['8.2']
|
|
|
34 |
moodle-branch: ['MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE']
|
|
|
35 |
database: ['mariadb', 'pgsql']
|
|
|
36 |
include:
|
|
|
37 |
- php: '8.3'
|
|
|
38 |
moodle-branch: 'main'
|
|
|
39 |
database: 'pgsql'
|
|
|
40 |
|
|
|
41 |
steps:
|
|
|
42 |
- name: checkout plugin
|
|
|
43 |
uses: actions/checkout@v4
|
|
|
44 |
with:
|
|
|
45 |
path: this-plugin
|
|
|
46 |
|
|
|
47 |
- name: setup PHP
|
|
|
48 |
uses: shivammathur/setup-php@v2
|
|
|
49 |
with:
|
|
|
50 |
php-version: ${{ matrix.php }}
|
|
|
51 |
ini-values: max_input_vars=5000
|
|
|
52 |
coverage: pcov
|
|
|
53 |
|
|
|
54 |
- name: composer
|
|
|
55 |
run: |
|
|
|
56 |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci
|
|
|
57 |
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
|
|
|
58 |
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
|
|
|
59 |
sudo locale-gen en_AU.UTF-8
|
|
|
60 |
|
|
|
61 |
- name: install Moodle
|
|
|
62 |
run: moodle-plugin-ci install --db-host=127.0.0.1 --plugin this-plugin
|
|
|
63 |
env:
|
|
|
64 |
DB: ${{ matrix.database }}
|
|
|
65 |
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
|
|
|
66 |
|
|
|
67 |
- name: phplint
|
|
|
68 |
if: ${{ always() }}
|
|
|
69 |
run: moodle-plugin-ci --ansi phplint
|
|
|
70 |
|
|
|
71 |
- name: phpmd
|
|
|
72 |
if: ${{ always() }}
|
|
|
73 |
run: moodle-plugin-ci --ansi phpmd
|
|
|
74 |
|
|
|
75 |
- name: phpdoc
|
|
|
76 |
if: ${{ always() }}
|
|
|
77 |
run: moodle-plugin-ci --ansi phpdoc
|
|
|
78 |
|
|
|
79 |
- name: codechecker
|
|
|
80 |
if: ${{ always() }}
|
|
|
81 |
run: moodle-plugin-ci --ansi codechecker
|
|
|
82 |
|
|
|
83 |
- name: validate
|
|
|
84 |
if: ${{ always() }}
|
|
|
85 |
run: moodle-plugin-ci --ansi validate
|
|
|
86 |
|
|
|
87 |
- name: savepoints
|
|
|
88 |
if: ${{ always() }}
|
|
|
89 |
run: moodle-plugin-ci --ansi savepoints
|
|
|
90 |
|
|
|
91 |
- name: grunt
|
|
|
92 |
if: ${{ matrix.moodle-branch == 'MOODLE_402_STABLE'}}
|
|
|
93 |
run: moodle-plugin-ci --ansi grunt
|
|
|
94 |
|
|
|
95 |
- name: mustache
|
|
|
96 |
if: ${{ always() }}
|
|
|
97 |
run: moodle-plugin-ci --ansi mustache
|
|
|
98 |
|
|
|
99 |
- name: phpunit
|
|
|
100 |
if: ${{ always() }}
|
|
|
101 |
run: moodle-plugin-ci --ansi phpunit --testdox --coverage-text --coverage-clover
|
|
|
102 |
|
|
|
103 |
- name: privacy
|
|
|
104 |
if: ${{ always() }}
|
|
|
105 |
run: vendor/bin/phpunit --colors --no-coverage --testsuite tool_dataprivacy_testsuite,tool_policy_testsuite,core_privacy_testsuite
|
|
|
106 |
working-directory: moodle
|
|
|
107 |
|
|
|
108 |
- name: coveralls
|
|
|
109 |
if: ${{ always() }}
|
|
|
110 |
run: moodle-plugin-ci coveralls-upload || true
|
|
|
111 |
env:
|
|
|
112 |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
113 |
|
|
|
114 |
- name: firefox
|
|
|
115 |
id: behat
|
|
|
116 |
if: ${{ always() }}
|
|
|
117 |
run: moodle-plugin-ci --ansi behat
|
|
|
118 |
|
|
|
119 |
- name: faildump
|
|
|
120 |
if: ${{ failure() && steps.behat.outcome == 'failure' }}
|
|
|
121 |
uses: actions/upload-artifact@v4
|
|
|
122 |
with:
|
|
|
123 |
name: firefox faildump (${{ join(matrix.*, ', ') }})
|
|
|
124 |
path: ${{ github.workspace }}/moodledata/behat_dump
|
|
|
125 |
retention-days: 7
|
|
|
126 |
if-no-files-found: ignore
|
|
|
127 |
|
|
|
128 |
- name: chrome
|
|
|
129 |
if: ${{ always() }}
|
|
|
130 |
run: moodle-plugin-ci --ansi behat --profile chrome
|
|
|
131 |
|
|
|
132 |
- name: firefox classic
|
|
|
133 |
if: ${{ always() }}
|
|
|
134 |
run: moodle-plugin-ci --ansi behat --suite="classic"
|
|
|
135 |
|
|
|
136 |
- name: chrome classic
|
|
|
137 |
if: ${{ always() }}
|
|
|
138 |
run: moodle-plugin-ci --ansi behat --suite="classic" --profile chrome
|
|
|
139 |
|
|
|
140 |
- name: admin bookmarks
|
|
|
141 |
if: ${{ always() }}
|
|
|
142 |
run: moodle-plugin-ci --ansi behat --auto-rerun=0 --profile chrome blocks/admin_bookmarks
|
|
|
143 |
working-directory: moodle
|
|
|
144 |
|
|
|
145 |
- name: admin xmldb
|
|
|
146 |
if: ${{ always() }}
|
|
|
147 |
run: moodle-plugin-ci --ansi behat --auto-rerun=0 --profile chrome admin/tool/xmldb
|
|
|
148 |
working-directory: moodle
|
|
|
149 |
|