Skip to content

Commit

Permalink
Made SG compatible with the latest version of Lingo (#75)
Browse files Browse the repository at this point in the history
* Made SG compatible with the latest version of Lingo that provides searching for specific search terms in the backend

* Update RELEASE-NOTES.md

* CI updates

* Skip tests - finish whenever somebody has time to do so

* Update required extensions

* Remove @todo and mark GlossaryCacheRebuilderTest as skipped; also bumped version to v5

---------

Co-authored-by: Youri van den Bogert <yvdbogert@archixl.nl>
  • Loading branch information
YOUR1 and YOUR1 authored Sep 26, 2024
1 parent 371881f commit 4a70905
Show file tree
Hide file tree
Showing 32 changed files with 818 additions and 196 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: smw
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.semantic-mediawiki.org/wiki/Sponsorship']
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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.39'
smw_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:10"
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: Update submodules
run: git submodule update --init --remote

- 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@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/php/coverage.xml
if: matrix.coverage == true
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "build"]
path = build
url = https://github.com/gesinn-it-pub/docker-compose-ci.git
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-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=SemanticGlossary

# docker images
MW_VERSION?=1.39
PHP_VERSION?=8.1
DB_TYPE?=sqlite
DB_IMAGE?=""

# extensions
SMW_VERSION?=4.1.3
MM_VERSION ?= 3.1.0
LINGO_VERSION ?= "dev-master"

# 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
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
This file contains the RELEASE-NOTES of the Semantic Glossary (a.k.a. SG) extension.

### 4.1.0
* New minumum required versions:
* Lingo: 3.2.1
* Improved glossary searching by using the given 'search terms' passed by Lingo
### 4.0.0

Released on 2021-07-09.
Expand Down
18 changes: 7 additions & 11 deletions SemanticGlossary.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ class SemanticGlossary {
* @since 2.0
*/
public static function initExtension() {

if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}

$GLOBALS[ 'wgexLingoBackend' ] = 'SG\LingoBackendAdapter';
}

$GLOBALS[ 'wgExtensionFunctions' ][] = function () {

$hookRegistry = new HookRegistry();

$hookRegistry->register();
};
/**
* @since 4.1.0
*/
public static function onExtensionFunction(): void {
$hookRegistry = new HookRegistry();
$hookRegistry->register();
}

