Skip to content

Commit a3ae22d

Browse files
Merge pull request #74 from catalyst/master-reusing-workflows
Add reusable workflows
2 parents 5c798bb + da93969 commit a3ae22d

14 files changed

+33
-150
lines changed

.github/workflows/ci.yml

+6-127
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,10 @@
1-
name: Moodle plugin CI for master
1+
name: Run all tests for moodle 35 to 39
22

33
on: [push, pull_request]
44

55
jobs:
6-
setup:
7-
name: CI test
8-
env:
9-
IGNORE_PATHS: tests/fixtures
10-
runs-on: 'ubuntu-latest'
11-
12-
services:
13-
postgres:
14-
image: postgres:9.6
15-
env:
16-
POSTGRES_USER: 'postgres'
17-
POSTGRES_HOST_AUTH_METHOD: 'trust'
18-
options: >-
19-
--health-cmd pg_isready
20-
--health-interval 10s
21-
--health-timeout 5s
22-
--health-retries 3
23-
ports:
24-
- 5432:5432
25-
26-
mariadb:
27-
image: mariadb:10.5
28-
env:
29-
MYSQL_USER: 'root'
30-
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
31-
ports:
32-
- 3306:3306
33-
options: >-
34-
--health-cmd="mysqladmin ping"
35-
--health-interval 10s
36-
--health-timeout 5s
37-
--health-retries 3
38-
strategy:
39-
fail-fast: false
40-
matrix:
41-
database: ['mariadb', 'pgsql']
42-
moodle-branch: [
43-
'MOODLE_35_STABLE',
44-
'MOODLE_36_STABLE',
45-
'MOODLE_37_STABLE',
46-
'MOODLE_38_STABLE',
47-
'MOODLE_39_STABLE',
48-
]
49-
node: ['14.15']
50-
php: ['7.1', '7.2', '7.3']
51-
exclude:
52-
- moodle-branch: MOODLE_35_STABLE
53-
php: 7.3
54-
- moodle-branch: MOODLE_39_STABLE
55-
php: 7.1
56-
57-
steps:
58-
- name: Check out repository code
59-
uses: actions/checkout@v2
60-
with:
61-
path: plugin
62-
63-
- name: Install node ${{ matrix.node }}
64-
uses: actions/setup-node@v2
65-
with:
66-
node-version: ${{ matrix.node }}
67-
68-
- name: Setup PHP ${{ matrix.php }}
69-
uses: shivammathur/setup-php@v2
70-
with:
71-
php-version: ${{ matrix.php }}
72-
extensions: pgsql, mysqli, zip, gd, xmlrpc, soap
73-
coverage: none
74-
75-
- name: Initialise moodle-plugin-ci
76-
run: |
77-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
78-
# Add dirs to $PATH
79-
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
80-
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
81-
# PHPUnit depends on en_AU.UTF-8 locale
82-
sudo locale-gen en_AU.UTF-8
83-
84-
- name: Install local_aws
85-
if: ${{ always() }}
86-
run: moodle-plugin-ci add-plugin catalyst/moodle-local_aws
87-
88-
- name: Install Moodle
89-
run: moodle-plugin-ci install -vvv --plugin ./plugin --db-host=127.0.0.1
90-
env:
91-
DB: ${{ matrix.database }}
92-
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
93-
94-
- name: Run phplint
95-
if: ${{ always() }}
96-
run: moodle-plugin-ci phplint
97-
98-
- name: Run codechecker
99-
if: ${{ always() }}
100-
run: moodle-plugin-ci codechecker
101-
102-
- name: Run validate
103-
if: ${{ always() }}
104-
run: moodle-plugin-ci validate
105-
106-
- name: Run savepoints
107-
if: ${{ always() }}
108-
run: moodle-plugin-ci savepoints
109-
110-
- name: Run mustache
111-
continue-on-error: true # This step will show errors but will not fail
112-
if: ${{ always() }}
113-
run: moodle-plugin-ci mustache
114-
115-
- name: Run phpunit
116-
if: ${{ always() }}
117-
run: moodle-plugin-ci phpunit
118-
119-
- name: Run behat
120-
if: ${{ always() }}
121-
run: moodle-plugin-ci behat --profile chrome
122-
123-
- name: PHP Copy/Paste Detector
124-
continue-on-error: true # This step will show errors but will not fail
125-
if: ${{ always() }}
126-
run: moodle-plugin-ci phpcpd
127-
128-
- name: PHP Mess Detector
129-
continue-on-error: true # This step will show errors but will not fail
130-
if: ${{ always() }}
131-
run: moodle-plugin-ci phpmd
6+
workflow_group_35_to_39_ci:
7+
uses: catalyst/catalyst-moodle-workflows/.github/workflows/group-35-to-39-ci.yml@main
8+
with:
9+
extra_plugin_runners: 'moodle-plugin-ci add-plugin catalyst/moodle-local_aws'
10+
disable_grunt: true

