Skip to content

Commit

Permalink
Initial changes for 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
malberts authored Jun 4, 2023
1 parent 2891c5d commit d1eb183
Show file tree
Hide file tree
Showing 12 changed files with 443 additions and 178 deletions.
184 changes: 157 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,17 @@ jobs:
strategy:
matrix:
include:
- mw: 'REL1_35'
php: 7.4
experimental: false
- mw: 'REL1_37'
php: 7.4
experimental: false
- mw: 'REL1_37'
php: 8.0
experimental: false
- mw: 'REL1_37'
php: 8.1
experimental: false
- mw: 'REL1_38'
php: 7.4
experimental: false
- mw: 'REL1_38'
- mw: 'REL1_39'
php: 8.0
experimental: false
- mw: 'REL1_38'
- mw: 'REL1_40'
php: 8.1
experimental: false
- mw: 'master'
php: 7.4
experimental: true
- mw: 'master'
php: 8.0
php: 8.1
experimental: true
- mw: 'master'
php: 8.1
php: 8.2
experimental: true

runs-on: ubuntu-latest
Expand All @@ -62,7 +44,7 @@ jobs:

- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
mediawiki
Expand All @@ -71,12 +53,12 @@ jobs:
key: mw_${{ matrix.mw }}-php${{ matrix.php }}

- name: Cache Composer cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
path: EarlyCopy

Expand All @@ -85,12 +67,160 @@ jobs:
working-directory: ~
run: bash EarlyCopy/.github/workflows/installWiki.sh ${{ matrix.mw }}

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
path: mediawiki/vendor/mediawiki/scss

- name: Composer update
run: composer update
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Run PHPUnit
run: php tests/phpunit/phpunit.php -c vendor/mediawiki/scss

code-style:
name: "Code style: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"

strategy:
matrix:
include:
- mw: 'REL1_39'
php: '8.0'

runs-on: ubuntu-latest

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, php-ast
tools: composer

- uses: actions/checkout@v3

- name: Composer install
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

- run: vendor/bin/phpcs -p -s

PHPStan:
name: "PHPStan: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"

strategy:
matrix:
include:
- mw: 'REL1_39'
php: '8.0'

runs-on: ubuntu-latest

defaults:
run:
working-directory: mediawiki

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl
tools: composer

- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v3
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}

- name: Cache Composer cache
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}

- uses: actions/checkout@v3
with:
path: EarlyCopy

- name: Install MediaWiki
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ~
run: bash EarlyCopy/.github/workflows/installWiki.sh ${{ matrix.mw }}

- uses: actions/checkout@v3
with:
path: mediawiki/vendor/mediawiki/scss

- name: Composer update
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Composer install
run: cd vendor/mediawiki/scss && composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: PHPStan
run: cd vendor/mediawiki/scss && php vendor/bin/phpstan analyse

Psalm:
name: "Psalm: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"

strategy:
matrix:
include:
- mw: 'REL1_39'
php: '8.0'

runs-on: ubuntu-latest

defaults:
run:
working-directory: mediawiki

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl
tools: composer

- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v3
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}

- name: Cache Composer cache
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}

- uses: actions/checkout@v3
with:
path: EarlyCopy

- name: Install MediaWiki
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ~
run: bash EarlyCopy/.github/workflows/installWiki.sh ${{ matrix.mw }}

- uses: actions/checkout@v3
with:
path: mediawiki/vendor/mediawiki/scss

- name: Composer update
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Composer install
run: cd vendor/mediawiki/scss && composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Psalm
run: cd vendor/mediawiki/scss && php vendor/bin/psalm --config=psalm.xml --shepherd --stats
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.PHONY: ci test cs phpunit phpcs stan psalm

ci: test cs
test: phpunit
cs: phpcs stan psalm

phpunit:
ifdef filter
php ../../../tests/phpunit/phpunit.php -c phpunit.xml.dist --filter $(filter)
else
php ../../../tests/phpunit/phpunit.php -c phpunit.xml.dist
endif

phpcs:
vendor/bin/phpcs -p -s --standard=$(shell pwd)/phpcs.xml

stan:
vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=2G

stan-baseline:
vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=2G --generate-baseline

psalm:
vendor/bin/psalm --config=psalm.xml --no-diff

