Skip to content

Commit

Permalink
Use the canonical MW_INSTALL_PATH (#692)
Browse files Browse the repository at this point in the history
* Use the canonical MW_INSTALL_PATH

* Update MW_INSTALL_PATH to fallback if not available

Fixes #832
  • Loading branch information
hexmode committed May 5, 2024
1 parent e0d36b9 commit de6a2f5
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 2 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
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'
semantic_mediawiki_version: 3.2.3
mermaid_version: 3.0.1
coverage: true
experimental: false
- mediawiki_version: '1.36'
semantic_mediawiki_version: dev-master
mermaid_version: dev-master
coverage: false
experimental: true

container:
image: gesinn/docker-mediawiki:${{ matrix.mediawiki_version }}

env:
EXT_NAME: SemanticResultFormats
MW_INSTALL_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_INSTALL_PATH }} mediawiki/semantic-media-wiki ${{ matrix.semantic_mediawiki_version }}
composer update --working-dir ${{ env.MW_INSTALL_PATH }}
echo "wfLoadExtension( 'SemanticMediaWiki' );" >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php
echo "enableSemantics( 'localhost' );" >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php
tail -n5 ${{ env.MW_INSTALL_PATH }}/LocalSettings.php
php ${{ env.MW_INSTALL_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_INSTALL_PATH }} mediawiki/mermaid ${{ matrix.mermaid_version }}
composer update --working-dir ${{ env.MW_INSTALL_PATH }}
echo "wfLoadExtension( 'Mermaid' );" >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php
tail -n5 ${{ env.MW_INSTALL_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_INSTALL_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_INSTALL_PATH }}
composer update --working-dir ${{ env.MW_INSTALL_PATH }}
echo "wfLoadExtension( '${{ env.EXT_NAME }}' );" >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php
tail -n5 ${{ env.MW_INSTALL_PATH }}/LocalSettings.php
php ${{ env.MW_INSTALL_PATH }}/maintenance/update.php --quick
- name: Run Tests
run: >
php ${{ env.MW_INSTALL_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_INSTALL_PATH }}/tests/phpunit/phpunit.php
--configuration ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}
--testdox
--coverage-clover ${{ env.MW_INSTALL_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_INSTALL_PATH }}/docs/coverage.xml
if: matrix.coverage == true
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
"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",
"phpunit": "php ${MW_INSTALL_PATH:-../..}/tests/phpunit/phpunit.php -c phpunit.xml.dist",
"phpunit-coverage": "php ${MW_INSTALL_PATH:-../..}/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",
Expand Down

2 comments on commit de6a2f5

@gesinn-it-gea
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we have ci.yml and main.yml. What's the purpose of having two workflows?

@hexmode
Copy link
Member Author

@hexmode hexmode commented on de6a2f5 May 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was because the pr sat for so long and I didn't see that you had changed the file. Feel free to delete my inadvertent addition of main.yml.

Please sign in to comment.