Skip to content

Commit d2390e9

Browse files
authored
Merge pull request #55 from kabalin/github-actions
GitHub actions for push and pull-requests
2 parents f9a761b + 004e828 commit d2390e9

File tree

3 files changed

+121
-3
lines changed

3 files changed

+121
-3
lines changed

.github/workflows/test.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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: CI test (make validate)
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.2'
60+
moodle-branch: 'MOODLE_35_STABLE'
61+
- php: '7.0'
62+
moodle-branch: 'MOODLE_35_STABLE'
63+
64+
steps:
65+
- name: Check out repository code
66+
uses: actions/checkout@v2
67+
68+
- name: Install node
69+
uses: actions/setup-node@v1
70+
with:
71+
node-version: '14.15.0'
72+
73+
- name: Setup PHP ${{ matrix.php }}
74+
uses: shivammathur/setup-php@v2
75+
with:
76+
php-version: ${{ matrix.php }}
77+
extensions: pgsql, zip, gd, xmlrpc, soap
78+
coverage: none
79+
80+
- name: Initialise moodle-plugin-ci
81+
run: |
82+
make init
83+
cp -R tests/Fixture/moodle-local_travis ../moodle-local_travis
84+
echo $(cd bin; pwd) >> $GITHUB_PATH
85+
echo $(cd vendor/bin; pwd) >> $GITHUB_PATH
86+
echo "TRAVIS_BUILD_DIR="$(cd ../moodle-local_travis; pwd) >> $GITHUB_ENV
87+
# PHPUnit depends on en_AU.UTF-8 locale
88+
sudo locale-gen en_AU.UTF-8
89+
90+
- name: Install moodle-plugin-ci
91+
run: moodle-plugin-ci install -vvv
92+
env:
93+
DB: 'pgsql'
94+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
95+
IGNORE_PATHS: 'ignore'
96+
IGNORE_NAMES: 'ignore_name.php'
97+
MUSTACHE_IGNORE_NAMES: 'broken.mustache'
98+
99+
- name: Run Integration tests
100+
env:
101+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
102+
run: |
103+
make test-phpunit
104+
moodle-plugin-ci phplint
105+
moodle-plugin-ci phpcpd
106+
moodle-plugin-ci phpmd
107+
moodle-plugin-ci codechecker
108+
moodle-plugin-ci validate
109+
moodle-plugin-ci savepoints
110+
moodle-plugin-ci mustache
111+
moodle-plugin-ci grunt || [ \
112+
"$MOODLE_BRANCH" != 'master' -a \
113+
"$MOODLE_BRANCH" != 'MOODLE_310_STABLE' -a \
114+
"$MOODLE_BRANCH" != 'MOODLE_39_STABLE' ]
115+
moodle-plugin-ci phpdoc
116+
moodle-plugin-ci phpunit --coverage-text
117+
moodle-plugin-ci behat --profile default
118+
moodle-plugin-ci behat --profile chrome

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ jobs:
6565
script:
6666
- make validate
6767
- stage: Integration tests
68+
- php: 7.4
69+
env: MOODLE_BRANCH=MOODLE_311_STABLE
6870
- php: 7.4
6971
env: MOODLE_BRANCH=MOODLE_310_STABLE
7072
- php: 7.4
7173
env: MOODLE_BRANCH=MOODLE_39_STABLE
7274
- php: 7.4
7375
env: MOODLE_BRANCH=MOODLE_38_STABLE
74-
- php: 7.3
75-
env: MOODLE_BRANCH=MOODLE_37_STABLE
7676
- php: 7.2
7777
env: MOODLE_BRANCH=MOODLE_35_STABLE
7878
- php: 7.0

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test-phpunit: vendor/autoload.php
1919
validate: build/php-cs-fixer.phar vendor/autoload.php psalm check-docs
2020
$(FIXER) fix --dry-run --stop-on-violation
2121
$(COMPOSER) validate
22-
phpdbg -qrr $(PHPUNIT) --coverage-text
22+
phpdbg -d memory_limit=-1 -qrr $(PHPUNIT) --coverage-text
2323

2424
.PHONY:psalm
2525
psalm: build/psalm.phar

0 commit comments

Comments
 (0)