Skip to content

Commit ea88ec7

Browse files
committed
Add Github Actions to local_codechecker
Not much to say, using the recommended configuration and the combinations already used by travis. Also, fix a couple of warnings to allow checks to pass.
1 parent e0be554 commit ea88ec7

File tree

2 files changed

+164
-2
lines changed

2 files changed

+164
-2
lines changed

Diff for: .github/workflows/ci.yml

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Codechecker CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-18.04
8+
9+
services:
10+
postgres:
11+
image: postgres:9.6
12+
env:
13+
POSTGRES_USER: 'postgres'
14+
POSTGRES_HOST_AUTH_METHOD: 'trust'
15+
ports:
16+
- 5432:5432
17+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
18+
mariadb:
19+
image: mariadb:10
20+
env:
21+
MYSQL_USER: 'root'
22+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
23+
ports:
24+
- 3306:3306
25+
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
26+
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- php: 7.4
32+
moodle-branch: master
33+
database: pgsql
34+
- php: 7.4
35+
moodle-branch: master
36+
database: mariadb
37+
- php: 7.4
38+
moodle-branch: MOODLE_311_STABLE
39+
database: pgsql
40+
- php: 7.4
41+
moodle-branch: MOODLE_311_STABLE
42+
database: mariadb
43+
- php: 7.4
44+
moodle-branch: MOODLE_310_STABLE
45+
database: pgsql
46+
- php: 7.4
47+
moodle-branch: MOODLE_39_STABLE
48+
database: mariadb
49+
- php: 7.4
50+
moodle-branch: MOODLE_38_STABLE
51+
database: pgsql
52+
53+
- php: 7.3
54+
moodle-branch: master
55+
database: pgsql
56+
- php: 7.3
57+
moodle-branch: master
58+
database: mariadb
59+
- php: 7.3
60+
moodle-branch: MOODLE_311_STABLE
61+
database: pgsql
62+
- php: 7.3
63+
moodle-branch: MOODLE_311_STABLE
64+
database: mariadb
65+
- php: 7.3
66+
moodle-branch: MOODLE_37_STABLE
67+
database: pgsql
68+
- php: 7.3
69+
moodle-branch: MOODLE_36_STABLE
70+
database: mariadb
71+
72+
- php: 7.2
73+
moodle-branch: MOODLE_310_STABLE
74+
database: pgsql
75+
- php: 7.2
76+
moodle-branch: MOODLE_39_STABLE
77+
database: mariadb
78+
- php: 7.2
79+
moodle-branch: MOODLE_35_STABLE
80+
database: pgsql
81+
- php: 7.2
82+
moodle-branch: MOODLE_34_STABLE
83+
database: mariadb
84+
85+
- php: 7.1
86+
moodle-branch: MOODLE_38_STABLE
87+
database: pgsql
88+
- php: 7.1
89+
moodle-branch: MOODLE_37_STABLE
90+
database: mariadb
91+
steps:
92+
- name: Check out repository code
93+
uses: actions/checkout@v2
94+
with:
95+
path: plugin
96+
97+
- name: Setup PHP ${{ matrix.php }}
98+
uses: shivammathur/setup-php@v2
99+
with:
100+
php-version: ${{ matrix.php }}
101+
coverage: none
102+
103+
- name: Initialise moodle-plugin-ci
104+
run: |
105+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
106+
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
107+
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
108+
sudo locale-gen en_AU.UTF-8
109+
110+
- name: Install moodle-plugin-ci
111+
run: |
112+
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
113+
env:
114+
DB: ${{ matrix.database }}
115+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
116+
IGNORE_PATHS: moodle/tests/fixtures,moodle/Sniffs
117+
118+
- name: PHP Lint
119+
if: ${{ always() }}
120+
run: moodle-plugin-ci phplint
121+
122+
- name: PHP Copy/Paste Detector
123+
continue-on-error: true # This step will show errors but will not fail
124+
if: ${{ always() }}
125+
run: moodle-plugin-ci phpcpd
126+
127+
- name: PHP Mess Detector
128+
continue-on-error: true # This step will show errors but will not fail
129+
if: ${{ always() }}
130+
run: moodle-plugin-ci phpmd
131+
132+
- name: Moodle Code Checker
133+
if: ${{ always() }}
134+
run: moodle-plugin-ci codechecker --max-warnings 0
135+
136+
- name: Moodle PHPDoc Checker
137+
if: ${{ always() }}
138+
run: moodle-plugin-ci phpdoc
139+
140+
- name: Validating
141+
if: ${{ always() }}
142+
run: moodle-plugin-ci validate
143+
144+
- name: Check upgrade savepoints
145+
if: ${{ always() }}
146+
run: moodle-plugin-ci savepoints
147+
148+
- name: Mustache Lint
149+
if: ${{ always() }}
150+
run: moodle-plugin-ci mustache
151+
152+
- name: Grunt
153+
if: ${{ always() }}
154+
run: moodle-plugin-ci grunt --max-lint-warnings 0
155+
156+
- name: PHPUnit tests
157+
if: ${{ always() }}
158+
run: moodle-plugin-ci phpunit
159+
160+
- name: Behat features
161+
if: ${{ always() }}
162+
run: moodle-plugin-ci behat --profile chrome

Diff for: locallib.php

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

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

29-
// Default errors severity level
29+
// Default errors severity level.
3030
if (defined('PHPCS_DEFAULT_ERROR_SEV') === false) {
3131
define('PHPCS_DEFAULT_ERROR_SEV', 5);
3232
}
3333

34-
// Default warnings severity level
34+
// Default warnings severity level.
3535
if (defined('PHPCS_DEFAULT_WARN_SEV') === false) {
3636
define('PHPCS_DEFAULT_WARN_SEV', 5);
3737
}

0 commit comments

Comments
 (0)