add docker-compose / make based CI (#789)

* add docker-compose / make based CI

* edit ci matrix

* fix Mermaid requirement

* use build-tools

* implement new repo-based docker compose ci

* fix ci

* update submodule

* fix test-coverage script "missing"
这个提交包含在:
Luke Eversfield 2023-10-19 14:21:49 +02:00 提交者 GitHub
父节点 94d7a484e1
当前提交 adf13b5535
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 7 个文件被更改,包括 123 次插入111 次删除

75
.github/workflows/ci.yml vendored 普通文件
查看文件

@ -0,0 +1,75 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
- mediawiki_version: '1.35'
smw_version: '4.1.2'
php_version: 7.4
database_type: mysql
database_image: "mysql:5.7"
coverage: true
experimental: false
- mediawiki_version: '1.35'
smw_version: dev-master
php_version: 7.4
database_type: mysql
database_image: "mysql:5.7"
coverage: false
experimental: false
- mediawiki_version: '1.39'
smw_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:latest"
coverage: false
experimental: true
- mediawiki_version: '1.40'
smw_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:latest"
coverage: false
experimental: true
env:
MW_VERSION: ${{ matrix.mediawiki_version }}
SMW_VERSION: ${{ matrix.smw_version }}
PHP_VERSION: ${{ matrix.php_version }}
DB_TYPE: ${{ matrix.database_type }}
DB_IMAGE: ${{ matrix.database_image }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run tests
run: make ci
if: matrix.coverage == false
- name: Run tests with coverage
run: make ci-coverage
if: matrix.coverage == true
- name: Upload code coverage
uses: codecov/codecov-action@v3
with:
files: coverage/php/coverage.xml
if: matrix.coverage == true

查看文件

@ -1,110 +0,0 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
- mediawiki_version: '1.35'
database_type: sqlite
semantic_mediawiki_version: 4.1.0
mermaid_version: 3.1.0
coverage: false
experimental: false
- mediawiki_version: '1.35'
database_type: sqlite
semantic_mediawiki_version: dev-master
mermaid_version: dev-master
coverage: false
experimental: false
- mediawiki_version: '1.38'
database_type: sqlite
semantic_mediawiki_version: dev-master
mermaid_version: dev-master
coverage: false
experimental: false
- mediawiki_version: '1.39'
database_type: sqlite
semantic_mediawiki_version: dev-master
mermaid_version: dev-master
coverage: false
experimental: true
container:
image: gesinn/docker-mediawiki-${{ matrix.database_type }}:${{ matrix.mediawiki_version }}
env:
EXT_NAME: SemanticResultFormats
MW_INST_PATH: /var/www/html
MW_DB_PATH: /var/www/data
MW_EXT_PATH: /var/www/html/extensions
steps:
- name: Install SemanticMediaWiki
run: |
COMPOSER=composer.local.json composer require --update-with-dependencies --working-dir ${{ env.MW_INST_PATH }} mediawiki/semantic-media-wiki ${{ matrix.semantic_mediawiki_version }}
composer update --working-dir ${{ env.MW_INST_PATH }}
echo "wfLoadExtension( 'SemanticMediaWiki' );" >> ${{ env.MW_INST_PATH }}/LocalSettings.php
echo "enableSemantics( 'localhost' );" >> ${{ env.MW_INST_PATH }}/LocalSettings.php
tail -n5 ${{ env.MW_INST_PATH }}/LocalSettings.php
php ${{ env.MW_INST_PATH }}/maintenance/update.php --skip-external-dependencies --quick
- name: Install Mermaid
run: |
COMPOSER=composer.local.json composer require --update-with-dependencies --working-dir ${{ env.MW_INST_PATH }} mediawiki/mermaid ${{ matrix.mermaid_version }}
composer update --working-dir ${{ env.MW_INST_PATH }}
echo "wfLoadExtension( 'Mermaid' );" >> ${{ env.MW_INST_PATH }}/LocalSettings.php
tail -n5 ${{ env.MW_INST_PATH }}/LocalSettings.php
- name: Checkout Extension
uses: actions/checkout@v2
with:
path: ${{ env.EXT_NAME }}
# Setting actions/checkout@v2 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: Install SemanticResultFormats
run: |
COMPOSER=composer.local.json composer require --no-update --working-dir ${{ env.MW_INST_PATH }} mediawiki/semantic-result-formats @dev
COMPOSER=composer.local.json composer config repositories.semantic-result-formats '{"type": "path", "url": "extensions/SemanticResultFormats"}' --working-dir ${{ env.MW_INST_PATH }}
composer update --working-dir ${{ env.MW_INST_PATH }}
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
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
if: matrix.coverage == true
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.MW_INST_PATH }}/docs/coverage.xml
if: matrix.coverage == true

2
.gitignore vendored
查看文件

@ -18,3 +18,5 @@ extensions/
node_modules/
conf/
.DS_Store
.env
coverage

3
.gitmodules vendored 普通文件
查看文件

@ -0,0 +1,3 @@
[submodule "build"]
path = build
url = git@github.com:gesinn-it-pub/docker-compose-ci.git

35
Makefile 普通文件
查看文件

@ -0,0 +1,35 @@
-include .env
export
# setup for docker-compose-ci build directory
# delete "build" directory to update docker-compose-ci
ifeq (,$(wildcard ./build/))
$(shell git submodule update --init --remote)
endif
EXTENSION=SemanticResultFormats
# docker images
MW_VERSION?=1.35
PHP_VERSION?=7.4
DB_TYPE?=sqlite
DB_IMAGE?=""
# extensions
SMW_VERSION?=4.1.2
PF_VERSION ?= 5.5.1
SFS_VERSION ?= 4.0.0-beta
MM_VERSION ?= 3.1.0
# composer
# Enables "composer update" inside of extension
COMPOSER_EXT?=true
# nodejs
# Enables node.js related tests and "npm install"
# NODE_JS?=true
# check for build dir and git submodule init if it does not exist
include build/Makefile

1
build 子模块

@ -0,0 +1 @@
Subproject commit 91d00523e3a9e5b7b334562d6a7aed5a300c3787

查看文件

@ -82,8 +82,14 @@
}
},
"scripts":{
"test": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist",
"test": [
"@phpunit"
],
"test-coverage": [
"@phpunit-coverage"
],
"phpunit": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist",
"phpunit-coverage": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --testdox --coverage-text --coverage-html coverage/php --coverage-clover coverage/php/coverage.xml",
"integration": "composer phpunit -- --testsuite=semantic-result-formats-integration",
"lint": [
"@parallel-lint",