mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-07 23:50:33 +07:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
eaaab1cec3 | |||
853381d0bb | |||
1394617d60 | |||
093498a0a1 | |||
d2241010ef | |||
a0f02c17c0 | |||
bb5257e07d | |||
f687ff8f21 | |||
537c66b2ea | |||
073c2e666b | |||
465e63b28c | |||
b8f0b066dc | |||
9e663851ce | |||
ad196941ed | |||
f8e867a9ff | |||
8cb01730c7 | |||
ebba1db2c3 | |||
716331904e | |||
2ad63ddbd3 | |||
c4606c9269 | |||
7dcb43c768 | |||
691c5309aa | |||
84b222366a | |||
b98ed88402 | |||
0ca827ae3b | |||
16b0a25bf6 | |||
fa0af5c382 | |||
db36b200b1 | |||
7cfd76cc1b | |||
682b1f5e44 |
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@ -8,7 +8,7 @@ Please note that this project is released with a [Contributor Code of Conduct](C
|
|||||||
|
|
||||||
* Fork the project.
|
* Fork the project.
|
||||||
* Make your bug fix or feature addition.
|
* Make your bug fix or feature addition.
|
||||||
* Add tests for it. This is important so we don't break it in a future version unintentionally.
|
* Add tests for it, so we don't break it in a future version unintentionally.
|
||||||
* If editing the scripts, create a demo integration test.
|
* If editing the scripts, create a demo integration test.
|
||||||
* Send a pull request to the develop branch with all the details.
|
* Send a pull request to the develop branch with all the details.
|
||||||
|
|
||||||
|
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1,5 +1,6 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
open_collective: setup-php
|
||||||
tidelift: "npm/setup-php"
|
tidelift: "npm/setup-php"
|
||||||
community_bridge: setup-php
|
community_bridge: setup-php
|
||||||
patreon: shivammathur
|
patreon: shivammathur
|
||||||
|
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -11,7 +11,7 @@ assignees: 'shivammathur'
|
|||||||
<!-- Please describe the bug concisely. -->
|
<!-- Please describe the bug concisely. -->
|
||||||
|
|
||||||
**Version**
|
**Version**
|
||||||
- [ ] I have checked releases and the bug exists in the latest patch version of `v1` or `v2`.
|
- [ ] I have checked releases, and the bug exists in the latest patch version of `v1` or `v2`.
|
||||||
- [ ] `v2`
|
- [ ] `v2`
|
||||||
- [ ] `v1`
|
- [ ] `v1`
|
||||||
|
|
||||||
|
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -11,7 +11,7 @@ assignees: 'shivammathur'
|
|||||||
<!-- Please describe concisely the feature you want to add. -->
|
<!-- Please describe concisely the feature you want to add. -->
|
||||||
|
|
||||||
**Version**
|
**Version**
|
||||||
- [ ] I have checked releases and the feature is missing in the latest patch version of `v2`.
|
- [ ] I have checked releases, and the feature is missing in the latest patch version of `v2`.
|
||||||
|
|
||||||
**Underlying issue**
|
**Underlying issue**
|
||||||
<!-- Please describe the issue this would solve. -->
|
<!-- Please describe the issue this would solve. -->
|
||||||
|
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -5,12 +5,12 @@ labels: bug or enhancement
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## A Pull Request should be associated with an Issue.
|
## A Pull Request should be associated with a Discussion.
|
||||||
|
|
||||||
> If you're fixing a bug, adding a new feature or improving something please provide the details in Issues,
|
> If you're fixing a bug, adding a new feature or improving something please provide the details in discussions,
|
||||||
> so that the development can be pointed in the intended direction.
|
> so that the development can be pointed in the intended direction.
|
||||||
|
|
||||||
Related issue: <!-- Please link the related issue -->
|
Related discussion: <!-- Please link the related discussion -->
|
||||||
|
|
||||||
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
|
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
|
||||||
> Thank you for your contribution.
|
> Thank you for your contribution.
|
||||||
|
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 |
|
| Version | Supported |
|
||||||
| ------- | ------------------ |
|
| ------- | ------------------ |
|
||||||
| 1.9.x | :white_check_mark: |
|
| 1.9.x | :white_check_mark: |
|
||||||
| 2.4.x | :white_check_mark: |
|
| 2.6.x | :white_check_mark: |
|
||||||
|
|
||||||
## Supported PHP Versions
|
## Supported PHP Versions
|
||||||
|
|
||||||
|
175
README.md
175
README.md
@ -8,10 +8,14 @@
|
|||||||
|
|
||||||
<p align="center">
|
<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://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://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://img.shields.io/codecov/c/github/shivammathur/setup-php?logo=codecov"></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="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-%3E%3D%205.3-8892BF.svg"></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>
|
||||||
<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>
|
</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>
|
</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.
|
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,8 +104,9 @@ 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.
|
- 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
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with pecl extension
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
tools: pecl
|
tools: pecl
|
||||||
extensions: swoole
|
extensions: swoole
|
||||||
@ -116,8 +121,9 @@ 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.
|
- 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
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with specific version of PECL extension
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '5.4'
|
php-version: '5.4'
|
||||||
tools: pecl
|
tools: pecl
|
||||||
extensions: swoole-1.9.3
|
extensions: swoole-1.9.3
|
||||||
@ -126,8 +132,9 @@ with:
|
|||||||
- Pre-release versions of PECL extensions can be setup by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
|
- Pre-release versions of PECL extensions can be setup by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with pre-release PECL extension
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
tools: pecl
|
tools: pecl
|
||||||
extensions: xdebug-beta
|
extensions: xdebug-beta
|
||||||
@ -136,12 +143,23 @@ with:
|
|||||||
- Shared extensions can be removed by prefixing them with a `:`.
|
- Shared extensions can be removed by prefixing them with a `:`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP and remove shared extension
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
extensions: :opcache
|
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.
|
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
|
||||||
|
|
||||||
- These extensions have custom support - `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`, and `blackfire`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
|
- These extensions have custom support - `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`, and `blackfire`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
|
||||||
@ -150,11 +168,12 @@ with:
|
|||||||
|
|
||||||
These tools can be setup globally using the `tools` input.
|
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`
|
`behat`, `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`, `phpspec`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with tools
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
tools: php-cs-fixer, phpunit
|
tools: php-cs-fixer, phpunit
|
||||||
```
|
```
|
||||||
@ -163,23 +182,29 @@ 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.
|
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
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with composer v2
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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.
|
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
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with tools
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
tools: php-cs-fixer:2.16.2, phpunit:8.5.1
|
php-version: '7.2'
|
||||||
|
tools: phpunit:8.5.8
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes**
|
**Notes**
|
||||||
- Latest versions of both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input.
|
- This is useful to set up tools which you only use in GitHub Actions, thus keeping your `composer.json` tidy.
|
||||||
- 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.
|
- 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.
|
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
|
||||||
|
|
||||||
@ -191,8 +216,9 @@ Specify `coverage: xdebug` to use `Xdebug`.
|
|||||||
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
|
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with Xdebug
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
```
|
```
|
||||||
@ -205,13 +231,25 @@ 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.
|
If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with PCOV
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
ini-values: pcov.directory=api #optional, see above for usage.
|
ini-values: pcov.directory=api #optional, see above for usage.
|
||||||
coverage: pcov
|
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
|
### Disable Coverage
|
||||||
|
|
||||||
Specify `coverage: none` to remove both `Xdebug` and `PCOV`.
|
Specify `coverage: none` to remove both `Xdebug` and `PCOV`.
|
||||||
@ -223,8 +261,9 @@ Consider disabling the coverage using this PHP action for these reasons.
|
|||||||
- You are profiling your code using `blackfire`.
|
- You are profiling your code using `blackfire`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with no coverage driver
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
coverage: none
|
coverage: none
|
||||||
```
|
```
|
||||||
@ -237,6 +276,7 @@ with:
|
|||||||
|
|
||||||
- Specify the PHP version you want to setup.
|
- Specify the PHP version you want to setup.
|
||||||
- Accepts a `string`. For example `'7.4'`.
|
- Accepts a `string`. For example `'7.4'`.
|
||||||
|
- Accepts `latest` to set up the latest stable PHP version.
|
||||||
- See [PHP support](#tada-php-support) for supported PHP versions.
|
- See [PHP support](#tada-php-support) for supported PHP versions.
|
||||||
|
|
||||||
#### `extensions` (optional)
|
#### `extensions` (optional)
|
||||||
@ -326,7 +366,7 @@ steps:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup nightly PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.0'
|
php-version: '8.0'
|
||||||
@ -438,7 +478,7 @@ jobs:
|
|||||||
- You can specify the `update` environment variable to `true` to force update to the latest release.
|
- You can specify the `update` environment variable to `true` to force update to the latest release.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP with latest versions
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
@ -453,7 +493,7 @@ jobs:
|
|||||||
To debug any issues, you can use the `verbose` tag instead of `v2`.
|
To debug any issues, you can use the `verbose` tag instead of `v2`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP with logs
|
||||||
uses: shivammathur/setup-php@verbose
|
uses: shivammathur/setup-php@verbose
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
@ -526,9 +566,11 @@ If you have a number of workflows which setup multiple tools or have many compos
|
|||||||
|
|
||||||
### Problem Matchers
|
### Problem Matchers
|
||||||
|
|
||||||
|
Problem matchers are `json` configurations which identify errors and warnings in your logs and surface that information prominently in the GitHub Actions UI by highlighting them and creating code annotations.
|
||||||
|
|
||||||
#### PHP
|
#### PHP
|
||||||
|
|
||||||
Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step. This will scan the logs for PHP errors and warnings, and surface them prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup problem matchers for PHP
|
- name: Setup problem matchers for PHP
|
||||||
@ -537,29 +579,59 @@ Setup problem matchers for your `PHP` output by adding this step after the `setu
|
|||||||
|
|
||||||
#### PHPUnit
|
#### PHPUnit
|
||||||
|
|
||||||
Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step. This will scan the logs for failing tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup problem matchers for PHPUnit
|
- name: Setup problem matchers for PHPUnit
|
||||||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Other Tools
|
#### PHPStan
|
||||||
|
|
||||||
For tools that support `checkstyle` reporting like `phpstan`, `psalm`, `php-cs-fixer` and `phpcs` you can use `cs2pr` to annotate your code.
|
PHPStan supports error reporting in GitHub Actions, so no problem matchers are required.
|
||||||
For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-pull-request-from-checkstyle).
|
|
||||||
|
|
||||||
> Here is an example with `phpstan`.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
tools: cs2pr, phpstan
|
tools: phpstan
|
||||||
|
|
||||||
- name: PHPStan
|
- name: Run PHPStan
|
||||||
run: phpstan analyse src --error-format=checkstyle | cs2pr
|
run: phpstan analyse src
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Psalm
|
||||||
|
|
||||||
|
Psalm supports error reporting in GitHub Actions with an output format `github`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
tools: psalm
|
||||||
|
|
||||||
|
- name: Run Psalm
|
||||||
|
run: psalm --output-format=github
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Tools with checkstyle support
|
||||||
|
|
||||||
|
For tools that support `checkstyle` reporting like `phpstan`, `psalm`, `php-cs-fixer` and `phpcs` you can use `cs2pr` to annotate your code.
|
||||||
|
For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-pull-request-from-checkstyle).
|
||||||
|
|
||||||
|
> Here is an example with `phpcs`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
tools: cs2pr, phpcs
|
||||||
|
|
||||||
|
- name: Run phpcs
|
||||||
|
run: phpcs -q --report=checkstyle src | cs2pr
|
||||||
```
|
```
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -613,21 +685,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.
|
- 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").
|
- 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
|
## :sparkling_heart: Support This Project
|
||||||
|
|
||||||
- Please star the project and share it. If you blog, please share your experience of using this action.
|
- 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.
|
- 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`*
|
*Huge thanks to the following companies for supporting `setup-php`*
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="https://www.jetbrains.com/?from=setup-php">
|
<a href="https://www.jetbrains.com/?from=setup-php">
|
||||||
<img src="https://shivammathur.com/jetbrains.svg" alt="JetBrains" width="150" height="85">
|
<img src="https://shivammathur.com/jetbrains.svg" alt="JetBrains" width="106" height="60">
|
||||||
</a>
|
</a>
|
||||||
<img src="https://shivammathur.com/blank.svg" alt="spacer" width="40" height="85">
|
|
||||||
|
<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">
|
<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/tidelift.png" alt="Tidelift" width="70" height="60">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -641,6 +725,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/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-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/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](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-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")
|
- [shivammathur/php-ubuntu](https://github.com/shivammathur/php-ubuntu "Cache stable PHP Packages for Ubuntu")
|
||||||
|
@ -70,7 +70,7 @@ describe('Extension tests', () => {
|
|||||||
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
|
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('remove_extension intl');
|
expect(linux).toContain('remove_extension intl');
|
||||||
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-ast');
|
expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-ast');
|
||||||
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-uopz');
|
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-uopz');
|
||||||
expect(linux).toContain('add_unstable_extension ast beta extension');
|
expect(linux).toContain('add_unstable_extension ast beta extension');
|
||||||
expect(linux).toContain('add_pdo_extension mysql');
|
expect(linux).toContain('add_pdo_extension mysql');
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import * as install from '../src/install';
|
import * as install from '../src/install';
|
||||||
|
import * as utils from '../src/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock install.ts
|
* Mock install.ts
|
||||||
*/
|
*/
|
||||||
jest.mock('../src/install', () => ({
|
jest.mock('../src/install', () => ({
|
||||||
build: jest.fn().mockImplementation(
|
getScript: jest.fn().mockImplementation(
|
||||||
async (
|
async (
|
||||||
filename: string,
|
filename: string,
|
||||||
version: string,
|
version: string,
|
||||||
@ -39,24 +40,18 @@ jest.mock('../src/install', () => ({
|
|||||||
run: jest.fn().mockImplementation(
|
run: jest.fn().mockImplementation(
|
||||||
async (): Promise<string> => {
|
async (): Promise<string> => {
|
||||||
const os_version: string = process.env['RUNNER_OS'] || '';
|
const os_version: string = process.env['RUNNER_OS'] || '';
|
||||||
let version: string = process.env['php-version'] || '';
|
const version: string = await utils.parseVersion(
|
||||||
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
await utils.getInput('php-version', true)
|
||||||
let script = '';
|
);
|
||||||
switch (os_version) {
|
const tool = await utils.scriptTool(os_version);
|
||||||
case 'darwin':
|
const filename = os_version + (await utils.scriptExtension(os_version));
|
||||||
case 'linux':
|
return [
|
||||||
script = await install.build(os_version + '.sh', version, os_version);
|
await install.getScript(filename, version, os_version),
|
||||||
script += 'bash script.sh ' + version + ' ' + __dirname;
|
tool,
|
||||||
break;
|
filename,
|
||||||
case 'win32':
|
version,
|
||||||
script = await install.build(os_version + '.sh', version, os_version);
|
__dirname
|
||||||
script += 'pwsh script.ps1 ' + version + ' ' + __dirname;
|
].join(' ');
|
||||||
break;
|
|
||||||
default:
|
|
||||||
script += os_version + ' is not supported';
|
|
||||||
}
|
|
||||||
|
|
||||||
return script;
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
@ -93,13 +88,13 @@ describe('Install', () => {
|
|||||||
|
|
||||||
let script: string = '' + (await install.run());
|
let script: string = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('pwsh script.ps1 7.0 ' + __dirname);
|
expect(script).toContain('pwsh win32.ps1 7.0 ' + __dirname);
|
||||||
|
|
||||||
setEnv('7.3', 'win32', '', '', '', '');
|
setEnv('7.3', 'win32', '', '', '', '');
|
||||||
|
|
||||||
script = '' + (await install.run());
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
|
expect(script).toContain('pwsh win32.ps1 7.3 ' + __dirname);
|
||||||
|
|
||||||
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '');
|
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '');
|
||||||
|
|
||||||
@ -108,7 +103,7 @@ describe('Install', () => {
|
|||||||
expect(script).toContain('install extensions');
|
expect(script).toContain('install extensions');
|
||||||
expect(script).toContain('edit php.ini');
|
expect(script).toContain('edit php.ini');
|
||||||
expect(script).toContain('set coverage driver');
|
expect(script).toContain('set coverage driver');
|
||||||
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
|
expect(script).toContain('pwsh win32.ps1 7.3 ' + __dirname);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Test install on linux', async () => {
|
it('Test install on linux', async () => {
|
||||||
@ -116,7 +111,13 @@ describe('Install', () => {
|
|||||||
|
|
||||||
let script: string = '' + (await install.run());
|
let script: string = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 7.3 ');
|
expect(script).toContain('bash linux.sh 7.3 ');
|
||||||
|
|
||||||
|
setEnv('latest', 'linux', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash linux.sh 7.4 ');
|
||||||
|
|
||||||
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit');
|
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit');
|
||||||
|
|
||||||
@ -125,7 +126,7 @@ describe('Install', () => {
|
|||||||
expect(script).toContain('install extensions');
|
expect(script).toContain('install extensions');
|
||||||
expect(script).toContain('edit php.ini');
|
expect(script).toContain('edit php.ini');
|
||||||
expect(script).toContain('set coverage driver');
|
expect(script).toContain('set coverage driver');
|
||||||
expect(script).toContain('bash script.sh 7.3');
|
expect(script).toContain('bash linux.sh 7.3');
|
||||||
expect(script).toContain('add_tool');
|
expect(script).toContain('add_tool');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ describe('Install', () => {
|
|||||||
|
|
||||||
let script: string = '' + (await install.run());
|
let script: string = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 7.3 ' + __dirname);
|
expect(script).toContain('bash darwin.sh 7.3 ' + __dirname);
|
||||||
|
|
||||||
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '');
|
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '');
|
||||||
|
|
||||||
@ -143,7 +144,7 @@ describe('Install', () => {
|
|||||||
expect(script).toContain('install extensions');
|
expect(script).toContain('install extensions');
|
||||||
expect(script).toContain('edit php.ini');
|
expect(script).toContain('edit php.ini');
|
||||||
expect(script).toContain('set coverage driver');
|
expect(script).toContain('set coverage driver');
|
||||||
expect(script).toContain('bash script.sh 7.3 ' + __dirname);
|
expect(script).toContain('bash darwin.sh 7.3 ' + __dirname);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Test malformed version inputs', async () => {
|
it('Test malformed version inputs', async () => {
|
||||||
@ -151,18 +152,18 @@ describe('Install', () => {
|
|||||||
|
|
||||||
let script: string = '' + '' + (await install.run());
|
let script: string = '' + '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 7.4 ' + __dirname);
|
expect(script).toContain('bash darwin.sh 7.4 ' + __dirname);
|
||||||
|
|
||||||
setEnv(8.0, 'darwin', '', '', '', '');
|
setEnv(8.0, 'darwin', '', '', '', '');
|
||||||
|
|
||||||
script = '' + (await install.run());
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 8.0 ' + __dirname);
|
expect(script).toContain('bash darwin.sh 8.0 ' + __dirname);
|
||||||
|
|
||||||
setEnv(8, 'darwin', '', '', '', '');
|
setEnv(8, 'darwin', '', '', '', '');
|
||||||
|
|
||||||
script = '' + (await install.run());
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 8.0 ' + __dirname);
|
expect(script).toContain('bash darwin.sh 8.0 ' + __dirname);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
import * as io from '@actions/io';
|
|
||||||
import * as matchers from '../src/matchers';
|
|
||||||
|
|
||||||
jest.mock('@actions/io');
|
|
||||||
|
|
||||||
describe('Matchers', () => {
|
|
||||||
it('Add matchers', async () => {
|
|
||||||
process.env['RUNNER_TOOL_CACHE'] = __dirname;
|
|
||||||
await matchers.addMatchers();
|
|
||||||
const spy = jest.spyOn(io, 'cp');
|
|
||||||
expect(spy).toHaveBeenCalledTimes(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Test PHPUnit Regex', async () => {
|
|
||||||
const regex1 = /^\d+\)\s.*$/;
|
|
||||||
const regex2 = /^(.*Failed\sasserting\sthat.*)$/;
|
|
||||||
const regex3 = /^\s*$/;
|
|
||||||
const regex4 = /^(.*):(\d+)$/;
|
|
||||||
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);
|
|
||||||
expect(regex2.test('Failed asserting that false is true')).toBe(true);
|
|
||||||
expect(regex3.test('\n')).toBe(true);
|
|
||||||
expect(regex4.test('/path/to/file.php:42')).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Test PHP Regex', async () => {
|
|
||||||
const regex1 = /^(.*error):\s+\s+(.+) in (.+) on line (\d+)$/;
|
|
||||||
const regex2 = /^(.*Warning|.*Deprecated|.*Notice):\s+\s+(.+) in (.+) on line (\d+)$/;
|
|
||||||
expect(
|
|
||||||
regex1.test('PHP Parse error: error_message in file.php on line 10')
|
|
||||||
).toBe(true);
|
|
||||||
expect(
|
|
||||||
regex2.test('PHP Notice: info_message in file.php on line 10')
|
|
||||||
).toBe(true);
|
|
||||||
expect(
|
|
||||||
regex2.test('PHP Warning: warning_message in file.php on line 10')
|
|
||||||
).toBe(true);
|
|
||||||
expect(
|
|
||||||
regex2.test('PHP Deprecated: deprecated_message in file.php on line 10')
|
|
||||||
).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
@ -277,14 +277,19 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it('checking getCleanedToolsList', async () => {
|
it('checking getCleanedToolsList', async () => {
|
||||||
const tools_list: string[] = await tools.getCleanedToolsList(
|
const tools_list: string[] = await tools.getCleanedToolsList(
|
||||||
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
|
'tool, composer:1.2.3, behat/behat, icanhazstring/composer-unused, laravel/vapor-cli, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher, phpspec/phpspec, symfony/flex'
|
||||||
);
|
);
|
||||||
expect(tools_list).toStrictEqual([
|
expect(tools_list).toStrictEqual([
|
||||||
'composer',
|
'composer',
|
||||||
'tool',
|
'tool',
|
||||||
|
'behat',
|
||||||
|
'composer-unused',
|
||||||
|
'vapor-cli',
|
||||||
'phinx',
|
'phinx',
|
||||||
'prestissimo',
|
'prestissimo',
|
||||||
'composer-prefetcher'
|
'composer-prefetcher',
|
||||||
|
'phpspec',
|
||||||
|
'flex'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -301,44 +306,46 @@ describe('Tools tests', () => {
|
|||||||
let script: string = await tools.addArchive(
|
let script: string = await tools.addArchive(
|
||||||
'tool',
|
'tool',
|
||||||
'https://tool.com/tool.phar',
|
'https://tool.com/tool.phar',
|
||||||
'linux'
|
'linux',
|
||||||
|
'-v'
|
||||||
);
|
);
|
||||||
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
||||||
script = await tools.addArchive(
|
script = await tools.addArchive(
|
||||||
'tool',
|
'tool',
|
||||||
'https://tool.com/tool.phar',
|
'https://tool.com/tool.phar',
|
||||||
'darwin'
|
'darwin',
|
||||||
|
'-v'
|
||||||
);
|
);
|
||||||
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
||||||
script = await tools.addArchive(
|
script = await tools.addArchive(
|
||||||
'tool',
|
'tool',
|
||||||
'https://tool.com/tool.phar',
|
'https://tool.com/tool.phar',
|
||||||
'win32'
|
'win32',
|
||||||
|
'-v'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Tool https://tool.com/tool.phar tool');
|
expect(script).toContain('Add-Tool https://tool.com/tool.phar tool');
|
||||||
|
|
||||||
script = await tools.addArchive(
|
script = await tools.addArchive(
|
||||||
'tool',
|
'tool',
|
||||||
'https://tool.com/tool.phar',
|
'https://tool.com/tool.phar',
|
||||||
'openbsd'
|
'openbsd',
|
||||||
|
'-v'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Platform openbsd is not supported');
|
expect(script).toContain('Platform openbsd is not supported');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addDevTools', async () => {
|
it('checking addDevTools', async () => {
|
||||||
let script: string = await tools.addDevTools('phpize', 'linux');
|
let script: string = await tools.addDevTools('phpize', 'linux');
|
||||||
expect(script).toContain('add_devtools');
|
expect(script).toContain('add_devtools phpize');
|
||||||
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
|
||||||
|
|
||||||
script = await tools.addDevTools('php-config', 'linux');
|
script = await tools.addDevTools('php-config', 'linux');
|
||||||
expect(script).toContain('add_devtools');
|
expect(script).toContain('add_devtools php-config');
|
||||||
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
|
||||||
|
|
||||||
script = await tools.addDevTools('phpize', 'darwin');
|
script = await tools.addDevTools('phpize', 'darwin');
|
||||||
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
expect(script).toContain('add_devtools phpize');
|
||||||
|
|
||||||
script = await tools.addDevTools('php-config', 'darwin');
|
script = await tools.addDevTools('php-config', 'darwin');
|
||||||
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
expect(script).toContain('add_devtools php-config');
|
||||||
|
|
||||||
script = await tools.addDevTools('phpize', 'win32');
|
script = await tools.addDevTools('phpize', 'win32');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
@ -381,34 +388,34 @@ describe('Tools tests', () => {
|
|||||||
);
|
);
|
||||||
expect(script).toContain('add_blackfire');
|
expect(script).toContain('add_blackfire');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
|
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar php-cs-fixer'
|
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar php-cs-fixer "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan'
|
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://www.phing.info/get/phing-latest.phar phing'
|
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://phar.io/releases/phive.phar phive'
|
'add_tool https://phar.io/releases/phive.phar phive status'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
|
'add_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony version'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain('add_protoc latest');
|
expect(script).toContain('add_protoc latest');
|
||||||
expect(script).toContain('add_grpc_php_plugin latest');
|
expect(script).toContain('add_grpc_php_plugin latest');
|
||||||
@ -417,12 +424,12 @@ describe('Tools tests', () => {
|
|||||||
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 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 php-config');
|
||||||
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
expect(script).toContain('add_devtools phpize');
|
||||||
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
|
||||||
});
|
});
|
||||||
it('checking addTools on darwin', async () => {
|
it('checking addTools on darwin', async () => {
|
||||||
const listOfTools = [
|
const listOfTools = [
|
||||||
|
'behat',
|
||||||
'blackfire',
|
'blackfire',
|
||||||
'blackfire-player',
|
'blackfire-player',
|
||||||
'composer-normalize',
|
'composer-normalize',
|
||||||
@ -444,6 +451,7 @@ describe('Tools tests', () => {
|
|||||||
'phpcs',
|
'phpcs',
|
||||||
'phpize',
|
'phpize',
|
||||||
'phpmd',
|
'phpmd',
|
||||||
|
'phpspec',
|
||||||
'protoc:v1.2.3',
|
'protoc:v1.2.3',
|
||||||
'psalm',
|
'psalm',
|
||||||
'symfony',
|
'symfony',
|
||||||
@ -460,72 +468,74 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
expect(script).toContain('add_blackfire');
|
expect(script).toContain('add_blackfire');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
|
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize'
|
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/maglnet/ComposerRequireChecker/releases/latest/download/composer-require-checker.phar composer-require-checker'
|
'add_tool https://github.com/maglnet/ComposerRequireChecker/releases/latest/download/composer-require-checker.phar composer-require-checker "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused'
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
|
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection'
|
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan'
|
'add_tool https://www.phing.info/get/phing-1.2.3.phar phing "-v"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://www.phing.info/get/phing-1.2.3.phar phing'
|
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs'
|
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf'
|
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd'
|
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
|
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"'
|
||||||
);
|
|
||||||
expect(script).toContain(
|
|
||||||
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
|
|
||||||
);
|
);
|
||||||
expect(script).toContain('add_grpc_php_plugin 1.2.3');
|
expect(script).toContain('add_grpc_php_plugin 1.2.3');
|
||||||
expect(script).toContain('add_protoc 1.2.3');
|
expect(script).toContain('add_protoc 1.2.3');
|
||||||
|
expect(script).toContain('add_composertool behat behat behat/');
|
||||||
|
expect(script).toContain('add_composertool phpspec phpspec phpspec/');
|
||||||
expect(script).toContain('add_composertool vapor-cli vapor-cli laravel/');
|
expect(script).toContain('add_composertool vapor-cli vapor-cli laravel/');
|
||||||
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(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phan/phan/releases/download/2.7.2/phan.phar phan'
|
'add_tool https://github.com/phan/phan/releases/download/2.7.2/phan.phar phan "-v"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_composertool composer-unused composer-unused icanhazstring/'
|
||||||
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony version'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony'
|
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony version'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
expect(script).toContain('add_devtools phpize');
|
||||||
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
expect(script).toContain('add_devtools php-config');
|
||||||
});
|
});
|
||||||
it('checking addTools on windows', async () => {
|
it('checking addTools on windows', async () => {
|
||||||
const listOfTools = [
|
const listOfTools = [
|
||||||
@ -554,31 +564,31 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
expect(script).toContain('Add-Blackfire');
|
expect(script).toContain('Add-Blackfire');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player'
|
'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Composertool flex flex symfony/');
|
expect(script).toContain('Add-Composertool flex flex symfony/');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://deployer.org/deployer.phar deployer'
|
'Add-Tool https://deployer.org/deployer.phar deployer "-V"'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
|
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive status'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony'
|
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony version'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
|
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
);
|
);
|
||||||
expect(script).toContain('phpize is not a windows tool');
|
expect(script).toContain('phpize is not a windows tool');
|
||||||
expect(script).toContain('php-config is not a windows tool');
|
expect(script).toContain('php-config is not a windows tool');
|
||||||
@ -621,7 +631,7 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
script = await tools.addTools('composer:preview', '7.4', 'linux');
|
script = await tools.addTools('composer:preview', '7.4', 'linux');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'
|
||||||
);
|
);
|
||||||
script = await tools.addTools(
|
script = await tools.addTools(
|
||||||
'composer:v1, composer:preview, composer:snapshot',
|
'composer:v1, composer:preview, composer:snapshot',
|
||||||
@ -629,7 +639,7 @@ describe('Tools tests', () => {
|
|||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -17,13 +17,26 @@ async function cleanup(path: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('Utils tests', () => {
|
describe('Utils tests', () => {
|
||||||
|
it('checking readEnv', async () => {
|
||||||
|
process.env['test'] = 'setup-php';
|
||||||
|
expect(await utils.readEnv('test')).toBe('setup-php');
|
||||||
|
expect(await utils.readEnv('undefined')).toBe('');
|
||||||
|
});
|
||||||
|
|
||||||
it('checking getInput', async () => {
|
it('checking getInput', async () => {
|
||||||
process.env['test'] = 'setup-php';
|
process.env['test'] = 'setup-php';
|
||||||
process.env['undefined'] = '';
|
|
||||||
expect(await utils.getInput('test', false)).toBe('setup-php');
|
expect(await utils.getInput('test', false)).toBe('setup-php');
|
||||||
expect(await utils.getInput('undefined', false)).toBe('');
|
|
||||||
expect(await utils.getInput('setup-php', false)).toBe('setup-php');
|
expect(await utils.getInput('setup-php', false)).toBe('setup-php');
|
||||||
expect(await utils.getInput('DoesNotExist', false)).toBe('');
|
expect(await utils.getInput('DoesNotExist', false)).toBe('');
|
||||||
|
expect(async () => {
|
||||||
|
await utils.getInput('DoesNotExist', true);
|
||||||
|
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking parseVersion', async () => {
|
||||||
|
expect(await utils.parseVersion('7')).toBe('7.0');
|
||||||
|
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
||||||
|
expect(await utils.parseVersion('latest')).toBe('7.4');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking asyncForEach', async () => {
|
it('checking asyncForEach', async () => {
|
||||||
@ -196,6 +209,15 @@ describe('Utils tests', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking scriptTool', async () => {
|
||||||
|
expect(await utils.scriptTool('linux')).toBe('bash');
|
||||||
|
expect(await utils.scriptTool('darwin')).toBe('bash');
|
||||||
|
expect(await utils.scriptTool('win32')).toBe('pwsh');
|
||||||
|
expect(await utils.scriptTool('openbsd')).toContain(
|
||||||
|
'Platform openbsd is not supported'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('checking customPackage', async () => {
|
it('checking customPackage', async () => {
|
||||||
const script_path: string = path.join('ext', 'pkg.sh');
|
const script_path: string = path.join('ext', 'pkg.sh');
|
||||||
expect(await utils.customPackage('pkg', 'ext', '1.2.3', 'linux')).toContain(
|
expect(await utils.customPackage('pkg', 'ext', '1.2.3', 'linux')).toContain(
|
||||||
|
308
dist/index.js
vendored
308
dist/index.js
vendored
@ -953,46 +953,29 @@ class ExecState extends events.EventEmitter {
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 86:
|
/***/ 82:
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
// We use any as a valid input type
|
||||||
if (k2 === undefined) k2 = k;
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
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);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.addMatchers = void 0;
|
|
||||||
const path = __importStar(__webpack_require__(622));
|
|
||||||
const utils = __importStar(__webpack_require__(163));
|
|
||||||
const io = __importStar(__webpack_require__(1));
|
|
||||||
/**
|
/**
|
||||||
* Cache json files for problem matchers
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
|
* @param input input to sanitize into a string
|
||||||
*/
|
*/
|
||||||
async function addMatchers() {
|
function toCommandValue(input) {
|
||||||
const config_path = path.join(__dirname, '..', 'src', 'configs');
|
if (input === null || input === undefined) {
|
||||||
const runner_dir = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
return '';
|
||||||
await io.cp(path.join(config_path, 'phpunit.json'), runner_dir);
|
}
|
||||||
await io.cp(path.join(config_path, 'php.json'), runner_dir);
|
else if (typeof input === 'string' || input instanceof String) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return JSON.stringify(input);
|
||||||
}
|
}
|
||||||
exports.addMatchers = addMatchers;
|
exports.toCommandValue = toCommandValue;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@ -1003,6 +986,42 @@ module.exports = require("os");
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 102:
|
||||||
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// For internal use, subject to change.
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
const fs = __importStar(__webpack_require__(747));
|
||||||
|
const os = __importStar(__webpack_require__(87));
|
||||||
|
const utils_1 = __webpack_require__(82);
|
||||||
|
function issueCommand(command, message) {
|
||||||
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
|
if (!filePath) {
|
||||||
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
throw new Error(`Missing file at path: ${filePath}`);
|
||||||
|
}
|
||||||
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.issueCommand = issueCommand;
|
||||||
|
//# sourceMappingURL=file-command.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 129:
|
/***/ 129:
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
@ -1030,15 +1049,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
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);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.customPackage = exports.scriptExtension = exports.joins = exports.getCommand = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.getInput = void 0;
|
exports.customPackage = exports.scriptTool = exports.scriptExtension = exports.joins = exports.getCommand = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.parseVersion = exports.getInput = exports.readEnv = void 0;
|
||||||
const fs = __importStar(__webpack_require__(747));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
|
/**
|
||||||
|
* Function to read environment variable and return a string value.
|
||||||
|
*
|
||||||
|
* @param property
|
||||||
|
*/
|
||||||
|
async function readEnv(property) {
|
||||||
|
const value = process.env[property];
|
||||||
|
switch (value) {
|
||||||
|
case undefined:
|
||||||
|
return '';
|
||||||
|
default:
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.readEnv = readEnv;
|
||||||
/**
|
/**
|
||||||
* Function to get inputs from both with and env annotations.
|
* Function to get inputs from both with and env annotations.
|
||||||
*
|
*
|
||||||
@ -1046,16 +1080,39 @@ const core = __importStar(__webpack_require__(470));
|
|||||||
* @param mandatory
|
* @param mandatory
|
||||||
*/
|
*/
|
||||||
async function getInput(name, mandatory) {
|
async function getInput(name, mandatory) {
|
||||||
const input = process.env[name];
|
const input = core.getInput(name);
|
||||||
switch (input) {
|
const env_input = await readEnv(name);
|
||||||
case '':
|
switch (true) {
|
||||||
case undefined:
|
case input != '':
|
||||||
return core.getInput(name, { required: mandatory });
|
|
||||||
default:
|
|
||||||
return input;
|
return input;
|
||||||
|
case input == '' && env_input != '':
|
||||||
|
return env_input;
|
||||||
|
case input == '' && env_input == '' && mandatory:
|
||||||
|
throw new Error(`Input required and not supplied: ${name}`);
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getInput = getInput;
|
exports.getInput = getInput;
|
||||||
|
/**
|
||||||
|
* Function to parse PHP version.
|
||||||
|
*
|
||||||
|
* @param version
|
||||||
|
*/
|
||||||
|
async function parseVersion(version) {
|
||||||
|
switch (version) {
|
||||||
|
case 'latest':
|
||||||
|
return '7.4';
|
||||||
|
default:
|
||||||
|
switch (true) {
|
||||||
|
case version.length > 1:
|
||||||
|
return version.slice(0, 3);
|
||||||
|
default:
|
||||||
|
return version + '.0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.parseVersion = parseVersion;
|
||||||
/**
|
/**
|
||||||
* Async foreach loop
|
* Async foreach loop
|
||||||
*
|
*
|
||||||
@ -1307,6 +1364,23 @@ async function scriptExtension(os_version) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.scriptExtension = scriptExtension;
|
exports.scriptExtension = scriptExtension;
|
||||||
|
/**
|
||||||
|
* Function to get script tool
|
||||||
|
*
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
async function scriptTool(os_version) {
|
||||||
|
switch (os_version) {
|
||||||
|
case 'win32':
|
||||||
|
return 'pwsh';
|
||||||
|
case 'linux':
|
||||||
|
case 'darwin':
|
||||||
|
return 'bash';
|
||||||
|
default:
|
||||||
|
return await log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.scriptTool = scriptTool;
|
||||||
/**
|
/**
|
||||||
* Function to get script to add tools with custom support.
|
* Function to get script to add tools with custom support.
|
||||||
*
|
*
|
||||||
@ -1348,6 +1422,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
|
const utils_1 = __webpack_require__(82);
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
@ -1401,28 +1476,14 @@ class Command {
|
|||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
||||||
* @param input input to sanitize into a string
|
|
||||||
*/
|
|
||||||
function toCommandValue(input) {
|
|
||||||
if (input === null || input === undefined) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
else if (typeof input === 'string' || input instanceof String) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
return JSON.stringify(input);
|
|
||||||
}
|
|
||||||
exports.toCommandValue = toCommandValue;
|
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return toCommandValue(s)
|
return utils_1.toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A');
|
.replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escapeProperty(s) {
|
function escapeProperty(s) {
|
||||||
return toCommandValue(s)
|
return utils_1.toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
@ -1456,6 +1517,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const command_1 = __webpack_require__(431);
|
const command_1 = __webpack_require__(431);
|
||||||
|
const file_command_1 = __webpack_require__(102);
|
||||||
|
const utils_1 = __webpack_require__(82);
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
/**
|
/**
|
||||||
@ -1482,9 +1545,17 @@ var ExitCode;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function exportVariable(name, val) {
|
function exportVariable(name, val) {
|
||||||
const convertedVal = command_1.toCommandValue(val);
|
const convertedVal = utils_1.toCommandValue(val);
|
||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||||
|
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||||
|
file_command_1.issueCommand('ENV', commandValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
@ -1500,7 +1571,13 @@ exports.setSecret = setSecret;
|
|||||||
* @param inputPath
|
* @param inputPath
|
||||||
*/
|
*/
|
||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
file_command_1.issueCommand('PATH', inputPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
|
}
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
}
|
}
|
||||||
exports.addPath = addPath;
|
exports.addPath = addPath;
|
||||||
@ -1682,7 +1759,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
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);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@ -1837,14 +1914,14 @@ async function addPhive(version, os_version) {
|
|||||||
switch (version) {
|
switch (version) {
|
||||||
case 'latest':
|
case 'latest':
|
||||||
return ((await utils.getCommand(os_version, 'tool')) +
|
return ((await utils.getCommand(os_version, 'tool')) +
|
||||||
'https://phar.io/releases/phive.phar phive');
|
'https://phar.io/releases/phive.phar phive status');
|
||||||
default:
|
default:
|
||||||
return ((await utils.getCommand(os_version, 'tool')) +
|
return ((await utils.getCommand(os_version, 'tool')) +
|
||||||
'https://github.com/phar-io/phive/releases/download/' +
|
'https://github.com/phar-io/phive/releases/download/' +
|
||||||
version +
|
version +
|
||||||
'/phive-' +
|
'/phive-' +
|
||||||
version +
|
version +
|
||||||
'.phar phive');
|
'.phar phive status');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.addPhive = addPhive;
|
exports.addPhive = addPhive;
|
||||||
@ -1976,7 +2053,7 @@ async function getCleanedToolsList(tools_csv) {
|
|||||||
.map(function (extension) {
|
.map(function (extension) {
|
||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
|
.replace(/-agent|behat\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//, '');
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
return [...new Set(tools_list)];
|
return [...new Set(tools_list)];
|
||||||
@ -1988,9 +2065,11 @@ exports.getCleanedToolsList = getCleanedToolsList;
|
|||||||
* @param tool
|
* @param tool
|
||||||
* @param url
|
* @param url
|
||||||
* @param os_version
|
* @param os_version
|
||||||
|
* @param ver_param
|
||||||
*/
|
*/
|
||||||
async function addArchive(tool, url, os_version) {
|
async function addArchive(tool, url, os_version, ver_param) {
|
||||||
return (await utils.getCommand(os_version, 'tool')) + url + ' ' + tool;
|
return ((await utils.getCommand(os_version, 'tool')) +
|
||||||
|
(await utils.joins(url, tool, ver_param)));
|
||||||
}
|
}
|
||||||
exports.addArchive = addArchive;
|
exports.addArchive = addArchive;
|
||||||
/**
|
/**
|
||||||
@ -2002,11 +2081,8 @@ exports.addArchive = addArchive;
|
|||||||
async function addDevTools(tool, os_version) {
|
async function addDevTools(tool, os_version) {
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return ('add_devtools' +
|
|
||||||
'\n' +
|
|
||||||
(await utils.addLog('$tick', tool, 'Added', 'linux')));
|
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return await utils.addLog('$tick', tool, 'Added', 'darwin');
|
return 'add_devtools ' + tool;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return await utils.addLog('$cross', tool, tool + ' is not a windows tool', 'win32');
|
return await utils.addLog('$cross', tool, tool + ' is not a windows tool', 'win32');
|
||||||
default:
|
default:
|
||||||
@ -2051,24 +2127,28 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
case 'protoc':
|
case 'protoc':
|
||||||
script += await utils.customPackage(tool, 'tools', version, os_version);
|
script += await utils.customPackage(tool, 'tools', version, os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'behat':
|
||||||
|
case 'phpspec':
|
||||||
|
script += await addPackage(tool, release, tool + '/', os_version);
|
||||||
|
break;
|
||||||
case 'blackfire-player':
|
case 'blackfire-player':
|
||||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'codeception':
|
case 'codeception':
|
||||||
url =
|
url =
|
||||||
'https://codeception.com/' +
|
'https://codeception.com/' +
|
||||||
(await getCodeceptionUri(version, php_version));
|
(await getCodeceptionUri(version, php_version));
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case 'composer':
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version);
|
||||||
script += await addArchive('composer', url, os_version);
|
script += await addArchive('composer', url, os_version, version);
|
||||||
break;
|
break;
|
||||||
case 'composer-normalize':
|
case 'composer-normalize':
|
||||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||||
url = github + 'ergebnis/composer-normalize/' + uri;
|
url = github + 'ergebnis/composer-normalize/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer-prefetcher':
|
case 'composer-prefetcher':
|
||||||
script += await addPackage(tool, release, 'narrowspark/automatic-', os_version);
|
script += await addPackage(tool, release, 'narrowspark/automatic-', os_version);
|
||||||
@ -2076,39 +2156,37 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
case 'composer-require-checker':
|
case 'composer-require-checker':
|
||||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||||
url = github + 'maglnet/ComposerRequireChecker/' + uri;
|
url = github + 'maglnet/ComposerRequireChecker/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer-unused':
|
case 'composer-unused':
|
||||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
script += await addPackage(tool, release, 'icanhazstring/', os_version);
|
||||||
url = github + 'composer-unused/composer-unused/' + uri;
|
|
||||||
script += await addArchive(tool, url, os_version);
|
|
||||||
break;
|
break;
|
||||||
case 'cs2pr':
|
case 'cs2pr':
|
||||||
uri = await getUri(tool, '', version, 'releases', '', 'download');
|
uri = await getUri(tool, '', version, 'releases', '', 'download');
|
||||||
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
|
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'deployer':
|
case 'deployer':
|
||||||
url = await getDeployerUrl(version);
|
url = await getDeployerUrl(version);
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'flex':
|
case 'flex':
|
||||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'infection':
|
case 'infection':
|
||||||
url = github + 'infection/infection/' + uri;
|
url = github + 'infection/infection/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'pecl':
|
case 'pecl':
|
||||||
script += await utils.getCommand(os_version, 'pecl');
|
script += await utils.getCommand(os_version, 'pecl');
|
||||||
break;
|
break;
|
||||||
case 'phan':
|
case 'phan':
|
||||||
url = github + 'phan/phan/' + uri;
|
url = github + 'phan/phan/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'phing':
|
case 'phing':
|
||||||
url = 'https://www.phing.info/get/phing-' + version + '.phar';
|
url = 'https://www.phing.info/get/phing-' + version + '.phar';
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'phinx':
|
case 'phinx':
|
||||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||||
@ -2123,48 +2201,48 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
case 'php-cs-fixer':
|
case 'php-cs-fixer':
|
||||||
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
|
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
|
||||||
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
|
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'phpcbf':
|
case 'phpcbf':
|
||||||
case 'phpcs':
|
case 'phpcs':
|
||||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phpcpd':
|
case 'phpcpd':
|
||||||
case 'phpunit':
|
case 'phpunit':
|
||||||
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
|
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phplint':
|
case 'phplint':
|
||||||
script += await addPackage(tool, release, 'overtrue/', os_version);
|
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'phpmd':
|
case 'phpmd':
|
||||||
url = github + 'phpmd/phpmd/' + uri;
|
url = github + 'phpmd/phpmd/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phpstan':
|
case 'phpstan':
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'prestissimo':
|
case 'prestissimo':
|
||||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'psalm':
|
case 'psalm':
|
||||||
url = github + 'vimeo/psalm/' + uri;
|
url = github + 'vimeo/psalm/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'symfony':
|
case 'symfony':
|
||||||
case 'symfony-cli':
|
case 'symfony-cli':
|
||||||
uri = await getSymfonyUri(version, os_version);
|
uri = await getSymfonyUri(version, os_version);
|
||||||
url = github + 'symfony/cli/' + uri;
|
url = github + 'symfony/cli/' + uri;
|
||||||
script += await addArchive('symfony', url, os_version);
|
script += await addArchive('symfony', url, os_version, 'version');
|
||||||
break;
|
break;
|
||||||
case 'vapor-cli':
|
case 'vapor-cli':
|
||||||
script += await addPackage(tool, release, 'laravel/', os_version);
|
script += await addPackage(tool, release, 'laravel/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'wp-cli':
|
case 'wp-cli':
|
||||||
url = github + (await getWpCliUrl(version));
|
url = github + (await getWpCliUrl(version));
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
script += await utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
|
script += await utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
|
||||||
@ -2212,7 +2290,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
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);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@ -2355,7 +2433,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
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);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@ -2448,12 +2526,12 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
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);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.run = exports.build = void 0;
|
exports.run = exports.getScript = void 0;
|
||||||
const exec_1 = __webpack_require__(986);
|
const exec_1 = __webpack_require__(986);
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const config = __importStar(__webpack_require__(641));
|
const config = __importStar(__webpack_require__(641));
|
||||||
@ -2461,7 +2539,6 @@ const coverage = __importStar(__webpack_require__(635));
|
|||||||
const extensions = __importStar(__webpack_require__(911));
|
const extensions = __importStar(__webpack_require__(911));
|
||||||
const tools = __importStar(__webpack_require__(534));
|
const tools = __importStar(__webpack_require__(534));
|
||||||
const utils = __importStar(__webpack_require__(163));
|
const utils = __importStar(__webpack_require__(163));
|
||||||
const matchers = __importStar(__webpack_require__(86));
|
|
||||||
/**
|
/**
|
||||||
* Build the script
|
* Build the script
|
||||||
*
|
*
|
||||||
@ -2469,17 +2546,15 @@ const matchers = __importStar(__webpack_require__(86));
|
|||||||
* @param version
|
* @param version
|
||||||
* @param os_version
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
async function build(filename, version, os_version) {
|
async function getScript(filename, version, os_version) {
|
||||||
|
const name = 'setup-php';
|
||||||
|
const url = 'https://setup-php.com/support';
|
||||||
// taking inputs
|
// taking inputs
|
||||||
const extension_csv = (await utils.getInput('extensions', false)) ||
|
const extension_csv = await utils.getInput('extensions', false);
|
||||||
(await utils.getInput('extension', false));
|
|
||||||
const ini_values_csv = await utils.getInput('ini-values', false);
|
const ini_values_csv = await utils.getInput('ini-values', false);
|
||||||
const coverage_driver = await utils.getInput('coverage', false);
|
const coverage_driver = await utils.getInput('coverage', false);
|
||||||
const pecl = await utils.getInput('pecl', false);
|
|
||||||
let tools_csv = await utils.getInput('tools', false);
|
let tools_csv = await utils.getInput('tools', false);
|
||||||
if (pecl == 'true' ||
|
if (/.*-(beta|alpha|devel|snapshot|\d+\.\d+\.\d+).*/.test(extension_csv)) {
|
||||||
/.*-(beta|alpha|devel|snapshot).*/.test(extension_csv) ||
|
|
||||||
/.*-(\d+\.\d+\.\d+).*/.test(extension_csv)) {
|
|
||||||
tools_csv = 'pecl, ' + tools_csv;
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
}
|
}
|
||||||
let script = await utils.readScript(filename);
|
let script = await utils.readScript(filename);
|
||||||
@ -2493,31 +2568,22 @@ async function build(filename, version, os_version) {
|
|||||||
if (ini_values_csv) {
|
if (ini_values_csv) {
|
||||||
script += await config.addINIValues(ini_values_csv, os_version);
|
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);
|
return await utils.writeScript(filename, script);
|
||||||
}
|
}
|
||||||
exports.build = build;
|
exports.getScript = getScript;
|
||||||
/**
|
/**
|
||||||
* Run the script
|
* Run the script
|
||||||
*/
|
*/
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
let version = await utils.getInput('php-version', true);
|
const version = await utils.parseVersion(await utils.getInput('php-version', true));
|
||||||
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
|
||||||
const os_version = process.platform;
|
const os_version = process.platform;
|
||||||
// check the os version and run the respective script
|
const tool = await utils.scriptTool(os_version);
|
||||||
let script_path = '';
|
const script = os_version + (await utils.scriptExtension(os_version));
|
||||||
switch (os_version) {
|
const location = await getScript(script, version, os_version);
|
||||||
case 'darwin':
|
await exec_1.exec(await utils.joins(tool, location, version, __dirname));
|
||||||
case 'linux':
|
|
||||||
script_path = await build(os_version + '.sh', version, os_version);
|
|
||||||
await exec_1.exec('bash ' + script_path + ' ' + version + ' ' + __dirname);
|
|
||||||
break;
|
|
||||||
case 'win32':
|
|
||||||
script_path = await build('win32.ps1', version, os_version);
|
|
||||||
await exec_1.exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
await matchers.addMatchers();
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
@ -2766,7 +2832,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
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);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@ -2986,8 +3052,8 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
extension = extension.replace(/pdo[_-]|3/, '');
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
// match ast and uopz
|
// match uopz
|
||||||
case /^(ast|uopz)$/.test(extension):
|
case /^(uopz)$/.test(extension):
|
||||||
command = command_prefix + '-' + extension + pipe;
|
command = command_prefix + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
|
1581
package-lock.json
generated
1581
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
32
package.json
32
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.4.3",
|
"version": "2.6.0",
|
||||||
"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",
|
||||||
@ -24,28 +24,28 @@
|
|||||||
"author": "shivammathur",
|
"author": "shivammathur",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.4",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.10",
|
"@types/jest": "^26.0.14",
|
||||||
"@types/node": "^14.6.0",
|
"@types/node": "^14.11.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
"@typescript-eslint/eslint-plugin": "^4.4.0",
|
||||||
"@typescript-eslint/parser": "^3.9.1",
|
"@typescript-eslint/parser": "^4.4.0",
|
||||||
"@zeit/ncc": "^0.22.3",
|
"@zeit/ncc": "^0.22.3",
|
||||||
"eslint": "^7.7.0",
|
"eslint": "^7.11.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.12.0",
|
||||||
"eslint-plugin-import": "^2.22.0",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
"eslint-plugin-jest": "^23.20.0",
|
"eslint-plugin-jest": "^24.1.0",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"husky": "^4.2.5",
|
"husky": "^4.3.0",
|
||||||
"jest": "^26.4.0",
|
"jest": "^26.5.3",
|
||||||
"jest-circus": "^26.4.0",
|
"jest-circus": "^26.5.3",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.1.2",
|
||||||
"ts-jest": "^26.2.0",
|
"ts-jest": "^26.4.1",
|
||||||
"typescript": "^3.9.7"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"skipCI": true,
|
"skipCI": true,
|
||||||
|
@ -295,8 +295,8 @@ export async function addExtensionLinux(
|
|||||||
extension = extension.replace(/pdo[_-]|3/, '');
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
// match ast and uopz
|
// match uopz
|
||||||
case /^(ast|uopz)$/.test(extension):
|
case /^(uopz)$/.test(extension):
|
||||||
command = command_prefix + '-' + extension + pipe;
|
command = command_prefix + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
|
@ -5,7 +5,6 @@ import * as coverage from './coverage';
|
|||||||
import * as extensions from './extensions';
|
import * as extensions from './extensions';
|
||||||
import * as tools from './tools';
|
import * as tools from './tools';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
import * as matchers from './matchers';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the script
|
* Build the script
|
||||||
@ -14,24 +13,19 @@ import * as matchers from './matchers';
|
|||||||
* @param version
|
* @param version
|
||||||
* @param os_version
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
export async function build(
|
export async function getScript(
|
||||||
filename: string,
|
filename: string,
|
||||||
version: string,
|
version: string,
|
||||||
os_version: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
const name = 'setup-php';
|
||||||
|
const url = 'https://setup-php.com/support';
|
||||||
// taking inputs
|
// taking inputs
|
||||||
const extension_csv: string =
|
const extension_csv: string = await utils.getInput('extensions', false);
|
||||||
(await utils.getInput('extensions', false)) ||
|
|
||||||
(await utils.getInput('extension', false));
|
|
||||||
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
||||||
const coverage_driver: string = await utils.getInput('coverage', false);
|
const coverage_driver: string = await utils.getInput('coverage', false);
|
||||||
const pecl: string = await utils.getInput('pecl', false);
|
|
||||||
let tools_csv: string = await utils.getInput('tools', false);
|
let tools_csv: string = await utils.getInput('tools', false);
|
||||||
if (
|
if (/.*-(beta|alpha|devel|snapshot|\d+\.\d+\.\d+).*/.test(extension_csv)) {
|
||||||
pecl == 'true' ||
|
|
||||||
/.*-(beta|alpha|devel|snapshot).*/.test(extension_csv) ||
|
|
||||||
/.*-(\d+\.\d+\.\d+).*/.test(extension_csv)
|
|
||||||
) {
|
|
||||||
tools_csv = 'pecl, ' + tools_csv;
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +42,9 @@ export async function build(
|
|||||||
script += await config.addINIValues(ini_values_csv, os_version);
|
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);
|
return await utils.writeScript(filename, script);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,24 +53,14 @@ export async function build(
|
|||||||
*/
|
*/
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
let version: string = await utils.getInput('php-version', true);
|
const version: string = await utils.parseVersion(
|
||||||
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
await utils.getInput('php-version', true)
|
||||||
|
);
|
||||||
const os_version: string = process.platform;
|
const os_version: string = process.platform;
|
||||||
|
const tool = await utils.scriptTool(os_version);
|
||||||
// check the os version and run the respective script
|
const script = os_version + (await utils.scriptExtension(os_version));
|
||||||
let script_path = '';
|
const location = await getScript(script, version, os_version);
|
||||||
switch (os_version) {
|
await exec(await utils.joins(tool, location, version, __dirname));
|
||||||
case 'darwin':
|
|
||||||
case 'linux':
|
|
||||||
script_path = await build(os_version + '.sh', version, os_version);
|
|
||||||
await exec('bash ' + script_path + ' ' + version + ' ' + __dirname);
|
|
||||||
break;
|
|
||||||
case 'win32':
|
|
||||||
script_path = await build('win32.ps1', version, os_version);
|
|
||||||
await exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
await matchers.addMatchers();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
import * as path from 'path';
|
|
||||||
import * as utils from './utils';
|
|
||||||
import * as io from '@actions/io';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cache json files for problem matchers
|
|
||||||
*/
|
|
||||||
export async function addMatchers(): Promise<void> {
|
|
||||||
const config_path = path.join(__dirname, '..', 'src', 'configs');
|
|
||||||
const runner_dir: string = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
|
||||||
await io.cp(path.join(config_path, 'phpunit.json'), runner_dir);
|
|
||||||
await io.cp(path.join(config_path, 'php.json'), runner_dir);
|
|
||||||
}
|
|
@ -67,7 +67,7 @@ check_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fuction to get the PECL version.
|
# Function to get the PECL version.
|
||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
extension=$1
|
extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||||
@ -152,16 +152,35 @@ configure_composer() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
echo "::add-path::/Users/$USER/.composer/vendor/bin"
|
echo "/Users/$USER/.composer/vendor/bin" >> "$GITHUB_PATH"
|
||||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to extract tool version.
|
||||||
|
get_tool_version() {
|
||||||
|
tool=$1
|
||||||
|
param=$2
|
||||||
|
version_regex="[0-9]+((\.{1}[0-9]+)+)(\.{0})(-[a-zA-Z0-9]+){0,1}"
|
||||||
|
if [ "$tool" = "composer" ]; then
|
||||||
|
if [ "$param" != "snapshot" ]; then
|
||||||
|
grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex"
|
||||||
|
else
|
||||||
|
trunk=$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")
|
||||||
|
commit=$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "[a-zA-z0-9]+" | tail -n 1)
|
||||||
|
echo "$trunk+$commit"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup a remote tool.
|
# Function to setup a remote tool.
|
||||||
add_tool() {
|
add_tool() {
|
||||||
url=$1
|
url=$1
|
||||||
tool=$2
|
tool=$2
|
||||||
|
ver_param=$3
|
||||||
tool_path="$tool_path_dir/$tool"
|
tool_path="$tool_path_dir/$tool"
|
||||||
if [ ! -e "$tool_path" ]; then
|
if [ ! -e "$tool_path" ]; then
|
||||||
rm -rf "$tool_path"
|
rm -rf "$tool_path"
|
||||||
@ -191,7 +210,8 @@ add_tool() {
|
|||||||
elif [ "$tool" = "wp-cli" ]; then
|
elif [ "$tool" = "wp-cli" ]; then
|
||||||
sudo cp -p "$tool_path" "$tool_path_dir"/wp
|
sudo cp -p "$tool_path" "$tool_path_dir"/wp
|
||||||
fi
|
fi
|
||||||
add_log "$tick" "$tool" "Added"
|
tool_version=$(get_tool_version "$tool" "$ver_param")
|
||||||
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
else
|
else
|
||||||
add_log "$cross" "$tool" "Could not setup $tool"
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
fi
|
fi
|
||||||
@ -203,10 +223,19 @@ add_composertool() {
|
|||||||
release=$2
|
release=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 && add_log "$tick" "$tool" "Added"
|
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
||||||
|
json=$(grep "$prefix$tool" /Users/"$USER"/.composer/composer.json) &&
|
||||||
|
tool_version=$(get_tool_version 'echo' "$json") &&
|
||||||
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to handle request to add phpize and php-config.
|
||||||
|
add_devtools() {
|
||||||
|
tool=$1
|
||||||
|
add_log "$tick" "$tool" "Added $tool $semver"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to configure PECL
|
# Function to configure PECL
|
||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
for tool in pear pecl; do
|
for tool in pear pecl; do
|
||||||
@ -217,7 +246,8 @@ configure_pecl() {
|
|||||||
|
|
||||||
# Function to handle request to add PECL.
|
# Function to handle request to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
add_log "$tick" "PECL" "Added"
|
pecl_version=$(get_tool_version "pecl" "version")
|
||||||
|
add_log "$tick" "PECL" "Found PECL $pecl_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup PHP 5.6 and newer.
|
# Function to setup PHP 5.6 and newer.
|
||||||
@ -237,6 +267,7 @@ setup_php() {
|
|||||||
tick="✓"
|
tick="✓"
|
||||||
cross="✗"
|
cross="✗"
|
||||||
version=$1
|
version=$1
|
||||||
|
dist=$2
|
||||||
nodot_version=${1/./}
|
nodot_version=${1/./}
|
||||||
old_versions="5.[3-5]"
|
old_versions="5.[3-5]"
|
||||||
tool_path_dir="/usr/local/bin"
|
tool_path_dir="/usr/local/bin"
|
||||||
@ -275,4 +306,5 @@ scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
|||||||
sudo mkdir -p "$ext_dir"
|
sudo mkdir -p "$ext_dir"
|
||||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
||||||
if [[ ! "$version" =~ $old_versions ]]; then configure_pecl >/dev/null 2>&1; fi
|
if [[ ! "$version" =~ $old_versions ]]; then configure_pecl >/dev/null 2>&1; fi
|
||||||
|
sudo mv "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "$tick" "PHP" "$status PHP $semver"
|
add_log "$tick" "PHP" "$status PHP $semver"
|
||||||
|
@ -9,10 +9,11 @@ add_license_log() {
|
|||||||
|
|
||||||
# Function to get the tag for a php version.
|
# Function to get the tag for a php version.
|
||||||
get_tag() {
|
get_tag() {
|
||||||
master_version='8.0'
|
|
||||||
tag='master'
|
tag='master'
|
||||||
if [ ! "${version:?}" = "$master_version" ]; then
|
if ! [[ ${version:?} =~ $nightly_versions ]]; then
|
||||||
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
||||||
|
elif [ "${version:?}" = '8.0' ]; then
|
||||||
|
tag="PHP-8.0"
|
||||||
fi
|
fi
|
||||||
echo "$tag"
|
echo "$tag"
|
||||||
}
|
}
|
||||||
@ -72,18 +73,23 @@ restore_phpize() {
|
|||||||
|
|
||||||
# Function to patch pdo_oci.
|
# Function to patch pdo_oci.
|
||||||
patch_pdo_oci_config() {
|
patch_pdo_oci_config() {
|
||||||
curl -O "${curl_opts[@]}" https://raw.githubusercontent.com/php/php-src/master/ext/pdo_oci/config.m4
|
curl -O "${curl_opts[@]}" https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
|
||||||
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
||||||
|
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install the dependencies.
|
# Function to install the dependencies.
|
||||||
add_dependencies() {
|
add_dependencies() {
|
||||||
if [ "$os" = 'Linux' ]; then
|
if [ "$os" = 'Linux' ]; then
|
||||||
if [ "${runner:?}" = "self-hosted" ]; then
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
${apt_install:?} autoconf automake libaio-dev gcc g++ php"$version"-dev
|
if ! [[ ${version:?} =~ $nightly_versions ]]; then
|
||||||
|
${apt_install:?} --no-upgrade --no-install-recommends autoconf automake libaio-dev gcc g++ php"$version"-dev
|
||||||
else
|
else
|
||||||
update_lists
|
${apt_install:?} --no-upgrade --no-install-recommends autoconf automake libaio-dev gcc g++
|
||||||
${apt_install:?} php"$version"-dev
|
fi
|
||||||
|
else
|
||||||
|
! [[ ${version:?} =~ $nightly_versions ]] && update_lists && ${apt_install:?} --no-upgrade --no-install-recommends php"$version"-dev
|
||||||
fi
|
fi
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
||||||
@ -117,6 +123,7 @@ add_oci() {
|
|||||||
oracle_home='/opt/oracle'
|
oracle_home='/opt/oracle'
|
||||||
oracle_client=$oracle_home/instantclient
|
oracle_client=$oracle_home/instantclient
|
||||||
os=$(uname -s)
|
os=$(uname -s)
|
||||||
|
nightly_versions='8.[0-1]'
|
||||||
add_client >/dev/null 2>&1
|
add_client >/dev/null 2>&1
|
||||||
add_dependencies >/dev/null 2>&1
|
add_dependencies >/dev/null 2>&1
|
||||||
add_oci_helper >/dev/null 2>&1
|
add_oci_helper >/dev/null 2>&1
|
||||||
|
@ -3,7 +3,11 @@ add_phalcon_helper() {
|
|||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
if [ "$os_name" = "Linux" ]; then
|
if [ "$os_name" = "Linux" ]; then
|
||||||
update_lists
|
update_lists
|
||||||
|
if [ "$extension" = "phalcon4" ]; then
|
||||||
|
${apt_install:?} "php${version:?}-psr" "php${version:?}-$extension"
|
||||||
|
else
|
||||||
${apt_install:?} "php${version:?}-$extension"
|
${apt_install:?} "php${version:?}-$extension"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
phalcon_ini_file=${ini_file:?}
|
phalcon_ini_file=${ini_file:?}
|
||||||
sed -i '' '/extension.*psr/d' "${ini_file:?}"
|
sed -i '' '/extension.*psr/d' "${ini_file:?}"
|
||||||
|
@ -42,7 +42,7 @@ cleanup_lists() {
|
|||||||
sudo mkdir /etc/apt/sources.list.d
|
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/*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
|
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
|
trap "sudo mv /etc/apt/sources.list.d.save/*.list /etc/apt/sources.list.d/ 2>/dev/null" exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ configure_pecl() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fuction to get the PECL version of an extension.
|
# Function to get the PECL version of an extension.
|
||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
extension=$1
|
extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||||
@ -153,7 +153,7 @@ enable_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion to add PDO extension.
|
# Function to add PDO extension.
|
||||||
add_pdo_extension() {
|
add_pdo_extension() {
|
||||||
pdo_ext="pdo_$1"
|
pdo_ext="pdo_$1"
|
||||||
if check_extension "$pdo_ext"; then
|
if check_extension "$pdo_ext"; then
|
||||||
@ -231,7 +231,7 @@ add_extension_from_source() {
|
|||||||
args=$4
|
args=$4
|
||||||
prefix=$5
|
prefix=$5
|
||||||
(
|
(
|
||||||
add_devtools
|
add_devtools phpize
|
||||||
delete_extension "$extension"
|
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
|
tar xf /tmp/"$extension".tar.gz -C /tmp
|
||||||
@ -252,16 +252,35 @@ configure_composer() {
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
echo "::add-path::/home/$USER/.composer/vendor/bin"
|
echo "/home/$USER/.composer/vendor/bin" >> "$GITHUB_PATH"
|
||||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to extract tool version.
|
||||||
|
get_tool_version() {
|
||||||
|
tool=$1
|
||||||
|
param=$2
|
||||||
|
version_regex="[0-9]+((\.{1}[0-9]+)+)(\.{0})(-[a-zA-Z0-9]+){0,1}"
|
||||||
|
if [ "$tool" = "composer" ]; then
|
||||||
|
if [ "$param" != "snapshot" ]; then
|
||||||
|
grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex"
|
||||||
|
else
|
||||||
|
trunk=$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")
|
||||||
|
commit=$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "[a-zA-z0-9]+" | tail -n 1)
|
||||||
|
echo "$trunk+$commit"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup a remote tool.
|
# Function to setup a remote tool.
|
||||||
add_tool() {
|
add_tool() {
|
||||||
url=$1
|
url=$1
|
||||||
tool=$2
|
tool=$2
|
||||||
|
ver_param=$3
|
||||||
tool_path="$tool_path_dir/$tool"
|
tool_path="$tool_path_dir/$tool"
|
||||||
if [ ! -e "$tool_path" ]; then
|
if [ ! -e "$tool_path" ]; then
|
||||||
rm -rf "$tool_path"
|
rm -rf "$tool_path"
|
||||||
@ -289,7 +308,8 @@ add_tool() {
|
|||||||
elif [ "$tool" = "wp-cli" ]; then
|
elif [ "$tool" = "wp-cli" ]; then
|
||||||
sudo cp -p "$tool_path" "$tool_path_dir"/wp
|
sudo cp -p "$tool_path" "$tool_path_dir"/wp
|
||||||
fi
|
fi
|
||||||
add_log "$tick" "$tool" "Added"
|
tool_version=$(get_tool_version "$tool" "$ver_param")
|
||||||
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
else
|
else
|
||||||
add_log "$cross" "$tool" "Could not setup $tool"
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
fi
|
fi
|
||||||
@ -302,18 +322,22 @@ add_composertool() {
|
|||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
||||||
add_log "$tick" "$tool" "Added"
|
json=$(grep "$prefix$tool" /home/"$USER"/.composer/composer.json) &&
|
||||||
|
tool_version=$(get_tool_version 'echo' "$json") &&
|
||||||
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup phpize and php-config.
|
# Function to setup phpize and php-config.
|
||||||
add_devtools() {
|
add_devtools() {
|
||||||
|
tool=$1
|
||||||
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
||||||
update_lists && $apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
update_lists && $apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl >/dev/null 2>&1
|
||||||
|
add_log "$tick" "$tool" "Added $tool $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup the nightly build from master branch.
|
# Function to setup the nightly build from master branch.
|
||||||
@ -330,12 +354,13 @@ setup_old_versions() {
|
|||||||
|
|
||||||
# Function to add PECL.
|
# Function to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
add_devtools >/dev/null 2>&1
|
add_devtools phpize >/dev/null 2>&1
|
||||||
if [ ! -e /usr/bin/pecl ]; then
|
if [ ! -e /usr/bin/pecl ]; then
|
||||||
$apt_install php-pear >/dev/null 2>&1 || update_lists && $apt_install php-pear >/dev/null 2>&1
|
$apt_install php-pear >/dev/null 2>&1 || update_lists && $apt_install php-pear >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl >/dev/null 2>&1
|
||||||
add_log "$tick" "PECL" "Added"
|
pecl_version=$(get_tool_version "pecl" "version")
|
||||||
|
add_log "$tick" "PECL" "Added PECL $pecl_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to switch versions of PHP binaries.
|
# Function to switch versions of PHP binaries.
|
||||||
@ -397,12 +422,13 @@ tick="✓"
|
|||||||
cross="✗"
|
cross="✗"
|
||||||
pecl_config="false"
|
pecl_config="false"
|
||||||
version=$1
|
version=$1
|
||||||
|
dist=$2
|
||||||
master_version="8.0"
|
master_version="8.0"
|
||||||
old_versions="5.[3-5]"
|
old_versions="5.[3-5]"
|
||||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||||
github="https://github.com/shivammathur"
|
github="https://github.com/shivammathur"
|
||||||
apt_install="sudo $debconf_fix apt-fast install -y"
|
apt_install="sudo $debconf_fix apt-get install -y"
|
||||||
apt_remove="sudo $debconf_fix apt-fast remove -y"
|
apt_remove="sudo $debconf_fix apt-get remove -y"
|
||||||
tool_path_dir="/usr/local/bin"
|
tool_path_dir="/usr/local/bin"
|
||||||
curl_opts=(-sL)
|
curl_opts=(-sL)
|
||||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||||
@ -452,4 +478,5 @@ pecl_file="$scan_dir"/99-pecl.ini
|
|||||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
||||||
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
||||||
|
sudo mv "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "$tick" "PHP" "$status PHP $semver"
|
add_log "$tick" "PHP" "$status PHP $semver"
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Function to add blackfire and blackfire-agent.
|
# Function to add blackfire and blackfire-agent.
|
||||||
Function Add-Blackfire() {
|
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
|
$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"
|
$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
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
||||||
@ -12,6 +16,6 @@ Function Add-Blackfire() {
|
|||||||
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
||||||
blackfire config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
|
blackfire config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
|
||||||
}
|
}
|
||||||
Add-Log $tick "blackfire" "Added"
|
Add-Log $tick "blackfire" "Added blackfire $agent_version"
|
||||||
Add-Log $tick "blackfire-agent" "Added"
|
Add-Log $tick "blackfire-agent" "Added blackfire-agent $agent_version"
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ add_blackfire() {
|
|||||||
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
||||||
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
|
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
|
||||||
blackfire_config >/dev/null 2>&1
|
blackfire_config >/dev/null 2>&1
|
||||||
add_log "${tick:?}" "blackfire" "Added"
|
tool_version=$(get_tool_version "blackfire" "version")
|
||||||
add_log "${tick:?}" "blackfire-agent" "Added"
|
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
||||||
|
add_log "${tick:?}" "blackfire-agent" "Added blackfire-agent $tool_version"
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,12 @@ Function Add-Msys2() {
|
|||||||
|
|
||||||
Function Add-Grpc_php_plugin() {
|
Function Add-Grpc_php_plugin() {
|
||||||
$msys_location = Add-Msys2
|
$msys_location = Add-Msys2
|
||||||
. $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
||||||
Write-Output "::add-path::$msys_location\mingw64\bin"
|
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
||||||
|
Write-Output "$msys_location\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||||
Write-Output "::set-output name=grpc_php_plugin_path::$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
Write-Output "::set-output name=grpc_php_plugin_path::$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe"
|
Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
Add-Log $tick "grpc_php_plugin" "Added"
|
Add-Log $tick "grpc_php_plugin" "Added grpc_php_plugin $grpc_version"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
||||||
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content
|
||||||
Write-Output "::endgroup::"
|
Write-Output "::endgroup::"
|
||||||
|
@ -44,7 +44,7 @@ add_grpc_php_plugin() {
|
|||||||
sudo chmod a+x /usr/local/bin/grpc_php_plugin
|
sudo chmod a+x /usr/local/bin/grpc_php_plugin
|
||||||
) >/dev/null 2>&1
|
) >/dev/null 2>&1
|
||||||
echo "::set-output name=grpc_php_plugin_path::/usr/local/bin/grpc_php_plugin"
|
echo "::set-output name=grpc_php_plugin_path::/usr/local/bin/grpc_php_plugin"
|
||||||
add_log "${tick:?}" "grpc_php_plugin" "Added"
|
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
||||||
cat "/tmp/grpc-${grpc_tag:1}/LICENSE"
|
cat "/tmp/grpc-${grpc_tag:1}/LICENSE"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
@ -31,7 +31,7 @@ Function Add-Protoc() {
|
|||||||
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
||||||
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
||||||
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
||||||
Add-Log $tick "protoc" "Added"
|
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
||||||
Write-Output "::endgroup::"
|
Write-Output "::endgroup::"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
get_protobuf_tag() {
|
get_protobuf_tag() {
|
||||||
if [ "$protobuf_tag" = "latest" ]; then
|
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
|
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")
|
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
|
if [ "$status_code" = "200" ]; then
|
||||||
protobuf_tag="v$protobuf_tag"
|
protobuf_tag="v$protobuf_tag"
|
||||||
else
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ add_protoc() {
|
|||||||
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
||||||
sudo chmod 777 /usr/local/bin/protoc -R /usr/local/include/google
|
sudo chmod 777 /usr/local/bin/protoc -R /usr/local/include/google
|
||||||
) >/dev/null 2>&1
|
) >/dev/null 2>&1
|
||||||
add_log "${tick:?}" "protoc" "Added"
|
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
@ -8,7 +8,7 @@ param (
|
|||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
[ValidateLength(1, [int]::MaxValue)]
|
||||||
[string]
|
[string]
|
||||||
$dir
|
$dist
|
||||||
)
|
)
|
||||||
|
|
||||||
# Function to log start of a operation.
|
# Function to log start of a operation.
|
||||||
@ -64,6 +64,20 @@ Function Add-Path {
|
|||||||
Get-PathFromRegistry
|
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 to get a clean Powershell profile.
|
||||||
Function Get-CleanPSProfile {
|
Function Get-CleanPSProfile {
|
||||||
if(-not(Test-Path -LiteralPath $profile)) {
|
if(-not(Test-Path -LiteralPath $profile)) {
|
||||||
@ -175,12 +189,33 @@ Function Edit-ComposerConfig() {
|
|||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
Write-Output "::add-path::$env:APPDATA\Composer\vendor\bin"
|
Write-Output "$env:APPDATA\Composer\vendor\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||||
if (Test-Path env:COMPOSER_TOKEN) {
|
if (Test-Path env:COMPOSER_TOKEN) {
|
||||||
composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN
|
composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to extract tool version.
|
||||||
|
Function Get-ToolVersion() {
|
||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
$tool,
|
||||||
|
[Parameter(Position = 1, Mandatory = $true)]
|
||||||
|
$param
|
||||||
|
)
|
||||||
|
$version_regex = "[0-9]+((\.{1}[0-9]+)+)(\.{0})(-[a-z0-9]+){0,1}"
|
||||||
|
if($tool -eq 'composer') {
|
||||||
|
if ($param -eq 'snapshot') {
|
||||||
|
$trunk = Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
|
||||||
|
$commit = Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern "[a-zA-Z0-9]+" -AllMatches | ForEach-Object { $_.matches[2].Value }
|
||||||
|
return "$trunk+$commit"
|
||||||
|
} else {
|
||||||
|
return Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value }
|
||||||
|
}
|
||||||
|
|
||||||
# Function to add tools.
|
# Function to add tools.
|
||||||
Function Add-Tool() {
|
Function Add-Tool() {
|
||||||
Param (
|
Param (
|
||||||
@ -189,9 +224,10 @@ Function Add-Tool() {
|
|||||||
$url,
|
$url,
|
||||||
[Parameter(Position = 1, Mandatory = $true)]
|
[Parameter(Position = 1, Mandatory = $true)]
|
||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
$tool,
|
||||||
[string]
|
[Parameter(Position = 2, Mandatory = $true)]
|
||||||
$tool
|
[ValidateNotNull()]
|
||||||
|
$ver_param
|
||||||
)
|
)
|
||||||
if (Test-Path $bin_dir\$tool) {
|
if (Test-Path $bin_dir\$tool) {
|
||||||
Remove-Item $bin_dir\$tool
|
Remove-Item $bin_dir\$tool
|
||||||
@ -225,7 +261,8 @@ Function Add-Tool() {
|
|||||||
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
||||||
}
|
}
|
||||||
if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
|
if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
|
||||||
Add-Log $tick $tool "Added"
|
$tool_version = Get-ToolVersion $tool $ver_param
|
||||||
|
Add-Log $tick $tool "Added $tool $tool_version"
|
||||||
} else {
|
} else {
|
||||||
Add-Log $cross $tool "Could not add $tool"
|
Add-Log $cross $tool "Could not add $tool"
|
||||||
}
|
}
|
||||||
@ -250,9 +287,11 @@ Function Add-Composertool() {
|
|||||||
[string]
|
[string]
|
||||||
$prefix
|
$prefix
|
||||||
)
|
)
|
||||||
composer -q global require $prefix$release 2>&1 | out-null
|
composer global require $prefix$release 2>&1 | out-null
|
||||||
if($?) {
|
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
|
||||||
Add-Log $tick $tool "Added"
|
if($json) {
|
||||||
|
$tool_version = Get-ToolVersion "Write-Output" "$json"
|
||||||
|
Add-Log $tick $tool "Added $tool $tool_version"
|
||||||
} else {
|
} else {
|
||||||
Add-Log $cross $tool "Could not setup $tool"
|
Add-Log $cross $tool "Could not setup $tool"
|
||||||
}
|
}
|
||||||
@ -275,17 +314,14 @@ $master_version = '8.0'
|
|||||||
$cert_source='CurrentUser'
|
$cert_source='CurrentUser'
|
||||||
|
|
||||||
$arch = 'x64'
|
$arch = 'x64'
|
||||||
$arch_name ='amd64'
|
|
||||||
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||||
$arch = 'x86'
|
$arch = 'x86'
|
||||||
$arch_name = '386'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ts = $env:PHPTS -eq 'ts'
|
$ts = $env:PHPTS -eq 'ts'
|
||||||
if($env:PHPTS -ne 'ts') {
|
if($env:PHPTS -ne 'ts') {
|
||||||
$env:PHPTS = 'nts'
|
$env:PHPTS = 'nts'
|
||||||
}
|
}
|
||||||
|
|
||||||
if($env:RUNNER -eq 'self-hosted') {
|
if($env:RUNNER -eq 'self-hosted') {
|
||||||
$bin_dir = 'C:\tools\bin'
|
$bin_dir = 'C:\tools\bin'
|
||||||
$php_dir = "$php_dir$version"
|
$php_dir = "$php_dir$version"
|
||||||
@ -294,10 +330,6 @@ if($env:RUNNER -eq 'self-hosted') {
|
|||||||
Get-CleanPSProfile >$null 2>&1
|
Get-CleanPSProfile >$null 2>&1
|
||||||
New-Item $bin_dir -Type Directory 2>&1 | Out-Null
|
New-Item $bin_dir -Type Directory 2>&1 | Out-Null
|
||||||
Add-Path -PathItem $bin_dir
|
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) {
|
if($version -lt 5.6) {
|
||||||
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
|
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
|
||||||
Start-Sleep 1
|
Start-Sleep 1
|
||||||
@ -315,6 +347,8 @@ if($env:RUNNER -eq 'self-hosted') {
|
|||||||
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
|
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Add-Printf >$null 2>&1
|
||||||
Step-Log "Setup PhpManager"
|
Step-Log "Setup PhpManager"
|
||||||
Install-PhpManager >$null 2>&1
|
Install-PhpManager >$null 2>&1
|
||||||
Add-Log $tick "PhpManager" "Installed"
|
Add-Log $tick "PhpManager" "Installed"
|
||||||
@ -359,4 +393,5 @@ if($version -lt "5.5") {
|
|||||||
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
||||||
}
|
}
|
||||||
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
||||||
|
Move-Item -path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||||
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
||||||
|
66
src/tools.ts
66
src/tools.ts
@ -167,7 +167,7 @@ export async function addPhive(
|
|||||||
case 'latest':
|
case 'latest':
|
||||||
return (
|
return (
|
||||||
(await utils.getCommand(os_version, 'tool')) +
|
(await utils.getCommand(os_version, 'tool')) +
|
||||||
'https://phar.io/releases/phive.phar phive'
|
'https://phar.io/releases/phive.phar phive status'
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
@ -176,7 +176,7 @@ export async function addPhive(
|
|||||||
version +
|
version +
|
||||||
'/phive-' +
|
'/phive-' +
|
||||||
version +
|
version +
|
||||||
'.phar phive'
|
'.phar phive status'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,7 +334,7 @@ export async function getCleanedToolsList(
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(
|
.replace(
|
||||||
/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//,
|
/-agent|behat\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@ -348,13 +348,18 @@ export async function getCleanedToolsList(
|
|||||||
* @param tool
|
* @param tool
|
||||||
* @param url
|
* @param url
|
||||||
* @param os_version
|
* @param os_version
|
||||||
|
* @param ver_param
|
||||||
*/
|
*/
|
||||||
export async function addArchive(
|
export async function addArchive(
|
||||||
tool: string,
|
tool: string,
|
||||||
url: string,
|
url: string,
|
||||||
os_version: string
|
os_version: string,
|
||||||
|
ver_param: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return (await utils.getCommand(os_version, 'tool')) + url + ' ' + tool;
|
return (
|
||||||
|
(await utils.getCommand(os_version, 'tool')) +
|
||||||
|
(await utils.joins(url, tool, ver_param))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -369,13 +374,8 @@ export async function addDevTools(
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return (
|
|
||||||
'add_devtools' +
|
|
||||||
'\n' +
|
|
||||||
(await utils.addLog('$tick', tool, 'Added', 'linux'))
|
|
||||||
);
|
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return await utils.addLog('$tick', tool, 'Added', 'darwin');
|
return 'add_devtools ' + tool;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return await utils.addLog(
|
return await utils.addLog(
|
||||||
'$cross',
|
'$cross',
|
||||||
@ -445,24 +445,28 @@ export async function addTools(
|
|||||||
case 'protoc':
|
case 'protoc':
|
||||||
script += await utils.customPackage(tool, 'tools', version, os_version);
|
script += await utils.customPackage(tool, 'tools', version, os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'behat':
|
||||||
|
case 'phpspec':
|
||||||
|
script += await addPackage(tool, release, tool + '/', os_version);
|
||||||
|
break;
|
||||||
case 'blackfire-player':
|
case 'blackfire-player':
|
||||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'codeception':
|
case 'codeception':
|
||||||
url =
|
url =
|
||||||
'https://codeception.com/' +
|
'https://codeception.com/' +
|
||||||
(await getCodeceptionUri(version, php_version));
|
(await getCodeceptionUri(version, php_version));
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case 'composer':
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version);
|
||||||
script += await addArchive('composer', url, os_version);
|
script += await addArchive('composer', url, os_version, version);
|
||||||
break;
|
break;
|
||||||
case 'composer-normalize':
|
case 'composer-normalize':
|
||||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||||
url = github + 'ergebnis/composer-normalize/' + uri;
|
url = github + 'ergebnis/composer-normalize/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer-prefetcher':
|
case 'composer-prefetcher':
|
||||||
script += await addPackage(
|
script += await addPackage(
|
||||||
@ -475,39 +479,37 @@ export async function addTools(
|
|||||||
case 'composer-require-checker':
|
case 'composer-require-checker':
|
||||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||||
url = github + 'maglnet/ComposerRequireChecker/' + uri;
|
url = github + 'maglnet/ComposerRequireChecker/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer-unused':
|
case 'composer-unused':
|
||||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
script += await addPackage(tool, release, 'icanhazstring/', os_version);
|
||||||
url = github + 'composer-unused/composer-unused/' + uri;
|
|
||||||
script += await addArchive(tool, url, os_version);
|
|
||||||
break;
|
break;
|
||||||
case 'cs2pr':
|
case 'cs2pr':
|
||||||
uri = await getUri(tool, '', version, 'releases', '', 'download');
|
uri = await getUri(tool, '', version, 'releases', '', 'download');
|
||||||
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
|
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'deployer':
|
case 'deployer':
|
||||||
url = await getDeployerUrl(version);
|
url = await getDeployerUrl(version);
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'flex':
|
case 'flex':
|
||||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'infection':
|
case 'infection':
|
||||||
url = github + 'infection/infection/' + uri;
|
url = github + 'infection/infection/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'pecl':
|
case 'pecl':
|
||||||
script += await utils.getCommand(os_version, 'pecl');
|
script += await utils.getCommand(os_version, 'pecl');
|
||||||
break;
|
break;
|
||||||
case 'phan':
|
case 'phan':
|
||||||
url = github + 'phan/phan/' + uri;
|
url = github + 'phan/phan/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'phing':
|
case 'phing':
|
||||||
url = 'https://www.phing.info/get/phing-' + version + '.phar';
|
url = 'https://www.phing.info/get/phing-' + version + '.phar';
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'phinx':
|
case 'phinx':
|
||||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||||
@ -522,48 +524,48 @@ export async function addTools(
|
|||||||
case 'php-cs-fixer':
|
case 'php-cs-fixer':
|
||||||
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
|
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
|
||||||
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
|
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'phpcbf':
|
case 'phpcbf':
|
||||||
case 'phpcs':
|
case 'phpcs':
|
||||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phpcpd':
|
case 'phpcpd':
|
||||||
case 'phpunit':
|
case 'phpunit':
|
||||||
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
|
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phplint':
|
case 'phplint':
|
||||||
script += await addPackage(tool, release, 'overtrue/', os_version);
|
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'phpmd':
|
case 'phpmd':
|
||||||
url = github + 'phpmd/phpmd/' + uri;
|
url = github + 'phpmd/phpmd/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phpstan':
|
case 'phpstan':
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'prestissimo':
|
case 'prestissimo':
|
||||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'psalm':
|
case 'psalm':
|
||||||
url = github + 'vimeo/psalm/' + uri;
|
url = github + 'vimeo/psalm/' + uri;
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'symfony':
|
case 'symfony':
|
||||||
case 'symfony-cli':
|
case 'symfony-cli':
|
||||||
uri = await getSymfonyUri(version, os_version);
|
uri = await getSymfonyUri(version, os_version);
|
||||||
url = github + 'symfony/cli/' + uri;
|
url = github + 'symfony/cli/' + uri;
|
||||||
script += await addArchive('symfony', url, os_version);
|
script += await addArchive('symfony', url, os_version, 'version');
|
||||||
break;
|
break;
|
||||||
case 'vapor-cli':
|
case 'vapor-cli':
|
||||||
script += await addPackage(tool, release, 'laravel/', os_version);
|
script += await addPackage(tool, release, 'laravel/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'wp-cli':
|
case 'wp-cli':
|
||||||
url = github + (await getWpCliUrl(version));
|
url = github + (await getWpCliUrl(version));
|
||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
script += await utils.addLog(
|
script += await utils.addLog(
|
||||||
|
71
src/utils.ts
71
src/utils.ts
@ -2,6 +2,21 @@ import * as fs from 'fs';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to read environment variable and return a string value.
|
||||||
|
*
|
||||||
|
* @param property
|
||||||
|
*/
|
||||||
|
export async function readEnv(property: string): Promise<string> {
|
||||||
|
const value = process.env[property];
|
||||||
|
switch (value) {
|
||||||
|
case undefined:
|
||||||
|
return '';
|
||||||
|
default:
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to get inputs from both with and env annotations.
|
* Function to get inputs from both with and env annotations.
|
||||||
*
|
*
|
||||||
@ -12,13 +27,36 @@ export async function getInput(
|
|||||||
name: string,
|
name: string,
|
||||||
mandatory: boolean
|
mandatory: boolean
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const input = process.env[name];
|
const input = core.getInput(name);
|
||||||
switch (input) {
|
const env_input = await readEnv(name);
|
||||||
case '':
|
switch (true) {
|
||||||
case undefined:
|
case input != '':
|
||||||
return core.getInput(name, {required: mandatory});
|
|
||||||
default:
|
|
||||||
return input;
|
return input;
|
||||||
|
case input == '' && env_input != '':
|
||||||
|
return env_input;
|
||||||
|
case input == '' && env_input == '' && mandatory:
|
||||||
|
throw new Error(`Input required and not supplied: ${name}`);
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to parse PHP version.
|
||||||
|
*
|
||||||
|
* @param version
|
||||||
|
*/
|
||||||
|
export async function parseVersion(version: string): Promise<string> {
|
||||||
|
switch (version) {
|
||||||
|
case 'latest':
|
||||||
|
return '7.4';
|
||||||
|
default:
|
||||||
|
switch (true) {
|
||||||
|
case version.length > 1:
|
||||||
|
return version.slice(0, 3);
|
||||||
|
default:
|
||||||
|
return version + '.0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,6 +377,27 @@ export async function scriptExtension(os_version: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get script tool
|
||||||
|
*
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function scriptTool(os_version: string): Promise<string> {
|
||||||
|
switch (os_version) {
|
||||||
|
case 'win32':
|
||||||
|
return 'pwsh';
|
||||||
|
case 'linux':
|
||||||
|
case 'darwin':
|
||||||
|
return 'bash';
|
||||||
|
default:
|
||||||
|
return await log(
|
||||||
|
'Platform ' + os_version + ' is not supported',
|
||||||
|
os_version,
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to get script to add tools with custom support.
|
* Function to get script to add tools with custom support.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user