Using docker-compose-ci: Difference between revisions

No edit summary
No edit summary
Line 1: Line 1:
These notes supplement [[Automated deployment of MediaWiki]] and also [[PHPUnit/VSCode]]
These notes supplement [[Automated deployment of MediaWiki]] and also [[PHPUnit/VSCode]]


I added '''docker-compose-ci''' to the CrawlerProtection extension, and here is how to do it.
I added the '''Gesinn IT''' [https://github.com/gesinn-it-pub/docker-compose-ci docker compose CI] system to the CrawlerProtection extension, and here is how to do it.


Initial setup
Initial setup
Line 95: Line 95:


=== Direct usage ===
=== Direct usage ===
This is kinda long and difficult.
<code>./vendor/bin/phpcbf -d memory_limit=512M --standard=MediaWiki --ignore=*/build/*,*/vendor/* /var/www/html/extensions/CrawlerProtection/</code>
<code>./vendor/bin/phpcbf -d memory_limit=512M --standard=MediaWiki --ignore=*/build/*,*/vendor/* /var/www/html/extensions/CrawlerProtection/</code>


Line 103: Line 105:
=== Fully-Configured usage ===
=== Fully-Configured usage ===
<code>composer phpcbf</code>
<code>composer phpcbf</code>
'''In the Docker container:'''
* Extension is at <code>/var/www/html/extensions/CrawlerProtection/</code>
* MediaWiki vendor is at <code>/var/www/html/vendor/</code>
* So <code>../../vendor/bin/phpcs</code> resolves correctly
'''In GitHub Actions:'''
* Extension is at <code>$GITHUB_WORKSPACE/extensions/CrawlerProtection/</code>
* MediaWiki vendor is at <code>$GITHUB_WORKSPACE/vendor/</code>
* Same <code>../../vendor/bin/phpcs</code> path works
'''Testing:'''


With everything in place, we should be able to <code>make bash</code> to get a command line in the container, and <code>composer phpcs</code> or <code>composer phpcbf</code> to run the tools.  Plus, fixes in the container can be viewed/edited/committed from VSCode on the host thanks to the <code>docker-compose-override.yml</code> filesystem mounts.
With everything in place, we should be able to <code>make bash</code> to get a command line in the container, and <code>composer phpcs</code> or <code>composer phpcbf</code> to run the tools.  Plus, fixes in the container can be viewed/edited/committed from VSCode on the host thanks to the <code>docker-compose-override.yml</code> filesystem mounts.
Line 165: Line 153:
         "phpunit": "../../vendor/bin/phpunit tests/phpunit"
         "phpunit": "../../vendor/bin/phpunit tests/phpunit"
     }
     }
</syntaxhighlight>
</syntaxhighlight>Note about path resolution
'''In the Docker container:'''
* Extension is at <code>/var/www/html/extensions/CrawlerProtection/</code>
* MediaWiki vendor is at <code>/var/www/html/vendor/</code>
* So <code>../../vendor/bin/phpcs</code> resolves correctly
 
'''In GitHub Actions:'''


* Extension is at <code>$GITHUB_WORKSPACE/extensions/CrawlerProtection/</code>
* MediaWiki vendor is at <code>$GITHUB_WORKSPACE/vendor/</code>
* Same <code>../../vendor/bin/phpcs</code> path works
{{References}}
{{References}}