Skip to content

Commit

Permalink
Merge pull request #131 from stronk7/gha_add
Browse files Browse the repository at this point in the history
Add Github Actions to local_codechecker
  • Loading branch information
sarjona authored Feb 5, 2021
2 parents e0be554 + 3543b32 commit 3d07a61
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 5 deletions.
160 changes: 160 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: Codechecker CI

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-18.04

services:
postgres:
image: postgres:9.6
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
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3

strategy:
fail-fast: false
matrix:
include:
- php: 7.4
moodle-branch: master
database: pgsql
- php: 7.4
moodle-branch: master
database: mariadb
- php: 7.4
moodle-branch: MOODLE_311_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_311_STABLE
database: mariadb
- php: 7.4
moodle-branch: MOODLE_310_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_39_STABLE
database: mariadb
- php: 7.4
moodle-branch: MOODLE_38_STABLE
database: pgsql

- php: 7.3
moodle-branch: master
database: pgsql
- php: 7.3
moodle-branch: master
database: mariadb
- php: 7.3
moodle-branch: MOODLE_311_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_311_STABLE
database: mariadb
- php: 7.3
moodle-branch: MOODLE_37_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_36_STABLE
database: mariadb

- php: 7.2
moodle-branch: MOODLE_310_STABLE
database: pgsql
- php: 7.2
moodle-branch: MOODLE_39_STABLE
database: mariadb
- php: 7.2
moodle-branch: MOODLE_35_STABLE
database: pgsql

- php: 7.1
moodle-branch: MOODLE_38_STABLE
database: pgsql
- php: 7.1
moodle-branch: MOODLE_37_STABLE
database: mariadb
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
path: plugin

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
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 install --plugin ./plugin --db-host=127.0.0.1
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
IGNORE_PATHS: moodle/tests/fixtures,moodle/Sniffs

- name: PHP Lint
if: ${{ always() }}
run: moodle-plugin-ci phplint

- 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

- name: PHP Mess Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci codechecker --max-warnings 0

- name: Moodle PHPDoc Checker
if: ${{ always() }}
run: moodle-plugin-ci phpdoc

- name: Validating
if: ${{ always() }}
run: moodle-plugin-ci validate

- name: Check upgrade savepoints
if: ${{ always() }}
run: moodle-plugin-ci savepoints

- name: Mustache Lint
if: ${{ always() }}
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ always() }}
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
run: moodle-plugin-ci phpunit

- name: Behat features
if: ${{ always() }}
run: moodle-plugin-ci behat --profile chrome
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ jobs:
env: MOODLE_BRANCH=MOODLE_39_STABLE DB=mysqli
- php: 7.2
env: MOODLE_BRANCH=MOODLE_35_STABLE DB=pgsql
- php: 7.2
env: MOODLE_BRANCH=MOODLE_34_STABLE DB=mysqli

- php: 7.1
env: MOODLE_BRANCH=MOODLE_38_STABLE DB=pgsql
Expand Down Expand Up @@ -80,7 +78,7 @@ script:
- moodle-plugin-ci phplint
- moodle-plugin-ci phpcpd
- moodle-plugin-ci phpmd
# - moodle-plugin-ci codechecker # Heh, cannot check codechecker 3 with codechecker 2!
- moodle-plugin-ci codechecker
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci mustache
Expand Down
4 changes: 2 additions & 2 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

require_once($CFG->libdir . '/formslib.php');

// Default errors severity level
// Default errors severity level.
if (defined('PHPCS_DEFAULT_ERROR_SEV') === false) {
define('PHPCS_DEFAULT_ERROR_SEV', 5);
}

// Default warnings severity level
// Default warnings severity level.
if (defined('PHPCS_DEFAULT_WARN_SEV') === false) {
define('PHPCS_DEFAULT_WARN_SEV', 5);
}
Expand Down

0 comments on commit 3d07a61

Please sign in to comment.