forked from edwardspec/mediawiki-aws-s3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml.disabled
129 lines (114 loc) · 6.5 KB
/
.travis.yml.disabled
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Commit message convention: "(doc)" means README updates, etc. - they don't change any code.
if: commit_message !~ /^\(doc\)/
dist: xenial
language: php
git:
depth: 1
notifications:
email: false
services:
- mysql
- memcached
php:
- 7.3
env:
global:
- DBTYPE=mysql
- DBUSER=root
- secure: "S288kAeEv5c6nN6WUltprGjf+uUEH0/1q2uDVfvqfvefYSOQeQ5ZpnEkJfOAp1e1zqQW2Ff/4gg5D60Vz8TS70NjtlUBWW6RWy7vmvjrPfpOsuKNSep+0PJNkkDLeXMikkCdIcZ/+rCdn95vmV3xgWj2ueINyn5mXHjkcOPms6Sdn0qRAziT+BBI31WcLU4/7138JXs7Oay/BhINfUZq6E0Hv8mze48iTr7B0zBGzH0qPtQjzn86t0KIN6v3lDbU6FMLWZJjKh0ugibji2jjUNWmTqq/4e4qcVZq8bcFoxvQ+QKu26Vgk8b7q6YsKis18sW3cwV4sZprsvun7+K97wyrTqyriLLZyGomcRuczp6CiNAn8xkhTE20miq5Ff2shOm5wtYxzvr/HqzvsV8QjDl65OecSdWNAflmweFpqsLaajL6t03cisRUFU+KxQ5Yu2YEOEtUSsvHAvwlQEsIf6fOp34U+LrGbPSvom7cvbXDK1kgvQGiJqZgsq3vSWFM8KpMrAd9kU8vTs+WOn0ppzEzgVbajF1SYjrxmWZuiIc4CR4obng9sQymYdYnuDAq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h0V7nJAXPu74E37FD6oPSJ4DDUPouYTJ8hgeb3O/x9tk7TjsZFyqu150xGJWj6WI05EoVRdPU5jyIo5INZ7WZVSp7xn9bPhX1J8K1owHnpfMMUl/boJvMp8FsfCnSY1UPySBN+D87clDksPfGyIC1r34FjIpZd2YTDhN9Ep7VOkJQf3bpu7BM9O/mC5M2Ymp0lXa60PfMjgpsjP86vjTMWPrpjjZNFR+9i0FaRXL7Mv/XpEDn+4I1esZIQ+9sfvwYRGI6cNaRKlHyJNjVpRAqlT/eCapNpf2M9Ci0/k6d+QgiB98b6S5i/Gua88cnfr5D976wGqddyea9Q+yaFt9UAT6VYuezdA/826cI440yLaYDHLIvBV9g72ywdFfCmDLtfDKek0AZOEwd7Jj3EHIPM="
matrix:
include:
# Linters (phpcs, etc.)
- &linter-php-build
name: "linters"
if: NOT branch IN (phan)
env: TESTSUITE_TYPE=linter-php
before_script: composer self-update --1 && composer install
script: composer test
# Phan (PHP static analyzer)
- &phan-build
name: "Phan"
env: TESTSUITE_TYPE=phan branch=REL1_35
php: 7.3
before_script:
- composer self-update --1
- pecl install ast
- phpenv config-rm xdebug.ini
- php -i
- bash -ex ./tests/travis/build_mediawiki.sh "$branch"
- rsync -a --exclude buildcache --exclude mediawiki --exclude .git . mediawiki/extensions/AWS/
- cd mediawiki/extensions/AWS
- composer install
script: ./vendor/bin/phan --analyze-twice
- <<: *phan-build
name: "Phan (PHAN_CHECK_TESTSUITE=1)"
if: branch NOT IN (master)
env: TESTSUITE_TYPE=phan branch=REL1_35 PHAN_CHECK_TESTSUITE=1
# PHPUnit tests
- env: branch=REL1_35 USE_MOCK=1
name: "PHPUnit: MW 1.35, PHP 7.3, USE_MOCK=1"
php: 7.3
- env: branch=REL1_35
name: "PHPUnit: MW 1.35, PHP 7.3"
php: 7.3
cache:
directories:
- buildcache
- $HOME/.composer/cache
- $HOME/.cache/pip
before_script:
# Revert Composer to 1.10, because wikimedia/composer-merge-plugin v1.4.1 is not compatible with Composer 2.
- composer self-update --1
- pyenv global system 3.6.7
# Real AWS credentials are unavailable when testing pull requests, etc.
# By setting USE_MOCK, we are telling AmazonS3FileBackendTest to connect to local Moto server instead of S3 itself.
- >
if [[ "$AWS_BUCKET_PREFIX" != "" ]] && [[ "$USE_MOCK" != "1" ]]; then
pip3 install --user awscli
mkdir -p ~/.aws
echo -en "\n[default]\naws_access_key_id = ${AWS_KEY}\naws_secret_access_key = ${AWS_SECRET}\n" >>~/.aws/credentials
echo -en "\n[default]\nregion = us-east-1\n" >>~/.aws/config
else
export USE_MOCK=1
fi
- if [ "$USE_MOCK" = "1" ]; then pip3 install --user "moto[server]" && ( moto_server s3 -p 3000 2>$TRAVIS_BUILD_DIR/moto.log & ); fi
- phpenv config-rm xdebug.ini
- bash -ex ./tests/travis/build_mediawiki.sh "$branch"
- rsync -a --exclude buildcache --exclude mediawiki --exclude .git * mediawiki/extensions/AWS/
- cd mediawiki
- cp extensions/AWS/tests/travis/composer.local.json . && composer update
- >
php maintenance/install.php traviswiki admin
--pass $(dd if=/dev/urandom count=1 bs=20 2>/dev/null | base64)
--dbtype "$DBTYPE"
--dbname traviswiki
--dbuser "$DBUSER"
--dbpass ""
--scriptpath "/w"
- echo -en "\n\nrequire_once __DIR__ . '/includes/DevelopmentSettings.php';\n" >> ./LocalSettings.php
- echo -en "\n\nrequire_once __DIR__ . '/extensions/AWS/tests/travis/AWSSettings.php';\n" >> ./LocalSettings.php
- php -l ./LocalSettings.php
# Wait for Moto server to start accepting connections.
- if [ "$USE_MOCK" = "1" ]; then ( while ! nc -z 127.0.0.1 3000; do sleep 1; done ); fi
script:
- php tests/phpunit/phpunit.php --group TestsWithNoNeedForAwsCredentials extensions/AWS/tests/phpunit/
# We run the test twice: one for container path "NameOfBucket" (public zone),
# one for container path "NameOfBucket/AdditionalPrefix" (e.g. within the "thumb" zone),
# to ensure that paths are properly calculated in both cases.
- >
fails=0;
for WITH_CACHE in 0 1; do
for zone in public thumb; do
export BUCKET="${AWS_BUCKET_PREFIX}-$(LC_ALL=C date +'%s')-$TRAVIS_JOB_NUMBER-$zone-cache$WITH_CACHE"
[[ -z "$USE_MOCK" ]] && ~/.local/bin/aws s3 mb s3://$BUCKET/ && aws s3api wait bucket-exists --bucket "$BUCKET"
AWS_S3_TEST_ZONE="$zone" WITH_CACHE="$WITH_CACHE" php tests/phpunit/phpunit.php extensions/AWS/tests/phpunit/AmazonS3FileBackendTest.php || ((fails++))
[[ -z "$USE_MOCK" ]] && ~/.local/bin/aws s3 rb --force s3://$BUCKET/
rm -rf -v "$TRAVIS_BUILD_DIR/aws.localcache"
done
done;
[[ $fails -eq 0 ]]
after_script:
- cat "$TRAVIS_BUILD_DIR/s3.log"
- cat "$TRAVIS_BUILD_DIR/moto.log"