psalm-baseline:
vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ The MediaWiki SCSS library provides a ResourceLoader module capable of compiling

## Requirements

- [PHP] 7.4.3 or later
- [MediaWiki] 1.35 or later
- [PHP] 8.0 or later
- [MediaWiki] 1.39 or later
- [Composer]

## Use
Expand Down Expand Up @@ -123,6 +123,15 @@ version 3][license] (or any later version).

## Release notes

### Version 4.0.0

Under development.

* Raised minimum MediaWiki version from 1.35 to 1.39
* Raised minimum PHP version from 7.4.3 to 8.0
* Raised minimum `scssphp` version from 1.10.2 to 1.11.0
* Modernized coding standards

### Version 3.0.1

Released on 2022-07-25
Expand Down
18 changes: 15 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@
"rss": "https://github.com/ProfessionalWiki/SCSS/releases.atom"
},
"require": {
"php": ">=7.4.3",
"scssphp/scssphp": "^1.10.2"
"php": ">=8.0",
"scssphp/scssphp": "^1.11.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6.8",
"vimeo/psalm": "^5.12.0",
"phpstan/phpstan": "^1.10.15",
"mediawiki/mediawiki-codesniffer": "^v41.0.0",
"slevomat/coding-standard": "^v8.11.1"
},
"autoload": {
"psr-4": {
Expand All @@ -47,7 +54,12 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
"dev-master": "4.x-dev"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
15 changes: 0 additions & 15 deletions docs/doxygen.php

This file was deleted.

40 changes: 40 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0"?>
<ruleset>
<file>src/</file>
<file>tests/</file>

<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="MediaWiki.Commenting.FunctionComment" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation" />
<exclude name="MediaWiki.Commenting.FunctionAnnotations.UnrecognizedAnnotation" />
<exclude name="MediaWiki.Commenting.MissingCovers.MissingCovers" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment" />
<exclude name="MediaWiki.WhiteSpace.DisallowEmptyLineFunctions.NoEmptyLine" />
<exclude name="MediaWiki.WhiteSpace.SpaceAfterClosure.NoWhitespaceAfterClosure" />
<exclude name="MediaWiki.WhiteSpace.SameLineCatch.CatchNotOnSameLine" />
<exclude name="MediaWiki.Classes.UnusedUseStatement.UnusedUse" />
<exclude name="MediaWiki.Classes.UnsortedUseStatements.UnsortedUse" />
<exclude name="MediaWiki.Usage.StaticClosure.StaticClosure" />
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine" />
<exclude name="MediaWiki.ControlStructures.IfElseStructure.SpaceBeforeElse" />
</rule>

<rule ref="Generic.Formatting.NoSpaceAfterCast" />
<rule ref="Generic.Metrics.CyclomaticComplexity" />
<rule ref="Generic.Metrics.NestingLevel" />
<rule ref="Generic.WhiteSpace.ScopeIndent" tabIndent="true">
<properties>
<property name="ignoreIndentationTokens" type="array">
<element value="T_COMMENT"/>
</property>
</properties>
</rule>
<rule ref="Squiz.Operators.ValidLogicalOperators" />
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
</ruleset>
21 changes: 21 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
parameters:
ignoreErrors:
-
message: "#^Call to function is_array\\(\\) with MediaWiki\\\\ResourceLoader\\\\FilePath\\|string will always evaluate to false\\.$#"
count: 1
path: src/ResourceLoaderSCSSModule.php

-
message: "#^Elseif branch is unreachable because previous condition is always true\\.$#"
count: 1
path: src/ResourceLoaderSCSSModule.php

-
message: "#^Method SCSS\\\\ResourceLoaderSCSSModule\\:\\:collateStyleFilesByPosition\\(\\) should return array\\<array\\<string\\>\\> but returns array\\<string, array\\<int, MediaWiki\\\\ResourceLoader\\\\FilePath\\|string\\>\\>\\.$#"
count: 1
path: src/ResourceLoaderSCSSModule.php

-
message: "#^Offset 'position' on \\*NEVER\\* on left side of \\?\\? always exists and is always null\\.$#"
count: 1
path: src/ResourceLoaderSCSSModule.php
Loading

0 comments on commit d1eb183

Please sign in to comment.