Awesome
Docker and GitHub Actions for Composer
GitHub Actions for Composer. Base on Docker official PHP image, and installed hirak/prestissimo package.
Why build another one image?
Actually, I want to follow DRY principle and use official Composer image. But see the following composer.json:
{
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"phpunit/phpunit": "^4 | ^5 | ^6"
}
}
And use the following workflow:
- name: Composer install
uses: docker://composer:1.9.1
with:
args: install
- name: PHPUnit testing
uses: docker://php:5.5
with:
args: php vendor/bin/phpunit
It's expected to work on PHP 5.5 ~ 7.3, so we should test on every platform. However, Composer image will install on PHP 7.3 platform and it will install PHPUnit 6.x. It will failed on PHP 5.5 container for PHPUnit 6.x require PHP ^7.0.
Of course, we can use the config.platform.php
config to force platform version on PHP 5.5 and it will install PHPUnit 4.x, but PHPUnit 4.x use too many deprecated functions, e.g. each(), so that cannot work on PHP >=7.2.
Finally, I think that build image on every version is the good idea.
Usage for GitHub Actions
Via GitHub Workflow
- uses: MilesChou/composer-action@master
with:
args: install
Use install image
- uses: MilesChou/composer-action/install@master
With specify PHP version
- uses: MilesChou/composer-action/5.5/install@master
Usage for Docker
See Docker Hub
Usage for GitHub Container Registry
Supported tags and respective Dockerfile
links
Notice: Default tags is using Composer v2.
latest
,8.2
(8.2/Dockerfile)8.1
(8.1/Dockerfile)8.0
(8.0/Dockerfile)7.4
(7.4/Dockerfile)7.3
(7.3/Dockerfile)7.2
(7.2/Dockerfile)7.1
(7.1/Dockerfile)7.0
(7.0/Dockerfile)5.6
(5.6/Dockerfile)5.5
(5.5/Dockerfile)
Here is tags for using Composer v1:
v1
,8.2-v1
(8.2/Dockerfile)8.1-v1
(8.1/Dockerfile)8.0-v1
(8.0/Dockerfile)7.4-v1
(7.4/Dockerfile)7.3-v1
(7.3/Dockerfile)7.2-v1
(7.2/Dockerfile)7.1-v1
(7.1/Dockerfile)7.0-v1
(7.0/Dockerfile)5.6-v1
(5.6/Dockerfile)5.5-v1
(5.5/Dockerfile) - no longer update
The following is built-in tools:
- git
- zip
- hirak/prestissimo (Composer v1)
Credits
License
The MIT License (MIT). Please see License File for more information.