Skip to content

Commit 80b3668

Browse files
committed
Add GitHub Action for integration test.
1 parent f9a761b commit 80b3668

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

.github/workflows/test.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Moodle Plugin CI
2+
3+
on:
4+
push:
5+
branches: [ 'master' ]
6+
pull_request:
7+
branches: [ 'master' ]
8+
9+
jobs:
10+
selftest:
11+
name: Self-test
12+
runs-on: ubuntu-18.04
13+
14+
steps:
15+
- name: Check out repository code
16+
uses: actions/checkout@v2
17+
18+
- name: Setup PHP 7.3
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 7.3
22+
23+
- name: Initialise
24+
run: make init
25+
26+
- name: Validate
27+
run: make validate
28+
29+
citest:
30+
name: CI test
31+
needs: selftest
32+
runs-on: ubuntu-18.04
33+
34+
services:
35+
postgres:
36+
image: postgres:9.6
37+
env:
38+
POSTGRES_USER: 'postgres'
39+
POSTGRES_HOST_AUTH_METHOD: 'trust'
40+
# Health check to wait for postgres to start.
41+
ports:
42+
- 5432:5432
43+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
44+
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
include:
49+
- php: '7.4'
50+
moodle-branch: 'master'
51+
- php: '7.4'
52+
moodle-branch: 'MOODLE_311_STABLE'
53+
- php: '7.4'
54+
moodle-branch: 'MOODLE_310_STABLE'
55+
- php: '7.4'
56+
moodle-branch: 'MOODLE_39_STABLE'
57+
- php: '7.4'
58+
moodle-branch: 'MOODLE_38_STABLE'
59+
- php: '7.3'
60+
moodle-branch: 'MOODLE_37_STABLE'
61+
- php: '7.2'
62+
moodle-branch: 'MOODLE_35_STABLE'
63+
- php: '7.0'
64+
moodle-branch: 'MOODLE_35_STABLE'
65+
66+
steps:
67+
- name: Check out repository code
68+
uses: actions/checkout@v2
69+
70+
- name: Install node
71+
uses: actions/setup-node@v1
72+
with:
73+
node-version: '14.15.0'
74+
75+
- name: Setup PHP ${{ matrix.php }}
76+
uses: shivammathur/setup-php@v2
77+
with:
78+
php-version: ${{ matrix.php }}
79+
extensions: pgsql, zip, gd, xmlrpc, soap
80+
coverage: none
81+
82+
- name: Initialise moodle-plugin-ci
83+
run: |
84+
make init
85+
cp -R tests/Fixture/moodle-local_travis ../moodle-local_travis
86+
echo $(cd bin; pwd) >> $GITHUB_PATH
87+
echo $(cd vendor/bin; pwd) >> $GITHUB_PATH
88+
echo "TRAVIS_BUILD_DIR="$(cd ../moodle-local_travis; pwd) >> $GITHUB_ENV
89+
# PHPUnit depends on en_AU.UTF-8 locale
90+
sudo locale-gen en_AU.UTF-8
91+
92+
- name: Install moodle-plugin-ci
93+
run: moodle-plugin-ci install -vvv
94+
env:
95+
DB: 'pgsql'
96+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
97+
IGNORE_PATHS: 'ignore'
98+
IGNORE_NAMES: 'ignore_name.php'
99+
MUSTACHE_IGNORE_NAMES: 'broken.mustache'
100+
101+
- name: Run Integration tests
102+
env:
103+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
104+
run: |
105+
make test-phpunit
106+
moodle-plugin-ci phplint
107+
moodle-plugin-ci phpcpd
108+
moodle-plugin-ci phpmd
109+
moodle-plugin-ci codechecker
110+
moodle-plugin-ci validate
111+
moodle-plugin-ci savepoints
112+
moodle-plugin-ci mustache
113+
moodle-plugin-ci grunt || [ \
114+
"$MOODLE_BRANCH" != 'master' -a \
115+
"$MOODLE_BRANCH" != 'MOODLE_310_STABLE' -a \
116+
"$MOODLE_BRANCH" != 'MOODLE_39_STABLE' ]
117+
moodle-plugin-ci phpdoc
118+
moodle-plugin-ci phpunit --coverage-text
119+
moodle-plugin-ci behat --profile default
120+
moodle-plugin-ci behat --profile chrome

0 commit comments

Comments
 (0)