/**
Expand Down
15 changes: 15 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

# Ignore the coverage output from local runs
/coverage
147 changes: 147 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
ARG MW_VERSION
ARG PHP_VERSION
FROM gesinn/mediawiki-ci:${MW_VERSION}-php${PHP_VERSION}

ARG EXTENSION
ARG MW_INSTALL_PATH
ARG MW_VERSION
ARG PHP_VERSION
ARG PHP_EXTENSIONS
ARG OS_PACKAGES
ENV EXTENSION=${EXTENSION}
ENV MW_INSTALL_PATH=${MW_INSTALL_PATH}
ENV PHP_EXTENSIONS=${PHP_EXTENSIONS}
ENV OS_PACKAGES=${OS_PACKAGES}

# get needed dependencies for this extension
RUN sed -i s/80/8080/g /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf

### SemanticMediaWiki
ARG SMW_VERSION
RUN if [ ! -z "${SMW_VERSION}" ]; then \
composer-require.sh mediawiki/semantic-media-wiki ${SMW_VERSION} && \
echo 'wfLoadExtension( "SemanticMediaWiki" );\n' \
'enableSemantics( $wgServer );\n' \
>> __setup_extension__; \
fi
### SemanticMediaWiki

### PageForms
ARG PF_VERSION
ARG PF_REPO
RUN if [ ! -z "${PF_VERSION}" ]; then \
get-github-extension.sh PageForms ${PF_VERSION} ${PF_REPO} && \
echo 'wfLoadExtension( "PageForms" );\n' >> __setup_extension__; \
fi
### PageForms

### PageSchemas
ARG PS_VERSION
RUN if [ ! -z "${PS_VERSION}" ]; then \
get-github-extension.sh PageSchemas ${PS_VERSION} && \
echo 'wfLoadExtension( "PageSchemas" );\n' >> __setup_extension__; \
fi
### PageSchemas

### DisplayTitle
ARG DT_VERSION
RUN if [ ! -z "${DT_VERSION}" ]; then \
get-github-extension.sh DisplayTitle ${DT_VERSION} && \
echo 'wfLoadExtension( "DisplayTitle" );\n' >> __setup_extension__; \
fi
### DisplayTitle

### AdminLinks
ARG AL_VERSION
RUN if [ ! -z "${AL_VERSION}" ]; then \
get-github-extension.sh AdminLinks ${AL_VERSION} && \
echo 'wfLoadExtension( "AdminLinks" );\n' >> __setup_extension__; \
fi
### AdminLinks

### Maps
ARG MAPS_VERSION
RUN if [ ! -z "${MAPS_VERSION}" ]; then \
composer-require.sh mediawiki/maps ${MAPS_VERSION} && \
echo 'wfLoadExtension( "Maps" );\n' >> __setup_extension__; \
fi
### Maps

### SemanticResultFormats
ARG SRF_VERSION
RUN if [ ! -z "${SRF_VERSION}" ]; then \
composer-require.sh mediawiki/semantic-result-formats ${SRF_VERSION} && \
echo 'wfLoadExtension( "SemanticResultFormats" );\n' >> __setup_extension__; \
fi
### SemanticResultFormats

### Mermaid
ARG MM_VERSION
RUN if [ ! -z "${MM_VERSION}" ]; then \
composer-require.sh mediawiki/mermaid ${MM_VERSION} && \
echo 'wfLoadExtension( "Mermaid" );\n' >> __setup_extension__; \
fi
### Mermaid

### Lingo
ARG LINGO_VERSION
RUN if [ ! -z "${LINGO_VERSION}" ]; then \
composer-require.sh mediawiki/lingo ${LINGO_VERSION} && \
echo 'wfLoadExtension( "Lingo" );\n' >> __setup_extension__; \
fi
### Lingo

### chameleon
ARG CHAMELEON_VERSION
RUN if [ ! -z "${CHAMELEON_VERSION}" ]; then \
composer-require.sh mediawiki/chameleon-skin ${CHAMELEON_VERSION} && \
echo "wfLoadExtension( 'Bootstrap' );\n" \
"wfLoadSkin( 'chameleon' );\n" \
"\$wgDefaultSkin='chameleon';\n" \ >> __setup_extension__; \
fi
### chameleon

### Lingo
ARG LINGO_VERSION
RUN if [ ! -z "${LINGO_VERSION}" ]; then \
composer-require.sh mediawiki/lingo ${LINGO_VERSION} && \
echo 'wfLoadExtension( "Lingo" );\n' >> __setup_extension__; \
fi
### Lingo

RUN composer update

COPY . /var/www/html/extensions/$EXTENSION

RUN if [ ! -z "${SMW_VERSION}" ] || [ "${EXTENSION}" = "SemanticMediaWiki" ]; then \
chown -R www-data:www-data /var/www/html/extensions/SemanticMediaWiki/; \
fi

ARG OS_PACKAGES
RUN if [ ! -z "${OS_PACKAGES}" ] ; then apt-get update && apt-get install -y $OS_PACKAGES ; fi

ARG PHP_EXTENSIONS
RUN if [ ! -z "${PHP_EXTENSIONS}" ] ; then docker-php-ext-install $PHP_EXTENSIONS ; fi

ARG COMPOSER_EXT
RUN if [ ! -z "${COMPOSER_EXT}" ] ; then cd extensions/$EXTENSION && composer update ; fi

ARG NODE_JS
RUN if [ ! -z "${NODE_JS}" ] ; then cd extensions/$EXTENSION && npm install ; fi

# special handling for testing SMW itself
RUN if [ "${EXTENSION}" = "SemanticMediaWiki" ]; then \
COMPOSER=composer.local.json composer require --no-update --working-dir ${MW_INSTALL_PATH} mediawiki/semantic-media-wiki @dev && \
COMPOSER=composer.local.json composer config repositories.semantic-media-wiki '{"type": "path", "url": "extensions/SemanticMediaWiki"}' --working-dir ${MW_INSTALL_PATH} && \
composer update --working-dir ${MW_INSTALL_PATH}; \
fi

RUN echo \
"wfLoadExtension( '$EXTENSION' );\n" \
>> __setup_extension__

COPY *__setup_extension__ setup_extension

RUN if [ -f setup_extension ]; then \
cat setup_extension >> __setup_extension__; \
fi
Loading

0 comments on commit 4a70905

Please sign in to comment.