Skip to content

Commit d1afe6d

Browse files
Merge pull request #59 from lucaboesch/githubactions
Adding Github actions.
2 parents dd7a0ed + 891af91 commit d1afe6d

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Moodle Plugin 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:10
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.5
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: MOODLE_311_STABLE
33+
database: pgsql
34+
- php: 7.4
35+
moodle-branch: MOODLE_311_STABLE
36+
database: mariadb
37+
38+
- php: 7.3
39+
moodle-branch: MOODLE_311_STABLE
40+
database: pgsql
41+
- php: 7.3
42+
moodle-branch: MOODLE_311_STABLE
43+
database: mariadb
44+
45+
steps:
46+
- name: Check out repository code
47+
uses: actions/checkout@v2
48+
with:
49+
path: plugin
50+
51+
- name: Setup PHP ${{ matrix.php }}
52+
uses: shivammathur/setup-php@v2
53+
with:
54+
php-version: ${{ matrix.php }}
55+
extensions: ${{ matrix.extensions }}
56+
ini-values: max_input_vars=5000
57+
coverage: none
58+
59+
- name: Initialise moodle-plugin-ci
60+
run: |
61+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
62+
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
63+
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
64+
sudo locale-gen en_AU.UTF-8
65+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
66+
67+
- name: Install moodle-plugin-ci
68+
run: |
69+
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
70+
env:
71+
DB: ${{ matrix.database }}
72+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
73+
IGNORE_PATHS: moodle/tests/fixtures,moodle/Sniffs
74+
CODECHECKER_IGNORE_PATHS: classes/vendor
75+
PHPDOCCHECKER_IGNORE_PATHS: classes/vendor
76+
77+
- name: PHP Lint
78+
if: ${{ always() }}
79+
run: moodle-plugin-ci phplint
80+
81+
- name: PHP Copy/Paste Detector
82+
continue-on-error: true # This step will show errors but will not fail
83+
if: ${{ always() }}
84+
run: moodle-plugin-ci phpcpd
85+
86+
- name: PHP Mess Detector
87+
continue-on-error: true # This step will show errors but will not fail
88+
if: ${{ always() }}
89+
run: moodle-plugin-ci phpmd
90+
91+
- name: Moodle Code Checker
92+
if: ${{ always() }}
93+
run: moodle-plugin-ci codechecker --max-warnings 0 || true
94+
95+
- name: Moodle PHPDoc Checker
96+
if: ${{ always() }}
97+
run: moodle-plugin-ci phpdoc || true
98+
99+
- name: Validating
100+
if: ${{ always() }}
101+
run: moodle-plugin-ci validate
102+
103+
- name: Check upgrade savepoints
104+
if: ${{ always() }}
105+
run: moodle-plugin-ci savepoints
106+
107+
- name: Mustache Lint
108+
if: ${{ always() }}
109+
run: moodle-plugin-ci mustache || true
110+
111+
- name: Grunt
112+
if: ${{ always() }}
113+
run: moodle-plugin-ci grunt || true
114+
115+
- name: PHPUnit tests
116+
if: ${{ always() }}
117+
run: moodle-plugin-ci phpunit --coverage-text || true
118+
119+
- name: Behat features
120+
if: ${{ always() }}
121+
run: moodle-plugin-ci behat --profile chrome
122+
123+

0 commit comments

Comments
 (0)