-
-
Notifications
You must be signed in to change notification settings - Fork 30
136 lines (128 loc) · 4.75 KB
/
main.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
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
130
131
132
133
134
135
136
name: JSON linter + luacheck
on: [push, pull_request, workflow_dispatch]
env:
DBTYPE: mysql
DBUSER: root
jobs:
# PHP linters: phpcs, parallel-lint, etc.
linter:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: composer
- uses: actions/cache@v4
with:
path: ~/.composer/cache
key: buildcache-linter
- run: sudo apt-get install -y composer && composer install
- run: composer test
# Phan (PHP static analyzer)
phan:
runs-on: ubuntu-22.04
env:
branch: REL1_43
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: ast
tools: composer
- uses: actions/cache@v4
with:
path: |
~/.composer/cache
buildcache
key: buildcache-phan
- uses: edwardspec/github-action-build-mediawiki@v1
with:
branch: ${{ env.branch }}
noinstall: 1
- name: Install dependencies
run: |
rsync -a --exclude buildcache --exclude mediawiki --exclude .git . mediawiki/extensions/AWS/
cd mediawiki/extensions/AWS
composer install
- name: RUN -- phan
run: cd mediawiki/extensions/AWS && ./vendor/bin/phan --analyze-twice
# PHPUnit testsuite + Moto (mock server that emulates S3 API).
phpunit-mock:
strategy:
fail-fast: false
matrix:
php: [8.1]
branch: [REL1_39, REL1_40, REL1_41, REL1_42, REL1_43]
env:
USE_MOCK: 1
branch: ${{ matrix.branch }}
runs-on: ubuntu-22.04
services:
memcached:
image: memcached:latest
ports:
- 11211:11211
options: --health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/11211'" --health-interval 10s --health-timeout 5s --health-retries 5
mariadb:
image: mariadb:10
env:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
buildcache
key: buildcache-${{ env.branch }}-${{ hashFiles('**/no/files/need/to/invalidate/cache/for/now') }}
- name: Install and run Moto (S3 mock server)
run: |
sudo apt-get install -y python3-pip netcat
pip3 install pyOpenSSL --upgrade
pip3 install --user "moto[server]" "moto[s3]" && ( ~/.local/bin/moto_server -p 3000 2>~/moto.log & )
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, opcache, mysqli
tools: composer
- name: (debug) Print "php -i"
run: php -i
- uses: edwardspec/github-action-build-mediawiki@v1
with:
branch: ${{ env.branch }}
extraLocalSettings: tests/travis/AWSSettings.php
- name: Finalize the installation of MediaWiki
run: |
rsync -a --exclude buildcache --exclude mediawiki --exclude .git . mediawiki/extensions/AWS/
cd mediawiki
cp extensions/AWS/tests/travis/composer.local.json . && composer update
echo '{{CURRENTVERSION}}' | php maintenance/parse.php
- name: Wait for Moto server to start accepting connections
run: |
cat ~/moto.log
( while ! nc -z 127.0.0.1 3000; do sleep 1; done )
- name: RUN -- phpunit (TestsWithNoNeedForAwsCredentials)
run: |
cd mediawiki
php tests/phpunit/phpunit.php --group TestsWithNoNeedForAwsCredentials extensions/AWS/tests/phpunit/
- name: RUN -- phpunit AmazonS3FileBackendTest.php
# 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.
run: |
cd mediawiki
# FIXME: surely there is a better way to do this, like moving this into a script or custom action.
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')-${{ job.container.id }}-$zone-cache$WITH_CACHE"
AWS_S3_TEST_ZONE="$zone" WITH_CACHE="$WITH_CACHE" php tests/phpunit/phpunit.php extensions/AWS/tests/phpunit/AmazonS3FileBackendTest.php || ((fails++))
rm -rf -v "~/aws.localcache"
done
done;
[[ $fails -eq 0 ]]
#