-
Notifications
You must be signed in to change notification settings - Fork 46
/
.travis.yml
104 lines (93 loc) · 2.94 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
language: php
dist: focal
addons:
postgresql: "13"
apt:
packages:
- postgresql-13
- postgresql-client-13
- libonig5
services:
- mysql
- docker
cache:
directories:
- $HOME/.composer/cache
- $HOME/.npm
env:
global:
- PGVER=13
- IGNORE_PATHS=ignore
- IGNORE_NAMES=ignore_name.php
- MUSTACHE_IGNORE_NAMES=broken.mustache
- DB=pgsql
before_install:
- echo 'max_input_vars=5000' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# We want to verify that xdebug works for coverage. Once we only support
# Moodle 3.10/PHPUnit 8 and up, we can switch our tests to pcov too.
# - phpenv config-rm xdebug.ini
- make init
# Mimic how a Moodle plugin would be run.
- cp -R tests/Fixture/moodle-local_ci ../moodle-local_ci
- export PATH="$(cd bin; pwd):$(cd vendor/bin; pwd):$PATH"
- export TRAVIS_BUILD_DIR=$(cd ../moodle-local_ci; pwd)
- >
if [ -n "$DOCKER_USER" ] && [ -n "$DOCKER_TOKEN" ]; then
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USER" --password-stdin
echo "Using authenticated connection (no pull limits)"
else
echo "Using unauthenticated docker (pull limits may apply). Setup DOCKER_USER and DOCKER_TOKEN if needed."
fi
install:
- moodle-plugin-ci install -vvv
script:
# This is basically "integration" testing.
- moodle-plugin-ci phplint
- moodle-plugin-ci phpcpd
- moodle-plugin-ci phpmd
- moodle-plugin-ci codechecker
- moodle-plugin-ci codefixer
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci mustache
- moodle-plugin-ci grunt || [[ "$MOODLE_BRANCH" =~ MOODLE_3[0-9]+_STABLE ]] # Fixtures only compatible with Moodle >= 4.0
- moodle-plugin-ci phpdoc
- moodle-plugin-ci phpunit --verbose --coverage-text --fail-on-warning
- moodle-plugin-ci behat --profile default
- moodle-plugin-ci behat --profile chrome
- moodle-plugin-ci behat --profile firefox --tags="@local_ci&&~@app"
jobs:
include:
- stage: CI test (make validate)
php: 7.4
before_install: skip
install:
- make init
script:
- make validate
- stage: Code coverage (coveralls)
if: repo = moodlehq/moodle-plugin-ci
php: 7.4
before_install: skip
install:
- make init
- composer create-project -n --no-dev --prefer-dist php-coveralls/php-coveralls coveralls ^2
script:
- make coverage-phpunit
after_success:
- coveralls/bin/php-coveralls -v
- stage: Integration tests
if: env(MOODLE_BRANCH) IS present
# Only main with highest supported PHP version.
- php: 8.3
env:
- MOODLE_BRANCH=main
- MOODLE_APP=true
# Last stable with highest supported PHP version.
- php: 8.3
env:
- MOODLE_BRANCH=MOODLE_405_STABLE
- MOODLE_APP=true
# And older stable supported (with lowest supported PHP version).
- php: 7.4
env: MOODLE_BRANCH=MOODLE_39_STABLE