Skip to content

Commit d9fa218

Browse files
author
Laur0r
authored
Merge pull request #15 from justusdieckmann/ci/github
CI: Move to Github and Update for Moodle 3.11
2 parents c9d21f8 + 1de27fe commit d9fa218

File tree

6 files changed

+177
-168
lines changed

6 files changed

+177
-168
lines changed

.github/workflows/moodle-ci.yml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
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+
98+
- name: Grunt
99+
if: ${{ always() }}
100+
run: moodle-plugin-ci grunt
101+
102+
test:
103+
runs-on: ubuntu-latest
104+
needs: static
105+
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
php: ['7.3', '7.4']
110+
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE']
111+
database: ['mariadb', 'pgsql']
112+
113+
steps:
114+
- name: Start MariaDB
115+
if: matrix.database == 'mariadb'
116+
run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10
117+
118+
- name: Start PostgreSQL
119+
if: matrix.database == 'pgsql'
120+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6
121+
122+
- name: Check out repository code
123+
uses: actions/checkout@v2
124+
with:
125+
path: plugin
126+
127+
- name: Setup PHP ${{ matrix.php }}
128+
uses: shivammathur/setup-php@v2
129+
with:
130+
php-version: ${{ matrix.php }}
131+
coverage: none
132+
133+
- name: Get composer cache directory
134+
id: composer-cache
135+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
136+
- name: Composer cache
137+
uses: actions/cache@v2
138+
with:
139+
path: ${{ steps.composer-cache.outputs.dir }}
140+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
141+
restore-keys: |
142+
${{ runner.os }}-composer-
143+
- name: npm cache
144+
uses: actions/cache@v2
145+
with:
146+
path: ~/.npm
147+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
148+
restore-keys: |
149+
${{ runner.os }}-node-
150+
151+
- name: Initialise moodle-plugin-ci
152+
run: |
153+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
154+
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
155+
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
156+
sudo locale-gen en_AU.UTF-8
157+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
158+
159+
- name: Install moodle-plugin-ci
160+
run: |
161+
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
162+
env:
163+
DB: ${{ matrix.database }}
164+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
165+
166+
- name: PHPUnit tests
167+
if: ${{ always() }}
168+
run: moodle-plugin-ci phpunit
169+
170+
- name: Behat features
171+
if: ${{ always() }}
172+
run: moodle-plugin-ci behat --profile chrome

.gitlab-ci.yml

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

.travis.yml

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

backup/moodle2/backup_groupmembers_activity_task.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function define_my_steps() {
5151
* @param string $content some HTML text that eventually contains URLs to the activity instance scripts
5252
* @return string the content with the URLs encoded
5353
*/
54-
static public function encode_content_links($content) {
54+
public static function encode_content_links($content) {
5555
global $CFG;
5656

5757
$base = preg_quote($CFG->wwwroot, "/");

backup/moodle2/restore_groupmembers_activity_task.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function define_my_steps() {
4848
* Define the contents in the activity that must be
4949
* processed by the link decoder
5050
*/
51-
static public function define_decode_contents() {
51+
public static function define_decode_contents() {
5252
$contents = array();
5353

5454
$contents[] = new restore_decode_content('groupmembers', array('intro'), 'groupmembers');
@@ -60,7 +60,7 @@ static public function define_decode_contents() {
6060
* Define the decoding rules for links belonging
6161
* to the activity to be executed by the link decoder
6262
*/
63-
static public function define_decode_rules() {
63+
public static function define_decode_rules() {
6464
$rules = array();
6565

6666
$rules[] = new restore_decode_rule('GROUPMEMBERVIEWBYID', '/mod/groupmember/view.php?id=$1', 'course_module');
@@ -76,7 +76,7 @@ static public function define_decode_rules() {
7676
* groupmembers logs. It must return one array
7777
* of {@link restore_log_rule} objects
7878
*/
79-
static public function define_restore_log_rules() {
79+
public static function define_restore_log_rules() {
8080
$rules = array();
8181

8282
$rules[] = new restore_log_rule('groupmembers', 'view', 'view.php?id={course_module}', '{groupmembers}');
@@ -94,7 +94,7 @@ static public function define_restore_log_rules() {
9494
* by the restore final task, but are defined here at
9595
* activity level. All them are rules not linked to any module instance (cmid = 0)
9696
*/
97-
static public function define_restore_log_rules_for_course() {
97+
public static function define_restore_log_rules_for_course() {
9898
$rules = array();
9999

100100
$rules[] = new restore_log_rule('groupmembers', 'view all', 'index.php?id={course}', null);

codecov.yml

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

0 commit comments

Comments
 (0)