mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 21:33:06 +07:00
commit
c0d425d939
26
README.md
26
README.md
@ -43,10 +43,11 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
- [Composer GitHub OAuth](#composer-github-oauth)
|
- [Composer GitHub OAuth](#composer-github-oauth)
|
||||||
- [Problem Matchers](#problem-matchers)
|
- [Problem Matchers](#problem-matchers)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
|
- [Versioning](#bookmark-versioning)
|
||||||
- [License](#scroll-license)
|
- [License](#scroll-license)
|
||||||
- [Contributions](#1-contributions)
|
- [Contributions](#1-contributions)
|
||||||
- [Support This Project](#sparkling_heart-support-this-project)
|
- [Support This Project](#sparkling_heart-support-this-project)
|
||||||
- [Dependencies](#bookmark-dependencies)
|
- [Dependencies](#package-dependencies)
|
||||||
- [Further Reading](#bookmark_tabs-further-reading)
|
- [Further Reading](#bookmark_tabs-further-reading)
|
||||||
|
|
||||||
## :tada: PHP Support
|
## :tada: PHP Support
|
||||||
@ -594,7 +595,7 @@ For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-p
|
|||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
Examples for setting up this GitHub Action with different PHP Frameworks/Packages.
|
Examples of using `setup-php` with various PHP Frameworks and Packages.
|
||||||
|
|
||||||
|Framework/Package|Runs on|Workflow|
|
|Framework/Package|Runs on|Workflow|
|
||||||
|--- |--- |--- |
|
|--- |--- |--- |
|
||||||
@ -622,13 +623,25 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package
|
|||||||
|Yii2 Starter Kit with `PostgreSQL`|`ubuntu`|[yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL")|
|
|Yii2 Starter Kit with `PostgreSQL`|`ubuntu`|[yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL")|
|
||||||
|Zend Framework|`macOS`, `ubuntu` and `windows`|[zend-framework.yml](./examples/zend-framework.yml "GitHub Action for Zend Framework")|
|
|Zend Framework|`macOS`, `ubuntu` and `windows`|[zend-framework.yml](./examples/zend-framework.yml "GitHub Action for Zend Framework")|
|
||||||
|
|
||||||
|
## :bookmark: Versioning
|
||||||
|
|
||||||
|
- It is highly recommended to use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with latest minor and patch releases. With `v2` you automatically get the bug fixes, new features and support for latest PHP releases. For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
|
||||||
|
- Semantic release versions can also be used. It is recommended to [use dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot "Setup Dependabot with GitHub Actions") with semantic versioning to keep the actions in your workflows up to date.
|
||||||
|
- Commit SHA can also be used, but are not recommended. They have to be updated with every release manually, without which you will not get any bug fixes or new features.
|
||||||
|
- Using the `master` branch as version is highly discouraged, it might break your workflow after major releases as they have breaking changes.
|
||||||
|
- If you are using the `v1` tag or a `1.x.y` version, it is recommended that you [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` only gets critical bug fixes. Maintenance support for `v1` will be dropped with the last `PHP 8.0` release.
|
||||||
|
|
||||||
## :scroll: License
|
## :scroll: License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php"). This project has multiple [dependencies](#bookmark-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
|
- The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php").
|
||||||
|
- This project has multiple [dependencies](#bookmark-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
|
||||||
|
|
||||||
## :+1: Contributions
|
## :+1: Contributions
|
||||||
|
|
||||||
Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide"). If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/setup-php/issues "Issues reported").
|
> Contributions are welcome!
|
||||||
|
|
||||||
|
- See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide") before you start.
|
||||||
|
- If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/setup-php/issues "Issues reported").
|
||||||
|
|
||||||
## :sparkling_heart: Support This Project
|
## :sparkling_heart: Support This Project
|
||||||
|
|
||||||
@ -639,14 +652,15 @@ If this action helped you.
|
|||||||
- If you blog, write about your experience of using this action.
|
- If you blog, write about your experience of using this action.
|
||||||
- If you need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
|
- If you need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
|
||||||
|
|
||||||
## :bookmark: Dependencies
|
## :package: Dependencies
|
||||||
|
|
||||||
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
|
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
|
||||||
- [gplessis/dotdeb-php](https://github.com/gplessis/dotdeb-php "Packaging for end of life PHP versions")
|
- [gplessis/dotdeb-php](https://github.com/gplessis/dotdeb-php "Packaging for end of life PHP versions")
|
||||||
- [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
|
- [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
|
||||||
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Packaging active PHP packages")
|
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Packaging active PHP packages")
|
||||||
- [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions "GitHub action to help with caching PHP extensions")
|
- [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions "GitHub action to help with caching PHP extensions")
|
||||||
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds for MacOS")
|
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds on MacOS")
|
||||||
|
- [shivammathur/homebrew-extensions](https://github.com/shivammathur/homebrew-extensions "Tap for PHP extensions on MacOS")
|
||||||
- [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package")
|
- [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package")
|
||||||
- [shivammathur/php5-darwin](https://github.com/shivammathur/php5-darwin "Scripts to setup PHP5 versions on darwin")
|
- [shivammathur/php5-darwin](https://github.com/shivammathur/php5-darwin "Scripts to setup PHP5 versions on darwin")
|
||||||
- [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions on ubuntu")
|
- [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions on ubuntu")
|
||||||
|
@ -114,12 +114,15 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
let darwin: string = await extensions.addExtension(
|
let darwin: string = await extensions.addExtension(
|
||||||
'Xdebug, pcov, sqlite, :intl, ast-beta, grpc-1.2.3',
|
'Xdebug, pcov, grpc, protobuf, swoole, sqlite, :intl, ast-beta, grpc-1.2.3',
|
||||||
'7.2',
|
'7.2',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
expect(darwin).toContain('add_brew_extension pcov');
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
|
expect(darwin).toContain('add_brew_extension grpc');
|
||||||
|
expect(darwin).toContain('add_brew_extension protobuf');
|
||||||
|
expect(darwin).toContain('add_brew_extension swoole');
|
||||||
expect(darwin).toContain('sudo pecl install -f sqlite3');
|
expect(darwin).toContain('sudo pecl install -f sqlite3');
|
||||||
expect(darwin).toContain('remove_extension intl');
|
expect(darwin).toContain('remove_extension intl');
|
||||||
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
||||||
|
@ -384,7 +384,7 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it('checking addTools on linux', async () => {
|
it('checking addTools on linux', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'blackfire, blackfire-player, cs2pr, flex, php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony, wp-cli',
|
'blackfire, blackfire-player, cs2pr, flex, php-cs-fixer, phplint, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony, wp-cli',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -419,6 +419,7 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain('add_pecl');
|
expect(script).toContain('add_pecl');
|
||||||
expect(script).toContain('add_composertool flex flex symfony/');
|
expect(script).toContain('add_composertool flex flex symfony/');
|
||||||
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
||||||
|
expect(script).toContain('add_composertool phplint phplint overtrue/');
|
||||||
expect(script).toContain('add_composertool phinx phinx:1.2.3 robmorgan/');
|
expect(script).toContain('add_composertool phinx phinx:1.2.3 robmorgan/');
|
||||||
expect(script).toContain('add_devtools');
|
expect(script).toContain('add_devtools');
|
||||||
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
17
dist/index.js
vendored
17
dist/index.js
vendored
@ -1918,7 +1918,7 @@ async function getCleanedToolsList(tools_csv) {
|
|||||||
.map(function (extension) {
|
.map(function (extension) {
|
||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(/symfony\/|laravel\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, '');
|
.replace(/hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
return [...new Set(tools_list)];
|
return [...new Set(tools_list)];
|
||||||
@ -2062,6 +2062,9 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
case 'phinx':
|
case 'phinx':
|
||||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'phplint':
|
||||||
|
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||||
|
break;
|
||||||
case 'prestissimo':
|
case 'prestissimo':
|
||||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||||
break;
|
break;
|
||||||
@ -2773,13 +2776,13 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
command =
|
command =
|
||||||
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
||||||
break;
|
break;
|
||||||
// match 5.6xdebug, 7.0xdebug...7.4xdebug, 8.0xdebug
|
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||||
command = 'add_brew_extension xdebug';
|
// match 7.1pcov to 8.0pcov
|
||||||
break;
|
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|swoole)/.test(version_extension):
|
||||||
// match 7.1pcov...7.4pcov, 8.0pcov
|
case /(5\.6|7\.[0-4])(grpc|protobuf)/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
command = 'add_brew_extension pcov';
|
command = 'add_brew_extension ' + ext_name;
|
||||||
break;
|
break;
|
||||||
// match 5.6redis
|
// match 5.6redis
|
||||||
case /5\.6redis/.test(version_extension):
|
case /5\.6redis/.test(version_extension):
|
||||||
|
1759
package-lock.json
generated
1759
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.3.1",
|
"version": "2.3.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -30,22 +30,22 @@
|
|||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.0",
|
"@types/jest": "^26.0.3",
|
||||||
"@types/node": "^14.0.13",
|
"@types/node": "^14.0.14",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.3.0",
|
"@typescript-eslint/eslint-plugin": "^3.5.0",
|
||||||
"@typescript-eslint/parser": "^3.3.0",
|
"@typescript-eslint/parser": "^3.5.0",
|
||||||
"@zeit/ncc": "^0.22.3",
|
"@zeit/ncc": "^0.22.3",
|
||||||
"eslint": "^7.2.0",
|
"eslint": "^7.3.1",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"eslint-plugin-import": "^2.21.2",
|
"eslint-plugin-import": "^2.22.0",
|
||||||
"eslint-plugin-jest": "^23.13.2",
|
"eslint-plugin-jest": "^23.17.1",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"husky": "^4.2.5",
|
"husky": "^4.2.5",
|
||||||
"jest": "^26.0.1",
|
"jest": "^26.1.0",
|
||||||
"jest-circus": "^26.0.1",
|
"jest-circus": "^26.1.0",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"ts-jest": "^26.1.0",
|
"ts-jest": "^26.1.1",
|
||||||
"typescript": "^3.9.5"
|
"typescript": "^3.9.6"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"skipCI": true,
|
"skipCI": true,
|
||||||
|
@ -83,13 +83,13 @@ export async function addExtensionDarwin(
|
|||||||
command =
|
command =
|
||||||
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
||||||
break;
|
break;
|
||||||
// match 5.6xdebug, 7.0xdebug...7.4xdebug, 8.0xdebug
|
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||||
command = 'add_brew_extension xdebug';
|
// match 7.1pcov to 8.0pcov
|
||||||
break;
|
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|swoole)/.test(version_extension):
|
||||||
// match 7.1pcov...7.4pcov, 8.0pcov
|
case /(5\.6|7\.[0-4])(grpc|protobuf)/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
command = 'add_brew_extension pcov';
|
command = 'add_brew_extension ' + ext_name;
|
||||||
break;
|
break;
|
||||||
// match 5.6redis
|
// match 5.6redis
|
||||||
case /5\.6redis/.test(version_extension):
|
case /5\.6redis/.test(version_extension):
|
||||||
|
@ -18,6 +18,7 @@ add_log() {
|
|||||||
|
|
||||||
# Function to read env inputs.
|
# Function to read env inputs.
|
||||||
read_env() {
|
read_env() {
|
||||||
|
. /etc/lsb-release
|
||||||
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
||||||
[ "$update" = false ] && [[ -n ${UPDATE} ]] && update="${UPDATE}"
|
[ "$update" = false ] && [[ -n ${UPDATE} ]] && update="${UPDATE}"
|
||||||
[[ -z "${runner}" ]] && runner='github' && RUNNER='github' || runner="${runner}"
|
[[ -z "${runner}" ]] && runner='github' && RUNNER='github' || runner="${runner}"
|
||||||
@ -32,19 +33,24 @@ update_lists() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to add ppa:ondrej/php.
|
||||||
|
add_ppa() {
|
||||||
|
if ! apt-cache policy | grep -q ondrej/php; then
|
||||||
|
LC_ALL=C.UTF-8 sudo apt-add-repository ppa:ondrej/php -y
|
||||||
|
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
||||||
|
sudo "$debconf_fix" apt-get update
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup environment for self-hosted runners.
|
# Function to setup environment for self-hosted runners.
|
||||||
self_hosted_setup() {
|
self_hosted_setup() {
|
||||||
echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf
|
echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf
|
||||||
if ! command -v apt-fast >/dev/null; then
|
if ! command -v apt-fast >/dev/null; then
|
||||||
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
||||||
fi
|
fi
|
||||||
update_lists && $apt_install curl make lsb-release software-properties-common unzip
|
update_lists && $apt_install curl make software-properties-common unzip
|
||||||
if ! apt-cache policy | grep -q ondrej/php; then
|
add_ppa
|
||||||
LC_ALL=C.UTF-8 sudo apt-add-repository ppa:ondrej/php -y
|
|
||||||
if [ "$(lsb_release -r -s)" = "16.04" ]; then
|
|
||||||
sudo "$debconf_fix" apt-get update
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to configure PECL.
|
# Function to configure PECL.
|
||||||
@ -393,6 +399,8 @@ if [ "$runner" = "self-hosted" ]; then
|
|||||||
else
|
else
|
||||||
self_hosted_setup >/dev/null 2>&1
|
self_hosted_setup >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
elif [ "$DISTRIB_RELEASE" = "20.04" ]; then
|
||||||
|
add_ppa >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup PHP
|
# Setup PHP
|
||||||
|
@ -358,7 +358,7 @@ export async function getCleanedToolsList(
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(
|
.replace(
|
||||||
/symfony\/|laravel\/|robmorgan\/|hirak\/|narrowspark\/automatic-/,
|
/hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@ -539,6 +539,9 @@ export async function addTools(
|
|||||||
case 'phinx':
|
case 'phinx':
|
||||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'phplint':
|
||||||
|
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||||
|
break;
|
||||||
case 'prestissimo':
|
case 'prestissimo':
|
||||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user