forked from enwikipedia-acc/waca
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (96 loc) · 3.13 KB
/
ci.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
name: CI
on:
push:
branches: [ "master" ]
pull_request:
permissions:
contents: read
jobs:
unit-tests:
name: "Unit tests (PHP ${{ matrix.php-version }})"
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [7.4, 8.2]
steps:
- uses: actions/checkout@v4
with:
# Bump depth for Scrutinizer
fetch-depth: 10
- name: Setup PHP Action
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-version }}
extensions: runkit7
tools: phpunit, composer
ini-values: runkit.internal_override=1
- name: Validate composer.json and composer.lock
run: composer validate --no-check-publish
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run PHP linting
run: bash .github/scripts/lint.sh
- name: Run test suite
run: php vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
- name: Upload Scrutinizer coverage
uses: sudo-bot/action-scrutinizer@latest
# Do not run this step on forked versions of the main repository (example: contributor forks)
# Also only run it for current production PHP version
if: github.repository == 'enwikipedia-acc/waca' && matrix.php-version == '7.4'
with:
cli-args: "--format=php-clover coverage.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"
database:
name: "Database"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Shut down old dbs
run: "[ $(docker ps -q | wc -l) -gt 0 ] && docker stop $(docker ps -q) || true"
- name: Start up MariaDB
uses: getong/[email protected]
with:
mariadb version: '10.11'
mysql database: 'waca'
mysql user: 'waca'
mysql password: 'waca'
# Use a silly charset to make sure problems are spotted.
character set server: 'latin1'
collation server: 'latin1_swedish_ci'
- name: Wait for MariaDB
timeout-minutes: 1
run: |
while ! mysqladmin ping -h127.0.0.1 --silent; do
sleep 1
done
- name: Test database build
run: |
sql/test_db.sh --ci
env:
MYSQL_HOST: 127.0.0.1
MYSQL_USER: waca
MYSQL_PASSWORD: waca
MYSQL_SCHEMA: waca
scss:
name: "Stylesheets"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Run SCSS build
run: npm run build-scss
- name: Check generated files
run: |
if [[ $(find resources/generated -type f -name *.css | wc -l) -ne 4 ]]; then
echo "Wrong number of generated files found!"
ls -l resources/generated/*.css
exit 1
fi