Skip to content

Commit

Permalink
Merge pull request #27 from lucaboesch/moodle-plugin-ci
Browse files Browse the repository at this point in the history
Moodle Plugin CI
  • Loading branch information
lucaboesch authored Sep 26, 2023
2 parents 04d3854 + 9aabedd commit 75f5205
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 10 deletions.
68 changes: 60 additions & 8 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04

services:
postgres:
image: postgres:9.6
image: postgres:13
env:
POSTGRES_USER: "postgres"
POSTGRES_HOST_AUTH_METHOD: "trust"
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
mariadb:
image: mariadb:10
image: mariadb:10.5
env:
MYSQL_USER: "root"
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
Expand All @@ -27,13 +27,65 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["7.2", "7.3", "7.4"]
moodle-branch: ["MOODLE_311_STABLE", "MOODLE_400_STABLE", "master"]
database: [pgsql, mariadb]
include:
- php: '8.0'
moodle-branch: 'master'
database: pgsql
- php: '8.1'
moodle-branch: 'master'
database: pgsql
- php: '8.2'
moodle-branch: 'master'
database: pgsql
- php: '8.0'
moodle-branch: 'master'
database: mariadb
- php: '8.1'
moodle-branch: 'master'
database: mariadb
- php: '8.2'
moodle-branch: 'master'
database: mariadb
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
database: pgsql
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
database: pgsql
- php: '8.2'
moodle-branch: 'MOODLE_402_STABLE'
database: pgsql
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
database: mariadb
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
database: mariadb
- php: '8.2'
moodle-branch: 'MOODLE_402_STABLE'
database: mariadb
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: pgsql
- php: '8.0'
moodle-branch: 'MOODLE_401_STABLE'
database: pgsql
- php: '8.1'
moodle-branch: 'MOODLE_401_STABLE'
database: pgsql
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: mariadb
- php: '8.0'
moodle-branch: 'MOODLE_401_STABLE'
database: mariadb
- php: '8.1'
moodle-branch: 'MOODLE_401_STABLE'
database: mariadb

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

Expand Down Expand Up @@ -64,7 +116,7 @@ jobs:
- name: PHP Copy/Paste Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpcpd
run: moodle-plugin-ci phpcpd || true

- name: PHP Mess Detector
continue-on-error: true # This step will show errors but will not fail
Expand Down
4 changes: 2 additions & 2 deletions externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static function create_file_resource($filename, $filepath, $courseid, $se

$component = "user";
$filearea = "private";
if ($filepath == '' OR !isset($filepath)) {
if ($filepath == '' || !isset($filepath)) {
$filepath = "/";
}
if ($displayname == '') {
Expand All @@ -113,7 +113,7 @@ public static function create_file_resource($filename, $filepath, $courseid, $se
if ($file->is_directory()) {
continue;
}
if (($file->get_filepath() == $filepath) AND ($file->get_filename() == $filename)) {
if (($file->get_filepath() == $filepath) && ($file->get_filename() == $filename)) {
// Found the file, now make a temporary one to pass on.

$tempfileinfo = new stdClass();
Expand Down

0 comments on commit 75f5205

Please sign in to comment.