Using docker-compose-ci: Difference between revisions

No edit summary
No edit summary
 
Line 127: Line 127:
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*.phan/*</exclude-pattern>
<exclude-pattern>*.phan/*</exclude-pattern>
<!-- test stub files intentionally have multiple classes in one file -->
<exclude-pattern>*/tests/phpunit/stubs.php</exclude-pattern>
<exclude-pattern>*/tests/phpunit/stubs.php</exclude-pattern>
<exclude-pattern>*/tests/phpunit/namespaced-stubs.php</exclude-pattern>
<exclude-pattern>*/tests/phpunit/namespaced-stubs.php</exclude-pattern>
Line 144: Line 145:
=== scripts ===
=== scripts ===
Here is the section of code to add to your Extension's <code>composer.json</code> to act like MediaWiki core for [[Continuous Integration]]<syntaxhighlight lang="json" line="1">
Here is the section of code to add to your Extension's <code>composer.json</code> to act like MediaWiki core for [[Continuous Integration]]<syntaxhighlight lang="json" line="1">
    },
     "scripts": {
     "scripts": {
         "test": [
         "test": [
Line 149: Line 151:
             "@phpunit"
             "@phpunit"
         ],
         ],
         "phpcs": "../../vendor/bin/phpcs -sp --standard=.phpcs.xml",
         "phpcs": "vendor/bin/phpcs -sp --standard=.phpcs.xml",
         "phpcbf": "../../vendor/bin/phpcbf --standard=.phpcs.xml",
         "phpcbf": "vendor/bin/phpcbf --standard=.phpcs.xml",
         "phpunit": "../../vendor/bin/phpunit tests/phpunit"
         "phpunit": "php ../../tests/phpunit/phpunit.php tests/phpunit/"
    },
    "config": {
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true
        }
     }
     }
</syntaxhighlight>Note about path resolution
</syntaxhighlight>Note about path resolution: snippet shows 'vendor/bin' as the path which is the local tool installed by 'composer install' from the extension directory in the container. This is available because we added require-dev libraries.
'''In the Docker container:'''
'''In the Docker container:'''
* Extension is at <code>/var/www/html/extensions/CrawlerProtection/</code>
* Extension is at <code>/var/www/html/extensions/CrawlerProtection/</code>
* MediaWiki vendor is at <code>/var/www/html/vendor/</code>
* MediaWiki vendor is at <code>/var/www/html/vendor/</code>
* So <code>../../vendor/bin/phpcs</code> resolves correctly
* So <code>../../vendor/bin/phpcs</code> resolves correctly if using core's tools


'''In GitHub Actions:'''
'''In GitHub Actions:'''