Skip to content

Commit 462cd07

Browse files
author
Laur0r
authored
Merge pull request #77 from justusdieckmann/ci/github
Move to Github Actions and Update for Moodle 3.11
2 parents a297dd5 + fc4cf6c commit 462cd07

File tree

10 files changed

+224
-200
lines changed

10 files changed

+224
-200
lines changed

.github/workflows/moodle-ci.yml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
name: Moodle Plugin CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
static:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
php: ['7.4']
12+
moodle-branch: ['MOODLE_311_STABLE']
13+
database: ['pgsql']
14+
15+
steps:
16+
- name: Start PostgreSQL
17+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6
18+
19+
- name: Check out repository code
20+
uses: actions/checkout@v2
21+
with:
22+
path: plugin
23+
24+
- name: Setup PHP ${{ matrix.php }}
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
coverage: none
29+
30+
- name: Get composer cache directory
31+
id: composer-cache
32+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
33+
34+
- name: Composer cache
35+
uses: actions/cache@v2
36+
with:
37+
path: ${{ steps.composer-cache.outputs.dir }}
38+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-composer-
41+
42+
- name: npm cache
43+
uses: actions/cache@v2
44+
with:
45+
path: ~/.npm
46+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
47+
restore-keys: |
48+
${{ runner.os }}-node-
49+
50+
- name: Initialise moodle-plugin-ci
51+
run: |
52+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
53+
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
54+
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
55+
sudo locale-gen en_AU.UTF-8
56+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
57+
58+
- name: Install moodle-plugin-ci
59+
run: |
60+
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 --no-init
61+
env:
62+
DB: ${{ matrix.database }}
63+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
64+
65+
- name: PHP Lint
66+
if: ${{ always() }}
67+
run: moodle-plugin-ci phplint
68+
69+
- name: PHP Copy/Paste Detector
70+
if: ${{ always() }}
71+
run: moodle-plugin-ci phpcpd
72+
73+
- name: PHP Mess Detector
74+
if: ${{ always() }}
75+
run: moodle-plugin-ci phpmd
76+
77+
- name: Moodle Code Checker
78+
if: ${{ always() }}
79+
run: moodle-plugin-ci codechecker
80+
81+
- name: Moodle PHPDoc Checker
82+
if: ${{ always() }}
83+
run: moodle-plugin-ci phpdoc
84+
continue-on-error: true
85+
86+
- name: Validating
87+
if: ${{ always() }}
88+
run: moodle-plugin-ci validate
89+
90+
- name: Check upgrade savepoints
91+
if: ${{ always() }}
92+
run: moodle-plugin-ci savepoints
93+
94+
- name: Mustache Lint
95+
if: ${{ always() }}
96+
run: moodle-plugin-ci mustache
97+
continue-on-error: true
98+
99+
- name: Grunt
100+
if: ${{ always() }}
101+
run: moodle-plugin-ci grunt
102+
103+
test:
104+
runs-on: ubuntu-latest
105+
needs: static
106+
107+
strategy:
108+
fail-fast: false
109+
matrix:
110+
php: ['7.3', '7.4']
111+
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE']
112+
database: ['mariadb', 'pgsql']
113+
114+
steps:
115+
- name: Start MariaDB
116+
if: matrix.database == 'mariadb'
117+
run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10
118+
119+
- name: Start PostgreSQL
120+
if: matrix.database == 'pgsql'
121+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6
122+
123+
- name: Check out repository code
124+
uses: actions/checkout@v2
125+
with:
126+
path: plugin
127+
128+
- name: Setup PHP ${{ matrix.php }}
129+
uses: shivammathur/setup-php@v2
130+
with:
131+
php-version: ${{ matrix.php }}
132+
coverage: none
133+
134+
- name: Get composer cache directory
135+
id: composer-cache
136+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
137+
- name: Composer cache
138+
uses: actions/cache@v2
139+
with:
140+
path: ${{ steps.composer-cache.outputs.dir }}
141+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
142+
restore-keys: |
143+
${{ runner.os }}-composer-
144+
- name: npm cache
145+
uses: actions/cache@v2
146+
with:
147+
path: ~/.npm
148+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
149+
restore-keys: |
150+
${{ runner.os }}-node-
151+
152+
- name: Initialise moodle-plugin-ci
153+
run: |
154+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
155+
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
156+
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
157+
sudo locale-gen en_AU.UTF-8
158+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
159+
160+
- name: Install moodle-plugin-ci
161+
run: |
162+
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
163+
env:
164+
DB: ${{ matrix.database }}
165+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
166+
167+
- name: PHPUnit tests
168+
if: ${{ always() }}
169+
run: moodle-plugin-ci phpunit
170+
171+
- name: Behat features
172+
if: ${{ always() }}
173+
run: moodle-plugin-ci behat --profile chrome

.gitlab-ci.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

classes/subscriptions.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,11 @@ public static function get_subscribed_users($moodleoverflow, $context, $fields =
531531

532532
// Default fields if none are submitted.
533533
if (empty($fields)) {
534-
$allnames = get_all_user_name_fields(true, 'u');
534+
if ($CFG->branch >= 311) {
535+
$allnames = \core_user\fields::for_name()->get_sql('u', false, '', '', false)->selects;
536+
} else {
537+
$allnames = get_all_user_name_fields(true, 'u');
538+
}
535539
$fields = "u.id, u.username, $allnames, u.maildisplay, u.mailformat, u.maildigest,
536540
u.imagealt, u.email, u.emailstop, u.city, u.country, u.lastaccess, u.lastlogin,
537541
u.picture, u.timezone, u.theme, u.lang, u.trackforums, u.mnethostid";

codecov.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)