.github/workflows/moodle-release.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Whenever version.php is changed, add the latest version
3+
# to the Moodle Plugins directory at https://moodle.org/plugins
4+
#
5+
name: master - Releasing in the Plugins directory
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
paths:
12+
- 'version.php'
13+
14+
jobs:
15+
workflow_group_35_to_39_release:
16+
uses: catalyst/catalyst-moodle-workflows/.github/workflows/group-35-to-39-release.yml@main
17+
with:
18+
plugin_name: search_elastic
19+
extra_plugin_runners: 'moodle-plugin-ci add-plugin catalyst/moodle-local_aws'
20+
disable_grunt: true
21+
secrets:
22+
moodle_org_token: ${{ secrets.MOODLE_ORG_TOKEN }}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/catalyst/moodle-search_elastic.svg?branch=master)](https://travis-ci.org/catalyst/moodle-search_elastic)
1+
[![Build Status](https://github.com/catalyst/moodle-search_elastic/workflows/Run%20all%20tests%20for%20moodle%2035%20to%2039/badge.svg)](https://github.com/catalyst/moodle-search_elastic/actions)
22

33
# Moodle Global Search - Elasticsearch Backend
44

classes/engine.php

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
namespace search_elastic;
3333

34-
defined('MOODLE_INTERNAL') || die();
35-
3634
/**
3735
* Elasticsearch engine.
3836
*

classes/enrich/base/base_enrich.php

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
namespace search_elastic\enrich\base;
2626

27-
defined('MOODLE_INTERNAL') || die;
28-
2927
/**
3028
* Base data enrichment class.
3129
*

classes/enrich/text/plain_text.php

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
use search_elastic\enrich\base\base_enrich;
2828

29-
defined('MOODLE_INTERNAL') || die;
30-
3129
/**
3230
* Extract text from files using Tika.
3331
*

classes/enrich/text/tika.php

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
use search_elastic\enrich\base\base_enrich;
2828

29-
defined('MOODLE_INTERNAL') || die;
30-
3129
/**
3230
* Extract text from files using Tika.
3331
*

classes/guzzle_exception.php

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
namespace search_elastic;
3333

34-
defined('MOODLE_INTERNAL') || die();
35-
3634
/**
3735
* Custom Guzzle exception class.
3836
*

classes/privacy/provider.php

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
*/
2424
namespace search_elastic\privacy;
2525

26-
defined('MOODLE_INTERNAL') || die();
27-
2826
use core_privacy\local\metadata\collection;
2927
use core_privacy\local\request\approved_userlist;
3028
use core_privacy\local\request\contextlist;

classes/query.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@
3131

3232
namespace search_elastic;
3333

34-
defined('MOODLE_INTERNAL') || die();
35-
3634
/**
3735
* Elasticsearch engine.
3836
*
3937
* @package search_elastic
4038
* @copyright Matt Porritt <[email protected]>
4139
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
4240
*/
43-
class query {
41+
class query {
4442

4543
/**
4644
* @var number of records to return to Global Search.

db/upgrade.php

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424

25-
defined('MOODLE_INTERNAL') || die();
26-
2725
/**
2826
* Function to upgrade search_elastic.
2927
*

db/upgradelib.php

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* @copyright 2020 Peter Burnett <[email protected]>
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
24-
defined('MOODLE_INTERNAL') || die();
2524

2625
/**
2726
* Updates the boosting settings to their new config names

lib.php

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424

25-
defined('MOODLE_INTERNAL') || die;
26-
2725
/**
2826
* Renders the top part of the "new workflow step" modal form. (The part with
2927
* the "Step type" and "Step" menus.

version.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424

2525
defined('MOODLE_INTERNAL') || die();
2626

27-
$plugin->version = 2020101200;
28-
$plugin->release = 2020101200; // Same as version.
27+
$plugin->version = 2020101201;
28+
$plugin->release = 2020101201; // Same as version.
2929
$plugin->requires = 2016052304;
3030
$plugin->component = 'search_elastic';
3131
$plugin->maturity = MATURITY_STABLE;
3232
$plugin->dependencies = array(
3333
'local_aws' => 2020061500
3434
);
35+
$plugin->supported = [35, 39]; // A range of branch numbers of supported moodle versions.

0 commit comments

Comments
 (0)