Skip to content

Commit

Permalink
chg (ci): add matrix for MW 1.35, 1.39 and 1.40
Browse files Browse the repository at this point in the history
  • Loading branch information
gesinn-it-ilm committed Jul 3, 2024
1 parent fb3a1a4 commit c1b4d8e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 60 deletions.
5 changes: 5 additions & 0 deletions .env-40
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# docker images
MW_VERSION?=1.40
PHP_VERSION?=8.1
DB_TYPE?=mysql
DB_IMAGE?=""
99 changes: 39 additions & 60 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,87 +2,66 @@ name: CI

on:
push:
branches: [ master ]
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-20.04

test:

runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.experimental }}

strategy:
matrix:
include:
- mediawiki_version: 1.31
database_type: sqlite
coverage: false
- mediawiki_version: 1.35
- mediawiki_version: '1.35'
php_version: 7.4
database_type: mysql
database_image: "mysql:5.7"
coverage: true
- mediawiki_version: 1.35
database_type: sqlite
experimental: false
- mediawiki_version: '1.39'
php_version: 8.1
database_type: mysql
database_image: "mysql:8"
coverage: false

services:
some-mysql:
image: mariadb:latest
env:
MYSQL_ROOT_PASSWORD: database
options: --name mysql --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10

container:
image: gesinn/docker-mediawiki-${{ matrix.database_type }}:${{ matrix.mediawiki_version }}
options: --link some-mysql:mysql
experimental: false
- mediawiki_version: '1.40'
php_version: 8.1
database_type: mysql
database_image: "mysql:8"
coverage: false
experimental: false

env:
EXT_NAME: EditWarning
MW_INST_PATH: /var/www/html
MW_DB_PATH: /var/www/data
MW_EXT_PATH: /var/www/html/extensions
MW_VERSION: ${{ matrix.mediawiki_version }}
PHP_VERSION: ${{ matrix.php_version }}
DB_TYPE: ${{ matrix.database_type }}
DB_IMAGE: ${{ matrix.database_image }}

steps:
- name: Get MySQL from dump
working-directory: ${{ env.MW_INST_PATH }}
run: bash restore-database.sh
if: matrix.database_type == 'mysql'

- name: Checkout Extension
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.EXT_NAME }}

# Setting actions/checkout@v3 path to env.MW_EXT_PATH fails with "Repository path '/var/www/html/extensions' is not under ..."
# See also open PR https://github.com/actions/checkout/pull/388
- name: Move Extension
run: |
mkdir -p ${{ env.MW_EXT_PATH }}
mv ${{ env.EXT_NAME }} ${{ env.MW_EXT_PATH }}
- name: Register Extension
run: |
echo "wfLoadExtension( '${{ env.EXT_NAME }}' );" >> ${{ env.MW_INST_PATH }}/LocalSettings.php
tail -n5 ${{ env.MW_INST_PATH }}/LocalSettings.php
php ${{ env.MW_INST_PATH }}/maintenance/update.php --quick
- name: Run Tests
run: >
php ${{ env.MW_INST_PATH }}/tests/phpunit/phpunit.php
--configuration ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}
--testdox
submodules: recursive

- name: Update submodules
run: git submodule update --init --remote

- name: Run tests
run: make ci
if: matrix.coverage == false

- name: Run Tests With Coverage
run: >
php ${{ env.MW_INST_PATH }}/tests/phpunit/phpunit.php
--configuration ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}
--testdox
--coverage-clover ${{ env.MW_INST_PATH }}/docs/coverage.xml
- name: Run tests with coverage
run: make ci-coverage
if: matrix.coverage == true

- name: Upload code coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.MW_INST_PATH }}/docs/coverage.xml
if: matrix.coverage == true
files: coverage/php/coverage.xml
if: matrix.coverage == true

0 comments on commit c1b4d8e

Please sign in to comment.