mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-20 13:53:30 +07:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
454626ac7a | |||
005bae6857 |
20
.github/CONTRIBUTING.md
vendored
20
.github/CONTRIBUTING.md
vendored
@ -17,6 +17,13 @@ Due to time constraints, you may not always get a quick response. Please do not
|
|||||||
|
|
||||||
## Coding Guidelines
|
## Coding Guidelines
|
||||||
|
|
||||||
|
This project comes with `.prettierrc.json` and `eslintrc.json` configuration files. Please run the following commands to format the code before committing it.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm run format
|
||||||
|
$ npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
## Using setup-php from a Git checkout
|
## Using setup-php from a Git checkout
|
||||||
|
|
||||||
The following commands can be used to perform the initial checkout of setup-php:
|
The following commands can be used to perform the initial checkout of setup-php:
|
||||||
@ -33,19 +40,6 @@ Install setup-php dependencies using [npm](https://www.npmjs.com/):
|
|||||||
$ npm install
|
$ npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using `Windows` configure `git` to handle line endings.
|
|
||||||
|
|
||||||
```cmd
|
|
||||||
git config --local core.autocrlf true
|
|
||||||
```
|
|
||||||
|
|
||||||
This project comes with `.prettierrc.json` and `eslintrc.json` configuration files. Please run the following commands to fix and verify the code quality.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm run format
|
|
||||||
$ npm run lint
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running the test suite
|
## Running the test suite
|
||||||
|
|
||||||
After following the steps shown above, The `setup-php` tests in the `__tests__` directory can be run using this command:
|
After following the steps shown above, The `setup-php` tests in the `__tests__` directory can be run using this command:
|
||||||
|
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -26,12 +26,7 @@ This PR [briefly explain what it does]
|
|||||||
- [ ] I have run `npm run format` before the commit.
|
- [ ] I have run `npm run format` before the commit.
|
||||||
- [ ] I have run `npm run lint` before the commit.
|
- [ ] I have run `npm run lint` before the commit.
|
||||||
- [ ] I have run `npm run release` before the commit.
|
- [ ] I have run `npm run release` before the commit.
|
||||||
- [ ] `npm test` returns with no unit test errors and all code covered.
|
- [ ] `npm test` returns with no unit test errors.
|
||||||
|
|
||||||
> In case this PR edits any scripts:
|
|
||||||
|
|
||||||
- [ ] I have checked the edited scripts for syntax.
|
|
||||||
- [ ] I have tested the changes in an integration test (If yes, provide workflow YAML and link).
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
- Please target the develop branch when submitting the pull request.
|
- Please target the develop branch when submitting the pull request.
|
||||||
|
8
.github/SECURITY.md
vendored
8
.github/SECURITY.md
vendored
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
The following versions of this project are supported for security updates.
|
The following versions of this project are supported for security updates.
|
||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
| -------- | ------------------ |
|
| ------- | ------------------ |
|
||||||
| 1.10.x | :white_check_mark: |
|
| 1.9.x | :white_check_mark: |
|
||||||
| 2.8.x | :white_check_mark: |
|
| 2.5.x | :white_check_mark: |
|
||||||
|
|
||||||
## Supported PHP Versions
|
## Supported PHP Versions
|
||||||
|
|
||||||
|
86
README.md
86
README.md
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<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://img.shields.io/codecov/c/github/shivammathur/setup-php?logo=codecov"></a>
|
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://codecov.io/gh/shivammathur/setup-php/branch/master/graph/badge.svg"></a>
|
||||||
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
|
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
|
||||||
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg"></a>
|
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
@ -63,8 +63,6 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
|Ubuntu 20.04|`ubuntu-20.04`|`PHP 7.4`|
|
|Ubuntu 20.04|`ubuntu-20.04`|`PHP 7.4`|
|
||||||
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 7.4`|
|
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 7.4`|
|
||||||
|macOS 10.15 Catalina|`macos-latest` or `macos-10.15`|`PHP 7.4`|
|
|macOS 10.15 Catalina|`macos-latest` or `macos-10.15`|`PHP 7.4`|
|
||||||
|macOS 11.0 Big Sur|`macos-11.0`|`PHP 7.4`|
|
|
||||||
|
|
||||||
|
|
||||||
## :heavy_plus_sign: PHP Extension Support
|
## :heavy_plus_sign: PHP Extension Support
|
||||||
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
||||||
@ -87,9 +85,8 @@ with:
|
|||||||
tools: php-cs-fixer, phpunit
|
tools: php-cs-fixer, phpunit
|
||||||
```
|
```
|
||||||
|
|
||||||
To set up a particular version of a tool, specify it in the form `tool:version`.
|
To setup a particular version of a tool, specify it in the form `tool:version`.
|
||||||
|
Latest stable version of `composer` is setup by default and accepts `v1`, `v2`, `snapshot` and `preview` as versions.
|
||||||
The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying `v1`, `v2`, `snapshot` or `preview` as versions or the exact version in semver format.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v1
|
uses: shivammathur/setup-php@v1
|
||||||
@ -98,8 +95,6 @@ with:
|
|||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
```
|
```
|
||||||
|
|
||||||
If you have specified composer plugins `prestissimo` or `composer-prefetcher` in tools, the latest stable version of `composer v1` will be setup. Unless some of your packages require `composer v1`, it is recommended to drop `prestissimo` and use `composer v2`.
|
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -269,14 +264,14 @@ You can persist composer's internal cache directory using the [`action/cache`](h
|
|||||||
**Note:** Please do not cache `vendor` directory using `action/cache` as that will have side-effects.
|
**Note:** Please do not cache `vendor` directory using `action/cache` as that will have side-effects.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Get Composer Cache Directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
@ -284,15 +279,10 @@ You can persist composer's internal cache directory using the [`action/cache`](h
|
|||||||
run: composer install --prefer-dist
|
run: composer install --prefer-dist
|
||||||
```
|
```
|
||||||
|
|
||||||
- If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
|
In the above example, if you support a range of `composer` dependencies and do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
|
||||||
```yaml
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
|
||||||
```
|
|
||||||
|
|
||||||
- If you support a range of `composer` dependencies and use `prefer-lowest` and `prefer-stable` options, you can store them in your matrix add them to the keys.
|
|
||||||
```yaml
|
```yaml
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.prefer }}-
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Composer GitHub OAuth
|
### Composer GitHub OAuth
|
||||||
@ -310,72 +300,31 @@ 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
|
|
||||||
|
|
||||||
Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Setup problem matchers for PHP
|
|
||||||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### PHPUnit
|
#### PHPUnit
|
||||||
|
|
||||||
Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step.
|
You can 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.
|
||||||
|
|
||||||
```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"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### PHPStan
|
#### Other Tools
|
||||||
|
|
||||||
PHPStan supports error reporting in GitHub Actions, so no problem matchers are required.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '7.4'
|
|
||||||
tools: phpstan
|
|
||||||
|
|
||||||
- name: Run PHPStan
|
|
||||||
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 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).
|
For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-pull-request-from-checkstyle).
|
||||||
|
|
||||||
> Here is an example with `phpcs`.
|
> Here is an example with `phpstan`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v1
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
tools: cs2pr, phpcs
|
tools: cs2pr, phpstan
|
||||||
|
|
||||||
- name: Run phpcs
|
- name: PHPStan
|
||||||
run: phpcs -q --report=checkstyle src | cs2pr
|
run: phpstan analyse src --error-format=checkstyle | cs2pr
|
||||||
```
|
```
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -426,7 +375,6 @@ If this action helped you.
|
|||||||
## :bookmark: Dependencies
|
## :bookmark: Dependencies
|
||||||
|
|
||||||
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
|
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
|
||||||
- [aaronparker/VcRedist](https://github.com/aaronparker/VcRedist "VcRedist PowerShell package")
|
|
||||||
- [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
|
- [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
|
||||||
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Packaging active PHP packages")
|
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Packaging active PHP packages")
|
||||||
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds for MacOS")
|
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds for MacOS")
|
||||||
|
@ -78,15 +78,13 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
let darwin: string = await extensions.addExtension(
|
let darwin: string = await extensions.addExtension(
|
||||||
'Xdebug, pcov, grpc, igbinary, imagick, protobuf, swoole, sqlite, ast-beta',
|
'Xdebug, pcov, grpc, protobuf, swoole, sqlite, ast-beta',
|
||||||
'7.2',
|
'7.2',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
expect(darwin).toContain('add_brew_extension pcov');
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
expect(darwin).toContain('add_brew_extension grpc');
|
expect(darwin).toContain('add_brew_extension grpc');
|
||||||
expect(darwin).toContain('add_brew_extension igbinary');
|
|
||||||
expect(darwin).toContain('add_brew_extension imagick');
|
|
||||||
expect(darwin).toContain('add_brew_extension protobuf');
|
expect(darwin).toContain('add_brew_extension protobuf');
|
||||||
expect(darwin).toContain('add_brew_extension swoole');
|
expect(darwin).toContain('add_brew_extension swoole');
|
||||||
expect(darwin).toContain('pecl_install sqlite3');
|
expect(darwin).toContain('pecl_install sqlite3');
|
||||||
@ -119,6 +117,14 @@ describe('Extension tests', () => {
|
|||||||
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('pecl_install redis');
|
expect(darwin).toContain('pecl_install redis');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
|
expect(darwin).toContain('pecl_install imagick');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
||||||
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
|
expect(darwin).toContain('pecl_install imagick');
|
||||||
|
|
||||||
darwin = await extensions.addExtension(
|
darwin = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
'7.2',
|
'7.2',
|
||||||
|
24
__tests__/matchers.test.ts
Normal file
24
__tests__/matchers.test.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test 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);
|
||||||
|
});
|
||||||
|
});
|
@ -240,17 +240,9 @@ describe('Tools tests', () => {
|
|||||||
'a',
|
'a',
|
||||||
'b'
|
'b'
|
||||||
]);
|
]);
|
||||||
expect(await tools.addComposer(['a', 'b', 'composer:1.2'])).toStrictEqual([
|
|
||||||
'composer',
|
|
||||||
'a',
|
|
||||||
'b'
|
|
||||||
]);
|
|
||||||
expect(
|
expect(
|
||||||
await tools.addComposer(['a', 'b', 'composer:1.2.3'])
|
await tools.addComposer(['a', 'b', 'composer:1.2.3'])
|
||||||
).toStrictEqual(['composer:1.2.3', 'a', 'b']);
|
).toStrictEqual(['composer', 'a', 'b']);
|
||||||
expect(
|
|
||||||
await tools.addComposer(['a', 'b', 'composer:v1.2.3'])
|
|
||||||
).toStrictEqual(['composer:1.2.3', 'a', 'b']);
|
|
||||||
expect(
|
expect(
|
||||||
await tools.addComposer(['a', 'b', 'composer:snapshot'])
|
await tools.addComposer(['a', 'b', 'composer:snapshot'])
|
||||||
).toStrictEqual(['composer:snapshot', 'a', 'b']);
|
).toStrictEqual(['composer:snapshot', 'a', 'b']);
|
||||||
@ -269,9 +261,6 @@ describe('Tools tests', () => {
|
|||||||
expect(
|
expect(
|
||||||
await tools.addComposer(['a', 'b', 'c', 'composer:v2'])
|
await tools.addComposer(['a', 'b', 'c', 'composer:v2'])
|
||||||
).toStrictEqual(['composer:2', 'a', 'b', 'c']);
|
).toStrictEqual(['composer:2', 'a', 'b', 'c']);
|
||||||
expect(
|
|
||||||
await tools.addComposer(['hirak', 'b', 'c', 'composer:v2'])
|
|
||||||
).toStrictEqual(['composer:1', 'hirak', 'b', 'c']);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getComposerUrl', async () => {
|
it('checking getComposerUrl', async () => {
|
||||||
@ -293,21 +282,6 @@ describe('Tools tests', () => {
|
|||||||
expect(await tools.getComposerUrl('2')).toContain(
|
expect(await tools.getComposerUrl('2')).toContain(
|
||||||
'https://getcomposer.org/composer-2.phar'
|
'https://getcomposer.org/composer-2.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('1.7.2')).toContain(
|
|
||||||
'https://github.com/composer/composer/releases/download/1.7.2/composer.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getComposerUrl('1.7.2')).toContain(
|
|
||||||
'https://getcomposer.org/composer-1.7.2.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getComposerUrl('2.0.0-RC2')).toContain(
|
|
||||||
'https://github.com/composer/composer/releases/download/2.0.0-RC2/composer.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getComposerUrl('2.0.0-RC2')).toContain(
|
|
||||||
'https://getcomposer.org/composer-2.0.0-RC2.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getComposerUrl('wrong')).toContain(
|
|
||||||
'https://getcomposer.org/composer-stable.phar'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getSymfonyUri', async () => {
|
it('checking getSymfonyUri', async () => {
|
||||||
@ -336,9 +310,15 @@ 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'
|
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
|
||||||
);
|
);
|
||||||
expect(tools_list).toStrictEqual(['composer:1.2.3', 'tool', 'phinx']);
|
expect(tools_list).toStrictEqual([
|
||||||
|
'composer',
|
||||||
|
'tool',
|
||||||
|
'phinx',
|
||||||
|
'prestissimo',
|
||||||
|
'composer-prefetcher'
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addArchive', async () => {
|
it('checking addArchive', async () => {
|
||||||
@ -453,7 +433,7 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
it('checking addTools on darwin', async () => {
|
it('checking addTools on darwin', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, cs2pr:1.2.3, phpize, php-config, symfony:1.2.3',
|
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3',
|
||||||
'7.4',
|
'7.4',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
@ -482,6 +462,12 @@ describe('Tools tests', () => {
|
|||||||
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-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
|
||||||
|
);
|
||||||
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'
|
||||||
);
|
);
|
||||||
@ -490,7 +476,7 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
it('checking addTools on windows', async () => {
|
it('checking addTools on windows', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'codeception, cs2pr, deployer, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, does_not_exist, composer',
|
'codeception, cs2pr, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, does_not_exist',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
@ -503,6 +489,7 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://deployer.org/deployer.phar deployer'
|
'Add-Tool https://deployer.org/deployer.phar deployer'
|
||||||
);
|
);
|
||||||
|
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'
|
||||||
);
|
);
|
||||||
@ -524,7 +511,7 @@ describe('Tools tests', () => {
|
|||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.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('Add-Composertool prestissimo prestissimo hirak/');
|
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
||||||
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
||||||
|
@ -17,19 +17,13 @@ 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['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 asyncForEach', async () => {
|
it('checking asyncForEach', async () => {
|
||||||
|
225
dist/index.js
vendored
225
dist/index.js
vendored
@ -953,29 +953,45 @@ class ExecState extends events.EventEmitter {
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 82:
|
/***/ 86:
|
||||||
/***/ (function(__unusedmodule, exports) {
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// We use any as a valid input type
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
if (k2 === undefined) k2 = k;
|
||||||
|
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.prototype.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));
|
||||||
/**
|
/**
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
* Cache json files for problem matchers
|
||||||
* @param input input to sanitize into a string
|
|
||||||
*/
|
*/
|
||||||
function toCommandValue(input) {
|
async function addMatchers() {
|
||||||
if (input === null || input === undefined) {
|
const config_path = path.join(__dirname, '..', 'src', 'configs', 'phpunit.json');
|
||||||
return '';
|
const runner_dir = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
||||||
}
|
await io.cp(config_path, runner_dir);
|
||||||
else if (typeof input === 'string' || input instanceof String) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
return JSON.stringify(input);
|
|
||||||
}
|
}
|
||||||
exports.toCommandValue = toCommandValue;
|
exports.addMatchers = addMatchers;
|
||||||
//# sourceMappingURL=utils.js.map
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@ -986,42 +1002,6 @@ 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) {
|
||||||
|
|
||||||
@ -1054,25 +1034,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.getInput = exports.readEnv = void 0;
|
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;
|
||||||
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.
|
||||||
*
|
*
|
||||||
@ -1080,17 +1045,13 @@ exports.readEnv = readEnv;
|
|||||||
* @param mandatory
|
* @param mandatory
|
||||||
*/
|
*/
|
||||||
async function getInput(name, mandatory) {
|
async function getInput(name, mandatory) {
|
||||||
const input = core.getInput(name);
|
const input = process.env[name];
|
||||||
const env_input = await readEnv(name);
|
switch (input) {
|
||||||
switch (true) {
|
case '':
|
||||||
case input != '':
|
case undefined:
|
||||||
return input;
|
return core.getInput(name, { required: mandatory });
|
||||||
case input == '' && env_input != '':
|
|
||||||
return env_input;
|
|
||||||
case input == '' && env_input == '' && mandatory:
|
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
|
||||||
default:
|
default:
|
||||||
return '';
|
return input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getInput = getInput;
|
exports.getInput = getInput;
|
||||||
@ -1309,7 +1270,6 @@ 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
|
||||||
*
|
*
|
||||||
@ -1363,14 +1323,28 @@ 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 utils_1.toCommandValue(s)
|
return 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 utils_1.toCommandValue(s)
|
return toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
@ -1404,8 +1378,6 @@ 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));
|
||||||
/**
|
/**
|
||||||
@ -1432,17 +1404,9 @@ 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 = utils_1.toCommandValue(val);
|
const convertedVal = command_1.toCommandValue(val);
|
||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
const filePath = process.env['GITHUB_ENV'] || '';
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
@ -1458,13 +1422,7 @@ exports.setSecret = setSecret;
|
|||||||
* @param inputPath
|
* @param inputPath
|
||||||
*/
|
*/
|
||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
const filePath = process.env['GITHUB_PATH'] || '';
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
if (filePath) {
|
|
||||||
file_command_1.issueCommand('PATH', inputPath);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
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;
|
||||||
@ -1894,19 +1852,15 @@ exports.getSymfonyUri = getSymfonyUri;
|
|||||||
*/
|
*/
|
||||||
async function addComposer(tools_list) {
|
async function addComposer(tools_list) {
|
||||||
const regex_any = /^composer($|:.*)/;
|
const regex_any = /^composer($|:.*)/;
|
||||||
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
|
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$)/;
|
||||||
const regex_composer1_tools = /hirak|prestissimo|narrowspark|composer-prefetcher/;
|
|
||||||
const matches = tools_list.filter(tool => regex_valid.test(tool));
|
const matches = tools_list.filter(tool => regex_valid.test(tool));
|
||||||
let composer = 'composer';
|
let composer = 'composer';
|
||||||
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
||||||
switch (true) {
|
switch (matches[0]) {
|
||||||
case regex_composer1_tools.test(tools_list.join(' ')):
|
case undefined:
|
||||||
composer = 'composer:1';
|
|
||||||
break;
|
|
||||||
case matches[0] == undefined:
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
composer = matches[matches.length - 1].replace(/v(\d\S*)/, '$1');
|
composer = matches[matches.length - 1].replace(/v([1-2])/, '$1');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tools_list.unshift(composer);
|
tools_list.unshift(composer);
|
||||||
@ -1919,17 +1873,18 @@ exports.addComposer = addComposer;
|
|||||||
* @param version
|
* @param version
|
||||||
*/
|
*/
|
||||||
async function getComposerUrl(version) {
|
async function getComposerUrl(version) {
|
||||||
let cache_url = `https://github.com/shivammathur/composer-cache/releases/latest/download/composer-${version.replace('latest', 'stable')}.phar`;
|
const cache_url = 'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-' +
|
||||||
switch (true) {
|
version.replace('latest', 'stable') +
|
||||||
case /^snapshot$/.test(version):
|
'.phar,';
|
||||||
return `${cache_url},https://getcomposer.org/composer.phar`;
|
switch (version) {
|
||||||
case /^preview$|^[1-2]$/.test(version):
|
case 'snapshot':
|
||||||
return `${cache_url},https://getcomposer.org/composer-${version}.phar`;
|
return cache_url + 'https://getcomposer.org/composer.phar';
|
||||||
case /^\d+\.\d+\.\d+[\w-]*$/.test(version):
|
case 'preview':
|
||||||
cache_url = `https://github.com/composer/composer/releases/download/${version}/composer.phar`;
|
case '1':
|
||||||
return `${cache_url},https://getcomposer.org/composer-${version}.phar`;
|
case '2':
|
||||||
|
return (cache_url + 'https://getcomposer.org/composer-' + version + '.phar');
|
||||||
default:
|
default:
|
||||||
return `${cache_url},https://getcomposer.org/composer-stable.phar`;
|
return cache_url + 'https://getcomposer.org/composer-stable.phar';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getComposerUrl = getComposerUrl;
|
exports.getComposerUrl = getComposerUrl;
|
||||||
@ -2380,6 +2335,7 @@ 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
|
||||||
*
|
*
|
||||||
@ -2390,7 +2346,7 @@ const utils = __importStar(__webpack_require__(163));
|
|||||||
async function build(filename, version, os_version) {
|
async function build(filename, version, os_version) {
|
||||||
// taking inputs
|
// taking inputs
|
||||||
const name = 'setup-php';
|
const name = 'setup-php';
|
||||||
const url = 'https://setup-php.com/support';
|
const url = 'setup-php.com/support';
|
||||||
const extension_csv = (await utils.getInput('extensions', false)) ||
|
const extension_csv = (await utils.getInput('extensions', false)) ||
|
||||||
(await utils.getInput('extension', false)) ||
|
(await utils.getInput('extension', false)) ||
|
||||||
(await utils.getInput('extension-csv', false));
|
(await utils.getInput('extension-csv', false));
|
||||||
@ -2424,14 +2380,9 @@ exports.build = build;
|
|||||||
*/
|
*/
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
core.warning('setup-php v1 is deprecated.\nPlease upgrade to v2 - https://github.com/shivammathur/setup-php/wiki/Switch-to-v2');
|
|
||||||
const os_version = process.platform;
|
const os_version = process.platform;
|
||||||
let version = await utils.getInput('php-version', true);
|
let version = await utils.getInput('php-version', true);
|
||||||
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
||||||
if (version == '8.1') {
|
|
||||||
core.setFailed('PHP 8.1 is not supported on setup-php v1.\nPlease upgrade to v2 - https://github.com/shivammathur/setup-php/wiki/Switch-to-v2');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// check the os version and run the respective script
|
// check the os version and run the respective script
|
||||||
let script_path = '';
|
let script_path = '';
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
@ -2445,6 +2396,7 @@ async function run() {
|
|||||||
await exec_1.exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
|
await exec_1.exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
await matchers.addMatchers();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
@ -2706,8 +2658,9 @@ const utils = __importStar(__webpack_require__(163));
|
|||||||
*
|
*
|
||||||
* @param extension_csv
|
* @param extension_csv
|
||||||
* @param version
|
* @param version
|
||||||
|
* @param pipe
|
||||||
*/
|
*/
|
||||||
async function addExtensionDarwin(extension_csv, version) {
|
async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||||
const extensions = await utils.extensionArray(extension_csv);
|
const extensions = await utils.extensionArray(extension_csv);
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
await utils.asyncForEach(extensions, async function (extension) {
|
await utils.asyncForEach(extensions, async function (extension) {
|
||||||
@ -2727,18 +2680,28 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
' ' +
|
' ' +
|
||||||
ext_prefix;
|
ext_prefix;
|
||||||
return;
|
return;
|
||||||
// match 5.6xdebug to 8.0xdebug, 5.6igbinary to 8.0igbinary
|
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||||
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
|
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
case /(5\.6|7\.[0-4]|8\.0)(xdebug|igbinary)/.test(version_extension):
|
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(version_extension):
|
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
command = 'add_brew_extension ' + extension_name;
|
command = 'add_brew_extension ' + extension_name;
|
||||||
break;
|
break;
|
||||||
// match 5.6redis
|
// match 5.6redis
|
||||||
case /5\.6redis/.test(version_extension):
|
case /5\.6redis/.test(version_extension):
|
||||||
command = command_prefix + 'redis-2.2.8';
|
command = command_prefix + 'redis-2.2.8';
|
||||||
break;
|
break;
|
||||||
|
// match imagick
|
||||||
|
case /^imagick$/.test(extension):
|
||||||
|
command =
|
||||||
|
'brew install pkg-config imagemagick' +
|
||||||
|
pipe +
|
||||||
|
' && ' +
|
||||||
|
command_prefix +
|
||||||
|
'imagick' +
|
||||||
|
pipe;
|
||||||
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
@ -2911,7 +2874,7 @@ async function addExtension(extension_csv, version, os_version, no_step = false)
|
|||||||
case 'win32':
|
case 'win32':
|
||||||
return script + (await addExtensionWindows(extension_csv, version));
|
return script + (await addExtensionWindows(extension_csv, version));
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return script + (await addExtensionDarwin(extension_csv, version));
|
return script + (await addExtensionDarwin(extension_csv, version, pipe));
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return script + (await addExtensionLinux(extension_csv, version, pipe));
|
return script + (await addExtensionLinux(extension_csv, version, pipe));
|
||||||
default:
|
default:
|
||||||
|
@ -17,11 +17,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -37,12 +37,12 @@ jobs:
|
|||||||
- name: Start mysql service
|
- name: Start mysql service
|
||||||
run: sudo /etc/init.d/mysql start
|
run: sudo /etc/init.d/mysql start
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
@ -70,12 +70,12 @@ jobs:
|
|||||||
php-version: '7.3'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
@ -98,12 +98,12 @@ jobs:
|
|||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -35,12 +35,12 @@ jobs:
|
|||||||
extensions: mbstring, intl, redis, pdo_pgsql
|
extensions: mbstring, intl, redis, pdo_pgsql
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
@ -68,12 +68,12 @@ jobs:
|
|||||||
php-version: '7.3'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
@ -96,12 +96,12 @@ jobs:
|
|||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -19,12 +19,12 @@ jobs:
|
|||||||
extensions: mbstring, intl, pdo_sqlite, pdo_mysql
|
extensions: mbstring, intl, pdo_sqlite, pdo_mysql
|
||||||
coverage: pcov #optional
|
coverage: pcov #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
@ -48,12 +48,12 @@ jobs:
|
|||||||
php-version: '7.3'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
@ -76,12 +76,12 @@ jobs:
|
|||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -18,12 +18,12 @@ jobs:
|
|||||||
extensions: mbstring, intl, curl, dom
|
extensions: mbstring, intl, curl, dom
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -44,12 +44,12 @@ jobs:
|
|||||||
- name: Start mysql service
|
- name: Start mysql service
|
||||||
run: sudo /etc/init.d/mysql start
|
run: sudo /etc/init.d/mysql start
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -44,12 +44,12 @@ jobs:
|
|||||||
extensions: mbstring, dom, fileinfo, pgsql
|
extensions: mbstring, dom, fileinfo, pgsql
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -20,12 +20,12 @@ jobs:
|
|||||||
extensions: mbstring, dom, fileinfo
|
extensions: mbstring, dom, fileinfo
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -44,12 +44,12 @@ jobs:
|
|||||||
- name: Start mysql service
|
- name: Start mysql service
|
||||||
run: sudo /etc/init.d/mysql start
|
run: sudo /etc/init.d/mysql start
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -44,12 +44,12 @@ jobs:
|
|||||||
extensions: mbstring, dom, fileinfo, pgsql
|
extensions: mbstring, dom, fileinfo, pgsql
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -20,12 +20,12 @@ jobs:
|
|||||||
extensions: mbstring, dom, fileinfo, mysql
|
extensions: mbstring, dom, fileinfo, mysql
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -44,12 +44,12 @@ jobs:
|
|||||||
- name: Start mysql service
|
- name: Start mysql service
|
||||||
run: sudo /etc/init.d/mysql start
|
run: sudo /etc/init.d/mysql start
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -43,12 +43,12 @@ jobs:
|
|||||||
extensions: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
|
extensions: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -33,12 +33,12 @@ jobs:
|
|||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-yarn-
|
restore-keys: ${{ runner.os }}-yarn-
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -18,12 +18,12 @@ jobs:
|
|||||||
extensions: mbstring, simplexml, dom
|
extensions: mbstring, simplexml, dom
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -31,12 +31,12 @@ jobs:
|
|||||||
- name: Start mysql service
|
- name: Start mysql service
|
||||||
run: sudo /etc/init.d/mysql start
|
run: sudo /etc/init.d/mysql start
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -29,12 +29,12 @@ jobs:
|
|||||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -20,12 +20,12 @@ jobs:
|
|||||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -41,12 +41,12 @@ jobs:
|
|||||||
- name: Start mysql service
|
- name: Start mysql service
|
||||||
run: sudo /etc/init.d/mysql start
|
run: sudo /etc/init.d/mysql start
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -39,12 +39,12 @@ jobs:
|
|||||||
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
|
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
@ -18,12 +18,12 @@ jobs:
|
|||||||
extensions: mbstring, bcmath, curl, intl
|
extensions: mbstring, bcmath, curl, intl
|
||||||
coverage: xdebug #optional
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composercache
|
||||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
2559
package-lock.json
generated
2559
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.10.0",
|
"version": "1.9.6",
|
||||||
"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",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"lint": "eslint **/*.ts --cache --fix",
|
"lint": "eslint **/*.ts --cache",
|
||||||
"format": "prettier --write **/*.ts && git add .",
|
"format": "prettier --write **/*.ts && git add .",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"release": "ncc build src/install.ts -o dist && git add -f dist/",
|
"release": "ncc build src/install.ts -o dist && git add -f dist/",
|
||||||
@ -24,28 +24,28 @@
|
|||||||
"author": "shivammathur",
|
"author": "shivammathur",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.5",
|
||||||
"@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.15",
|
"@types/jest": "^26.0.13",
|
||||||
"@types/node": "^14.14.7",
|
"@types/node": "^14.6.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.7.0",
|
"@typescript-eslint/eslint-plugin": "^4.0.1",
|
||||||
"@typescript-eslint/parser": "^4.7.0",
|
"@typescript-eslint/parser": "^4.0.1",
|
||||||
"@zeit/ncc": "^0.22.3",
|
"@zeit/ncc": "^0.22.3",
|
||||||
"eslint": "^7.13.0",
|
"eslint": "^7.8.1",
|
||||||
"eslint-config-prettier": "^6.15.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.22.0",
|
||||||
"eslint-plugin-jest": "^24.1.3",
|
"eslint-plugin-jest": "^24.0.0",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"husky": "^4.3.0",
|
"husky": "^4.2.5",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.4.2",
|
||||||
"jest-circus": "^26.6.3",
|
"jest-circus": "^26.4.2",
|
||||||
"prettier": "^2.1.2",
|
"prettier": "^2.1.1",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^26.3.0",
|
||||||
"typescript": "^4.0.5"
|
"typescript": "^4.0.2"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"skipCI": true,
|
"skipCI": true,
|
||||||
|
@ -6,10 +6,12 @@ import * as utils from './utils';
|
|||||||
*
|
*
|
||||||
* @param extension_csv
|
* @param extension_csv
|
||||||
* @param version
|
* @param version
|
||||||
|
* @param pipe
|
||||||
*/
|
*/
|
||||||
export async function addExtensionDarwin(
|
export async function addExtensionDarwin(
|
||||||
extension_csv: string,
|
extension_csv: string,
|
||||||
version: string
|
version: string,
|
||||||
|
pipe: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
@ -30,20 +32,28 @@ export async function addExtensionDarwin(
|
|||||||
' ' +
|
' ' +
|
||||||
ext_prefix;
|
ext_prefix;
|
||||||
return;
|
return;
|
||||||
// match 5.6xdebug to 8.0xdebug, 5.6igbinary to 8.0igbinary
|
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||||
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
|
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
case /(5\.6|7\.[0-4]|8\.0)(xdebug|igbinary)/.test(version_extension):
|
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(
|
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
|
||||||
version_extension
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
):
|
|
||||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
|
||||||
command = 'add_brew_extension ' + extension_name;
|
command = 'add_brew_extension ' + extension_name;
|
||||||
break;
|
break;
|
||||||
// match 5.6redis
|
// match 5.6redis
|
||||||
case /5\.6redis/.test(version_extension):
|
case /5\.6redis/.test(version_extension):
|
||||||
command = command_prefix + 'redis-2.2.8';
|
command = command_prefix + 'redis-2.2.8';
|
||||||
break;
|
break;
|
||||||
|
// match imagick
|
||||||
|
case /^imagick$/.test(extension):
|
||||||
|
command =
|
||||||
|
'brew install pkg-config imagemagick' +
|
||||||
|
pipe +
|
||||||
|
' && ' +
|
||||||
|
command_prefix +
|
||||||
|
'imagick' +
|
||||||
|
pipe;
|
||||||
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
@ -229,7 +239,7 @@ export async function addExtension(
|
|||||||
case 'win32':
|
case 'win32':
|
||||||
return script + (await addExtensionWindows(extension_csv, version));
|
return script + (await addExtensionWindows(extension_csv, version));
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return script + (await addExtensionDarwin(extension_csv, version));
|
return script + (await addExtensionDarwin(extension_csv, version, pipe));
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return script + (await addExtensionLinux(extension_csv, version, pipe));
|
return script + (await addExtensionLinux(extension_csv, version, pipe));
|
||||||
default:
|
default:
|
||||||
|
@ -5,6 +5,7 @@ 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
|
||||||
@ -20,7 +21,7 @@ export async function build(
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
// taking inputs
|
// taking inputs
|
||||||
const name = 'setup-php';
|
const name = 'setup-php';
|
||||||
const url = 'https://setup-php.com/support';
|
const url = 'setup-php.com/support';
|
||||||
const extension_csv: string =
|
const extension_csv: string =
|
||||||
(await utils.getInput('extensions', false)) ||
|
(await utils.getInput('extensions', false)) ||
|
||||||
(await utils.getInput('extension', false)) ||
|
(await utils.getInput('extension', false)) ||
|
||||||
@ -62,18 +63,9 @@ export async function build(
|
|||||||
*/
|
*/
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
core.warning(
|
|
||||||
'setup-php v1 is deprecated.\nPlease upgrade to v2 - https://github.com/shivammathur/setup-php/wiki/Switch-to-v2'
|
|
||||||
);
|
|
||||||
const os_version: string = process.platform;
|
const os_version: string = process.platform;
|
||||||
let version: string = await utils.getInput('php-version', true);
|
let version: string = await utils.getInput('php-version', true);
|
||||||
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
||||||
if (version == '8.1') {
|
|
||||||
core.setFailed(
|
|
||||||
'PHP 8.1 is not supported on setup-php v1.\nPlease upgrade to v2 - https://github.com/shivammathur/setup-php/wiki/Switch-to-v2'
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// check the os version and run the respective script
|
// check the os version and run the respective script
|
||||||
let script_path = '';
|
let script_path = '';
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
@ -87,6 +79,7 @@ export async function run(): Promise<void> {
|
|||||||
await exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
|
await exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
await matchers.addMatchers();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
18
src/matchers.ts
Normal file
18
src/matchers.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
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',
|
||||||
|
'phpunit.json'
|
||||||
|
);
|
||||||
|
const runner_dir: string = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
||||||
|
await io.cp(config_path, runner_dir);
|
||||||
|
}
|
@ -40,10 +40,10 @@ pecl_install() {
|
|||||||
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the PECL version
|
# Fuction 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|preview)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)")
|
||||||
@ -58,7 +58,7 @@ add_pecl_extension() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
pecl_version=$2
|
pecl_version=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then
|
||||||
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
||||||
fi
|
fi
|
||||||
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
@ -124,7 +124,7 @@ configure_composer() {
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
echo "$composer_bin" >> "$GITHUB_PATH"
|
echo "::add-path::/Users/$USER/.composer/vendor/bin"
|
||||||
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
|
||||||
@ -145,10 +145,6 @@ add_tool() {
|
|||||||
else
|
else
|
||||||
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
||||||
fi
|
fi
|
||||||
if [ "$status_code" != "200" ] && [[ "$url" =~ .*github.com.*releases.*latest.* ]]; then
|
|
||||||
url=$(echo $url | sed -e "s|releases/latest/download|releases/download/$(curl "${curl_opts[@]}" "$(echo "$url" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "$url" | sed -e "s/.*\///")" | cut -d '/' -f 1)|")
|
|
||||||
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
|
||||||
fi
|
|
||||||
if [ "$status_code" = "200" ]; then
|
if [ "$status_code" = "200" ]; then
|
||||||
sudo chmod a+x "$tool_path"
|
sudo chmod a+x "$tool_path"
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
@ -180,9 +176,6 @@ add_composertool() {
|
|||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
if [ -e "$composer_bin/composer" ]; then
|
|
||||||
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to configure PECL
|
# Function to configure PECL
|
||||||
@ -199,20 +192,8 @@ add_pecl() {
|
|||||||
add_log "$tick" "PECL" "Added"
|
add_log "$tick" "PECL" "Added"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update dependencies
|
|
||||||
update_dependencies() {
|
|
||||||
if [ "$version" = '8.0' ]; then
|
|
||||||
while read -r formula; do
|
|
||||||
curl -o "$(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/$formula.rb" "${curl_opts[@]}" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb" &
|
|
||||||
to_wait+=( $! )
|
|
||||||
done < "$(brew --prefix)/Homebrew/Library/Taps/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
|
||||||
wait "${to_wait[@]}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to setup PHP and composer
|
# Function to setup PHP and composer
|
||||||
setup_php() {
|
setup_php() {
|
||||||
update_dependencies
|
|
||||||
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
||||||
brew tap --shallow shivammathur/homebrew-php
|
brew tap --shallow shivammathur/homebrew-php
|
||||||
brew install shivammathur/php/php@"$version"
|
brew install shivammathur/php/php@"$version"
|
||||||
@ -223,10 +204,8 @@ setup_php() {
|
|||||||
tick="✓"
|
tick="✓"
|
||||||
cross="✗"
|
cross="✗"
|
||||||
version=$1
|
version=$1
|
||||||
dist=$2
|
|
||||||
tool_path_dir="/usr/local/bin"
|
tool_path_dir="/usr/local/bin"
|
||||||
curl_opts=(-sL)
|
curl_opts=(-sL)
|
||||||
composer_bin="$HOME/.composer/vendor/bin"
|
|
||||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||||
|
|
||||||
# Setup PHP
|
# Setup PHP
|
||||||
@ -242,8 +221,7 @@ sudo chmod 777 "$ini_file" "$tool_path_dir"
|
|||||||
echo -e "date.timezone=UTC\nmemory_limit=-1" >>"$ini_file"
|
echo -e "date.timezone=UTC\nmemory_limit=-1" >>"$ini_file"
|
||||||
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
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 ' ')
|
||||||
configure_pecl
|
configure_pecl
|
||||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
|
||||||
add_log "$tick" "PHP" "$status PHP $semver"
|
add_log "$tick" "PHP" "$status PHP $semver"
|
||||||
|
@ -22,7 +22,7 @@ update_ppa() {
|
|||||||
install_phalcon() {
|
install_phalcon() {
|
||||||
extension=$1
|
extension=$1
|
||||||
version=$2
|
version=$2
|
||||||
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ cleanup_lists() {
|
|||||||
sudo mv /etc/apt/sources.list.d /etc/apt/sources.list.d.save || true
|
sudo mv /etc/apt/sources.list.d /etc/apt/sources.list.d.save || true
|
||||||
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/ || true
|
sudo mv /etc/apt/sources.list.d.save/*ondrej*.list /etc/apt/sources.list.d/ || true
|
||||||
trap "sudo mv /etc/apt/sources.list.d.save/*.list /etc/apt/sources.list.d/ 2>/dev/null" exit
|
trap "sudo mv /etc/apt/sources.list.d.save/*.list /etc/apt/sources.list.d/" exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,10 +46,10 @@ configure_pecl() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the PECL version
|
# Fuction 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|preview)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)")
|
||||||
@ -103,12 +103,9 @@ add_extension() {
|
|||||||
elif check_extension "$extension"; then
|
elif check_extension "$extension"; then
|
||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! check_extension "$extension"; then
|
elif ! check_extension "$extension"; then
|
||||||
if [ "$version" = "8.0" ]; then
|
eval "$install_command" >/dev/null 2>&1 ||
|
||||||
pecl_install "$extension"
|
(update_lists && eval "$install_command" >/dev/null 2>&1) ||
|
||||||
else
|
sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
eval "$install_command" >/dev/null 2>&1 ||
|
|
||||||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
|
||||||
fi
|
|
||||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
fi
|
fi
|
||||||
@ -120,7 +117,7 @@ add_pecl_extension() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
pecl_version=$2
|
pecl_version=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then
|
||||||
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
||||||
fi
|
fi
|
||||||
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
@ -158,7 +155,7 @@ configure_composer() {
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
echo "$composer_bin" >> "$GITHUB_PATH"
|
echo "::add-path::/home/$USER/.composer/vendor/bin"
|
||||||
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
|
||||||
@ -179,10 +176,6 @@ add_tool() {
|
|||||||
else
|
else
|
||||||
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
||||||
fi
|
fi
|
||||||
if [ "$status_code" != "200" ] && [[ "$url" =~ .*github.com.*releases.*latest.* ]]; then
|
|
||||||
url=$(echo $url | sed -e "s|releases/latest/download|releases/download/$(curl "${curl_opts[@]}" "$(echo "$url" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "$url" | sed -e "s/.*\///")" | cut -d '/' -f 1)|")
|
|
||||||
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
|
||||||
fi
|
|
||||||
if [ "$status_code" = "200" ]; then
|
if [ "$status_code" = "200" ]; then
|
||||||
sudo chmod a+x "$tool_path"
|
sudo chmod a+x "$tool_path"
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
@ -210,9 +203,6 @@ add_composertool() {
|
|||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
if [ -e "$composer_bin/composer" ]; then
|
|
||||||
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup phpize and php-config
|
# Function to setup phpize and php-config
|
||||||
@ -264,17 +254,15 @@ cross="✗"
|
|||||||
lists_updated="false"
|
lists_updated="false"
|
||||||
pecl_config="false"
|
pecl_config="false"
|
||||||
version=$1
|
version=$1
|
||||||
dist=$2
|
|
||||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||||
apt_install="sudo $debconf_fix apt-fast install -y"
|
apt_install="sudo $debconf_fix apt-fast install -y"
|
||||||
tool_path_dir="/usr/local/bin"
|
tool_path_dir="/usr/local/bin"
|
||||||
curl_opts=(-sL)
|
curl_opts=(-sL)
|
||||||
composer_bin="$HOME/.composer/vendor/bin"
|
|
||||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||||
|
|
||||||
# Setup PHP
|
# Setup PHP
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
sudo mkdir -m 777 -p "$HOME/.composer" /var/run /run/php
|
sudo mkdir -p /var/run /run/php
|
||||||
. /etc/lsb-release
|
. /etc/lsb-release
|
||||||
if [ "$DISTRIB_RELEASE" = "20.04" ]; then
|
if [ "$DISTRIB_RELEASE" = "20.04" ]; then
|
||||||
if ! apt-cache policy | grep -q ondrej/php; then
|
if ! apt-cache policy | grep -q ondrej/php; then
|
||||||
@ -310,5 +298,4 @@ 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 cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
|
||||||
add_log "$tick" "PHP" "$status PHP $semver"
|
add_log "$tick" "PHP" "$status PHP $semver"
|
||||||
|
@ -8,7 +8,7 @@ param (
|
|||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
[ValidateLength(1, [int]::MaxValue)]
|
||||||
[string]
|
[string]
|
||||||
$dist
|
$dir
|
||||||
)
|
)
|
||||||
|
|
||||||
Function Step-Log($message) {
|
Function Step-Log($message) {
|
||||||
@ -48,7 +48,7 @@ Function Add-Printf {
|
|||||||
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
||||||
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe
|
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe
|
||||||
} else {
|
} else {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$php_dir\printf.zip"
|
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$php_dir\printf.zip"
|
||||||
Expand-Archive -Path $php_dir\printf.zip -DestinationPath $php_dir -Force
|
Expand-Archive -Path $php_dir\printf.zip -DestinationPath $php_dir -Force
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -56,23 +56,16 @@ Function Add-Printf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Install-PSPackage() {
|
Function Install-PhpManager() {
|
||||||
param(
|
$module_path = "$php_dir\PhpManager\PhpManager.psm1"
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
|
||||||
$package,
|
|
||||||
[Parameter(Position = 1, Mandatory = $true)]
|
|
||||||
$psm1_path,
|
|
||||||
[Parameter(Position = 2, Mandatory = $true)]
|
|
||||||
$url
|
|
||||||
)
|
|
||||||
$module_path = "$php_dir\$psm1_path.psm1"
|
|
||||||
if(-not (Test-Path $module_path -PathType Leaf)) {
|
if(-not (Test-Path $module_path -PathType Leaf)) {
|
||||||
$zip_file = "$php_dir\$package.zip"
|
$release = Invoke-RestMethod https://api.github.com/repos/mlocati/powershell-phpmanager/releases/latest
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $zip_file
|
$zip_file = "$php_dir\PhpManager.zip"
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri $release.assets[0].browser_download_url -OutFile $zip_file
|
||||||
Expand-Archive -Path $zip_file -DestinationPath $php_dir -Force
|
Expand-Archive -Path $zip_file -DestinationPath $php_dir -Force
|
||||||
}
|
}
|
||||||
Import-Module $module_path
|
Import-Module $module_path
|
||||||
Add-ToProfile $current_profile "$package-search" "Import-Module $module_path"
|
Add-ToProfile $current_profile 'powershell-phpmanager' "Import-Module $module_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Extension {
|
Function Add-Extension {
|
||||||
@ -156,7 +149,7 @@ Function Edit-ComposerConfig() {
|
|||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
Write-Output $composer_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
Write-Output "::add-path::$env:APPDATA\Composer\vendor\bin"
|
||||||
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
|
||||||
}
|
}
|
||||||
@ -179,41 +172,33 @@ Function Add-Tool() {
|
|||||||
if($url.Count -gt 1) { $url = $url[0] }
|
if($url.Count -gt 1) { $url = $url[0] }
|
||||||
if ($tool -eq "symfony") {
|
if ($tool -eq "symfony") {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.exe" >$null 2>&1
|
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.exe" > $null 2>&1
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
||||||
} catch {
|
$bat_content = @()
|
||||||
if($url -match '.*github.com.*releases.*latest.*') {
|
$bat_content += "@ECHO off"
|
||||||
try {
|
$bat_content += "setlocal DISABLEDELAYEDEXPANSION"
|
||||||
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Invoke-WebRequest -UseBasicParsing -Uri ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
$bat_content += "php %BIN_TARGET% %*"
|
||||||
} catch { }
|
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
||||||
}
|
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat" > $null 2>&1
|
||||||
}
|
} catch { }
|
||||||
}
|
}
|
||||||
|
if($tool -eq "phive") {
|
||||||
|
Add-Extension curl >$null 2>&1
|
||||||
|
Add-Extension mbstring >$null 2>&1
|
||||||
|
Add-Extension xml >$null 2>&1
|
||||||
|
} elseif($tool -eq "cs2pr") {
|
||||||
|
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
||||||
|
} elseif($tool -eq "composer") {
|
||||||
|
Edit-ComposerConfig $php_dir\$tool
|
||||||
|
} elseif($tool -eq "wp-cli") {
|
||||||
|
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
||||||
|
}
|
||||||
|
|
||||||
if (((Get-ChildItem -Path $php_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
|
if (((Get-ChildItem -Path $php_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
|
||||||
$bat_content = @()
|
Add-Log $tick $tool "Added"
|
||||||
$bat_content += "@ECHO off"
|
|
||||||
$bat_content += "setlocal DISABLEDELAYEDEXPANSION"
|
|
||||||
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
|
|
||||||
$bat_content += "php %BIN_TARGET% %*"
|
|
||||||
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat" >$null 2>&1
|
|
||||||
if($tool -eq "phan") {
|
|
||||||
Add-Extension fileinfo >$null 2>&1
|
|
||||||
Add-Extension ast >$null 2>&1
|
|
||||||
} elseif($tool -eq "phive") {
|
|
||||||
Add-Extension xml >$null 2>&1
|
|
||||||
} elseif($tool -eq "cs2pr") {
|
|
||||||
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
|
||||||
} elseif($tool -eq "composer") {
|
|
||||||
Edit-ComposerConfig $php_dir\$tool
|
|
||||||
} elseif($tool -eq "wp-cli") {
|
|
||||||
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
|
||||||
}
|
|
||||||
$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"
|
||||||
}
|
}
|
||||||
@ -243,9 +228,6 @@ Function Add-Composertool() {
|
|||||||
} else {
|
} else {
|
||||||
Add-Log $cross $tool "Could not setup $tool"
|
Add-Log $cross $tool "Could not setup $tool"
|
||||||
}
|
}
|
||||||
if(Test-Path $composer_bin\composer) {
|
|
||||||
Copy-Item -Path "$php_dir\composer" -Destination "$composer_bin\composer" -Force
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Pecl() {
|
Function Add-Pecl() {
|
||||||
@ -259,8 +241,6 @@ $php_dir = 'C:\tools\php'
|
|||||||
$ext_dir = "$php_dir\ext"
|
$ext_dir = "$php_dir\ext"
|
||||||
$current_profile = "$PSHOME\Profile.ps1"
|
$current_profile = "$PSHOME\Profile.ps1"
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
$github = 'https://github.com'
|
|
||||||
$composer_bin = "$env:APPDATA\Composer\vendor\bin"
|
|
||||||
$master_version = '8.0'
|
$master_version = '8.0'
|
||||||
$arch = 'x64'
|
$arch = 'x64'
|
||||||
$ts = $env:PHPTS -eq 'ts'
|
$ts = $env:PHPTS -eq 'ts'
|
||||||
@ -273,7 +253,7 @@ if(-not(Test-Path -LiteralPath $current_profile)) {
|
|||||||
|
|
||||||
Add-Printf >$null 2>&1
|
Add-Printf >$null 2>&1
|
||||||
Step-Log "Setup PhpManager"
|
Step-Log "Setup PhpManager"
|
||||||
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" >$null 2>&1
|
Install-PhpManager >$null 2>&1
|
||||||
Add-Log $tick "PhpManager" "Installed"
|
Add-Log $tick "PhpManager" "Installed"
|
||||||
|
|
||||||
Step-Log "Setup PHP"
|
Step-Log "Setup PHP"
|
||||||
@ -286,7 +266,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|||||||
$status = "Installed"
|
$status = "Installed"
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
||||||
if ($version -lt '7.0') {
|
if ($version -lt '7.0') {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1
|
Install-Module -Name VcRedist -Force
|
||||||
$arch='x86'
|
$arch='x86'
|
||||||
}
|
}
|
||||||
if ($version -eq $master_version) {
|
if ($version -eq $master_version) {
|
||||||
@ -305,6 +285,4 @@ Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir
|
|||||||
Set-PhpIniKey -Key 'memory_limit' -Value '-1' -Path $php_dir
|
Set-PhpIniKey -Key 'memory_limit' -Value '-1' -Path $php_dir
|
||||||
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 CurrentUser
|
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
||||||
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
|
||||||
New-Item -ItemType Directory -Path $composer_bin -Force 2>&1 | Out-Null
|
|
||||||
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
||||||
|
39
src/tools.ts
39
src/tools.ts
@ -282,19 +282,15 @@ export async function getSymfonyUri(
|
|||||||
*/
|
*/
|
||||||
export async function addComposer(tools_list: string[]): Promise<string[]> {
|
export async function addComposer(tools_list: string[]): Promise<string[]> {
|
||||||
const regex_any = /^composer($|:.*)/;
|
const regex_any = /^composer($|:.*)/;
|
||||||
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
|
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$)/;
|
||||||
const regex_composer1_tools = /hirak|prestissimo|narrowspark|composer-prefetcher/;
|
|
||||||
const matches: string[] = tools_list.filter(tool => regex_valid.test(tool));
|
const matches: string[] = tools_list.filter(tool => regex_valid.test(tool));
|
||||||
let composer = 'composer';
|
let composer = 'composer';
|
||||||
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
||||||
switch (true) {
|
switch (matches[0]) {
|
||||||
case regex_composer1_tools.test(tools_list.join(' ')):
|
case undefined:
|
||||||
composer = 'composer:1';
|
|
||||||
break;
|
|
||||||
case matches[0] == undefined:
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
composer = matches[matches.length - 1].replace(/v(\d\S*)/, '$1');
|
composer = matches[matches.length - 1].replace(/v([1-2])/, '$1');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tools_list.unshift(composer);
|
tools_list.unshift(composer);
|
||||||
@ -307,20 +303,21 @@ export async function addComposer(tools_list: string[]): Promise<string[]> {
|
|||||||
* @param version
|
* @param version
|
||||||
*/
|
*/
|
||||||
export async function getComposerUrl(version: string): Promise<string> {
|
export async function getComposerUrl(version: string): Promise<string> {
|
||||||
let cache_url = `https://github.com/shivammathur/composer-cache/releases/latest/download/composer-${version.replace(
|
const cache_url =
|
||||||
'latest',
|
'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-' +
|
||||||
'stable'
|
version.replace('latest', 'stable') +
|
||||||
)}.phar`;
|
'.phar,';
|
||||||
switch (true) {
|
switch (version) {
|
||||||
case /^snapshot$/.test(version):
|
case 'snapshot':
|
||||||
return `${cache_url},https://getcomposer.org/composer.phar`;
|
return cache_url + 'https://getcomposer.org/composer.phar';
|
||||||
case /^preview$|^[1-2]$/.test(version):
|
case 'preview':
|
||||||
return `${cache_url},https://getcomposer.org/composer-${version}.phar`;
|
case '1':
|
||||||
case /^\d+\.\d+\.\d+[\w-]*$/.test(version):
|
case '2':
|
||||||
cache_url = `https://github.com/composer/composer/releases/download/${version}/composer.phar`;
|
return (
|
||||||
return `${cache_url},https://getcomposer.org/composer-${version}.phar`;
|
cache_url + 'https://getcomposer.org/composer-' + version + '.phar'
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return `${cache_url},https://getcomposer.org/composer-stable.phar`;
|
return cache_url + 'https://getcomposer.org/composer-stable.phar';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
31
src/utils.ts
31
src/utils.ts
@ -2,21 +2,6 @@ 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.
|
||||||
*
|
*
|
||||||
@ -27,17 +12,13 @@ export async function getInput(
|
|||||||
name: string,
|
name: string,
|
||||||
mandatory: boolean
|
mandatory: boolean
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const input = core.getInput(name);
|
const input = process.env[name];
|
||||||
const env_input = await readEnv(name);
|
switch (input) {
|
||||||
switch (true) {
|
case '':
|
||||||
case input != '':
|
case undefined:
|
||||||
return input;
|
return core.getInput(name, {required: mandatory});
|
||||||
case input == '' && env_input != '':
|
|
||||||
return env_input;
|
|
||||||
case input == '' && env_input == '' && mandatory:
|
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
|
||||||
default:
|
default:
|
||||||
return '';
|
return input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user