mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
commit
0ca827ae3b
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1,5 +1,6 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
open_collective: setup-php
|
||||
tidelift: "npm/setup-php"
|
||||
community_bridge: setup-php
|
||||
patreon: shivammathur
|
||||
|
2
.github/SECURITY.md
vendored
2
.github/SECURITY.md
vendored
@ -7,7 +7,7 @@ The following versions of this project are supported for security updates.
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.9.x | :white_check_mark: |
|
||||
| 2.4.x | :white_check_mark: |
|
||||
| 2.5.x | :white_check_mark: |
|
||||
|
||||
## Supported PHP Versions
|
||||
|
||||
|
171
README.md
171
README.md
@ -9,9 +9,13 @@
|
||||
<p align="center">
|
||||
<a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
|
||||
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://codecov.io/gh/shivammathur/setup-php/branch/master/graph/badge.svg"></a>
|
||||
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
|
||||
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.3-8892BF.svg"></a>
|
||||
<a href="https://twitter.com/setup_php" title="setup-php twitter"><img alt="setup-php twitter" src="https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter"></a>
|
||||
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
|
||||
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.0-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit&logoColor=FF5700&labelColor=555555"></a>
|
||||
<a href="https://twitter.com/setup_php" title="setup-php twitter"><img alt="setup-php twitter" src="https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555"></a>
|
||||
<a href="https://setup-php.statuspage.io/" title="setup-php status"><img alt="setup-php status" src="https://img.shields.io/badge/status-subscribe-28A745?logo=statuspage&logoColor=28A745&labelColor=555555"></a>
|
||||
</p>
|
||||
|
||||
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
|
||||
@ -100,11 +104,12 @@ Both `GitHub-hosted` runners and `self-hosted` runners are supported on the foll
|
||||
- On `ubuntu` by default extensions which are available as a package can be installed. PECL extensions if not available as a package can be installed by specifying `pecl` in the tools input.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: pecl
|
||||
extensions: swoole
|
||||
- name: Setup PHP with pecl extension
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: pecl
|
||||
extensions: swoole
|
||||
```
|
||||
|
||||
- On `windows` PECL extensions which have the `DLL` binary can be installed.
|
||||
@ -116,30 +121,43 @@ with:
|
||||
- Specific versions of PECL extensions can be installed by suffixing the version. This is useful for installing old versions of extensions which support end of life PHP versions.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '5.4'
|
||||
tools: pecl
|
||||
extensions: swoole-1.9.3
|
||||
- name: Setup PHP with specific version of PECL extension
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '5.4'
|
||||
tools: pecl
|
||||
extensions: swoole-1.9.3
|
||||
```
|
||||
|
||||
- Pre-release versions of PECL extensions can be setup by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: pecl
|
||||
extensions: xdebug-beta
|
||||
- name: Setup PHP with pre-release PECL extension
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: pecl
|
||||
extensions: xdebug-beta
|
||||
```
|
||||
|
||||
- Shared extensions can be removed by prefixing them with a `:`.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
extensions: :opcache
|
||||
- name: Setup PHP and remove shared extension
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
extensions: :opcache
|
||||
```
|
||||
|
||||
- Extension `intl` can be setup with specific `ICU` version for `PHP 5.6` to `PHP 7.4` in `Ubuntu` workflows by suffixing `intl` with the `ICU` version. `ICU 50.2` and newer versions are supported. Refer to [`ICU builds`](https://github.com/shivammathur/icu-intl#icu4c-builds) for the specific versions supported.
|
||||
|
||||
```yaml
|
||||
- name: Setup PHP with intl
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
extensions: intl-67.1
|
||||
```
|
||||
|
||||
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
|
||||
@ -150,36 +168,42 @@ with:
|
||||
|
||||
These tools can be setup globally using the `tools` input.
|
||||
|
||||
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
||||
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: php-cs-fixer, phpunit
|
||||
- name: Setup PHP with tools
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: php-cs-fixer, phpunit
|
||||
```
|
||||
|
||||
To setup a particular version of a tool, specify it in the form `tool:version`.
|
||||
Latest stable version of `composer` is setup by default. You can setup the required version by specifying `v1`, `v2`, `snapshot` or `preview` as version.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: composer:v2
|
||||
- name: Setup PHP with composer v2
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: composer:v2
|
||||
```
|
||||
|
||||
Version for other tools should be in `semver` format and a valid release of the tool.
|
||||
Latest versions of both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input. Please refer to the [official documentation](https://blackfire.io/docs/integrations/ci/github-actions "Blackfire.io documentation for GitHub Actions") for using `blackfire` with GitHub Actions.
|
||||
|
||||
Version for other tools should be in `semver` format and a valid release of the tool.
|
||||
This is useful for installing tools for older versions of PHP.
|
||||
For example to setup `PHPUnit` on `PHP 7.2`.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: php-cs-fixer:2.16.2, phpunit:8.5.1
|
||||
- name: Setup PHP with tools
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.2'
|
||||
tools: phpunit:8.5.8
|
||||
```
|
||||
|
||||
**Notes**
|
||||
- Latest versions of both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input.
|
||||
- If you have a tool in your `composer.json`, do not setup it globally using this action as the two instances of the tool might conflict.
|
||||
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
|
||||
|
||||
@ -191,10 +215,11 @@ Specify `coverage: xdebug` to use `Xdebug`.
|
||||
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: xdebug
|
||||
- name: Setup PHP with Xdebug
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: xdebug
|
||||
```
|
||||
|
||||
### PCOV
|
||||
@ -205,11 +230,23 @@ Tests with `PCOV` run much faster than with `Xdebug`.
|
||||
If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
ini-values: pcov.directory=api #optional, see above for usage.
|
||||
coverage: pcov
|
||||
- name: Setup PHP with PCOV
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
ini-values: pcov.directory=api #optional, see above for usage.
|
||||
coverage: pcov
|
||||
```
|
||||
|
||||
`PHPUnit` 8 and above supports `PCOV` out of the box.
|
||||
If you are using `PHPUnit` 5, 6 or 7, you will need `krakjoe/pcov-clobber`.
|
||||
Before executing your tests add the following step.
|
||||
|
||||
```yaml
|
||||
- name: Setup PCOV
|
||||
run: |
|
||||
composer require pcov/clobber
|
||||
vendor/bin/pcov clobber
|
||||
```
|
||||
|
||||
### Disable Coverage
|
||||
@ -223,10 +260,11 @@ Consider disabling the coverage using this PHP action for these reasons.
|
||||
- You are profiling your code using `blackfire`.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
- name: Setup PHP with no coverage driver
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
```
|
||||
|
||||
## :memo: Usage
|
||||
@ -326,7 +364,7 @@ steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
- name: Setup nightly PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.0'
|
||||
@ -438,7 +476,7 @@ jobs:
|
||||
- You can specify the `update` environment variable to `true` to force update to the latest release.
|
||||
|
||||
```yaml
|
||||
- name: Setup PHP
|
||||
- name: Setup PHP with latest versions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
@ -453,7 +491,7 @@ jobs:
|
||||
To debug any issues, you can use the `verbose` tag instead of `v2`.
|
||||
|
||||
```yaml
|
||||
- name: Setup PHP
|
||||
- name: Setup PHP with logs
|
||||
uses: shivammathur/setup-php@verbose
|
||||
with:
|
||||
php-version: '7.4'
|
||||
@ -613,21 +651,33 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
|
||||
- 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").
|
||||
|
||||
*Join the list of setup-php contributors*
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/shivammathur/setup-php/graphs/contributors">
|
||||
<img src="https://opencollective.com/setup-php/contributors.svg?width=1024&button=false" alt="setup-php contributers" width="100%">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## :sparkling_heart: Support This Project
|
||||
|
||||
- Please star the project and share it. If you blog, please share your experience of using this action.
|
||||
- Please consider supporting our work by sponsoring using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal") or by subscribing on [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon").
|
||||
- Please consider supporting our work by sponsoring using [Open Collective](https://opencollective.com/setup-php), [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal") or [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon").
|
||||
- If you use `setup-php` at your company, please [reach out](mailto:contact@setup-php.com) to sponsor the project.
|
||||
|
||||
*Huge thanks to the following companies for supporting `setup-php`*
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<a href="https://www.jetbrains.com/?from=setup-php">
|
||||
<img src="https://shivammathur.com/jetbrains.svg" alt="JetBrains" width="150" height="85">
|
||||
</a>
|
||||
<img src="https://shivammathur.com/blank.svg" alt="spacer" width="40" height="85">
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
||||
<img src="https://shivammathur.com/tidelift.png" alt="Tidelift" width="100" height="85">
|
||||
<img src="https://shivammathur.com/jetbrains.svg" alt="JetBrains" width="106" height="60">
|
||||
</a>
|
||||
|
||||
<a href="https://blackfire.io/?utm_source=setup-php">
|
||||
<img src="https://shivammathur.com/blackfire.svg" alt="Blackfire" width="212" height="60">
|
||||
</a>
|
||||
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
||||
<img src="https://shivammathur.com/tidelift.png" alt="Tidelift" width="70" height="60">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@ -641,6 +691,7 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
|
||||
- [shivammathur/composer-cache](https://github.com/shivammathur/composer-cache "Cache composer releases")
|
||||
- [shivammathur/homebrew-extensions](https://github.com/shivammathur/homebrew-extensions "Tap for PHP extensions on MacOS")
|
||||
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds on MacOS")
|
||||
- [shivammathur/icu-intl](https://github.com/shivammathur/icu-intl "icu4c and php-intl builds")
|
||||
- [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package for Ubuntu")
|
||||
- [shivammathur/php-builder-windows](https://github.com/shivammathur/php-builder-windows "Nightly PHP package for Windows")
|
||||
- [shivammathur/php-ubuntu](https://github.com/shivammathur/php-ubuntu "Cache stable PHP Packages for Ubuntu")
|
||||
|
@ -12,9 +12,9 @@ describe('Config tests', () => {
|
||||
|
||||
win32 = await config.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'fedora'
|
||||
'openbsd'
|
||||
);
|
||||
expect(win32).toContain('Platform fedora is not supported');
|
||||
expect(win32).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
|
||||
it('checking addINIValuesOnLinux', async () => {
|
||||
@ -29,9 +29,9 @@ describe('Config tests', () => {
|
||||
|
||||
linux = await config.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'fedora'
|
||||
'openbsd'
|
||||
);
|
||||
expect(linux).toContain('Platform fedora is not supported');
|
||||
expect(linux).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
|
||||
it('checking addINIValuesOnDarwin', async () => {
|
||||
@ -45,8 +45,8 @@ describe('Config tests', () => {
|
||||
|
||||
darwin = await config.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'fedora'
|
||||
'openbsd'
|
||||
);
|
||||
expect(darwin).toContain('Platform fedora is not supported');
|
||||
expect(darwin).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
});
|
||||
|
@ -46,8 +46,8 @@ describe('Extension tests', () => {
|
||||
expect(win32).toContain('Add-Phalcon phalcon3');
|
||||
expect(win32).toContain('Add-Extension does_not_exist');
|
||||
|
||||
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(win32).toContain('Platform fedora is not supported');
|
||||
win32 = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||
expect(win32).toContain('Platform openbsd is not supported');
|
||||
|
||||
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
||||
expect(win32).toContain('Add-Blackfire blackfire');
|
||||
@ -100,8 +100,8 @@ describe('Extension tests', () => {
|
||||
linux = await extensions.addExtension('cubrid', '7.4', 'linux');
|
||||
expect(linux).toContain('add_cubrid cubrid');
|
||||
|
||||
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(linux).toContain('Platform fedora is not supported');
|
||||
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||
expect(linux).toContain('Platform openbsd is not supported');
|
||||
|
||||
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
||||
expect(linux).toContain('add_phalcon phalcon3');
|
||||
@ -119,6 +119,12 @@ describe('Extension tests', () => {
|
||||
|
||||
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
|
||||
expect(linux).toContain('add_blackfire blackfire-1.31.0');
|
||||
|
||||
linux = await extensions.addExtension('intl-65.1', '5.6', 'linux');
|
||||
expect(linux).toContain('add_intl intl-65.1');
|
||||
|
||||
linux = await extensions.addExtension('intl-67.1', '7.3', 'linux');
|
||||
expect(linux).toContain('add_intl intl-67.1');
|
||||
});
|
||||
|
||||
it('checking addExtensionOnDarwin', async () => {
|
||||
@ -195,7 +201,7 @@ describe('Extension tests', () => {
|
||||
);
|
||||
expect(darwin).toContain('add_extension does_not_exist');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(darwin).toContain('Platform fedora is not supported');
|
||||
darwin = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||
expect(darwin).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
});
|
||||
|
@ -270,8 +270,8 @@ describe('Tools tests', () => {
|
||||
expect(await tools.getSymfonyUri('1.2.3', 'win32')).toContain(
|
||||
'releases/download/v1.2.3/symfony_windows_amd64'
|
||||
);
|
||||
expect(await tools.getSymfonyUri('1.2.3', 'fedora')).toContain(
|
||||
'Platform fedora is not supported'
|
||||
expect(await tools.getSymfonyUri('1.2.3', 'openbsd')).toContain(
|
||||
'Platform openbsd is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
@ -300,21 +300,18 @@ describe('Tools tests', () => {
|
||||
it('checking addArchive', async () => {
|
||||
let script: string = await tools.addArchive(
|
||||
'tool',
|
||||
'1.2.3',
|
||||
'https://tool.com/tool.phar',
|
||||
'linux'
|
||||
);
|
||||
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
||||
script = await tools.addArchive(
|
||||
'tool',
|
||||
'1.2.3',
|
||||
'https://tool.com/tool.phar',
|
||||
'darwin'
|
||||
);
|
||||
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
||||
script = await tools.addArchive(
|
||||
'tool',
|
||||
'1.2.3',
|
||||
'https://tool.com/tool.phar',
|
||||
'win32'
|
||||
);
|
||||
@ -322,11 +319,10 @@ describe('Tools tests', () => {
|
||||
|
||||
script = await tools.addArchive(
|
||||
'tool',
|
||||
'1.2.3',
|
||||
'https://tool.com/tool.phar',
|
||||
'fedora'
|
||||
'openbsd'
|
||||
);
|
||||
expect(script).toContain('Platform fedora is not supported');
|
||||
expect(script).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
|
||||
it('checking addDevTools', async () => {
|
||||
@ -354,8 +350,8 @@ describe('Tools tests', () => {
|
||||
'Add-Log "$cross" "php-config" "php-config is not a windows tool"'
|
||||
);
|
||||
|
||||
script = await tools.addDevTools('tool', 'fedora');
|
||||
expect(script).toContain('Platform fedora is not supported');
|
||||
script = await tools.addDevTools('tool', 'openbsd');
|
||||
expect(script).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
|
||||
it('checking addPackage', async () => {
|
||||
@ -373,13 +369,13 @@ describe('Tools tests', () => {
|
||||
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'win32');
|
||||
expect(script).toContain('Add-Composertool tool tool:1.2.3 user/');
|
||||
|
||||
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'fedora');
|
||||
expect(script).toContain('Platform fedora is not supported');
|
||||
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'openbsd');
|
||||
expect(script).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
|
||||
it('checking addTools on linux', async () => {
|
||||
const script: string = await tools.addTools(
|
||||
'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, php-cs-fixer, phplint, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, protoc, symfony, wp-cli',
|
||||
'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, php-cs-fixer, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, php-config, phpize, protoc, symfony, wp-cli',
|
||||
'7.4',
|
||||
'linux'
|
||||
);
|
||||
@ -399,6 +395,9 @@ describe('Tools tests', () => {
|
||||
expect(script).toContain(
|
||||
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan'
|
||||
);
|
||||
expect(script).toContain(
|
||||
'add_tool https://www.phing.info/get/phing-latest.phar phing'
|
||||
);
|
||||
expect(script).toContain(
|
||||
'add_tool https://phar.io/releases/phive.phar phive'
|
||||
);
|
||||
@ -436,6 +435,7 @@ describe('Tools tests', () => {
|
||||
'infection',
|
||||
'phan',
|
||||
'phan:2.7.2',
|
||||
'phing:1.2.3',
|
||||
'phinx',
|
||||
'phive:1.2.3',
|
||||
'php-config',
|
||||
@ -483,6 +483,9 @@ describe('Tools tests', () => {
|
||||
expect(script).toContain(
|
||||
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan'
|
||||
);
|
||||
expect(script).toContain(
|
||||
'add_tool https://www.phing.info/get/phing-1.2.3.phar phing'
|
||||
);
|
||||
expect(script).toContain(
|
||||
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs'
|
||||
);
|
||||
|
@ -131,8 +131,8 @@ describe('Utils tests', () => {
|
||||
expect(step_log).toEqual('step_log "Test message"');
|
||||
step_log = await utils.stepLog(message, 'darwin');
|
||||
expect(step_log).toEqual('step_log "Test message"');
|
||||
step_log = await utils.stepLog(message, 'fedora');
|
||||
expect(step_log).toContain('Platform fedora is not supported');
|
||||
step_log = await utils.stepLog(message, 'openbsd');
|
||||
expect(step_log).toContain('Platform openbsd is not supported');
|
||||
|
||||
let add_log: string = await utils.addLog(
|
||||
'tick',
|
||||
@ -145,8 +145,8 @@ describe('Utils tests', () => {
|
||||
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
||||
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'darwin');
|
||||
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
||||
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'fedora');
|
||||
expect(add_log).toContain('Platform fedora is not supported');
|
||||
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'openbsd');
|
||||
expect(add_log).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
|
||||
it('checking getExtensionPrefix', async () => {
|
||||
@ -163,8 +163,8 @@ describe('Utils tests', () => {
|
||||
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
||||
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
||||
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
||||
expect(await utils.suppressOutput('fedora')).toContain(
|
||||
'Platform fedora is not supported'
|
||||
expect(await utils.suppressOutput('openbsd')).toContain(
|
||||
'Platform openbsd is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
@ -178,8 +178,8 @@ describe('Utils tests', () => {
|
||||
expect(await utils.getCommand('linux', 'tool')).toBe('add_tool ');
|
||||
expect(await utils.getCommand('darwin', 'tool')).toBe('add_tool ');
|
||||
expect(await utils.getCommand('win32', 'tool')).toBe('Add-Tool ');
|
||||
expect(await utils.getCommand('fedora', 'tool')).toContain(
|
||||
'Platform fedora is not supported'
|
||||
expect(await utils.getCommand('openbsd', 'tool')).toContain(
|
||||
'Platform openbsd is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
@ -191,8 +191,8 @@ describe('Utils tests', () => {
|
||||
expect(await utils.scriptExtension('linux')).toBe('.sh');
|
||||
expect(await utils.scriptExtension('darwin')).toBe('.sh');
|
||||
expect(await utils.scriptExtension('win32')).toBe('.ps1');
|
||||
expect(await utils.scriptExtension('fedora')).toContain(
|
||||
'Platform fedora is not supported'
|
||||
expect(await utils.scriptExtension('openbsd')).toContain(
|
||||
'Platform openbsd is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
|
62
dist/index.js
vendored
62
dist/index.js
vendored
@ -973,7 +973,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -1030,7 +1030,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -1682,7 +1682,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -1986,11 +1986,10 @@ exports.getCleanedToolsList = getCleanedToolsList;
|
||||
* Helper function to get script to setup a tool using a phar url
|
||||
*
|
||||
* @param tool
|
||||
* @param version
|
||||
* @param url
|
||||
* @param os_version
|
||||
*/
|
||||
async function addArchive(tool, version, url, os_version) {
|
||||
async function addArchive(tool, url, os_version) {
|
||||
return (await utils.getCommand(os_version, 'tool')) + url + ' ' + tool;
|
||||
}
|
||||
exports.addArchive = addArchive;
|
||||
@ -2054,22 +2053,22 @@ async function addTools(tools_csv, php_version, os_version) {
|
||||
break;
|
||||
case 'blackfire-player':
|
||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'codeception':
|
||||
url =
|
||||
'https://codeception.com/' +
|
||||
(await getCodeceptionUri(version, php_version));
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer':
|
||||
url = await getComposerUrl(version);
|
||||
script += await addArchive('composer', version, url, os_version);
|
||||
script += await addArchive('composer', url, os_version);
|
||||
break;
|
||||
case 'composer-normalize':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'ergebnis/composer-normalize/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer-prefetcher':
|
||||
script += await addPackage(tool, release, 'narrowspark/automatic-', os_version);
|
||||
@ -2077,35 +2076,39 @@ async function addTools(tools_csv, php_version, os_version) {
|
||||
case 'composer-require-checker':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'maglnet/ComposerRequireChecker/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer-unused':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'composer-unused/composer-unused/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'cs2pr':
|
||||
uri = await getUri(tool, '', version, 'releases', '', 'download');
|
||||
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'deployer':
|
||||
url = await getDeployerUrl(version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'flex':
|
||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||
break;
|
||||
case 'infection':
|
||||
url = github + 'infection/infection/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'pecl':
|
||||
script += await utils.getCommand(os_version, 'pecl');
|
||||
break;
|
||||
case 'phan':
|
||||
url = github + 'phan/phan/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phing':
|
||||
url = 'https://www.phing.info/get/phing-' + version + '.phar';
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phinx':
|
||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||
@ -2120,48 +2123,48 @@ async function addTools(tools_csv, php_version, os_version) {
|
||||
case 'php-cs-fixer':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
|
||||
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpcbf':
|
||||
case 'phpcs':
|
||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpcpd':
|
||||
case 'phpunit':
|
||||
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phplint':
|
||||
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||
break;
|
||||
case 'phpmd':
|
||||
url = github + 'phpmd/phpmd/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpstan':
|
||||
url = github + 'phpstan/phpstan/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'prestissimo':
|
||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||
break;
|
||||
case 'psalm':
|
||||
url = github + 'vimeo/psalm/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'symfony':
|
||||
case 'symfony-cli':
|
||||
uri = await getSymfonyUri(version, os_version);
|
||||
url = github + 'symfony/cli/' + uri;
|
||||
script += await addArchive('symfony', version, url, os_version);
|
||||
script += await addArchive('symfony', url, os_version);
|
||||
break;
|
||||
case 'vapor-cli':
|
||||
script += await addPackage(tool, release, 'laravel/', os_version);
|
||||
break;
|
||||
case 'wp-cli':
|
||||
url = github + (await getWpCliUrl(version));
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
default:
|
||||
script += await utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
|
||||
@ -2209,7 +2212,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -2352,7 +2355,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -2445,7 +2448,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -2467,6 +2470,8 @@ const matchers = __importStar(__webpack_require__(86));
|
||||
* @param os_version
|
||||
*/
|
||||
async function build(filename, version, os_version) {
|
||||
const name = 'setup-php';
|
||||
const url = 'setup-php.com/support';
|
||||
// taking inputs
|
||||
const extension_csv = (await utils.getInput('extensions', false)) ||
|
||||
(await utils.getInput('extension', false));
|
||||
@ -2490,6 +2495,8 @@ async function build(filename, version, os_version) {
|
||||
if (ini_values_csv) {
|
||||
script += await config.addINIValues(ini_values_csv, os_version);
|
||||
}
|
||||
script += '\n' + (await utils.stepLog('Support this project', os_version));
|
||||
script += '\n' + (await utils.addLog('$tick', name, url, os_version));
|
||||
return await utils.writeScript(filename, script);
|
||||
}
|
||||
exports.build = build;
|
||||
@ -2763,7 +2770,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -2950,6 +2957,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
case /^5\.6intl-[\d]+\.[\d]+$|^7\.[0-4]intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
|
774
package-lock.json
generated
774
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-php",
|
||||
"version": "2.4.3",
|
||||
"version": "2.5.0",
|
||||
"private": false,
|
||||
"description": "Setup PHP for use with GitHub Actions",
|
||||
"main": "dist/index.js",
|
||||
@ -24,28 +24,28 @@
|
||||
"author": "shivammathur",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.4",
|
||||
"@actions/core": "^1.2.5",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/io": "^1.0.2",
|
||||
"fs": "0.0.1-security"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.10",
|
||||
"@types/node": "^14.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
||||
"@typescript-eslint/parser": "^3.9.1",
|
||||
"@types/jest": "^26.0.13",
|
||||
"@types/node": "^14.6.4",
|
||||
"@typescript-eslint/eslint-plugin": "^4.0.1",
|
||||
"@typescript-eslint/parser": "^4.0.1",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"eslint": "^7.7.0",
|
||||
"eslint": "^7.8.1",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-jest": "^23.20.0",
|
||||
"eslint-plugin-jest": "^24.0.0",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.4.0",
|
||||
"jest-circus": "^26.4.0",
|
||||
"prettier": "^2.0.5",
|
||||
"ts-jest": "^26.2.0",
|
||||
"typescript": "^3.9.7"
|
||||
"jest": "^26.4.2",
|
||||
"jest-circus": "^26.4.2",
|
||||
"prettier": "^2.1.1",
|
||||
"ts-jest": "^26.3.0",
|
||||
"typescript": "^4.0.2"
|
||||
},
|
||||
"husky": {
|
||||
"skipCI": true,
|
||||
|
@ -245,6 +245,9 @@ export async function addExtensionLinux(
|
||||
version_extension
|
||||
):
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
case /^5\.6intl-[\d]+\.[\d]+$|^7\.[0-4]intl-[\d]+\.[\d]+$/.test(
|
||||
version_extension
|
||||
):
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
|
@ -19,6 +19,8 @@ export async function build(
|
||||
version: string,
|
||||
os_version: string
|
||||
): Promise<string> {
|
||||
const name = 'setup-php';
|
||||
const url = 'setup-php.com/support';
|
||||
// taking inputs
|
||||
const extension_csv: string =
|
||||
(await utils.getInput('extensions', false)) ||
|
||||
@ -48,6 +50,9 @@ export async function build(
|
||||
script += await config.addINIValues(ini_values_csv, os_version);
|
||||
}
|
||||
|
||||
script += '\n' + (await utils.stepLog('Support this project', os_version));
|
||||
script += '\n' + (await utils.addLog('$tick', name, url, os_version));
|
||||
|
||||
return await utils.writeScript(filename, script);
|
||||
}
|
||||
|
||||
|
23
src/scripts/ext/intl.sh
Normal file
23
src/scripts/ext/intl.sh
Normal file
@ -0,0 +1,23 @@
|
||||
# Function to install ICU
|
||||
install_icu() {
|
||||
icu=$1
|
||||
if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
|
||||
sudo curl -o /tmp/icu.tar.zst -sL "https://dl.bintray.com/shivammathur/icu4c/icu4c-$icu.tar.zst"
|
||||
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
|
||||
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to add ext-intl with the given version of ICU
|
||||
add_intl() {
|
||||
icu=$(echo "$1" | cut -d'-' -f 2)
|
||||
supported_version=$(curl "${curl_opts[@]:?}" https://api.bintray.com/packages/shivammathur/icu4c/icu4c | grep -Po "$icu" | head -n 1)
|
||||
if [ "$icu" != "$supported_version" ]; then
|
||||
add_log "${cross:?}" "intl" "ICU $icu is not supported"
|
||||
else
|
||||
install_icu "$icu" >/dev/null 2>&1
|
||||
sudo curl "${curl_opts[@]:?}" -o "${ext_dir:?}/intl.so" "https://dl.bintray.com/shivammathur/icu4c/php${version:?}-intl-$icu.so"
|
||||
enable_extension intl extension
|
||||
add_extension_log intl "Installed and enabled with ICU $icu"
|
||||
fi
|
||||
}
|
@ -41,6 +41,7 @@ cleanup_lists() {
|
||||
sudo mv /etc/apt/sources.list.d /etc/apt/sources.list.d.save
|
||||
sudo mkdir /etc/apt/sources.list.d
|
||||
sudo mv /etc/apt/sources.list.d.save/*ondrej*.list /etc/apt/sources.list.d/
|
||||
sudo mv /etc/apt/sources.list.d.save/*dotdeb*.list /etc/apt/sources.list.d/ 2>/dev/null || true
|
||||
trap "sudo mv /etc/apt/sources.list.d.save/*.list /etc/apt/sources.list.d/" exit
|
||||
fi
|
||||
}
|
||||
@ -124,7 +125,10 @@ delete_extension() {
|
||||
sudo sed -i "/$extension/d" "$pecl_file"
|
||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
||||
[ "$runner" = "self-hosted" ] && $apt_remove "php-$extension"
|
||||
if [ "$runner" = "self-hosted" ]; then
|
||||
$apt_remove "php-$extension" >/dev/null 2>&1 || true
|
||||
$apt_remove "php$version-$extension" >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to disable and delete extensions.
|
||||
@ -229,7 +233,7 @@ add_extension_from_source() {
|
||||
(
|
||||
add_devtools
|
||||
delete_extension "$extension"
|
||||
curl -o /tmp/"$extension".tar.gz "${curl_opts[@]}" https://github.com/"$repo"/archive/"$release".tar.gz
|
||||
curl -o /tmp/"$extension".tar.gz "${curl_opts[@]}" https://github.com/"$repo"/archive/"$release".tar.gz
|
||||
tar xf /tmp/"$extension".tar.gz -C /tmp
|
||||
cd /tmp/"$extension-$release" || exit 1
|
||||
phpize && ./configure "$args" && make && sudo make install
|
||||
|
@ -1,5 +1,9 @@
|
||||
# Function to add blackfire and blackfire-agent.
|
||||
Function Add-Blackfire() {
|
||||
$arch_name ='amd64'
|
||||
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||
$arch_name = '386'
|
||||
}
|
||||
$agent_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).agent
|
||||
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
||||
|
@ -1,12 +1,12 @@
|
||||
get_protobuf_tag() {
|
||||
if [ "$protobuf_tag" = "latest" ]; then
|
||||
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+.[0-9]+.[0-9]+)" | head -n 1)
|
||||
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
||||
else
|
||||
status_code=$(sudo curl -s -w "%{http_code}" -o /tmp/protobuf.tmp "${curl_opts[@]:?}" "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
||||
if [ "$status_code" = "200" ]; then
|
||||
protobuf_tag="v$protobuf_tag"
|
||||
else
|
||||
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+.[0-9]+.[0-9]+)" | head -n 1)
|
||||
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -64,6 +64,20 @@ Function Add-Path {
|
||||
Get-PathFromRegistry
|
||||
}
|
||||
|
||||
# Function to make sure printf is in PATH.
|
||||
Function Add-Printf {
|
||||
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
|
||||
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
||||
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe
|
||||
} else {
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip"
|
||||
Expand-Archive -Path $bin_dir\printf.zip -DestinationPath $bin_dir -Force
|
||||
}
|
||||
} else {
|
||||
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value "C:\Program Files\Git\usr\bin\printf.exe"
|
||||
}
|
||||
}
|
||||
|
||||
# Function to get a clean Powershell profile.
|
||||
Function Get-CleanPSProfile {
|
||||
if(-not(Test-Path -LiteralPath $profile)) {
|
||||
@ -75,13 +89,12 @@ Function Get-CleanPSProfile {
|
||||
|
||||
# Function to install PhpManager.
|
||||
Function Install-PhpManager() {
|
||||
$repo = "mlocati/powershell-phpmanager"
|
||||
$tag = (Invoke-RestMethod https://api.github.com/repos/$repo/tags)[0].Name
|
||||
$module_path = "$bin_dir\PhpManager\powershell-phpmanager-$tag\PhpManager\PhpManager.psm1"
|
||||
$module_path = "$bin_dir\PhpManager\PhpManager.psm1"
|
||||
if(-not (Test-Path $module_path -PathType Leaf)) {
|
||||
$release = Invoke-RestMethod https://api.github.com/repos/mlocati/powershell-phpmanager/releases/latest
|
||||
$zip_file = "$bin_dir\PhpManager.zip"
|
||||
Invoke-WebRequest -UseBasicParsing -Uri https://github.com/$repo/archive/$tag.zip -OutFile $zip_file
|
||||
Expand-Archive -Path $zip_file -DestinationPath $bin_dir\PhpManager -Force
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $release.assets[0].browser_download_url -OutFile $zip_file
|
||||
Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force
|
||||
}
|
||||
Import-Module $module_path
|
||||
Add-ToProfile $current_profile 'powershell-phpmanager' "Import-Module $module_path"
|
||||
@ -276,17 +289,14 @@ $master_version = '8.0'
|
||||
$cert_source='CurrentUser'
|
||||
|
||||
$arch = 'x64'
|
||||
$arch_name ='amd64'
|
||||
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||
$arch = 'x86'
|
||||
$arch_name = '386'
|
||||
}
|
||||
|
||||
$ts = $env:PHPTS -eq 'ts'
|
||||
if($env:PHPTS -ne 'ts') {
|
||||
$env:PHPTS = 'nts'
|
||||
}
|
||||
|
||||
if($env:RUNNER -eq 'self-hosted') {
|
||||
$bin_dir = 'C:\tools\bin'
|
||||
$php_dir = "$php_dir$version"
|
||||
@ -295,10 +305,6 @@ if($env:RUNNER -eq 'self-hosted') {
|
||||
Get-CleanPSProfile >$null 2>&1
|
||||
New-Item $bin_dir -Type Directory 2>&1 | Out-Null
|
||||
Add-Path -PathItem $bin_dir
|
||||
if(-not(Test-Path $bin_dir\printf.exe)) {
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/printf/releases/latest/download/printf-$arch.zip" -OutFile "$bin_dir\printf.zip" >$null 2>&1
|
||||
Expand-Archive -Path $bin_dir\printf.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
||||
}
|
||||
if($version -lt 5.6) {
|
||||
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
|
||||
Start-Sleep 1
|
||||
@ -316,6 +322,8 @@ if($env:RUNNER -eq 'self-hosted') {
|
||||
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
|
||||
}
|
||||
}
|
||||
|
||||
Add-Printf >$null 2>&1
|
||||
Step-Log "Setup PhpManager"
|
||||
Install-PhpManager >$null 2>&1
|
||||
Add-Log $tick "PhpManager" "Installed"
|
||||
|
42
src/tools.ts
42
src/tools.ts
@ -346,13 +346,11 @@ export async function getCleanedToolsList(
|
||||
* Helper function to get script to setup a tool using a phar url
|
||||
*
|
||||
* @param tool
|
||||
* @param version
|
||||
* @param url
|
||||
* @param os_version
|
||||
*/
|
||||
export async function addArchive(
|
||||
tool: string,
|
||||
version: string,
|
||||
url: string,
|
||||
os_version: string
|
||||
): Promise<string> {
|
||||
@ -449,22 +447,22 @@ export async function addTools(
|
||||
break;
|
||||
case 'blackfire-player':
|
||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'codeception':
|
||||
url =
|
||||
'https://codeception.com/' +
|
||||
(await getCodeceptionUri(version, php_version));
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer':
|
||||
url = await getComposerUrl(version);
|
||||
script += await addArchive('composer', version, url, os_version);
|
||||
script += await addArchive('composer', url, os_version);
|
||||
break;
|
||||
case 'composer-normalize':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'ergebnis/composer-normalize/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer-prefetcher':
|
||||
script += await addPackage(
|
||||
@ -477,35 +475,39 @@ export async function addTools(
|
||||
case 'composer-require-checker':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'maglnet/ComposerRequireChecker/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer-unused':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'composer-unused/composer-unused/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'cs2pr':
|
||||
uri = await getUri(tool, '', version, 'releases', '', 'download');
|
||||
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'deployer':
|
||||
url = await getDeployerUrl(version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'flex':
|
||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||
break;
|
||||
case 'infection':
|
||||
url = github + 'infection/infection/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'pecl':
|
||||
script += await utils.getCommand(os_version, 'pecl');
|
||||
break;
|
||||
case 'phan':
|
||||
url = github + 'phan/phan/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phing':
|
||||
url = 'https://www.phing.info/get/phing-' + version + '.phar';
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phinx':
|
||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||
@ -520,48 +522,48 @@ export async function addTools(
|
||||
case 'php-cs-fixer':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
|
||||
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpcbf':
|
||||
case 'phpcs':
|
||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpcpd':
|
||||
case 'phpunit':
|
||||
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phplint':
|
||||
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||
break;
|
||||
case 'phpmd':
|
||||
url = github + 'phpmd/phpmd/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpstan':
|
||||
url = github + 'phpstan/phpstan/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'prestissimo':
|
||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||
break;
|
||||
case 'psalm':
|
||||
url = github + 'vimeo/psalm/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'symfony':
|
||||
case 'symfony-cli':
|
||||
uri = await getSymfonyUri(version, os_version);
|
||||
url = github + 'symfony/cli/' + uri;
|
||||
script += await addArchive('symfony', version, url, os_version);
|
||||
script += await addArchive('symfony', url, os_version);
|
||||
break;
|
||||
case 'vapor-cli':
|
||||
script += await addPackage(tool, release, 'laravel/', os_version);
|
||||
break;
|
||||
case 'wp-cli':
|
||||
url = github + (await getWpCliUrl(version));
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
default:
|
||||
script += await utils.addLog(
|
||||
|
Loading…
Reference in New Issue
Block a user