Skip to content

Commit

Permalink
CI: Update for Moodle 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
justusdieckmann committed Apr 4, 2024
1 parent 1435bc5 commit 0f58295
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 71 deletions.
93 changes: 29 additions & 64 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ jobs:

strategy:
matrix:
php: [ '8.1' ]
moodle-branch: [ 'MOODLE_402_STABLE' ]
database: [ 'pgsql' ]
php: ['8.2']
moodle-branch: ['main']
database: ['pgsql']

steps:
- name: Start PostgreSQL
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14

- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: plugin

Expand All @@ -28,37 +28,16 @@ jobs:
ini-values: max_input_vars=5000
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Composer cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: npm cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- name: Install moodle-plugin-ci
run: |
moodle-plugin-ci add-plugin learnweb/moodle-tool_lifecycle
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 --no-init
env:
DB: ${{ matrix.database }}
Expand Down Expand Up @@ -108,28 +87,21 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.0', '8.1' ]
moodle-branch: [ 'MOODLE_401_STABLE', 'MOODLE_402_STABLE' ]
database: [ 'mariadb', 'pgsql' ]
php: ['8.0', '8.1', '8.2']
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'main']
database: ['mariadb', 'pgsql']
exclude:
- php: '8.0'
moodle-branch: 'main'
- php: '8.2'
moodle-branch: 'MOODLE_401_STABLE'
include:
- php: '7.4'
moodle-branch: 'MOODLE_39_STABLE'
database: 'mariadb'
- php: '7.4'
moodle-branch: 'MOODLE_39_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_311_STABLE'
database: 'mariadb'
- php: '8.0'
moodle-branch: 'MOODLE_311_STABLE'
moodle-branch: 'MOODLE_401_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_400_STABLE'
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: 'mariadb'
- php: '8.0'
moodle-branch: 'MOODLE_400_STABLE'
database: 'pgsql'

steps:
- name: Start MariaDB
Expand All @@ -141,7 +113,7 @@ jobs:
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14

- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: plugin

Expand All @@ -152,24 +124,6 @@ jobs:
ini-values: max_input_vars=5000
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Composer cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: npm cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
Expand All @@ -180,7 +134,6 @@ jobs:
- name: Install moodle-plugin-ci
run: |
moodle-plugin-ci add-plugin learnweb/moodle-tool_lifecycle
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
env:
DB: ${{ matrix.database }}
Expand All @@ -193,3 +146,15 @@ jobs:
- name: Behat features
if: ${{ always() }}
run: moodle-plugin-ci behat --profile chrome --auto-rerun 0

# This step allows to upload Behat faildump (screenshots) as workflow artifact,
# so it can be downloaded and inspected. You don't need this step if you
# are not running Behat test. Artifact will be retained for 7 days.
- name: Upload Behat Faildump
if: ${{ failure() && steps.behat.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: Behat Faildump (${{ join(matrix.*, ', ') }})
path: ${{ github.workspace }}/moodledata/behat_dump
retention-days: 7
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class provider implements null_provider {
*
* @return string the reason
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
6 changes: 3 additions & 3 deletions tests/make_invisible_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
* @copyright 2019 Justus Dieckmann
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class make_invisible_test extends \advanced_testcase {
final class make_invisible_test extends \advanced_testcase {

/**
* Setup the testcase.
*/
public function setUp() :void {
public function setUp(): void {
global $USER;
$this->resetAfterTest(true);

Expand All @@ -57,7 +57,7 @@ public function setUp() :void {
* @throws dml_transaction_exception
* @throws moodle_exception
*/
public function test_make_invisible() {
public function test_make_invisible(): void {
$generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle');
$workflow = $generator->create_workflow([], []);
$trigger = $generator->create_trigger('manual', 'manual', $workflow->id);
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
$plugin->version = 2023052300;
$plugin->component = 'lifecyclestep_makeinvisible';
$plugin->requires = 2020061500; // Requires Moodle 3.9+.
$plugin->dependencies = array(
'tool_lifecycle' => 2022112400
);
$plugin->dependencies = [
'tool_lifecycle' => 2022112400,
];
$plugin->release = 'v4.2-r1';
$plugin->maturity = MATURITY_STABLE;

0 comments on commit 0f58295

Please sign in to comment.