Compare commits

..

93 Commits

Author SHA1 Message Date
da0e854737 Fix phalcon setup on Ubuntu 2022-01-05 15:18:04 +05:30
f24f33ea89 Scope binary tools installed using composer 2021-12-31 00:11:33 +05:30
7789b4e03e Switch to phar releases for phpspec 2021-12-29 20:17:24 +05:30
75988cd9be Update sponsors section in README 2021-12-26 06:55:07 +05:30
65341e4a6d Fix parsing composer version when snapshot is stable 2021-12-22 22:34:35 +05:30
0f13e29d1f Use composer phars from cache with PHP version 2021-12-22 20:07:07 +05:30
5cd765a20d Add support for blackfire extension on PHP 8.1 2021-12-20 19:50:31 +05:30
deb31af403 Fix http support on 8.1
Fallback to source/pecl if http extension package is missing
2021-12-20 19:35:45 +05:30
a6b35b119b Fix oci8 setup on Windows 2021-12-20 18:29:46 +05:30
7dadf1bf21 Improve coverage section in README 2021-12-19 17:09:41 +05:30
cca8ad3588 Fix node-release workflow to add lib to the packages 2021-12-17 18:34:16 +05:30
7117491f1a Update and refactor example workflows 2021-12-15 16:49:10 +05:30
aa1efabe45 Change command to start mysql from sysVinit to systemd in examples 2021-12-15 13:26:33 +05:30
dab0e73adf Refactor addPhive in tools.ts 2021-12-13 08:11:59 +05:30
15b20027cf Use GitHub releases for phive's latest version 2021-12-13 07:47:57 +05:30
1b4cc0b6fa Revert to GitHub Releases as primary script source 2021-12-08 20:34:44 +05:30
bbba8d75a6 Change primary script sources 2021-12-08 19:28:08 +05:30
a274bd910a Fix to handle wrong pecl versions with hyphen 2021-12-08 04:56:29 +05:30
f4d1db5c23 Update Node version to 16.x 2021-12-07 21:33:45 +05:30
cecf84878d Update Harden Runner step in node workflows 2021-12-07 21:26:23 +05:30
be75d5e01d Add patch to add PHP 8.1 extensions from snaps on Windows 2021-12-06 10:42:28 +05:30
cf36ddc55e Set nightly versions to 8.2 and newer 2021-12-06 10:13:24 +05:30
fe438f8e25 Mark PHP 7.3 as End of life in README 2021-12-06 08:22:55 +05:30
fdd0a76eca Mark PHP 7.4 as Security fixes only in README 2021-11-28 21:15:27 +05:30
7c0b4c8c8e Bump version to 2.16.0 2021-11-26 00:15:10 +05:30
b33066473d Log error when wrong Xdebug version is requested 2021-11-26 00:07:28 +05:30
92b4784fb6 Suppress error in Get-Php run before PHP setup in win32.ps1 2021-11-25 23:24:48 +05:30
345999bf0b Add support for mailparse on macOS using shivammathur/extensions tap 2021-11-25 20:29:41 +05:30
4c5c122aa6 PHP 8.1 is now stable and marked as default version 2021-11-25 17:34:13 +05:30
bee5abe269 Bump extension cache key in workflow.yml 2021-11-24 18:23:02 +05:30
220d0c24c7 Fix reading build commit on Windows 2021-11-24 18:01:01 +05:30
2f5c2edb22 Fix upgrading nightly versions 2021-11-18 19:40:47 +05:30
721e4c3367 Add dev package for PHP by default on self-hosted 2021-11-18 16:51:20 +05:30
2f2a90e464 Add workaround to ensure PHPUnit installed by setup-php is used along with PHPUnit-Polyfills 2021-11-16 08:23:46 +05:30
81a06ff6ed Fix shellcheck warning in add_tools.sh 2021-11-16 08:14:06 +05:30
dfc02c42d9 Bump extension cache key in workflow.yml 2021-11-11 19:55:50 +05:30
ac7d3d7f84 Merge pull request #528 from shivammathur/develop
Stop using Install-PhpExtensionPrerequisite for imagick
2021-11-11 19:29:43 +05:30
874e5099b0 Stop using Install-PhpExtensionPrerequisite for imagick 2021-11-11 19:22:29 +05:30
4a3337d069 Add release badge 2021-11-11 07:32:02 +05:30
123f6df529 Improve npm release workflow [skip ci] 2021-11-11 05:26:21 +05:30
341cf69e13 Add allowed endpoints to node workflow 2021-11-10 08:36:00 +05:30
f7b503e36b Add action to harden runner in node workflow 2021-11-10 06:17:07 +05:30
beaceb0089 Fix to only copy problem-matchers configs to RUNNER_TOOL_CACHE 2021-11-10 05:45:18 +05:30
03509eca9b Fix error while opening blackfire configuration file on Linux 2021-10-19 00:16:05 +05:30
2c9c274411 Fix dependency support in self-hosted macOS 2021-10-15 22:32:24 +05:30
1c85db7f9e Add patch for Debian 12 and the distributions based on it 2021-10-15 18:34:06 +05:30
d259dd49a2 Improve package checks for extensions 2021-10-15 17:53:09 +05:30
ea20ae1fbd Fix minor bug in checking lists on Linux 2021-10-15 15:58:06 +05:30
383c74bb06 Improve adding CA certificates on Windows 2021-10-14 22:08:11 +05:30
b4593b7df0 Revert "Add patch to update ca-certificates on windows-2016"
This reverts commit d7c3e33a96.
2021-10-14 21:00:58 +05:30
9b92c9db92 Revert "Add patch to update brew core repo"
This reverts commit dab978c436.
2021-10-14 20:59:16 +05:30
a357b6a054 Revert "Fetch CA certificate from Curl on all Windows versions"
This reverts commit a7f90656b3.
2021-10-14 20:58:09 +05:30
0bc2f7ce96 Revert "Fix macOS patch to allow link libraries"
This reverts commit e2e76ea34f.
2021-10-14 20:57:18 +05:30
e2e76ea34f Fix macOS patch to allow link libraries 2021-10-13 15:25:38 +05:30
719018955c Add support for xlswriter on macOS using shivammathur/extensions tap 2021-10-12 20:56:58 +05:30
4c903565c9 Merge pull request #518 from jrfnl/feature/readme-improve-tool-discoverability
README: improve discoverability of tools
2021-10-11 10:49:10 +05:30
fc60088a95 README: improve discoverability of tools
Not every developer will be familiar with all tools.

By linking the tools listed to the relevant documentation website, the discoverability of tools new to a developer is improved.
2021-10-11 05:54:18 +02:00
a7f90656b3 Fetch CA certificate from Curl on all Windows versions 2021-10-10 05:43:54 +05:30
0cd4af837e Merge pull request #516 from aneeshrelan/feature/refactor-install-tests-to-use-jest-each
tests: refactor install.test.ts to use jest.each
2021-10-09 19:18:17 +05:30
96e47f9be7 tests: have a strict assertion using toBe 2021-10-09 19:01:59 +05:30
eca40cad4d tests: resolve windows path matching 2021-10-09 18:59:50 +05:30
4e864eae3b tests: move os to a parameter 2021-10-09 18:44:47 +05:30
49a0bad962 tests: refactor install.test.ts to use jest.each 2021-10-09 17:30:06 +05:30
b971d8f4ad use brew_extensions config for testing add_brew_extension 2021-10-09 08:11:39 +05:30
fca0924fa9 Use custom support for phalcon 2021-10-09 06:26:16 +05:30
8dfe214356 Merge pull request #514 from aneeshrelan/feature/refactor-tests-to-use-jest-each
tests: use parameterised testing using `jest.each` for extensions.test.ts
2021-10-08 22:33:11 +05:30
f2d6820ca2 tests: sort test data in alphabetic order and merge duplicates 2021-10-08 22:24:17 +05:30
705c2a5785 tests: increase test coverage for extensions.test.ts 2021-10-08 20:28:41 +05:30
5e33fdb0d9 tests: refactor extensions.test.ts to use jest.each 2021-10-08 20:02:42 +05:30
dab978c436 Add patch to update brew core repo 2021-10-06 18:12:11 +05:30
2cc925b655 tests: refactor extensions test to use jest-each 2021-10-06 01:05:47 +05:30
4ce6f3c3df Merge pull request #513 from aneeshrelan/feature/automate-publish-to-npm-github
ci: add github action to publish to npm and github packages
2021-10-05 23:39:12 +05:30
b3bf0f3990 fix: remove dry run 2021-10-05 23:23:05 +05:30
8426bf89fd ci: add github action to publish to npm and github packages 2021-10-05 23:10:58 +05:30
d7c3e33a96 Add patch to update ca-certificates on windows-2016 2021-10-04 19:41:33 +05:30
17ef667e04 Bump version to 2.15.0
Update Node.js dependencies

Replace husky with simple-git-hooks

Cleanup whitespace in README

Fix git command in format script
2021-09-28 04:19:39 +05:30
295b5da700 Add config to resolve extensions from shivammathur/extensions 2021-09-23 18:55:16 +05:30
e820a5d75b Merge pull request #503 from jrfnl/feature/tools-add-phpunit-polyfills
Tools: add PHPUnit Polyfills
2021-09-20 19:38:29 +05:30
2c8682d5e6 Tools: add support for phpunit-polyfills
Ref: https://github.com/Yoast/PHPUnit-Polyfills
2021-09-20 16:04:04 +02:00
87993cd853 Add lowercase alias for phpDocumentor on unix 2021-09-20 06:23:13 +05:30
e0dd9c9560 Merge pull request #501 from jrfnl/feature/fix-typo
Fix apparent typo
2021-09-20 06:19:02 +05:30
28853c9f3b Merge pull request #500 from jrfnl/feature/tools-add-parallel-lint
Tools: add support for PHP Parallel Lint
2021-09-20 06:18:47 +05:30
608ad1a0cf Tools: fix typo
While the PHPCPD and PHPUnit tools use the [same function under the hood](1fa3ba1b16/src/tools.ts (L461-L473)), I have the impression that the `function` keyword should be the tool name.

If that's correct, this should fix it.
2021-09-20 02:22:42 +02:00
257e4c088d Tools: add support for parallel-lint 2021-09-20 02:22:22 +02:00
7b145b5fae Add fileinfo extension with phpdoc
Add aliases for phpdoc
2021-09-20 05:46:02 +05:30
253459691c Merge pull request #498 from jrfnl/feature/tools-add-phpdocumentor
Tools: add support for phpDocumentor
2021-09-20 04:52:15 +05:30
cb5db3f888 Fix enabling cached extensions with custom support 2021-09-20 01:55:38 +05:30
52d2b3b70b Fix Blackfire extensions logs when cached 2021-09-19 21:42:29 +05:30
fa5fbefff9 Tools: add support for phpDocumentor 2021-09-19 13:41:39 +02:00
256b466cc4 Make all extension variables local 2021-09-19 15:33:45 +05:30
57f4a60e24 Fix enabling firebird when cached 2021-09-19 10:05:07 +05:30
2e289f30e2 Fix Ioncube logs if cached 2021-09-19 10:05:06 +05:30
bc0d607611 Fix cache support for phalcon4 2021-09-19 10:04:57 +05:30
61 changed files with 4199 additions and 3525 deletions

70
.github/workflows/node-release.yml vendored Normal file
View File

@ -0,0 +1,70 @@
name: Publish Package
on:
release:
types: [created]
workflow_dispatch:
inputs:
skip:
description: Skip release to repository
required: false
tag:
description: Tag name
required: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@v1
with:
allowed-endpoints:
github.com:443
npm.pkg.github.com:443
registry.npmjs.org:443
- name: Checkout release
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v2
- name: Checkout tag
uses: actions/checkout@v2
if: github.event_name == 'workflow_dispatch'
with:
ref: ${{ github.event.inputs.tag }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: https://registry.npmjs.org
- name: Install dependencies and add lib
run: |
npm install
npm run build
sed -i -e '/lib\//d' .gitignore
- name: Publish to NPM
if: "!contains(github.event.inputs.skip, 'skip-npm')"
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Change to GitHub Packages registry
uses: actions/setup-node@v2
with:
registry-url: https://npm.pkg.github.com
scope: '@shivammathur'
- name: Patch package.json
run: |
sed -i 's#"name": "#"name": "@shivammathur/#' package.json
- name: Publish to GitHub Packages
if: "!contains(github.event.inputs.skip, 'skip-github-packages')"
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -25,13 +25,25 @@ jobs:
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- name: Harden Runner
uses: step-security/harden-runner@v1
with:
allowed-endpoints:
codecov.io.:443
github.com.:443
nodejs.org.:443
raw.githubusercontent.com.:443
registry.npmjs.org.:443
setup-php.com.:443
storage.googleapis.com.:443
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup Node.js 15.x - name: Setup Node.js 16.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 15.x node-version: 16.x
- name: Install dependencies - name: Install dependencies
run: npm install run: npm install

View File

@ -28,7 +28,7 @@ jobs:
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
env: env:
extensions: xml, opcache, xdebug, pcov extensions: xml, opcache, xdebug, pcov
key: cache-v3 key: cache-v5
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2

108
README.md
View File

@ -11,6 +11,7 @@
<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://img.shields.io/codecov/c/github/shivammathur/setup-php?logo=codecov"></a>
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a> <a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.2-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a> <a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.2-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
<a href="https://beta.stepsecurity.io/npm/setup-php"><img alt="release verified" src="https://img.shields.io/endpoint?url=https://beta.api.stepsecurity.io/v1/npm/setup-php/badge?q=1"></a>
</p> </p>
<p align="center"> <p align="center">
<a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit&logoColor=FF5700&labelColor=555555"></a> <a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit&logoColor=FF5700&labelColor=555555"></a>
@ -109,14 +110,14 @@ On all supported OS/Platforms the following PHP versions are supported as per th
|`7.0`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`| |`7.0`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|`7.1`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`| |`7.1`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|`7.2`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`| |`7.2`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|`7.3`|`Stable`|`Security fixes only`|`GitHub-hosted`, `self-hosted`| |`7.3`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|`7.4`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`| |`7.4`|`Stable`|`Security fixes only`|`GitHub-hosted`, `self-hosted`|
|`8.0`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`| |`8.0`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
|`8.1`|`Nightly`|`In development`|`GitHub-hosted`, `self-hosted`| |`8.1`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
|`8.2`|`Nightly`|`In development`|`GitHub-hosted`, `self-hosted`| |`8.2`|`Nightly`|`In development`|`GitHub-hosted`, `self-hosted`|
**Notes:** **Notes:**
- Specifying `8.1` and `8.2` in `php-version` input installs a nightly build of `PHP 8.1.0-dev` and `PHP 8.2.0-dev` respectively. See [nightly build setup](#nightly-build-setup) for more information. - Specifying `8.2` in `php-version` input installs a nightly build of `PHP 8.2.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
- To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section. - To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section.
## :heavy_plus_sign: PHP Extension Support ## :heavy_plus_sign: PHP Extension Support
@ -216,7 +217,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
These tools can be set up globally using the `tools` input. It accepts a string in csv-format. These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
`behat`, `blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `php-config`, `php-cs-fixer`, `phpcbf`, `phpcpd`, `phpcs`, `phpize`, `phplint`, `phpmd`, `phpspec`, `phpstan`, `phpunit`, `phpunit-bridge`, `prestissimo`, `protoc`, `psalm`, `symfony` or `symfony-cli`, `vapor` or `vapor-cli`, `wp` or `wp-cli` [`behat`], [`blackfire`], [`blackfire-player`], [`codeception`], [`composer`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`prestissimo`], [`protoc`], [`psalm`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
```yaml ```yaml
- name: Setup PHP with tools - name: Setup PHP with tools
@ -315,7 +316,7 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
coverage: xdebug coverage: xdebug
``` ```
- The latest version of Xdebug compatible with the PHP version is set up by default. - When you specify `coverage: xdebug`, the latest version of Xdebug compatible with the PHP version is set up by default.
- If you need Xdebug 2.x on PHP 7.2, 7.3 or 7.4, you can specify `coverage: xdebug2`. - If you need Xdebug 2.x on PHP 7.2, 7.3 or 7.4, you can specify `coverage: xdebug2`.
```yaml ```yaml
@ -326,6 +327,8 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
coverage: xdebug2 coverage: xdebug2
``` ```
**Note**: Xdebug is enabled by default on Ubuntu GitHub Actions images, so if you are not using it in your workflow it is recommended to disable it as that will have a positive impact on your PHP performance. Please refer to the [disable coverage](#disable-coverage) section for details.
### PCOV ### PCOV
Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`. Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`.
@ -359,7 +362,6 @@ Specify `coverage: none` to disable both `Xdebug` and `PCOV`.
Disable coverage for these reasons: Disable coverage for these reasons:
- You are not generating coverage reports while testing. - You are not generating coverage reports while testing.
- It will disable `Xdebug`, which will have a positive impact on PHP performance.
- You are using `phpdbg` for running your tests. - You are using `phpdbg` for running your tests.
- You are profiling your code using `blackfire`. - You are profiling your code using `blackfire`.
- You are using PHP in JIT mode. Please refer to [JIT configuration](#jit-configuration) section for more details. - You are using PHP in JIT mode. Please refer to [JIT configuration](#jit-configuration) section for more details.
@ -486,12 +488,12 @@ jobs:
strategy: strategy:
matrix: matrix:
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest'] operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
php-versions: ['7.3', '7.4', '8.0'] php-versions: ['7.4', '8.0', '8.1']
phpunit-versions: ['latest'] phpunit-versions: ['latest']
include: include:
- operating-system: 'ubuntu-latest' - operating-system: 'ubuntu-latest'
php-versions: '7.2' php-versions: '7.2'
phpunit-versions: '8.5.19' phpunit-versions: '8.5.21'
steps: steps:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
@ -505,7 +507,7 @@ jobs:
### Nightly Build Setup ### Nightly Build Setup
> Setup a nightly build of `PHP 8.1` or `PHP 8.2`. > Setup a nightly build of `PHP 8.2`.
- This version is currently in development. - This version is currently in development.
- Some user space extensions might not support this version currently. - Some user space extensions might not support this version currently.
@ -515,7 +517,7 @@ steps:
- name: Setup nightly PHP - name: Setup nightly PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.1' php-version: '8.2'
extensions: mbstring extensions: mbstring
ini-values: post_max_size=256M, max_execution_time=180 ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug coverage: xdebug
@ -618,9 +620,6 @@ jobs:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }} name: PHP ${{ matrix.php-versions }}
steps: steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
@ -837,6 +836,7 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
|CakePHP with `PostgreSQL` and `Redis`|`ubuntu`|[cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis")| |CakePHP with `PostgreSQL` and `Redis`|`ubuntu`|[cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis")|
|CakePHP without services|`macOS`, `ubuntu` and `windows`|[cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services")| |CakePHP without services|`macOS`, `ubuntu` and `windows`|[cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services")|
|CodeIgniter|`macOS`, `ubuntu` and `windows`|[codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter")| |CodeIgniter|`macOS`, `ubuntu` and `windows`|[codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter")|
|Laminas MVC|`macOS`, `ubuntu` and `windows`|[laminas-mvc.yml](./examples/laminas-mvc.yml "GitHub Action for Laminas Framework MVC Projects")|
|Laravel with `MySQL` and `Redis`|`ubuntu`|[laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis")| |Laravel with `MySQL` and `Redis`|`ubuntu`|[laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis")|
|Laravel with `PostgreSQL` and `Redis`|`ubuntu`|[laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis")| |Laravel with `PostgreSQL` and `Redis`|`ubuntu`|[laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis")|
|Laravel without services|`macOS`, `ubuntu` and `windows`|[laravel.yml](./examples/laravel.yml "GitHub Action for Laravel without services")| |Laravel without services|`macOS`, `ubuntu` and `windows`|[laravel.yml](./examples/laravel.yml "GitHub Action for Laravel without services")|
@ -853,7 +853,6 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
|Symfony without services|`macOS`, `ubuntu` and `windows`|[symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services")| |Symfony without services|`macOS`, `ubuntu` and `windows`|[symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services")|
|Yii2 Starter Kit with `MySQL`|`ubuntu`|[yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL")| |Yii2 Starter Kit with `MySQL`|`ubuntu`|[yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL")|
|Yii2 Starter Kit with `PostgreSQL`|`ubuntu`|[yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL")| |Yii2 Starter Kit with `PostgreSQL`|`ubuntu`|[yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL")|
|Zend Framework|`macOS`, `ubuntu` and `windows`|[zend-framework.yml](./examples/zend-framework.yml "GitHub Action for Zend Framework")|
## :bookmark: Versioning ## :bookmark: Versioning
@ -886,23 +885,29 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
## :sparkling_heart: Support This Project ## :sparkling_heart: Support This Project
- This project is provided as Free and Open-Source software. We need funds to maintain and do future improvements. Please sponsor setup-php using [GitHub sponsors](https://github.com/sponsors/shivammathur).
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
- Please star the project and share it. If you blog, please share your experience of using this action. - Please star the project and share it. If you blog, please share your experience of using this action.
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
### Corporate Sponsors Many users and organisations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
<p align="center"> <a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
<a href="https://github.com/sponsors/shivammathur">
<img src="https://setup-php.com/sponsors-corp/?" alt="Corporate sponsors of setup-php and related projects" width="100%"> These companies generously provide setup-php their products and services to aid in the development of this project.
<p>
<a href="https://www.jetbrains.com/?from=setup-php">
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
</a> </a>
</p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.macstadium.com/opensource/members#gh-light-mode-only">
### Individual Sponsors <img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="148" height="60">
</a>
<p align="center"> <a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only">
<a href="https://github.com/sponsors/shivammathur"> <img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="148" height="60">
<img src="https://setup-php.com/sponsors/?" alt="Individual sponsors of setup-php and related projects" width="100%"> </a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="70" height="60">
</a> </a>
</p> </p>
@ -928,3 +933,50 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
- [About GitHub Actions](https://github.com/features/actions "GitHub Actions") - [About GitHub Actions](https://github.com/features/actions "GitHub Actions")
- [GitHub Actions Syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions "GitHub Actions Syntax") - [GitHub Actions Syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions "GitHub Actions Syntax")
- [Other Awesome Actions](https://github.com/sdras/awesome-actions "List of Awesome GitHub Actions") - [Other Awesome Actions](https://github.com/sdras/awesome-actions "List of Awesome GitHub Actions")
<!-- Links to tools -->
[`behat`]: https://docs.behat.org/en/latest/
[`blackfire`]: https://blackfire.io/docs/php/index
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
[`codeception`]: https://codeception.com/
[`composer`]: https://getcomposer.org/
[`composer-normalize`]: https://github.com/ergebnis/composer-normalize
[`composer-prefetcher`]: https://github.com/narrowspark/automatic-composer-prefetcher
[`composer-require-checker`]: https://github.com/maglnet/ComposerRequireChecker
[`composer-unused`]: https://github.com/composer-unused/composer-unused
[`cs2pr`]: https://github.com/staabm/annotate-pull-request-from-checkstyle
[`deployer`]: https://deployer.org/
[`flex`]: https://flex.symfony.com/
[`grpc_php_plugin`]: https://grpc.io/
[`infection`]: https://infection.github.io/
[`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint
[`pecl`]: https://pecl.php.net/
[`phan`]: https://github.com/phan/phan/wiki
[`phing`]: https://www.phing.info/
[`phinx`]: https://phinx.org/
[`phive`]: https://phar.io/
[`php-config`]: https://www.php.net/manual/en/install.pecl.php-config.php
[`php-cs-fixer`]: https://cs.symfony.com/
[`phpcbf`]: https://github.com/squizlabs/php_codesniffer
[`phpcpd`]: https://github.com/sebastianbergmann/phpcpd
[`phpcs`]: https://github.com/squizlabs/php_codesniffer
[`phpdoc`]: https://phpdoc.org/
[`phpDocumentor`]: https://phpdoc.org/
[`phpize`]: https://www.php.net/manual/en/install.pecl.phpize.php
[`phplint`]: https://github.com/overtrue/phplint
[`phpmd`]: https://phpmd.org/
[`phpspec`]: https://www.phpspec.net/
[`phpstan`]: https://phpstan.org/
[`phpunit`]: https://phpunit.de/
[`phpunit-bridge`]: https://symfony.com/doc/current/components/phpunit_bridge.html
[`phpunit-polyfills`]: https://github.com/Yoast/PHPUnit-Polyfills
[`prestissimo`]: https://github.com/hirak/prestissimo
[`protoc`]: https://developers.google.com/protocol-buffers/
[`psalm`]: https://psalm.dev/
[`symfony`]: https://symfony.com/download
[`symfony-cli`]: https://symfony.com/download
[`vapor`]: https://docs.vapor.build/
[`vapor-cli`]: https://docs.vapor.build/
[`wp`]: https://wp-cli.org/
[`wp-cli`]: https://wp-cli.org/

View File

@ -10,14 +10,15 @@ describe('Config tests', () => {
${'pcov'} | ${'7.4'} | ${'linux'} | ${'add_extension pcov,disable_extension xdebug false'} ${'pcov'} | ${'7.4'} | ${'linux'} | ${'add_extension pcov,disable_extension xdebug false'}
${'pcov'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension pcov,disable_extension xdebug false'} ${'pcov'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension pcov,disable_extension xdebug false'}
${'xdebug'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug'} ${'xdebug'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug'}
${'xdebug3'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug'} ${'xdebug3'} | ${'7.1'} | ${'win32'} | ${'xdebug3 is not supported on PHP 7.1'}
${'xdebug2'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug stable 2.9.8'} ${'xdebug2'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug stable 2.9.8'}
${'xdebug'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'} ${'xdebug'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'}
${'xdebug3'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'} ${'xdebug3'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'}
${'xdebug2'} | ${'7.4'} | ${'linux'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'} ${'xdebug2'} | ${'7.4'} | ${'linux'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
${'xdebug'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'} ${'xdebug'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'}
${'xdebug3'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'} ${'xdebug3'} | ${'7.1'} | ${'darwin'} | ${'xdebug3 is not supported on PHP 7.1'}
${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2'} ${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2'}
${'xdebug2'} | ${'8.0'} | ${'darwin'} | ${'xdebug2 is not supported on PHP 8.0'}
${'none'} | ${'7.4'} | ${'win32'} | ${'Disable-Extension xdebug false,Disable-Extension pcov false'} ${'none'} | ${'7.4'} | ${'win32'} | ${'Disable-Extension xdebug false,Disable-Extension pcov false'}
${'none'} | ${'7.4'} | ${'linux'} | ${'disable_extension xdebug false,disable_extension pcov false'} ${'none'} | ${'7.4'} | ${'linux'} | ${'disable_extension xdebug false,disable_extension pcov false'}
${'none'} | ${'7.4'} | ${'darwin'} | ${'disable_extension xdebug false,disable_extension pcov false'} ${'none'} | ${'7.4'} | ${'darwin'} | ${'disable_extension xdebug false,disable_extension pcov false'}

View File

@ -1,269 +1,139 @@
import * as fs from 'fs';
import * as extensions from '../src/extensions'; import * as extensions from '../src/extensions';
describe('Extension tests', () => { describe('Extension tests', () => {
it('checking addExtensionOnWindows', async () => { it.each`
let win32: string = await extensions.addExtension( extension | version | output
'none, Xdebug, pcov, sqlite, :intl, phalcon4, pecl_http, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2, sqlsrv-1.2.3preview1', ${'none'} | ${'7.4'} | ${'Disable-AllShared'}
'7.4', ${':intl'} | ${'7.4'} | ${'Disable-Extension intl'}
'win32' ${'ast-beta'} | ${'7.4'} | ${'Add-Extension ast beta'}
); ${'blackfire'} | ${'7.3'} | ${'Add-Blackfire blackfire'}
expect(win32).toContain('Disable-AllShared'); ${'blackfire-1.31.0'} | ${'7.3'} | ${'Add-Blackfire blackfire-1.31.0'}
expect(win32).toContain('Add-Extension xdebug'); ${'grpc-1.2.3'} | ${'7.4'} | ${'Add-Extension grpc stable 1.2.3'}
expect(win32).toContain('Add-Extension pcov'); ${'inotify-1.2.3alpha2'} | ${'7.4'} | ${'Add-Extension inotify alpha 1.2.3'}
expect(win32).toContain('Add-Extension sqlite3'); ${'ioncube'} | ${'7.4'} | ${'Add-Ioncube'}
expect(win32).toContain('Disable-Extension intl'); ${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'Add-Log "$cross" "mongodb-mongodb/mongo-php-driver@master" "mongodb-mongodb/mongo-php-driver@master is not supported on PHP 7.3"'}
expect(win32).toContain('Add-Phalcon phalcon4'); ${'mysql'} | ${'7.4'} | ${'Add-Extension mysqli\nAdd-Extension mysqlnd'}
expect(win32).toContain('Add-Http'); ${'mysql'} | ${'5.5'} | ${'Add-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd'}
expect(win32).toContain('Add-Ioncube'); ${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
expect(win32).toContain('Add-Oci oci8'); ${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
expect(win32).toContain('Add-Oci pdo_oci'); ${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
expect(win32).toContain('Add-Extension ast beta'); ${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
expect(win32).toContain('Add-Extension grpc stable 1.2.3'); ${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
expect(win32).toContain('Add-Extension inotify alpha 1.2.3'); ${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'}
expect(win32).toContain('Add-Extension sqlsrv devel 1.2.3'); ${'sqlite'} | ${'7.4'} | ${'Add-Extension sqlite3'}
${'sqlsrv-1.2.3preview1'} | ${'7.4'} | ${'Add-Extension sqlsrv devel 1.2.3'}
win32 = await extensions.addExtension('pcov', '5.6', 'win32'); ${'Xdebug'} | ${'7.4'} | ${'Add-Extension xdebug'}
expect(win32).toContain( ${'xdebug2'} | ${'7.2'} | ${'Add-Extension xdebug stable 2.9.8'}
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"' `(
'checking addExtensionOnWindows for extension $extension on version $version',
async ({extension, version, output}) => {
expect(
await extensions.addExtension(extension, version, 'win32')
).toContain(output);
}
); );
win32 = await extensions.addExtension('xdebug2', '7.2', 'win32'); it.each`
expect(win32).toContain('Add-Extension xdebug stable 2.9.8'); extension | version | output
${'none'} | ${'7.4'} | ${'disable_all_shared'}
win32 = await extensions.addExtension('mysql', '7.4', 'win32'); ${':intl'} | ${'7.4'} | ${'disable_extension intl'}
expect(win32).toContain('Add-Extension mysqli'); ${'ast-beta'} | ${'7.4'} | ${'add_unstable_extension ast beta extension'}
expect(win32).toContain('Add-Extension mysqlnd'); ${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
win32 = await extensions.addExtension('mysql', '8.0', 'win32'); ${'couchbase'} | ${'7.4'} | ${'add_couchbase'}
expect(win32).toContain('Add-Extension mysqli'); ${'gearman'} | ${'5.6'} | ${'add_gearman'}
expect(win32).toContain('Add-Extension mysqlnd'); ${'geos'} | ${'7.3'} | ${'add_geos'}
${'grpc-1.2.3'} | ${'7.4'} | ${'add_pecl_extension grpc 1.2.3 extension'}
win32 = await extensions.addExtension('mysql', '5.5', 'win32'); ${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
expect(win32).toContain('Add-Extension mysql'); ${'intl-65.1'} | ${'5.6'} | ${'add_intl intl-65.1'}
expect(win32).toContain('Add-Extension mysqli'); ${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
expect(win32).toContain('Add-Extension mysqlnd'); ${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
win32 = await extensions.addExtension( ${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
'phalcon3, does_not_exist', ${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
'7.2', ${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
'win32', ${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
true ${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
${'pecl_http'} | ${'7.3'} | ${'add_http'}
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
${'sqlite'} | ${'7.4'} | ${'add_extension sqlite3'}
${'sqlsrv-1.2.3-beta1'} | ${'7.4'} | ${'add_pecl_extension sqlsrv 1.2.3beta1 extension'}
${'Xdebug'} | ${'7.4'} | ${'add_extension xdebug'}
${'xdebug-alpha'} | ${'7.4'} | ${'add_unstable_extension xdebug alpha zend_extension'}
${'xdebug2'} | ${'7.2'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
`(
'checking addExtensionOnLinux for extension $extension on version $version',
async ({extension, version, output}) => {
expect(
await extensions.addExtension(extension, version, 'linux')
).toContain(output);
}
); );
expect(win32).toContain('Add-Phalcon phalcon3');
expect(win32).toContain('Add-Extension does_not_exist');
win32 = await extensions.addExtension('xdebug', '7.2', 'openbsd'); it.each`
expect(win32).toContain('Platform openbsd is not supported'); extension | version | output
${'none'} | ${'7.2'} | ${'disable_all_shared'}
win32 = await extensions.addExtension('blackfire', '7.3', 'win32'); ${':intl'} | ${'7.2'} | ${'disable_extension intl'}
expect(win32).toContain('Add-Blackfire blackfire'); ${'ast-beta'} | ${'7.2'} | ${'add_unstable_extension ast beta extension'}
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32'); ${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
expect(win32).toContain('Add-Blackfire blackfire-1.31.0'); ${'couchbase'} | ${'5.6'} | ${'add_couchbase'}
${'does_not_exist'} | ${'7.2'} | ${'add_extension does_not_exist'}
win32 = await extensions.addExtension( ${'geos'} | ${'7.3'} | ${'add_geos'}
'mongodb-mongodb/mongo-php-driver@master', ${'grpc-1.2.3'} | ${'7.2'} | ${'add_pecl_extension grpc 1.2.3 extension'}
'7.3', ${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
'win32' ${'imagick'} | ${'5.5'} | ${'add_extension imagick'}
); ${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
expect(win32).toContain( ${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.2'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
'Add-Log "$cross" "mongodb-mongodb/mongo-php-driver@master" "mongodb-mongodb/mongo-php-driver@master is not supported on PHP 7.3"' ${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
${'pecl_http'} | ${'7.3'} | ${'add_http'}
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
`(
'checking addExtensionOnDarwin for extension $extension on version $version',
async ({extension, version, output}) => {
expect(
await extensions.addExtension(extension, version, 'darwin')
).toContain(output);
}
); );
const data: string[][] = fs
.readFileSync('src/configs/brew_extensions')
.toString()
.split(/\r?\n/)
.filter(Boolean)
.map(line => {
const [formula, extension]: string[] = line.split('=');
const prefix: string =
extension == 'xdebug' ? 'zend_extension' : 'extension';
const output: string = fs.existsSync(`src/scripts/ext/${extension}.sh`)
? `add_${extension}`
: `add_brew_extension ${formula} ${prefix}`;
return [formula, '7.3', output];
}); });
it('checking addExtensionOnLinux', async () => { it.each(data)(
let linux: string = await extensions.addExtension( 'checking addExtensionOnDarwin for brew extension %s',
'none, Xdebug, pcov, sqlite, :intl, ast, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3', async (extension, version, output) => {
'7.4', expect(
'linux' await extensions.addExtension(extension, version, 'darwin')
); ).toContain(output);
expect(linux).toContain('disable_all_shared'); }
expect(linux).toContain('add_extension xdebug');
expect(linux).toContain('add_extension sqlite3');
expect(linux).toContain('disable_extension intl');
expect(linux).toContain('add_unstable_extension ast beta extension');
expect(linux).toContain('add_pdo_extension mysql');
expect(linux).toContain('add_pdo_extension odbc');
expect(linux).toContain('add_pecl_extension grpc 1.2.3 extension');
expect(linux).toContain(
'add_unstable_extension xdebug alpha zend_extension'
); );
linux = await extensions.addExtension('pcov', '5.6', 'linux'); it.each`
expect(linux).toContain( extension | version | output
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"' ${'xdebug'} | ${'7.2'} | ${'Platform openbsd is not supported'}
); `(
'checking addExtension on openbsd for extension $extension on version $version',
linux = await extensions.addExtension('gearman', '5.6', 'linux'); async ({extension, version, output}) => {
expect(linux).toContain('add_gearman'); expect(
linux = await extensions.addExtension('gearman', '7.4', 'linux'); await extensions.addExtension(extension, version, 'openbsd')
expect(linux).toContain('add_gearman'); ).toContain(output);
}
linux = await extensions.addExtension('couchbase', '5.6', 'linux');
expect(linux).toContain('add_couchbase');
linux = await extensions.addExtension('couchbase', '7.4', 'linux');
expect(linux).toContain('add_couchbase');
linux = await extensions.addExtension('pdo_cubrid', '7.0', 'linux');
expect(linux).toContain('add_cubrid pdo_cubrid');
linux = await extensions.addExtension('cubrid', '7.4', 'linux');
expect(linux).toContain('add_cubrid cubrid');
linux = await extensions.addExtension('xdebug2', '7.2', 'linux');
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
expect(linux).toContain('Platform openbsd is not supported');
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
expect(linux).toContain('add_phalcon phalcon3');
expect(linux).toContain('add_phalcon phalcon4');
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
expect(linux).toContain('add_ioncube');
linux = await extensions.addExtension('geos', '7.3', 'linux');
expect(linux).toContain('add_geos');
linux = await extensions.addExtension('pecl_http', '7.3', 'linux');
expect(linux).toContain('add_http');
linux = await extensions.addExtension('http-1.2.3', '7.3', 'linux');
expect(linux).toContain('add_http http-1.2.3');
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
expect(linux).toContain('add_oci oci8');
expect(linux).toContain('add_oci pdo_oci');
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
expect(linux).toContain('add_blackfire blackfire');
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
expect(linux).toContain('add_blackfire blackfire-1.31.0');
linux = await extensions.addExtension('intl-65.1', '5.6', 'linux');
expect(linux).toContain('add_intl intl-65.1');
linux = await extensions.addExtension('intl-67.1', '7.3', 'linux');
expect(linux).toContain('add_intl intl-67.1');
linux = await extensions.addExtension('intl-68.2', '8.0', 'linux');
expect(linux).toContain('add_intl intl-68.2');
linux = await extensions.addExtension(
'mongodb-mongodb/mongo-php-driver@master',
'7.3',
'linux'
);
expect(linux).toContain(
'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'
); );
}); });
it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension(
'none, amqp, apcu, expect, Xdebug, pcov, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, phalcon3, phalcon4, protobuf, psr, rdkafka, redis, ssh2, swoole, vips, yaml, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
'7.2',
'darwin'
);
expect(darwin).toContain('disable_all_shared');
expect(darwin).toContain('add_brew_extension amqp extension');
expect(darwin).toContain('add_brew_extension apcu extension');
expect(darwin).toContain('add_brew_extension expect extension');
expect(darwin).toContain('add_brew_extension xdebug zend_extension');
expect(darwin).toContain('add_brew_extension pcov extension');
expect(darwin).toContain('add_brew_extension grpc extension');
expect(darwin).toContain('add_brew_extension igbinary extension');
expect(darwin).toContain('add_brew_extension imagick extension');
expect(darwin).toContain('add_brew_extension imap extension');
expect(darwin).toContain('add_brew_extension memcache extension');
expect(darwin).toContain('add_brew_extension memcached extension');
expect(darwin).toContain('add_brew_extension mongodb extension');
expect(darwin).toContain('add_brew_extension msgpack extension');
expect(darwin).toContain('add_brew_extension phalcon3 extension');
expect(darwin).toContain('add_brew_extension phalcon4 extension');
expect(darwin).toContain('add_brew_extension protobuf extension');
expect(darwin).toContain('add_brew_extension psr extension');
expect(darwin).toContain('add_brew_extension rdkafka extension');
expect(darwin).toContain('add_brew_extension redis extension');
expect(darwin).toContain('add_brew_extension ssh2 extension');
expect(darwin).toContain('add_brew_extension swoole extension');
expect(darwin).toContain('add_brew_extension vips extension');
expect(darwin).toContain('add_brew_extension yaml extension');
expect(darwin).toContain('add_extension sqlite3');
expect(darwin).toContain('disable_extension intl');
expect(darwin).toContain('add_unstable_extension ast beta extension');
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
darwin = await extensions.addExtension('couchbase', '5.6', 'darwin');
expect(darwin).toContain('add_couchbase');
darwin = await extensions.addExtension('couchbase', '7.3', 'darwin');
expect(darwin).toContain('add_couchbase');
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
expect(darwin).toContain('add_ioncube');
darwin = await extensions.addExtension('geos', '7.3', 'darwin');
expect(darwin).toContain('add_geos');
darwin = await extensions.addExtension('pecl_http', '7.3', 'darwin');
expect(darwin).toContain('add_http');
darwin = await extensions.addExtension('http-1.2.3', '7.3', 'darwin');
expect(darwin).toContain('add_http http-1.2.3');
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
expect(darwin).toContain('add_oci oci8');
expect(darwin).toContain('add_oci pdo_oci');
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
expect(darwin).toContain(
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
);
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
expect(darwin).toContain('add_brew_extension pcov');
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
expect(darwin).toContain('add_brew_extension xdebug');
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
expect(darwin).toContain('add_brew_extension xdebug');
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
expect(darwin).toContain('add_brew_extension xdebug');
darwin = await extensions.addExtension('xdebug2', '7.2', 'darwin');
expect(darwin).toContain('add_brew_extension xdebug2');
darwin = await extensions.addExtension('imagick', '5.5', 'darwin');
expect(darwin).toContain('add_extension imagick');
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
expect(darwin).toContain('add_blackfire blackfire');
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
expect(darwin).toContain('add_blackfire blackfire-1.31.0');
darwin = await extensions.addExtension(
'does_not_exist',
'7.2',
'darwin',
false
);
expect(darwin).toContain('add_extension does_not_exist');
darwin = await extensions.addExtension('xdebug', '7.2', 'openbsd');
expect(darwin).toContain('Platform openbsd is not supported');
darwin = await extensions.addExtension(
'mongodb-mongodb/mongo-php-driver@master',
'7.3',
'darwin'
);
expect(darwin).toContain(
'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'
);
});
});

View File

@ -5,26 +5,18 @@ import * as utils from '../src/utils';
* Mock install.ts * Mock install.ts
*/ */
jest.mock('../src/install', () => ({ jest.mock('../src/install', () => ({
getScript: jest getScript: jest.fn().mockImplementation(async (): Promise<string> => {
.fn()
.mockImplementation(
async (
filename: string,
version: string,
os_version: string
): Promise<string> => {
const extension_csv: string = process.env['extensions'] || ''; const extension_csv: string = process.env['extensions'] || '';
const ini_values_csv: string = process.env['ini-values'] || ''; const ini_values_csv: string = process.env['ini-values'] || '';
const coverage_driver: string = process.env['coverage'] || ''; const coverage_driver: string = process.env['coverage'] || '';
let tools_csv: string = process.env['tools'] || ''; const tools_csv: string = process.env['tools'] || '';
let script = 'initial script ' + filename + version + os_version; let script = 'initial script';
script += tools_csv ? ' add_tool' : ''; script += tools_csv ? ' add_tool' : '';
script += extension_csv ? ' install extensions' : ''; script += extension_csv ? ' install extensions' : '';
script += coverage_driver ? ' set coverage driver' : ''; script += coverage_driver ? ' set coverage driver' : '';
script += ini_values_csv ? ' edit php.ini' : ''; script += ini_values_csv ? ' edit php.ini' : '';
return script; return script;
} }),
),
run: jest.fn().mockImplementation(async (): Promise<string> => { run: jest.fn().mockImplementation(async (): Promise<string> => {
const os_version: string = process.env['RUNNER_OS'] || ''; const os_version: string = process.env['RUNNER_OS'] || '';
const version: string = await utils.parseVersion( const version: string = await utils.parseVersion(
@ -69,93 +61,41 @@ function setEnv(
} }
describe('Install', () => { describe('Install', () => {
it('Test install on windows', async () => { it.each`
setEnv('7.0', 'win32', '', '', '', ''); version | os | extension_csv | ini_values_csv | coverage_driver | tools | output
${'7.3'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 7.3 ' + __dirname}
${'7.3'} | ${'darwin'} | ${'a, b'} | ${'a=b'} | ${'x'} | ${''} | ${'initial script install extensions set coverage driver edit php.ini bash darwin.sh 7.3 ' + __dirname}
${'7.4.1'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 7.4 ' + __dirname}
${'8'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 8.0 ' + __dirname}
${'8.0'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 8.0 ' + __dirname}
${'8.1'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 8.1 ' + __dirname}
${'7.3'} | ${'linux'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash linux.sh 7.3 ' + __dirname}
${'7.3'} | ${'linux'} | ${'a, b'} | ${'a=b'} | ${'x'} | ${'phpunit'} | ${'initial script add_tool install extensions set coverage driver edit php.ini bash linux.sh 7.3 ' + __dirname}
${'latest'} | ${'linux'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash linux.sh 8.1 ' + __dirname}
${'7.0'} | ${'win32'} | ${''} | ${''} | ${''} | ${''} | ${'initial script pwsh win32.ps1 7.0 ' + __dirname}
${'7.3'} | ${'win32'} | ${''} | ${''} | ${''} | ${''} | ${'initial script pwsh win32.ps1 7.3 ' + __dirname}
${'7.3'} | ${'win32'} | ${'a, b'} | ${'a=b'} | ${'x'} | ${''} | ${'initial script install extensions set coverage driver edit php.ini pwsh win32.ps1 7.3 ' + __dirname}
`(
'Test install on $os for $version with extensions=$extension_csv, ini_values=$ini_values_csv, coverage_driver=$coverage_driver, tools=$tools',
async ({
version,
os,
extension_csv,
ini_values_csv,
coverage_driver,
tools,
output
}) => {
setEnv(
version,
os,
extension_csv,
ini_values_csv,
coverage_driver,
tools
);
let script: string = '' + (await install.run()); expect(await install.run()).toBe(output);
expect(script).toContain('initial script'); }
expect(script).toContain('pwsh win32.ps1 7.0 ' + __dirname); );
setEnv('7.3', 'win32', '', '', '', '');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('pwsh win32.ps1 7.3 ' + __dirname);
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('install extensions');
expect(script).toContain('edit php.ini');
expect(script).toContain('set coverage driver');
expect(script).toContain('pwsh win32.ps1 7.3 ' + __dirname);
});
it('Test install on linux', async () => {
setEnv('7.3', 'linux', '', '', '', '');
let script: string = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash linux.sh 7.3 ');
setEnv('latest', 'linux', '', '', '', '');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash linux.sh 8.0 ');
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('install extensions');
expect(script).toContain('edit php.ini');
expect(script).toContain('set coverage driver');
expect(script).toContain('bash linux.sh 7.3');
expect(script).toContain('add_tool');
});
it('Test install on darwin', async () => {
setEnv('7.3', 'darwin', '', '', '', '');
let script: string = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash darwin.sh 7.3 ' + __dirname);
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('install extensions');
expect(script).toContain('edit php.ini');
expect(script).toContain('set coverage driver');
expect(script).toContain('bash darwin.sh 7.3 ' + __dirname);
});
it('Test malformed version inputs', async () => {
setEnv('7.4.1', 'darwin', '', '', '', '');
let script: string = '' + '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash darwin.sh 7.4 ' + __dirname);
setEnv(8.0, 'darwin', '', '', '', '');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash darwin.sh 8.0 ' + __dirname);
setEnv(8, 'darwin', '', '', '', '');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash darwin.sh 8.0 ' + __dirname);
setEnv(8.1, 'darwin', '', '', '', '');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash darwin.sh 8.1 ' + __dirname);
});
}); });

View File

@ -10,6 +10,7 @@ interface IData {
php_version?: string; php_version?: string;
release?: string; release?: string;
repository?: string; repository?: string;
scope?: string;
type?: string; type?: string;
fetch_latest?: string; fetch_latest?: string;
version_parameter?: string; version_parameter?: string;
@ -26,6 +27,7 @@ function getData(data: IData): Record<string, string> {
php_version: data.php_version || '7.4', php_version: data.php_version || '7.4',
release: data.release || [data.tool, data.version].join(':'), release: data.release || [data.tool, data.version].join(':'),
repository: data.repository || '', repository: data.repository || '',
scope: data.scope || 'global',
type: data.type || 'phar', type: data.type || 'phar',
fetch_latest: data.fetch_latest || 'false', fetch_latest: data.fetch_latest || 'false',
version_parameter: data.version_parameter || '-V', version_parameter: data.version_parameter || '-V',
@ -209,25 +211,29 @@ describe('Tools tests', () => {
}); });
it.each` it.each`
os_version | script os_version | script | scope
${'linux'} | ${'add_composertool tool tool:1.2.3 user/'} ${'linux'} | ${'add_composertool tool tool:1.2.3 user/ global'} | ${'global'}
${'darwin'} | ${'add_composertool tool tool:1.2.3 user/'} ${'darwin'} | ${'add_composertool tool tool:1.2.3 user/ scoped'} | ${'scoped'}
${'win32'} | ${'Add-Composertool tool tool:1.2.3 user/'} ${'win32'} | ${'Add-Composertool tool tool:1.2.3 user/ scoped'} | ${'scoped'}
${'openbsd'} | ${'Platform openbsd is not supported'} ${'openbsd'} | ${'Platform openbsd is not supported'} | ${'global'}
`('checking addPackage: $os_version', async ({os_version, script}) => { `(
'checking addPackage: $os_version, $scope',
async ({os_version, script, scope}) => {
const data = getData({ const data = getData({
tool: 'tool', tool: 'tool',
version: '1.2.3', version: '1.2.3',
repository: 'user/tool', repository: 'user/tool',
os_version: os_version os_version: os_version,
scope: scope
}); });
data['release'] = [data['tool'], data['version']].join(':'); data['release'] = [data['tool'], data['version']].join(':');
expect(await tools.addPackage(data)).toContain(script); expect(await tools.addPackage(data)).toContain(script);
}); }
);
it.each` it.each`
version | php_version | os_version | script version | php_version | os_version | script
${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://phar.io/releases/phive.phar phive'} ${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'}
${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'} ${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'} ${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'} ${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
@ -238,7 +244,6 @@ describe('Tools tests', () => {
async ({version, php_version, os_version, script}) => { async ({version, php_version, os_version, script}) => {
const data = getData({ const data = getData({
tool: 'phive', tool: 'phive',
domain: 'https://phar.io',
repository: 'phar-io/phive', repository: 'phar-io/phive',
version_parameter: 'status', version_parameter: 'status',
version: version, version: version,
@ -285,12 +290,12 @@ describe('Tools tests', () => {
it.each` it.each`
version | no_tool_cache | cache_url | source_url version | no_tool_cache | cache_url | source_url
${'latest'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'} ${'latest'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
${'stable'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'} ${'stable'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
${'snapshot'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'} ${'snapshot'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
${'preview'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'} ${'preview'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
${'1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar'} | ${'https://getcomposer.org/composer-1.phar'} ${'1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
${'2'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-2.phar'} | ${'https://getcomposer.org/composer-2.phar'} ${'2'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
${'1.2.3'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'} ${'1.2.3'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'}
${'1.2.3-RC1'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'} ${'1.2.3-RC1'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'}
`( `(
@ -373,29 +378,32 @@ describe('Tools tests', () => {
it.each([ it.each([
[ [
'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, php-cs-fixer, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, php-config, phpize, protoc, symfony, vapor, wp', 'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, php-config, phpize, protoc, symfony, vapor, wp',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_blackfire', 'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"', 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"', 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
'add_composertool flex flex symfony/', 'add_composertool flex flex symfony/ global',
'add_grpc_php_plugin latest', 'add_grpc_php_plugin latest',
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"', 'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
'add_composertool phplint phplint overtrue/', 'add_composertool phplint phplint overtrue/',
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"', 'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
'add_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"', 'add_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"',
'add_pecl', 'add_pecl',
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"', 'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
'add_composertool phinx phinx robmorgan/', 'add_composertool phinx phinx robmorgan/ scoped',
'add_composertool phinx phinx:1.2.3 robmorgan/', 'add_composertool phinx phinx:1.2.3 robmorgan/ scoped',
'add_tool https://phar.io/releases/phive.phar phive "status"', 'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive "status"',
'add_composertool phpunit-bridge phpunit-bridge symfony/', 'add_composertool phpunit-bridge phpunit-bridge symfony/ global',
'add_composertool phpunit-polyfills phpunit-polyfills yoast/ global',
'add_devtools php-config', 'add_devtools php-config',
'add_devtools phpize', 'add_devtools phpize',
'add_protoc latest', 'add_protoc latest',
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony-cli "version"', 'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony-cli "version"',
'add_composertool vapor-cli vapor-cli laravel/', 'add_composertool vapor-cli vapor-cli laravel/ scoped',
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"' 'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
] ]
] ]
@ -408,37 +416,39 @@ describe('Tools tests', () => {
it.each([ it.each([
[ [
'behat, blackfire, blackfire-player, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpize, phpmd, phpspec, phpunit-bridge:5.6, protoc:v1.2.3, psalm, symfony-cli, symfony:1.2.3, vapor-cli, wp-cli', 'behat, blackfire, blackfire-player, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, symfony-cli, symfony:1.2.3, vapor-cli, wp-cli',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_composertool behat behat behat/', 'add_composertool behat behat behat/ scoped',
'add_blackfire', 'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"', 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"', 'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"',
'add_composertool composer-require-checker composer-require-checker maglnet/', 'add_composertool composer-require-checker composer-require-checker maglnet/ scoped',
'add_composertool composer-unused composer-unused icanhazstring/', 'add_composertool composer-unused composer-unused icanhazstring/ scoped',
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"', 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"',
'add_composertool flex flex symfony/', 'add_composertool flex flex symfony/ global',
'add_grpc_php_plugin 1.2.3', 'add_grpc_php_plugin 1.2.3',
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"', 'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"', 'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"', 'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
'add_tool https://www.phing.info/get/phing-1.2.3.phar phing "-v"', 'add_tool https://www.phing.info/get/phing-1.2.3.phar phing "-v"',
'add_composertool phinx phinx robmorgan/', 'add_composertool phinx phinx robmorgan/ scoped',
'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',
'add_devtools php-config', 'add_devtools php-config',
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"', 'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"', 'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"', 'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
'add_devtools phpize', 'add_devtools phpize',
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"', 'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
'add_composertool phpspec phpspec phpspec/', 'add_tool https://github.com/phpspec/phpspec/releases/latest/download/phpspec.phar phpspec "-V"',
'add_composertool phpunit-bridge phpunit-bridge:5.6.* symfony/', 'add_composertool phpunit-bridge phpunit-bridge:5.6.* symfony/ global',
'add_composertool phpunit-polyfills phpunit-polyfills:1.0.1 yoast/ global',
'add_protoc 1.2.3', 'add_protoc 1.2.3',
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"', 'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony-cli "version"', 'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony-cli "version"',
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony-cli "version"', 'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony-cli "version"',
'add_composertool vapor-cli vapor-cli laravel/', 'add_composertool vapor-cli vapor-cli laravel/ scoped',
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"' 'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
] ]
] ]
@ -453,19 +463,19 @@ describe('Tools tests', () => {
[ [
'blackfire, blackfire-player:1.2.3, cs2pr, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp', 'blackfire, blackfire-player:1.2.3, cs2pr, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp',
[ [
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'Add-Blackfire', 'Add-Blackfire',
'Add-Tool https://get.blackfire.io/blackfire-player-v1.2.3.phar blackfire-player "-V"', 'Add-Tool https://get.blackfire.io/blackfire-player-v1.2.3.phar blackfire-player "-V"',
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"', 'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
'Add-Tool https://deployer.org/deployer.phar deployer "-V"', 'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
'Tool does_not_exist is not supported', 'Tool does_not_exist is not supported',
'Add-Composertool flex flex symfony/', 'Add-Composertool flex flex symfony/ global',
'Add-Composertool phinx phinx robmorgan/', 'Add-Composertool phinx phinx robmorgan/ scoped',
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive "status"', 'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive "status"',
'php-config is not a windows tool', 'php-config is not a windows tool',
'phpize is not a windows tool', 'phpize is not a windows tool',
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"', 'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
'Add-Composertool phpunit-bridge phpunit-bridge symfony/', 'Add-Composertool phpunit-bridge phpunit-bridge symfony/ global',
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony-cli "version"', 'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony-cli "version"',
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"' 'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
] ]
@ -481,14 +491,14 @@ describe('Tools tests', () => {
[ [
'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2', 'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2',
[ [
'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-7.4-1.phar,https://getcomposer.org/composer-1.phar composer',
'Add-Composertool codeception codeception codeception/', 'Add-Composertool codeception codeception codeception/ global',
'Add-Composertool prestissimo prestissimo hirak/', 'Add-Composertool prestissimo prestissimo hirak/ global',
'Add-Composertool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/', 'Add-Composertool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/ global',
'Add-Composertool phinx phinx:1.2.* robmorgan/', 'Add-Composertool phinx phinx:1.2.* robmorgan/ scoped',
'Add-Composertool phinx phinx:^1.2 robmorgan/', 'Add-Composertool phinx phinx:^1.2 robmorgan/ global',
'Add-Composertool tool tool:1.2.3 user/', 'Add-Composertool tool tool:1.2.3 user/ global',
'Add-Composertool tool tool:~1.2 user/' 'Add-Composertool tool tool:~1.2 user/ global'
] ]
] ]
])( ])(
@ -504,10 +514,10 @@ describe('Tools tests', () => {
it.each` it.each`
tools_csv | script tools_csv | script
${'none'} | ${''} ${'none'} | ${''}
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'} ${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'}
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'} ${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'} ${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'} ${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
`('checking composer setup: $tools_csv', async ({tools_csv, script}) => { `('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script); expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
}); });

View File

@ -64,7 +64,7 @@ describe('Utils tests', () => {
} }
} }
); );
expect(await utils.parseVersion('latest')).toBe('8.0'); expect(await utils.parseVersion('latest')).toBe('8.1');
expect(await utils.parseVersion('7')).toBe('7.0'); expect(await utils.parseVersion('7')).toBe('7.0');
expect(await utils.parseVersion('7.4')).toBe('7.4'); expect(await utils.parseVersion('7.4')).toBe('7.4');
expect(await utils.parseVersion('5.x')).toBe('5.6'); expect(await utils.parseVersion('5.x')).toBe('5.6');

View File

@ -7,7 +7,7 @@ branding:
inputs: inputs:
php-version: php-version:
description: 'Setup PHP version.' description: 'Setup PHP version.'
default: '8.0' default: '8.1'
required: true required: true
extensions: extensions:
description: 'Setup PHP extensions.' description: 'Setup PHP extensions.'

1241
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -8,17 +8,21 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.1', '7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
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: composer-cache
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.composer-cache.outputs.dir }}
@ -26,7 +30,9 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: PHP test - name: PHP test
run: composer test run: composer test

View File

@ -15,17 +15,22 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
# blackfire-player supports PHP >= 5.5 # blackfire-player supports PHP >= 5.5
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: blackfire extensions: blackfire
tools: blackfire, blackfire-player #Setup Blackfire client, agent and player # Setup Blackfire CLI and player
tools: blackfire, blackfire-player
coverage: none coverage: none
# Refer to https://blackfire.io/docs/player/index#usage
- name: Play the scenario - name: Play the scenario
run: blackfire-player run scenario.bkf # Refer to https://blackfire.io/docs/player/index#usage run: blackfire-player run scenario.bkf

View File

@ -15,17 +15,23 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
# Blackfire supports PHP >= 5.3 on ubuntu and macos and PHP >= 5.4 on windows # Blackfire supports PHP >= 5.3 on Ubuntu and macOS, and PHP >= 5.4 on Windows
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
# Setup Blackfire extension and CLI
extensions: blackfire extensions: blackfire
tools: blackfire #Setup Blackfire cli tools: blackfire
# Disable Xdebug and PCOV coverage drivers
coverage: none coverage: none
# Refer to https://blackfire.io/docs/cookbooks/profiling-cli
- name: Profile - name: Profile
run: blackfire run php my-script.php # Refer to https://blackfire.io/docs/cookbooks/profiling-cli run: blackfire run php my-script.php

View File

@ -6,11 +6,11 @@ jobs:
tests: tests:
strategy: strategy:
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
mysql: mysql:
image: mysql:5.7 image: mysql:latest
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: false MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password MYSQL_ROOT_PASSWORD: password
@ -18,6 +18,7 @@ jobs:
ports: ports:
- 3306/tcp - 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis: redis:
image: redis image: redis
ports: ports:
@ -26,6 +27,8 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
@ -34,11 +37,14 @@ jobs:
# Install memcached if using ext-memcached # Install memcached if using ext-memcached
extensions: mbstring, intl, redis, pdo_mysql extensions: mbstring, intl, redis, pdo_mysql
coverage: pcov coverage: pcov
- name: Start mysql service - name: Start mysql service
run: sudo /etc/init.d/mysql start run: sudo systemctl start mysql
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -47,10 +53,12 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: | run: |
composer install --no-progress --prefer-dist --optimize-autoloader composer install --no-progress --prefer-dist --optimize-autoloader
composer run-script post-install-cmd --no-interaction composer run-script post-install-cmd --no-interaction
# Add a step to run migrations if required # Add a step to run migrations if required
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text
@ -64,14 +72,18 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.3' php-version: '8.1'
extensions: mbstring, intl extensions: mbstring, intl
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -80,8 +92,10 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: PHP CodeSniffer - name: PHP CodeSniffer
run: composer cs-check run: composer cs-check
@ -91,15 +105,19 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.3' php-version: '8.1'
extensions: mbstring, intl extensions: mbstring, intl
tools: phpstan tools: phpstan
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -108,7 +126,9 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Static Analysis using PHPStan - name: Static Analysis using PHPStan
run: phpstan analyse --no-progress src/ run: phpstan analyse --no-progress src/

View File

@ -6,11 +6,11 @@ jobs:
tests: tests:
strategy: strategy:
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
postgres: postgres:
image: postgres:10.8 image: postgres:latest
env: env:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
@ -18,6 +18,7 @@ jobs:
ports: ports:
- 5432/tcp - 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
redis: redis:
image: redis image: redis
ports: ports:
@ -26,6 +27,8 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
@ -34,9 +37,11 @@ jobs:
# Install memcached if using ext-memcached # Install memcached if using ext-memcached
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: composer-cache
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:
@ -45,10 +50,12 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: | run: |
composer install --no-progress --prefer-dist --optimize-autoloader composer install --no-progress --prefer-dist --optimize-autoloader
composer run-script post-install-cmd --no-interaction composer run-script post-install-cmd --no-interaction
# Add a step to run migrations if required # Add a step to run migrations if required
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text
@ -62,14 +69,18 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.3' php-version: '8.1'
extensions: mbstring, intl extensions: mbstring, intl
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -78,8 +89,10 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: PHP CodeSniffer - name: PHP CodeSniffer
run: composer cs-check run: composer cs-check
@ -89,15 +102,18 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.3' php-version: '8.1'
extensions: mbstring, intl extensions: mbstring, intl
tools: phpstan tools: phpstan
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -106,7 +122,9 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Static Analysis using PHPStan - name: Static Analysis using PHPStan
run: phpstan analyse --no-progress src/ run: phpstan analyse --no-progress src/

View File

@ -7,20 +7,24 @@ jobs:
strategy: strategy:
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, pdo_sqlite, pdo_mysql extensions: mbstring, intl, pdo_sqlite, pdo_mysql
coverage: pcov #optional coverage: pcov
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -29,10 +33,12 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: | run: |
composer install --no-progress --prefer-dist --optimize-autoloader composer install --no-progress --prefer-dist --optimize-autoloader
composer run-script post-install-cmd --no-interaction composer run-script post-install-cmd --no-interaction
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text
@ -42,14 +48,17 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.3' php-version: '8.1'
extensions: mbstring, intl extensions: mbstring, intl
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -58,8 +67,10 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: PHP CodeSniffer - name: PHP CodeSniffer
run: composer cs-check run: composer cs-check
@ -69,15 +80,19 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.3' php-version: '8.1'
extensions: mbstring, intl extensions: mbstring, intl
tools: phpstan tools: phpstan
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -86,7 +101,9 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Static Analysis using PHPStan - name: Static Analysis using PHPStan
run: phpstan analyse --no-progress src/ run: phpstan analyse --no-progress src/

View File

@ -6,20 +6,24 @@ jobs:
strategy: strategy:
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, curl, dom extensions: mbstring, intl, curl, dom
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -28,7 +32,9 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text

View File

@ -1,4 +1,4 @@
# GitHub Action for Zend Framework # GitHub Action for Laminas framework MVC projects
name: Testing Zend Framework name: Testing Zend Framework
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -6,20 +6,23 @@ jobs:
strategy: strategy:
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, bcmath, curl, intl coverage: xdebug
coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -28,9 +31,9 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: | run: composer install --no-progress --prefer-dist --optimize-autoloader
composer install --no-progress --prefer-dist --optimize-autoloader
composer require --dev phpunit/phpunit squizlabs/php_codesniffer zendframework/zend-test
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text

View File

@ -15,7 +15,7 @@ jobs:
SESSION_DRIVER: redis SESSION_DRIVER: redis
services: services:
mysql: mysql:
image: mysql:5.7 image: mysql:latest
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: false MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password MYSQL_ROOT_PASSWORD: password
@ -23,6 +23,7 @@ jobs:
ports: ports:
- 3306/tcp - 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis: redis:
image: redis image: redis
ports: ports:
@ -31,21 +32,26 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional coverage: xdebug
- name: Start mysql service - name: Start mysql service
run: sudo /etc/init.d/mysql start run: sudo systemctl start mysql
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -54,19 +60,24 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application - name: Prepare the application
run: | run: |
php -r "file_exists('.env') || copy('.env.example', '.env');" php -r "file_exists('.env') || copy('.env.example', '.env');"
php artisan key:generate php artisan key:generate
- name: Clear Config - name: Clear Config
run: php artisan config:clear run: php artisan config:clear
- name: Run Migration - name: Run Migration
run: php artisan migrate -v run: php artisan migrate -v
env: env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }} DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text
env: env:

View File

@ -17,7 +17,7 @@ jobs:
DB_DATABASE: postgres DB_DATABASE: postgres
services: services:
postgres: postgres:
image: postgres:10.8 image: postgres:latest
env: env:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
@ -25,6 +25,7 @@ jobs:
ports: ports:
- 5432/tcp - 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
redis: redis:
image: redis image: redis
ports: ports:
@ -33,19 +34,23 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, pgsql extensions: mbstring, dom, fileinfo, pgsql
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -54,19 +59,24 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application - name: Prepare the application
run: | run: |
php -r "file_exists('.env') || copy('.env.example', '.env');" php -r "file_exists('.env') || copy('.env.example', '.env');"
php artisan key:generate php artisan key:generate
- name: Clear Config - name: Clear Config
run: php artisan config:clear run: php artisan config:clear
- name: Run Migration - name: Run Migration
run: php artisan migrate -v run: php artisan migrate -v
env: env:
DB_PORT: ${{ job.services.postgres.ports[5432] }} DB_PORT: ${{ job.services.postgres.ports[5432] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text
env: env:

View File

@ -9,19 +9,23 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo extensions: mbstring, dom, fileinfo
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -30,13 +34,17 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application - name: Prepare the application
run: | run: |
php -r "file_exists('.env') || copy('.env.example', '.env');" php -r "file_exists('.env') || copy('.env.example', '.env');"
php artisan key:generate php artisan key:generate
- name: Clear Config - name: Clear Config
run: php artisan config:clear run: php artisan config:clear
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text

View File

@ -15,7 +15,7 @@ jobs:
SESSION_DRIVER: redis SESSION_DRIVER: redis
services: services:
mysql: mysql:
image: mysql:5.7 image: mysql:latest
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: false MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password MYSQL_ROOT_PASSWORD: password
@ -23,6 +23,7 @@ jobs:
ports: ports:
- 3306/tcp - 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis: redis:
image: redis image: redis
ports: ports:
@ -31,21 +32,26 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional coverage: xdebug
- name: Start mysql service - name: Start mysql service
run: sudo /etc/init.d/mysql start run: sudo systemctl start mysql
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -54,19 +60,24 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: | run: |
composer install --no-progress --prefer-dist --optimize-autoloader composer install --no-progress --prefer-dist --optimize-autoloader
composer require predis/predis illuminate/redis composer require predis/predis illuminate/redis
- name: Prepare the application - name: Prepare the application
run: php -r "file_exists('.env') || copy('.env.example', '.env');" run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Register Redis as service provider - name: Register Redis as service provider
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
- name: Run Migration - name: Run Migration
run: php artisan migrate -v run: php artisan migrate -v
env: env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }} DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text
env: env:

View File

@ -17,7 +17,7 @@ jobs:
DB_DATABASE: postgres DB_DATABASE: postgres
services: services:
postgres: postgres:
image: postgres:10.8 image: postgres:latest
env: env:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
@ -25,6 +25,7 @@ jobs:
ports: ports:
- 5432/tcp - 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
redis: redis:
image: redis image: redis
ports: ports:
@ -33,19 +34,23 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, pgsql extensions: mbstring, dom, fileinfo, pgsql
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -54,19 +59,24 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: | run: |
composer install --no-progress --prefer-dist --optimize-autoloader composer install --no-progress --prefer-dist --optimize-autoloader
composer require predis/predis illuminate/redis composer require predis/predis illuminate/redis
- name: Prepare the application - name: Prepare the application
run: php -r "file_exists('.env') || copy('.env.example', '.env');" run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Register Redis as service provider - name: Register Redis as service provider
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
- name: Run Migration - name: Run Migration
run: php artisan migrate -v run: php artisan migrate -v
env: env:
DB_PORT: ${{ job.services.postgres.ports[5432] }} DB_PORT: ${{ job.services.postgres.ports[5432] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text
env: env:

View File

@ -9,19 +9,23 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -30,9 +34,12 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application - name: Prepare the application
run: php -r "file_exists('.env') || copy('.env.example', '.env');" run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text

View File

@ -18,7 +18,7 @@ jobs:
CODECEPTION_PORT: 8888 CODECEPTION_PORT: 8888
services: services:
mysql: mysql:
image: mysql:5.7 image: mysql:latest
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: false MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password MYSQL_ROOT_PASSWORD: password
@ -35,17 +35,23 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x. # Use phalcon3 for the phalcon 3.x.
coverage: xdebug #optional extensions: mbstring, dom, zip, phalcon4, mysql
coverage: xdebug
- name: Start mysql service - name: Start mysql service
run: sudo /etc/init.d/mysql start run: sudo systemctl start mysql
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -54,10 +60,13 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application - name: Prepare the application
run: php -r "file_exists('.env') || copy('.env.example', '.env');" run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Run Migration - name: Run Migration
run: | run: |
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
@ -65,6 +74,7 @@ jobs:
vendor/bin/phinx seed:run vendor/bin/phinx seed:run
env: env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }} DB_PORT: ${{ job.services.mysql.ports['3306'] }}
- name: Run Tests - name: Run Tests
run: | run: |
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &) (cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)

View File

@ -19,7 +19,7 @@ jobs:
DB_CONNECTION: pgsql DB_CONNECTION: pgsql
services: services:
postgres: postgres:
image: postgres:10.8 image: postgres:latest
env: env:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
@ -36,12 +36,16 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x # Use phalcon3 for the phalcon 3.x
coverage: xdebug #optional extensions: mbstring, dom, zip, phalcon4, pgsql
coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)" run: echo "::set-output name=dir::$(composer config cache-files-dir)"

View File

@ -8,33 +8,41 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.1', '7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
node-versions: ['8', '10'] node-versions: [16']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: ${{ matrix.node-versions }} node-version: ${{ matrix.node-versions }}
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring extensions: mbstring
- name: Check node versions - name: Check node versions
run: node -v run: node -v
- name: Get yarn cache - name: Get yarn cache
id: yarn-cache id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)" run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
path: ${{ steps.yarn-cache.outputs.dir }} path: ${{ steps.yarn-cache.outputs.dir }}
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: composer-cache
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:
@ -43,15 +51,19 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install yarn dependencies - name: Install yarn dependencies
run: yarn -V run: yarn -V
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Yarn test and build - name: Yarn test and build
run: | run: |
yarn run test yarn run test
yarn run build yarn run build
yarn run rmdist yarn run rmdist
yarn run "build:production" yarn run "build:production"
- name: PHP test - name: PHP test
run: composer test run: composer test

View File

@ -6,20 +6,24 @@ jobs:
strategy: strategy:
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, simplexml, dom extensions: mbstring, simplexml, dom
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -28,7 +32,9 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Test with phpunit - name: Test with phpunit
run: vendor/bin/phpunit --coverage-text run: vendor/bin/phpunit --coverage-text

View File

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
mysql: mysql:
image: mysql:5.7 image: mysql:latest
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: false MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: symfony MYSQL_ROOT_PASSWORD: symfony
@ -18,22 +18,27 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
tools: phpunit-bridge tools: phpunit-bridge
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
coverage: xdebug #optional coverage: xdebug
- name: Start mysql service - name: Start mysql service
run: sudo /etc/init.d/mysql start run: sudo systemctl start mysql
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -42,8 +47,10 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run Migration - name: Run Migration
run: | run: |
composer require --dev symfony/orm-pack composer require --dev symfony/orm-pack
@ -51,7 +58,9 @@ jobs:
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed" php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
env: env:
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
- name: Install PHPUnit - name: Install PHPUnit
run: simple-phpunit install run: simple-phpunit install
- name: Run tests - name: Run tests
run: simple-phpunit --coverage-text run: simple-phpunit --coverage-text

View File

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
postgres: postgres:
image: postgres:10.8 image: postgres:latest
env: env:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
@ -18,20 +18,24 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
tools: phpunit-bridge tools: phpunit-bridge
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -40,8 +44,10 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run Migration - name: Run Migration
run: | run: |
composer require --dev symfony/orm-pack composer require --dev symfony/orm-pack
@ -49,7 +55,9 @@ jobs:
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed" php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
env: env:
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8 DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
- name: Install PHPUnit - name: Install PHPUnit
run: simple-phpunit install run: simple-phpunit install
- name: Run tests - name: Run tests
run: simple-phpunit --coverage-text run: simple-phpunit --coverage-text

View File

@ -9,20 +9,24 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.3', '7.4'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
tools: phpunit-bridge tools: phpunit-bridge
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -31,9 +35,12 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Install PHPUnit - name: Install PHPUnit
run: simple-phpunit install run: simple-phpunit install
- name: Run tests - name: Run tests
run: simple-phpunit --coverage-text run: simple-phpunit --coverage-text

View File

@ -13,7 +13,7 @@ jobs:
DB_CHARSET: utf8 DB_CHARSET: utf8
services: services:
mysql: mysql:
image: mysql:5.7 image: mysql:latest
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: false MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: yii MYSQL_ROOT_PASSWORD: yii
@ -24,25 +24,31 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set Node.js 10.x - name: Set Node.js 10.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 10.x node-version: 10.x
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, gd, imagick, zip, dom, mysql extensions: mbstring, intl, gd, imagick, zip, dom, mysql
coverage: xdebug #optional coverage: xdebug
- name: Start mysql service - name: Start mysql service
run: sudo /etc/init.d/mysql start run: sudo systemctl start mysql
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -51,8 +57,10 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application - name: Prepare the application
run: | run: |
php -r "file_exists('.env') || copy('.env.dist', '.env');" php -r "file_exists('.env') || copy('.env.dist', '.env');"
@ -62,6 +70,7 @@ jobs:
env: env:
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
- name: Run Tests - name: Run Tests
run: | run: |
vendor/bin/codecept build vendor/bin/codecept build

View File

@ -13,7 +13,7 @@ jobs:
DB_CHARSET: utf8 DB_CHARSET: utf8
services: services:
postgres: postgres:
image: postgres:10.8 image: postgres:latest
env: env:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
@ -24,23 +24,28 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.4', '8.0']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set Node.js 10.x - name: Set Node.js 10.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 10.x node-version: 10.x
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
coverage: xdebug #optional coverage: xdebug
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache
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:
@ -49,8 +54,10 @@ jobs:
# 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') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application - name: Prepare the application
run: | run: |
php -r "file_exists('.env') || copy('.env.dist', '.env');" php -r "file_exists('.env') || copy('.env.dist', '.env');"
@ -60,6 +67,7 @@ jobs:
env: env:
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
- name: Run Tests - name: Run Tests
run: | run: |
vendor/bin/codecept build vendor/bin/codecept build

4414
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "2.14.0", "version": "2.16.0",
"private": false, "private": false,
"description": "Setup PHP for use with GitHub Actions", "description": "Setup PHP for use with GitHub Actions",
"main": "lib/install.js", "main": "lib/install.js",
@ -17,7 +17,7 @@
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"lint": "eslint **/src/*.ts --cache --fix", "lint": "eslint **/src/*.ts --cache --fix",
"format": "prettier --write **/src/*.ts && git add .", "format": "prettier --write **/src/*.ts && git add -f src/",
"format-check": "prettier --check **/src/*.ts", "format-check": "prettier --check **/src/*.ts",
"release": "ncc build -o dist && git add -f dist/", "release": "ncc build -o dist && git add -f dist/",
"test": "jest" "test": "jest"
@ -34,36 +34,33 @@
"author": "shivammathur", "author": "shivammathur",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.5.0", "@actions/core": "^1.6.0",
"@actions/exec": "^1.1.0", "@actions/exec": "^1.1.0",
"@actions/io": "^1.1.1", "@actions/io": "^1.1.1",
"fs": "0.0.1-security" "fs": "0.0.1-security"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.1", "@types/jest": "^27.0.3",
"@types/node": "^16.9.1", "@types/node": "^16.11.10",
"@typescript-eslint/eslint-plugin": "^4.31.0", "@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^4.31.0", "@typescript-eslint/parser": "^5.4.0",
"@vercel/ncc": "^0.31.0", "@vercel/ncc": "^0.32.0",
"eslint": "^7.32.0", "eslint": "^8.3.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2", "eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^24.4.0", "eslint-plugin-jest": "^25.3.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"husky": "^4.3.8", "jest": "^27.3.1",
"jest": "^27.1.1", "jest-circus": "^27.3.1",
"jest-circus": "^27.1.1", "prettier": "^2.5.0",
"prettier": "^2.4.0", "simple-git-hooks": "^2.7.0",
"ts-jest": "^27.0.5", "ts-jest": "^27.0.7",
"typescript": "^4.4.3" "typescript": "^4.5.2"
}, },
"bugs": { "bugs": {
"url": "https://github.com/shivammathur/setup-php/issues" "url": "https://github.com/shivammathur/setup-php/issues"
}, },
"husky": { "simple-git-hooks": {
"skipCI": true,
"hooks": {
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release" "pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
} }
} }
}

View File

@ -0,0 +1,30 @@
amqp=amqp
apcu=apcu
expect=expect
grpc=grpc
igbinary=igbinary
imagick=imagick
imap=imap
mailparse=mailparse
memcache=memcache
memcached=memcached
mongodb=mongodb
msgpack=msgpack
pcov=pcov
pecl_http=http
phalcon3=phalcon
phalcon4=phalcon
propro=propro
protobuf=protobuf
psr=psr
raphf=raphf
rdkafka=rdkafka
redis=redis
ssh2=ssh2
swoole=swoole
vips=vips
xdebug=xdebug
xdebug2=xdebug
xlswriter=xlswriter
yaml=yaml
zmq=zmq

View File

@ -1,7 +1,7 @@
{ {
"latest": "8.0", "latest": "8.1",
"nightly": "8.2", "nightly": "8.2",
"5.x": "5.6", "5.x": "5.6",
"7.x": "7.4", "7.x": "7.4",
"8.x": "8.0" "8.x": "8.1"
} }

View File

@ -31,6 +31,14 @@
"version_prefix": "", "version_prefix": "",
"version_parameter": "-v" "version_parameter": "-v"
}, },
"parallel-lint": {
"type": "phar",
"repository": "php-parallel-lint/PHP-Parallel-Lint",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "v",
"version_parameter": "--version"
},
"php-cs-fixer": { "php-cs-fixer": {
"type": "phar", "type": "phar",
"repository": "FriendsOfPHP/PHP-CS-Fixer", "repository": "FriendsOfPHP/PHP-CS-Fixer",
@ -56,6 +64,15 @@
"version_prefix": "", "version_prefix": "",
"version_parameter": "--version" "version_parameter": "--version"
}, },
"phpDocumentor": {
"type": "phar",
"repository": "phpDocumentor/phpDocumentor",
"extension": ".phar",
"domain": "https://github.com",
"alias": "phpdoc",
"version_prefix": "v",
"version_parameter": "--version"
},
"phpmd": { "phpmd": {
"type": "phar", "type": "phar",
"repository": "phpmd/phpmd", "repository": "phpmd/phpmd",
@ -64,6 +81,14 @@
"version_prefix": "", "version_prefix": "",
"version_parameter": "--version" "version_parameter": "--version"
}, },
"phpspec": {
"type": "phar",
"repository": "phpspec/phpspec",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
"version_parameter": "-V"
},
"phpstan": { "phpstan": {
"type": "phar", "type": "phar",
"repository": "phpstan/phpstan", "repository": "phpstan/phpstan",
@ -82,54 +107,66 @@
}, },
"behat": { "behat": {
"type": "composer", "type": "composer",
"repository": "behat/behat" "repository": "behat/behat",
"scope": "scoped"
}, },
"codeception": { "codeception": {
"type": "composer", "type": "composer",
"repository": "codeception/codeception" "repository": "codeception/codeception",
"scope": "scoped"
}, },
"automatic-composer-prefetcher": { "automatic-composer-prefetcher": {
"type": "composer", "type": "composer",
"alias": "composer-prefetcher", "alias": "composer-prefetcher",
"repository": "narrowspark/automatic-composer-prefetcher" "repository": "narrowspark/automatic-composer-prefetcher",
"scope": "global"
}, },
"composer-require-checker": { "composer-require-checker": {
"type": "composer", "type": "composer",
"repository": "maglnet/composer-require-checker" "repository": "maglnet/composer-require-checker",
"scope": "scoped"
}, },
"composer-unused": { "composer-unused": {
"type": "composer", "type": "composer",
"repository": "icanhazstring/composer-unused" "repository": "icanhazstring/composer-unused",
"scope": "scoped"
}, },
"flex": { "flex": {
"type": "composer", "type": "composer",
"repository": "symfony/flex" "repository": "symfony/flex",
"scope": "global"
}, },
"phinx": { "phinx": {
"type": "composer", "type": "composer",
"repository": "robmorgan/phinx" "repository": "robmorgan/phinx",
"scope": "scoped"
}, },
"phplint": { "phplint": {
"type": "composer", "type": "composer",
"repository": "overtrue/phplint" "repository": "overtrue/phplint",
}, "scope": "scoped"
"phpspec": {
"type": "composer",
"repository": "phpspec/phpspec"
}, },
"phpunit-bridge": { "phpunit-bridge": {
"alias": "simple-phpunit", "alias": "simple-phpunit",
"type": "composer", "type": "composer",
"repository": "symfony/phpunit-bridge" "repository": "symfony/phpunit-bridge",
"scope": "global"
},
"phpunit-polyfills": {
"type": "composer",
"repository": "yoast/phpunit-polyfills",
"scope": "global"
}, },
"prestissimo": { "prestissimo": {
"type": "composer", "type": "composer",
"repository": "hirak/prestissimo" "repository": "hirak/prestissimo",
"scope": "global"
}, },
"vapor-cli": { "vapor-cli": {
"type": "composer", "type": "composer",
"alias": "vapor", "alias": "vapor",
"repository": "laravel/vapor-cli" "repository": "laravel/vapor-cli",
"scope": "scoped"
}, },
"blackfire": { "blackfire": {
"type": "custom-package", "type": "custom-package",
@ -184,7 +221,7 @@
"phive": { "phive": {
"type": "custom-function", "type": "custom-function",
"repository": "phar-io/phive", "repository": "phar-io/phive",
"domain": "https://phar.io", "domain": "https://github.com",
"function": "phive", "function": "phive",
"version_prefix": "", "version_prefix": "",
"version_parameter": "status" "version_parameter": "status"
@ -201,7 +238,7 @@
"type": "custom-function", "type": "custom-function",
"repository": "sebastianbergmann/phpunit", "repository": "sebastianbergmann/phpunit",
"domain": "https://phar.phpunit.de", "domain": "https://phar.phpunit.de",
"function": "phpcpd", "function": "phpunit",
"version_prefix": "", "version_prefix": "",
"version_parameter": "--version" "version_parameter": "--version"
}, },

View File

@ -13,6 +13,7 @@
"fetch_latest": "true", "fetch_latest": "true",
"function": "function_name", "function": "function_name",
"repository": "user/tool", "repository": "user/tool",
"scope": "global, scoped",
"type": "phar, composer, custom-package or custom-function", "type": "phar, composer, custom-package or custom-function",
"version_parameter": "--version", "version_parameter": "--version",
"version_prefix": "v" "version_prefix": "v"
@ -76,6 +77,16 @@
"user/tool" "user/tool"
] ]
}, },
"scope": {
"$id": "#/items/properties/scope",
"type": "string",
"title": "The scope schema",
"description": "Scope of tool installation: global or scoped",
"enum": [
"global",
"scoped"
]
},
"type": { "type": {
"$id": "#/items/properties/type", "$id": "#/items/properties/type",
"type": "string", "type": "string",

View File

@ -2,6 +2,19 @@ import * as utils from './utils';
import * as extensions from './extensions'; import * as extensions from './extensions';
import * as config from './config'; import * as config from './config';
export async function checkXdebugError(
extension: string,
version: string
): Promise<string> {
if (
(/^5\.[3-6]$|^7\.[0-1]$/.test(version) && extension == 'xdebug3') ||
(/^8\.[0-9]$/.test(version) && extension == 'xdebug2')
) {
return extension + ' is not supported on PHP ' + version;
}
return '';
}
/** /**
* Function to setup Xdebug * Function to setup Xdebug
* *
@ -17,18 +30,24 @@ export async function addCoverageXdebug(
pipe: string pipe: string
): Promise<string> { ): Promise<string> {
let script = '\n'; let script = '\n';
let message: string = await checkXdebugError(extension, version);
let status = '$cross';
if (!message) {
script += script +=
(await extensions.addExtension(':pcov:false', version, os_version, true)) + (await extensions.addExtension(
pipe; ':pcov:false',
version,
os_version,
true
)) + pipe;
extension = extension == 'xdebug3' ? 'xdebug' : extension;
script += script +=
(await extensions.addExtension(extension, version, os_version, true)) + (await extensions.addExtension(extension, version, os_version, true)) +
pipe; pipe;
script += await utils.addLog( message = 'Xdebug enabled as coverage driver';
'$tick', status = '$tick';
extension, }
'Xdebug enabled as coverage driver', script += await utils.addLog(status, extension, message, os_version);
os_version
);
return script; return script;
} }
@ -136,13 +155,11 @@ export async function addCoverage(
case 'pcov': case 'pcov':
return script + (await addCoveragePCOV(version, os_version, pipe)); return script + (await addCoveragePCOV(version, os_version, pipe));
case 'xdebug': case 'xdebug':
case 'xdebug2':
case 'xdebug3': case 'xdebug3':
return ( return (
script + (await addCoverageXdebug('xdebug', version, os_version, pipe)) script +
); (await addCoverageXdebug(coverage_driver, version, os_version, pipe))
case 'xdebug2':
return (
script + (await addCoverageXdebug('xdebug2', version, os_version, pipe))
); );
case 'none': case 'none':
return script + (await disableCoverage(version, os_version, pipe)); return script + (await disableCoverage(version, os_version, pipe));

View File

@ -31,18 +31,19 @@ export async function addExtensionDarwin(
case /.+-.+\/.+@.+/.test(extension): case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.parseExtensionSource(extension, ext_prefix); add_script += await utils.parseExtensionSource(extension, ext_prefix);
return; return;
// match 5.3blackfire...8.0blackfire // match 5.3blackfire...8.1blackfire
// match 5.3blackfire-(semver)...8.0blackfire-(semver) // match 5.3blackfire-(semver)...8.1blackfire-(semver)
// match couchbase, geos, pdo_oci, oci8, http, pecl_http // match couchbase, geos, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...7.4ioncube // match 5.3ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4 // match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test( case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension version_extension
): ):
case /^couchbase$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test( case /^couchbase$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
extension extension
): ):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension):
add_script += await utils.customPackage( add_script += await utils.customPackage(
ext_name, ext_name,
'ext', 'ext',
@ -75,14 +76,13 @@ export async function addExtensionDarwin(
// match 5.6 and newer - amqp, apcu, expect, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq // match 5.6 and newer - amqp, apcu, expect, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
// match 7.1 and newer - pcov // match 7.1 and newer - pcov
// match 5.6 to 7.4 - propro // match 5.6 to 7.4 - propro
// match 7.0 and newer - vips // match 7.0 and newer - vips, xlswriter
case /(?<!5\.[3-5])(amqp|apcu|expect|grpc|igbinary|imagick|imap|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test( case /(?<!5\.[3-5])(amqp|apcu|expect|grpc|igbinary|imagick|imap|mailparse|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
version_extension version_extension
): ):
case /(5\.6|7\.[0-4])propro/.test(version_extension): case /(5\.6|7\.[0-4])propro/.test(version_extension):
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension): case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension): case /(?<!5\.[3-6])(vips|xlswriter)/.test(version_extension):
case /(?<!5\.[3-6])vips/.test(version_extension):
add_script += await utils.joins( add_script += await utils.joins(
'\nadd_brew_extension', '\nadd_brew_extension',
ext_name, ext_name,
@ -231,7 +231,9 @@ export async function addExtensionLinux(
let remove_script = ''; let remove_script = '';
await utils.asyncForEach(extensions, async function (extension: string) { await utils.asyncForEach(extensions, async function (extension: string) {
const version_extension: string = version + extension; const version_extension: string = version + extension;
const [ext_name, ext_version]: string[] = extension.split('-'); const [ext_name, ext_version]: string[] = extension
.split(/-(.+)/)
.filter(Boolean);
const ext_prefix = await utils.getExtensionPrefix(ext_name); const ext_prefix = await utils.getExtensionPrefix(ext_name);
switch (true) { switch (true) {
@ -247,13 +249,13 @@ export async function addExtensionLinux(
case /.+-.+\/.+@.+/.test(extension): case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.parseExtensionSource(extension, ext_prefix); add_script += await utils.parseExtensionSource(extension, ext_prefix);
return; return;
// match 5.3blackfire...8.0blackfire // match 5.3blackfire...8.1blackfire
// match 5.3blackfire-(semver)...8.0blackfire-(semver) // match 5.3blackfire-(semver)...8.1blackfire-(semver)
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid // match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
// match couchbase, geos, pdo_oci, oci8, http, pecl_http // match couchbase, geos, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...7.4ioncube // match 5.3ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4 // match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test( case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension version_extension
): ):
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test( case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(

View File

@ -4,7 +4,7 @@ export cross="✗"
export curl_opts=(-sL) export curl_opts=(-sL)
export old_versions="5.[3-5]" export old_versions="5.[3-5]"
export jit_versions="8.[0-9]" export jit_versions="8.[0-9]"
export nightly_versions="8.[1-9]" export nightly_versions="8.[2-9]"
export xdebug3_versions="7.[2-4]|8.[0-9]" export xdebug3_versions="7.[2-4]|8.[0-9]"
export tool_path_dir="/usr/local/bin" export tool_path_dir="/usr/local/bin"
export composer_home="$HOME/.composer" export composer_home="$HOME/.composer"
@ -14,6 +14,7 @@ export composer_lock="$composer_home/composer.lock"
export latest="releases/latest/download" export latest="releases/latest/download"
export github="https://github.com/shivammathur" export github="https://github.com/shivammathur"
export jsdeliver="https://cdn.jsdelivr.net/gh/shivammathur" export jsdeliver="https://cdn.jsdelivr.net/gh/shivammathur"
export setup_php="https://setup-php.com"
# Function to log start of a operation. # Function to log start of a operation.
step_log() { step_log() {
@ -76,7 +77,7 @@ run_script() {
repo=$1 repo=$1
shift shift
args=("$@") args=("$@")
get -q -e /tmp/install.sh "$github/$repo/$latest/install.sh" "$jsdeliver/$1@main/scripts/install.sh" get -q -e /tmp/install.sh "$github/$repo/$latest/install.sh" "$jsdeliver/$repo@main/scripts/install.sh" "$setup_php/$repo/install.sh"
bash /tmp/install.sh "${args[@]}" bash /tmp/install.sh "${args[@]}"
} }
@ -94,7 +95,7 @@ self_hosted_setup() {
# Function to test if extension is loaded. # Function to test if extension is loaded.
check_extension() { check_extension() {
extension=$1 local extension=$1
if [ "$extension" != "mysql" ]; then if [ "$extension" != "mysql" ]; then
php -m | grep -i -q -w "$extension" php -m | grep -i -q -w "$extension"
else else
@ -107,24 +108,20 @@ shared_extension() {
[ -e "${ext_dir:?}/$1.so" ] [ -e "${ext_dir:?}/$1.so" ]
} }
# Function to enable cached extensions. # Function to enable cached extension's dependencies.
enable_cache_extension() { enable_cache_extension_dependencies() {
deps=() if [ -d /tmp/extcache ] && shared_extension "$1"; then
for ext in /tmp/extcache/"$1"/*; do cache_dir=$(find /tmp/extcache -maxdepth 1 -type d -regex ".*$1[0-9]*")
deps+=("$(basename "$ext")") if [[ -n "$cache_dir" ]]; then
done IFS=" " read -r -a deps <<<"$(find "$cache_dir" -maxdepth 1 -type f -name "*" -exec basename {} \; | tr '\n' ' ')"
if [ "x${deps[*]}" = "x" ]; then if [[ -n "${deps[*]}" ]] && php "${deps[@]/#/-d ${2}=}" -d "${2}=$1" -m 2>/dev/null | grep -i -q "$1"; then
sudo rm -rf /tmp/extcache/"$1"
enable_extension "$1" "$2"
else
deps+=("$1")
if php "${deps[@]/#/-d ${2}=}" -m 2>/dev/null | grep -i -q "$1"; then
for ext in "${deps[@]}"; do for ext in "${deps[@]}"; do
sudo rm -rf /tmp/extcache/"$ext" sudo rm -rf /tmp/extcache/"$ext"
enable_extension "$ext" "$2" enable_extension "$ext" "$2"
done done
fi fi
fi fi
fi
} }
# Function to enable existing extensions. # Function to enable existing extensions.
@ -132,9 +129,8 @@ enable_extension() {
modules_dir="/var/lib/php/modules/$version" modules_dir="/var/lib/php/modules/$version"
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete [ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
enable_extension_dependencies "$1" "$2" enable_extension_dependencies "$1" "$2"
if [ -d /tmp/extcache/"$1" ]; then enable_cache_extension_dependencies "$1" "$2"
enable_cache_extension "$1" "$2" if ! check_extension "$1" && shared_extension "$1"; then
elif ! check_extension "$1" && shared_extension "$1"; then
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
fi fi
} }
@ -146,7 +142,7 @@ get_extension_map() {
# Function to enable extension dependencies which are also extensions. # Function to enable extension dependencies which are also extensions.
enable_extension_dependencies() { enable_extension_dependencies() {
extension=$1 local extension=$1
prefix=$2 prefix=$2
if ! [ -e /tmp/map.orig ]; then if ! [ -e /tmp/map.orig ]; then
get_extension_map | sudo tee /tmp/map.orig >/dev/null get_extension_map | sudo tee /tmp/map.orig >/dev/null
@ -167,7 +163,7 @@ disable_extension_dependents() {
# Function to disable an extension. # Function to disable an extension.
disable_extension() { disable_extension() {
extension=$1 local extension=$1
if check_extension "$extension"; then if check_extension "$extension"; then
if shared_extension "$extension"; then if shared_extension "$extension"; then
disable_extension_helper "$extension" true disable_extension_helper "$extension" true
@ -212,7 +208,7 @@ configure_pecl() {
# Function to get the PECL version of an extension. # Function to get the PECL version of an extension.
get_pecl_version() { get_pecl_version() {
extension=$1 local extension=$1
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")" stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
pecl_rest='https://pecl.php.net/rest/r/' pecl_rest='https://pecl.php.net/rest/r/'
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml) response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
@ -232,7 +228,7 @@ pecl_install() {
# Function to install a specific version of PECL extension. # Function to install a specific version of PECL extension.
add_pecl_extension() { add_pecl_extension() {
extension=$1 local extension=$1
pecl_version=$2 pecl_version=$2
prefix=$3 prefix=$3
enable_extension "$extension" "$prefix" enable_extension "$extension" "$prefix"
@ -240,7 +236,7 @@ add_pecl_extension() {
pecl_version=$(get_pecl_version "$extension" "$pecl_version") pecl_version=$(get_pecl_version "$extension" "$pecl_version")
fi fi
ext_version=$(php -r "echo phpversion('$extension');") ext_version=$(php -r "echo phpversion('$extension');")
if [ "$ext_version" = "$pecl_version" ]; then if [ "${ext_version/-/}" = "$pecl_version" ]; then
add_log "${tick:?}" "$extension" "Enabled" add_log "${tick:?}" "$extension" "Enabled"
else else
disable_extension_helper "$extension" >/dev/null 2>&1 disable_extension_helper "$extension" >/dev/null 2>&1
@ -251,7 +247,7 @@ add_pecl_extension() {
# Function to setup pre-release extensions using PECL. # Function to setup pre-release extensions using PECL.
add_unstable_extension() { add_unstable_extension() {
extension=$1 local extension=$1
stability=$2 stability=$2
prefix=$3 prefix=$3
pecl_version=$(get_pecl_version "$extension" "$stability") pecl_version=$(get_pecl_version "$extension" "$stability")
@ -265,10 +261,11 @@ get_tool_version() {
alp="[a-zA-Z0-9]" alp="[a-zA-Z0-9]"
version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}" version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
if [ "$tool" = "composer" ]; then if [ "$tool" = "composer" ]; then
if [ "$param" != "snapshot" ]; then composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
composer_version="$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")" if [[ -n "$composer_alias_version" ]]; then
composer_version="$composer_alias_version+$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$alp+" | tail -n 1)"
else else
composer_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")+$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "[a-zA-z0-9]+" | tail -n 1)" composer_version="$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
fi fi
echo "$composer_version" | sudo tee /tmp/composer_version echo "$composer_version" | sudo tee /tmp/composer_version
else else
@ -334,6 +331,7 @@ add_composertool() {
tool=$1 tool=$1
release=$2 release=$2
prefix=$3 prefix=$3
scope=$4
if [[ "$tool" =~ prestissimo|composer-prefetcher ]]; then if [[ "$tool" =~ prestissimo|composer-prefetcher ]]; then
composer_version=$(cat /tmp/composer_version) composer_version=$(cat /tmp/composer_version)
if [ "$(echo "$composer_version" | cut -d'.' -f 1)" != "1" ]; then if [ "$(echo "$composer_version" | cut -d'.' -f 1)" != "1" ]; then
@ -343,8 +341,19 @@ add_composertool() {
fi fi
fi fi
( (
if [ "$scope" = "global" ]; then
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
composer global require "$prefix$release" 2>&1 | tee /tmp/composer.log >/dev/null 2>&1 composer global require "$prefix$release" 2>&1 | tee /tmp/composer.log >/dev/null 2>&1
else
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
if ! [ -e "$scoped_dir" ]; then
mkdir -p "$scoped_dir"
composer require "$prefix$release" -d "$scoped_dir" 2>&1 | tee /tmp/composer.log >/dev/null 2>&1
export PATH=$PATH:"$scoped_dir"/vendor/bin
echo "${tool}"_bin="$scoped_dir"/vendor/bin | sudo tee -a "$GITHUB_ENV" >/dev/null
echo "$scoped_dir"/vendor/bin >>"$GITHUB_PATH"
fi
fi
log=$(grep "$prefix$tool" /tmp/composer.log) && log=$(grep "$prefix$tool" /tmp/composer.log) &&
tool_version=$(get_tool_version 'echo' "$log") && tool_version=$(get_tool_version 'echo' "$log") &&
add_log "$tick" "$tool" "Added $tool $tool_version" add_log "$tick" "$tool" "Added $tool $tool_version"

View File

@ -7,6 +7,18 @@ self_hosted_helper() {
fi fi
} }
# Disable dependency extensions
disable_dependency_extensions() {
local extension=$1
formula_file="$tap_dir/$ext_tap/Formula/$extension@${version:?}.rb"
if [ -e "$formula_file" ]; then
IFS=" " read -r -a dependency_extensions <<< "$(grep -Eo "shivammathur.*@" "$formula_file" | xargs -I {} -n 1 basename '{}' | cut -d '@' -f 1 | tr '\n' ' ')"
for dependency_extension in "${dependency_extensions[@]}"; do
sudo sed -Ei '' "/=(.*\/)?\"?$dependency_extension(.so)?$/d" "${ini_file:?}"
done
fi
}
# Helper function to disable an extension. # Helper function to disable an extension.
disable_extension_helper() { disable_extension_helper() {
local extension=$1 local extension=$1
@ -49,15 +61,17 @@ add_brew_tap() {
add_brew_extension() { add_brew_extension() {
formula=$1 formula=$1
prefix=$2 prefix=$2
extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")" extension=$(grep "$formula=" "$dist"/../src/configs/brew_extensions | cut -d '=' -f 2)
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")"
enable_extension "$extension" "$prefix" enable_extension "$extension" "$prefix"
if check_extension "$extension"; then if check_extension "$extension"; then
add_log "${tick:?}" "$extension" "Enabled" add_log "${tick:?}" "$extension" "Enabled"
else else
add_brew_tap shivammathur/homebrew-php add_brew_tap "$php_tap"
add_brew_tap shivammathur/homebrew-extensions add_brew_tap "$ext_tap"
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$formula"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "$core_repo/Formula/" 2>/dev/null || true
update_dependencies >/dev/null 2>&1 update_dependencies >/dev/null 2>&1
disable_dependency_extensions "$extension" >/dev/null 2>&1
brew install -f "$formula@$version" >/dev/null 2>&1 brew install -f "$formula@$version" >/dev/null 2>&1
sudo cp "$brew_prefix/opt/$formula@$version/$extension.so" "$ext_dir" sudo cp "$brew_prefix/opt/$formula@$version/$extension.so" "$ext_dir"
add_extension_log "$extension" "Installed and enabled" add_extension_log "$extension" "Installed and enabled"
@ -66,7 +80,7 @@ add_brew_extension() {
# Function to setup extensions. # Function to setup extensions.
add_extension() { add_extension() {
extension=$1 local extension=$1
prefix=$2 prefix=$2
enable_extension "$extension" "$prefix" enable_extension "$extension" "$prefix"
if check_extension "$extension"; then if check_extension "$extension"; then
@ -118,19 +132,23 @@ patch_brew() {
# Helper function to update the dependencies. # Helper function to update the dependencies.
update_dependencies_helper() { update_dependencies_helper() {
dependency=$1 dependency=$1
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$dependency.rb" get -q -n "$core_repo/Formula/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$dependency.rb"
link_libraries "$dependency" link_libraries "$dependency"
} }
# Function to update dependencies. # Function to update dependencies.
update_dependencies() { update_dependencies() {
if ! [ -e /tmp/update_dependencies ] && [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then if ! [ -e /tmp/update_dependencies ]; then
if [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
patch_brew patch_brew
while read -r dependency; do while read -r dependency; do
update_dependencies_helper "$dependency" & update_dependencies_helper "$dependency" &
to_wait+=($!) to_wait+=($!)
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}" done <"$tap_dir/$php_tap/.github/deps/${ImageOS:?}_${ImageVersion:?}"
wait "${to_wait[@]}" wait "${to_wait[@]}"
else
git -C "$core_repo" fetch origin master && git -C "$core_repo" reset --hard origin/master
fi
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1 echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
fi fi
} }
@ -160,7 +178,7 @@ get_brewed_php() {
add_php() { add_php() {
action=$1 action=$1
existing_version=$2 existing_version=$2
add_brew_tap shivammathur/homebrew-php add_brew_tap "$php_tap"
update_dependencies update_dependencies
if [ "$existing_version" != "false" ]; then if [ "$existing_version" != "false" ]; then
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula" ([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
@ -172,8 +190,8 @@ add_php() {
# Function to get extra version. # Function to get extra version.
php_extra_version() { php_extra_version() {
php_formula_file="$tap_dir"/shivammathur/homebrew-php/Formula/php@"$version".rb php_formula_file="$tap_dir"/"$php_tap"/Formula/php@"$version".rb
if [ -e "$php_formula_file" ] && ! grep -q "deprecate!" $php_formula_file && grep -Eq "archive/[0-9a-zA-Z]+" "$php_formula_file"; then if [ -e "$php_formula_file" ] && ! grep -q "deprecate!" "$php_formula_file" && grep -Eq "archive/[0-9a-zA-Z]+" "$php_formula_file"; then
echo " ($(grep -Eo "archive/[0-9a-zA-Z]+" "$php_formula_file" | cut -d'/' -f 2))" echo " ($(grep -Eo "archive/[0-9a-zA-Z]+" "$php_formula_file" | cut -d'/' -f 2))"
fi fi
} }
@ -208,7 +226,7 @@ setup_php() {
exit 1 exit 1
fi fi
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/" sudo cp "$dist"/../src/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
echo "::set-output name=php-version::$semver" echo "::set-output name=php-version::$semver"
add_log "$tick" "PHP" "$status PHP $semver$extra_version" add_log "$tick" "PHP" "$status PHP $semver$extra_version"
} }
@ -220,7 +238,10 @@ php_formula=shivammathur/php/php@"$version"
brew_prefix="$(brew --prefix)" brew_prefix="$(brew --prefix)"
brew_repo="$(brew --repository)" brew_repo="$(brew --repository)"
tap_dir="$brew_repo"/Library/Taps tap_dir="$brew_repo"/Library/Taps
core_repo="$tap_dir"/homebrew/homebrew-core
scripts="${dist}"/../src/scripts scripts="${dist}"/../src/scripts
ext_tap=shivammathur/homebrew-extensions
php_tap=shivammathur/homebrew-php
export HOMEBREW_CHANGE_ARCH_TO_ARM=1 export HOMEBREW_CHANGE_ARCH_TO_ARM=1
export HOMEBREW_DEVELOPER=1 export HOMEBREW_DEVELOPER=1
export HOMEBREW_NO_INSTALL_CLEANUP=1 export HOMEBREW_NO_INSTALL_CLEANUP=1

View File

@ -1,12 +1,13 @@
# Function to install blackfire extension. # Function to install blackfire extension.
add_blackfire() { add_blackfire() {
extension=$1 local extension=$1
version=${version:?} version=${version:?}
no_dot_version=${version/./} no_dot_version=${version/./}
platform=$(uname -s | tr '[:upper:]' '[:lower:]') platform=$(uname -s | tr '[:upper:]' '[:lower:]')
extension_version=$(echo "$extension" | cut -d '-' -f 2) extension_version=$(echo "$extension" | cut -d '-' -f 2)
blackfire_ini_file="${pecl_file:-${ini_file[@]}}" status='Enabled'
if ! shared_extension blackfire; then if ! shared_extension blackfire; then
status='Installed and enabled'
if [ "$extension_version" = "blackfire" ]; then if [ "$extension_version" = "blackfire" ]; then
if [[ ${version:?} =~ 5.[3-6] ]]; then if [[ ${version:?} =~ 5.[3-6] ]]; then
extension_version='1.50.0' extension_version='1.50.0'
@ -16,6 +17,6 @@ add_blackfire() {
fi fi
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1 get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1
fi fi
echo "extension=blackfire.so" | sudo tee -a "$blackfire_ini_file" >/dev/null 2>&1 enable_extension blackfire extension
add_extension_log "$extension-$extension_version" "Installed and enabled" add_extension_log blackfire "$status"
} }

View File

@ -18,8 +18,13 @@ add_firebird_helper() {
} }
add_firebird() { add_firebird() {
enable_extension pdo_firebird if [ "$(uname -s )" = "Darwin" ]; then
add_firebird_client_darwin >/dev/null 2>&1
fi
enable_extension pdo_firebird extension
status="Enabled"
if ! check_extension pdo_firebird; then if ! check_extension pdo_firebird; then
status="Installed and enabled"
if [ "$(uname -s)" = "Linux" ]; then if [ "$(uname -s)" = "Linux" ]; then
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
add_firebird_helper /usr >/dev/null 2>&1 add_firebird_helper /usr >/dev/null 2>&1
@ -27,9 +32,8 @@ add_firebird() {
add_pdo_extension firebird >/dev/null 2>&1 add_pdo_extension firebird >/dev/null 2>&1
fi fi
else else
add_firebird_client_darwin >/dev/null 2>&1
add_firebird_helper /opt/firebird >/dev/null 2>&1 add_firebird_helper /opt/firebird >/dev/null 2>&1
fi fi
add_extension_log pdo_firebird "Installed and enabled"
fi fi
add_extension_log pdo_firebird "$status"
} }

View File

@ -80,11 +80,9 @@ add_http_latest() {
if ! check_extension http; then if ! check_extension http; then
add_http_dependencies add_http_dependencies
if [ "$os" = "Linux" ]; then if [ "$os" = "Linux" ]; then
if ! [[ "${version:?}" =~ ${old_versions:?}|${nightly_versions:?} ]]; then package="php$version-http"
install_packages "php$version-http" add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
else (check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
add_http_helper "$(get_http_version)" "$os"
fi
else else
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
add_brew_extension pecl_http extension add_brew_extension pecl_http extension

View File

@ -8,6 +8,7 @@ Function Add-LicenseLog() {
# Function to add ioncube extension. # Function to add ioncube extension.
Function Add-Ioncube() { Function Add-Ioncube() {
try { try {
$status = 'Enabled'
if (-not(Test-Path $ext_dir\php_ioncube.dll)) { if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
$status = 'Installed and enabled' $status = 'Installed and enabled'
$arch_part = $arch $arch_part = $arch

View File

@ -1,17 +1,19 @@
# Function to log result of a operation. # Function to log result of a operation.
add_license_log() { add_license_log() {
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information" printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
cat /tmp/ioncube/LICENSE.txt cat "${ext_dir:?}"/IONCUBE_LICENSE.txt
echo "::endgroup::" echo "::endgroup::"
} }
# Function to install ioncube. # Function to install ioncube.
add_ioncube() { add_ioncube() {
status='Enabled'
if ! shared_extension ioncube; then if ! shared_extension ioncube; then
status='Installed and enabled' status='Installed and enabled'
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac' os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "${ext_dir:?}/ioncube.so" sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "${ext_dir:?}/ioncube.so"
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
fi fi
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1 echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
add_extension_log "ioncube" "$status" add_extension_log "ioncube" "$status"

View File

@ -20,6 +20,36 @@ Function Add-InstantClient() {
} }
} }
# Function to oci8 extension URL.
Function Get-Oci8Url() {
if($version -lt '8.0') {
$ociVersion = '2.2.0'
if ($version -eq '7.0') {
$ociVersion = '2.1.8'
} elseif ($version -lt '7.0') {
$ociVersion = '2.0.12'
}
return Get-PeclArchiveUrl oci8 $ociVersion $installed
} else {
$ociUrl = '';
Get-PeclPackageVersion oci8 -MinimumStability stable -MaximumStability stable | ForEach-Object {
$ociUrl = Get-PeclArchiveUrl oci8 $_ $installed
if($ociUrl) {
return $ociUrl
}
}
}
}
# Function to get OCI8 DLL.
Function Get-Oci8DLL() {
Get-ChildItem $ext_dir\php_oci8*.dll | ForEach-Object {
if((Get-PhpExtension -Path $_).PhpVersion -eq $version) {
return $_
}
}
}
# Function to install oci8 and pdo_oci. # Function to install oci8 and pdo_oci.
Function Add-Oci() { Function Add-Oci() {
Param ( Param (
@ -36,19 +66,14 @@ Function Add-Oci() {
Enable-PhpExtension pdo_oci -Path $php_dir Enable-PhpExtension pdo_oci -Path $php_dir
} else { } else {
if(-not(Test-Path $ext_dir\php_oci8.dll)) { if(-not(Test-Path $ext_dir\php_oci8.dll)) {
$oci8DLL = Get-Oci8DLL
if($oci8DLL) {
Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll
} else {
$status = 'Installed and enabled' $status = 'Installed and enabled'
$ociVersion = Get-PeclPackageVersion oci8 -MinimumStability stable -MaximumStability stable | Select-Object -First 1 Invoke-WebRequest -Uri (Get-Oci8Url) -OutFile $php_dir\oci8.zip
if ($version -eq '7.0') {
$ociVersion = '2.1.8'
} elseif ($version -lt '7.0') {
$ociVersion = '2.0.12'
} elseif ($version -lt '8.0') {
$ociVersion = '2.2.0'
}
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
Invoke-WebRequest -Uri $ociUrl -OutFile $php_dir\oci8.zip
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
}
} }
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
} }

View File

@ -1,10 +1,13 @@
# Helper function to add phalcon. # Helper function to add phalcon.
add_phalcon_helper() { add_phalcon_helper() {
status='Installed and enabled' status='Installed and enabled'
if [ "$extension" = "phalcon4" ]; then if [ "$(uname -s)" = "Darwin" ]; then
install_packages "php${version:?}-psr" "php${version:?}-$extension" add_brew_extension "$extension" extension
else else
install_packages "php${version:?}-$extension" packages=("php${version:?}-$extension")
[ "$extension" = "phalcon4" ] && packages+=("php${version:?}-psr")
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
check_package "${packages[0]}" && install_packages "${packages[@]}"
fi fi
} }
@ -15,7 +18,7 @@ add_phalcon3() {
if [ "$phalcon_version" != "$extension_major_version" ]; then if [ "$phalcon_version" != "$extension_major_version" ]; then
add_phalcon_helper add_phalcon_helper
else else
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file" enable_extension phalcon extension
fi fi
else else
add_phalcon_helper add_phalcon_helper
@ -24,16 +27,14 @@ add_phalcon3() {
# Function to add phalcon4. # Function to add phalcon4.
add_phalcon4() { add_phalcon4() {
if shared_extension phalcon && ! php -m | grep -i -q -w psr; then enable_extension psr extension
echo "extension=psr.so" | sudo tee -a "${ini_file:?}"
fi
if shared_extension phalcon; then if shared_extension phalcon; then
if php -m | grep -i -q -w psr; then if check_extension psr; then
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1) phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
if [ "$phalcon_version" != "$extension_major_version" ]; then if [ "$phalcon_version" != "$extension_major_version" ]; then
add_phalcon_helper add_phalcon_helper
else else
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file" enable_extension phalcon extension
fi fi
else else
add_phalcon_helper add_phalcon_helper
@ -47,7 +48,6 @@ add_phalcon4() {
add_phalcon() { add_phalcon() {
extension=$1 extension=$1
status='Enabled' status='Enabled'
phalcon_ini_file="${pecl_file:-${ini_file[@]}}"
extension_major_version=${extension: -1} extension_major_version=${extension: -1}
if [ "$extension_major_version" = "4" ]; then if [ "$extension_major_version" = "4" ]; then
add_phalcon4 >/dev/null 2>&1 add_phalcon4 >/dev/null 2>&1

View File

@ -14,7 +14,6 @@ self_hosted_helper() {
# Function to install a package # Function to install a package
install_packages() { install_packages() {
packages=("$@") packages=("$@")
[[ "${packages[*]}" =~ php ]] && add_ppa ondrej/php >/dev/null 2>&1
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && $apt_install "${packages[@]}" >/dev/null 2>&1) $apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && $apt_install "${packages[@]}" >/dev/null 2>&1)
} }
@ -60,19 +59,22 @@ add_pdo_extension() {
fi fi
} }
# Function to check if a package exists
check_package() {
sudo apt-cache policy "$1" 2>/dev/null | grep -q 'Candidate'
}
# Function to add extensions. # Function to add extensions.
add_extension() { add_extension() {
extension=$1 local extension=$1
prefix=$2 prefix=$2
package=php"$version"-"$extension"
enable_extension "$extension" "$prefix" enable_extension "$extension" "$prefix"
if check_extension "$extension"; then if check_extension "$extension"; then
add_log "${tick:?}" "$extension" "Enabled" add_log "${tick:?}" "$extension" "Enabled"
else else
if [[ "$version" =~ ${nightly_versions:?} ]]; then add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
pecl_install "$extension" (check_package "$package" && install_packages "$package") || pecl_install "$extension"
else
install_packages "php$version-$extension" || pecl_install "$extension"
fi
add_extension_log "$extension" "Installed and enabled" add_extension_log "$extension" "Installed and enabled"
fi fi
sudo chmod 777 "${ini_file[@]}" sudo chmod 777 "${ini_file[@]}"
@ -125,8 +127,8 @@ switch_version() {
# Function to install packaged PHP # Function to install packaged PHP
add_packaged_php() { add_packaged_php() {
if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
update_lists add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
IFS=' ' read -r -a packages <<<"$(echo "cli curl mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")" IFS=' ' read -r -a packages <<<"$(echo "cli curl dev mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")"
install_packages "${packages[@]}" install_packages "${packages[@]}"
else else
run_script "php-ubuntu" "$version" run_script "php-ubuntu" "$version"
@ -135,13 +137,13 @@ add_packaged_php() {
# Function to update PHP. # Function to update PHP.
update_php() { update_php() {
initial_version=$(php_semver) initial_version="$(php_semver)$(php_extra_version)"
add_packaged_php add_php
updated_version=$(php_semver) updated_version="$(php_semver)$(php_extra_version)"
if [ "$updated_version" != "$initial_version" ]; then if [ "$updated_version" != "$initial_version" ]; then
status="Updated to" status="Updated to"
else else
status="Switched to" status="Found"
fi fi
} }
@ -153,6 +155,7 @@ add_php() {
setup_old_versions setup_old_versions
else else
add_packaged_php add_packaged_php
switch_version >/dev/null 2>&1
fi fi
status="Installed" status="Installed"
} }
@ -181,15 +184,15 @@ setup_php() {
if [ ! -e "/usr/bin/php$version" ]; then if [ ! -e "/usr/bin/php$version" ]; then
add_php >/dev/null 2>&1 add_php >/dev/null 2>&1
else else
if ! [[ "$version" =~ ${old_versions:?} ]]; then
switch_version >/dev/null 2>&1
fi
if [ "${update:?}" = "true" ]; then if [ "${update:?}" = "true" ]; then
update_php >/dev/null 2>&1 update_php >/dev/null 2>&1
else else
status="Switched to" status="Switched to"
fi fi
fi fi
if ! [[ "$version" =~ ${old_versions:?}|${nightly_versions:?} ]]; then
switch_version >/dev/null 2>&1
fi
else else
if [ "$update" = "true" ]; then if [ "$update" = "true" ]; then
update_php >/dev/null 2>&1 update_php >/dev/null 2>&1
@ -213,7 +216,7 @@ setup_php() {
configure_php configure_php
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/" sudo cp "$dist"/../src/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
echo "::set-output name=php-version::$semver" echo "::set-output name=php-version::$semver"
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version" add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
} }

View File

@ -5,7 +5,7 @@ Function Add-ToolsHelper() {
$tool $tool
) )
if($tool -eq "codeception") { if($tool -eq "codeception") {
Copy-Item $composer_bin\codecept.bat -Destination $composer_bin\codeception.bat Copy-Item $codeception_bin\codecept.bat -Destination $codeception_bin\codeception.bat
} elseif($tool -eq "composer") { } elseif($tool -eq "composer") {
Edit-ComposerConfig $bin_dir\$tool Edit-ComposerConfig $bin_dir\$tool
} elseif($tool -eq "cs2pr") { } elseif($tool -eq "cs2pr") {
@ -15,11 +15,14 @@ Function Add-ToolsHelper() {
Add-Extension ast >$null 2>&1 Add-Extension ast >$null 2>&1
} elseif($tool -eq "phive") { } elseif($tool -eq "phive") {
Add-Extension xml >$null 2>&1 Add-Extension xml >$null 2>&1
} elseif($tool -eq "phpDocumentor") {
Add-Extension fileinfo >$null 2>&1
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
} elseif($tool -eq "symfony-cli") { } elseif($tool -eq "symfony-cli") {
Add-ToProfile $current_profile "symfony" "New-Alias symfony $bin_dir\symfony-cli.exe" Add-ToProfile $current_profile "symfony" "New-Alias symfony $bin_dir\symfony-cli.exe"
Add-ToProfile $current_profile "symfony_cli" "New-Alias symfony-cli $bin_dir\symfony-cli.exe" Add-ToProfile $current_profile "symfony_cli" "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
} elseif($tool -match "vapor-cli") { } elseif($tool -match "vapor-cli") {
Copy-Item $composer_bin\vapor.bat -Destination $composer_bin\vapor-cli.bat Copy-Item $vapor_cli_bin\vapor.bat -Destination $vapor_cli_bin\vapor-cli.bat
} elseif($tool -eq "wp-cli") { } elseif($tool -eq "wp-cli") {
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
} }

View File

@ -1,7 +1,8 @@
add_tools_helper() { add_tools_helper() {
tool=$1 tool=$1
if [ "$tool" = "codeception" ]; then if [ "$tool" = "codeception" ]; then
sudo ln -s "${composer_bin:?}"/codecept "${composer_bin:?}"/codeception codeception_bin=$(grep codeception_bin "${GITHUB_ENV:?}" | cut -d '=' -f 2)
sudo ln -s "${codeception_bin:?}"/codecept "${codeception_bin:?}"/codeception
elif [ "$tool" = "composer" ]; then elif [ "$tool" = "composer" ]; then
configure_composer "${tool_path:?}" configure_composer "${tool_path:?}"
elif [ "$tool" = "cs2pr" ]; then elif [ "$tool" = "cs2pr" ]; then
@ -14,7 +15,15 @@ add_tools_helper() {
add_extension curl extension >/dev/null 2>&1 add_extension curl extension >/dev/null 2>&1
add_extension mbstring extension >/dev/null 2>&1 add_extension mbstring extension >/dev/null 2>&1
add_extension xml extension >/dev/null 2>&1 add_extension xml extension >/dev/null 2>&1
elif [ "$tool" = "phpDocumentor" ]; then
add_extension fileinfo extension >/dev/null 2>&1
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/phpdocumentor 2>/dev/null || true
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/phpdoc
elif [[ "$tool" =~ phpunit(-polyfills)?$ ]]; then
if [ -e "${tool_path_dir:?}"/phpunit ]; then
sudo cp "${tool_path_dir:?}"/phpunit "${composer_bin:?}"
fi
elif [[ "$tool" =~ (symfony|vapor|wp)-cli ]]; then elif [[ "$tool" =~ (symfony|vapor|wp)-cli ]]; then
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/${tool%-*} sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/"${tool%-*}"
fi fi
} }

View File

@ -1,7 +1,8 @@
add_blackfire_linux() { add_blackfire_linux() {
sudo mkdir -p /var/run/blackfire sudo mkdir -p /var/run/blackfire /etc/blackfire
add_list debian/blackfire http://packages.blackfire.io/debian https://packages.blackfire.io/gpg.key any main add_list debian/blackfire http://packages.blackfire.io/debian https://packages.blackfire.io/gpg.key any main
install_packages blackfire install_packages blackfire
sudo chmod 777 /etc/blackfire/agent
} }
add_blackfire_darwin() { add_blackfire_darwin() {

View File

@ -31,6 +31,10 @@ set_base_version() {
else else
set_base_version_codename set_base_version_codename
set_base_version_id set_base_version_id
# Remove once PPAs start having bookworm releases
[ "$VERSION_CODENAME" = 'bookworm' ] && VERSION_CODENAME="bullseye"
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release >/dev/null 2>&1 printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release >/dev/null 2>&1
fi fi
} }
@ -101,7 +105,7 @@ check_lists() {
ppa=$1 ppa=$1
ppa_search=$2 ppa_search=$2
if grep -Eqr "$ppa_search" "$list_dir"; then if grep -Eqr "$ppa_search" "$list_dir"; then
list_count="$(find /var/lib/apt/lists -name "*${ppa/\//_}*" | wc -l)" list_count="$(sudo find /var/lib/apt/lists -type f -name "*${ppa/\//_}*" | wc -l)"
if [ "$list_count" = "0" ]; then if [ "$list_count" = "0" ]; then
update_lists "$ppa" "$ppa_search" update_lists "$ppa" "$ppa_search"
fi fi
@ -121,6 +125,7 @@ add_list() {
ppa_search="deb .*$ppa_url $package_dist .*$branches" ppa_search="deb .*$ppa_url $package_dist .*$branches"
if check_lists "$ppa" "$ppa_search"; then if check_lists "$ppa" "$ppa_search"; then
echo "Repository $ppa already exists"; echo "Repository $ppa already exists";
return 1;
else else
arch=$(dpkg --print-architecture) arch=$(dpkg --print-architecture)
[ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg [ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
@ -129,6 +134,7 @@ add_list() {
update_lists "$ppa" "$ppa_search" update_lists "$ppa" "$ppa_search"
. /etc/os-release . /etc/os-release
fi fi
return 0;
} }
# Function to remove a PPA. # Function to remove a PPA.
@ -150,6 +156,20 @@ add_ppa() {
else else
add_list "$ppa" add_list "$ppa"
fi fi
status="$?"
. /etc/os-release
return $status
}
# Function to update a PPA.
update_ppa() {
set_base_version
ppa=${1:-ondrej/php}
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
package_dist=${4:-"$VERSION_CODENAME"}
branches=${5:-main}
ppa_search="deb .*$ppa_url $package_dist .*$branches"
update_lists "$ppa" "$ppa_search"
. /etc/os-release . /etc/os-release
} }

View File

@ -3,7 +3,7 @@ param (
[ValidateNotNull()] [ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)] [ValidateLength(1, [int]::MaxValue)]
[string] [string]
$version = '8.0', $version = '8.1',
[Parameter(Position = 1, Mandatory = $true)] [Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()] [ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)] [ValidateLength(1, [int]::MaxValue)]
@ -141,24 +141,14 @@ Function Set-ExtensionPrerequisites
} }
} }
# Function to get extension pre-requisites. # Function to add CA certificates to PHP.
# https://windows.php.net/downloads/pecl/deps Function Add-PhpCAInfo {
# Currently only imagick is supported using this Cmdlet. try {
Function Get-ExtensionPrerequisites{ Update-PhpCAInfo -Path $php_dir -Source Curl
Param ( } catch {
[Parameter(Position = 0, Mandatory = $true)] Add-Log $cross PHP "Could not fetch CA certificate bundle from Curl"
[ValidateNotNull()] Update-PhpCAInfo -Path $php_dir -Source CurrentUser
[ValidateLength(1, [int]::MaxValue)]
[string]
$extension
)
$deps_dir = "$ext_dir\$extension-vc$($installed.VCVersion)-$arch"
$extensions_with_dependencies = ('imagick')
New-Item $deps_dir -Type Directory -Force > $null 2>&1
if($extensions_with_dependencies.Contains($extension)) {
Install-PhpExtensionPrerequisite -Extension $extension -InstallPath $deps_dir -PhpPath $php_dir
} }
return $deps_dir
} }
# Function to add PHP extensions. # Function to add PHP extensions.
@ -182,6 +172,8 @@ Function Add-Extension {
) )
try { try {
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension } $extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
$deps_dir = "$ext_dir\$extension-vc$($installed.VCVersion)-$arch"
New-Item $deps_dir -Type Directory -Force > $null 2>&1
if ($null -ne $extension_info) { if ($null -ne $extension_info) {
switch ($extension_info.State) { switch ($extension_info.State) {
'Builtin' { 'Builtin' {
@ -191,7 +183,6 @@ Function Add-Extension {
Add-Log $tick $extension "Enabled" Add-Log $tick $extension "Enabled"
} }
default { default {
$deps_dir = Get-ExtensionPrerequisites $extension
Enable-ExtensionDependencies $extension Enable-ExtensionDependencies $extension
Enable-PhpExtension -Extension $extension_info.Handle -Path $php_dir Enable-PhpExtension -Extension $extension_info.Handle -Path $php_dir
Set-ExtensionPrerequisites $deps_dir Set-ExtensionPrerequisites $deps_dir
@ -200,8 +191,13 @@ Function Add-Extension {
} }
} }
else { else {
$deps_dir = Get-ExtensionPrerequisites $extension # Patch till PHP 8.1 DLLs are released as stable.
$params = @{ Extension = $extension; MinimumStability = $stability; MaximumStability = $stability; Path = $php_dir; AdditionalFilesPath = $deps_dir; NoDependencies = $true } $minimumStability = 'stable'
if($version -eq '8.1' -and $stability -eq 'stable') {
$minimumStability = 'snapshot'
}
$params = @{ Extension = $extension; MinimumStability = $minimumStability; MaximumStability = $stability; Path = $php_dir; AdditionalFilesPath = $deps_dir; NoDependencies = $true }
if($extension_version -ne '') { if($extension_version -ne '') {
$params["Version"] = $extension_version $params["Version"] = $extension_version
} }
@ -349,8 +345,9 @@ Function Get-ToolVersion() {
$alp = "[a-zA-Z0-9]" $alp = "[a-zA-Z0-9]"
$version_regex = "[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}" $version_regex = "[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
if($tool -eq 'composer') { if($tool -eq 'composer') {
if ($param -eq 'snapshot') { $composer_branch_alias = Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
$composer_version = (Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }) + '+' + (Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern "[a-zA-Z0-9]+" -AllMatches | ForEach-Object { $_.matches[2].Value }) if ($composer_branch_alias) {
$composer_version = $composer_branch_alias + '+' + (Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern "[a-zA-Z0-9]+" -AllMatches | ForEach-Object { $_.matches[2].Value })
} else { } else {
$composer_version = Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value } $composer_version = Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
} }
@ -426,18 +423,36 @@ Function Add-Composertool() {
[ValidateNotNull()] [ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)] [ValidateLength(1, [int]::MaxValue)]
[string] [string]
$prefix $prefix,
[Parameter(Position = 3, Mandatory = $true)]
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$scope
) )
if($tool -match "prestissimo|composer-prefetcher" -and $composer_version.split('.')[0] -ne "1") { if($tool -match "prestissimo|composer-prefetcher" -and $composer_version.split('.')[0] -ne "1") {
Write-Output "::warning:: Skipping $tool, as it does not support Composer $composer_version. Specify composer:v1 in tools to use $tool" Write-Output "::warning:: Skipping $tool, as it does not support Composer $composer_version. Specify composer:v1 in tools to use $tool"
Add-Log $cross $tool "Skipped" Add-Log $cross $tool "Skipped"
Return Return
} }
if($scope -eq 'global') {
if(Test-Path $composer_lock) { if(Test-Path $composer_lock) {
Remove-Item -Path $composer_lock -Force Remove-Item -Path $composer_lock -Force
} }
(composer global require $prefix$release 2>&1 | Tee-Object -FilePath $env:APPDATA\Composer\composer.log) >$null 2>&1 (composer global require $prefix$release 2>&1 | Tee-Object -FilePath $env:APPDATA\Composer\composer.log) >$null 2>&1
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json $json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
} else {
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
$scoped_tool_dir_suffix = (Get-FileHash -InputStream $release_stream -Algorithm sha256).Hash
$scoped_tool_dir = "$composer_bin\_tools\$tool-$scoped_tool_dir_suffix"
if(-not(Test-Path $scoped_tool_dir)) {
New-Item -ItemType Directory -Force -Path $scoped_tool_dir > $null 2>&1
(composer global require $prefix$release -d $scoped_tool_dir.replace('\', '/') 2>&1 | Tee-Object -FilePath $env:APPDATA\Composer\composer.log) >$null 2>&1
Add-Content $scoped_tool_dir\vendor\bin -Path $env:GITHUB_PATH -Encoding utf8
New-Variable -Name ($tool.replace('-', '_') + '_bin') -Value $scoped_tool_dir\vendor\bin
}
$json = (Test-Path $scoped_tool_dir\composer.json) -and (findstr $prefix$tool $scoped_tool_dir\composer.json)
}
$log = findstr $prefix$tool $env:APPDATA\Composer\composer.log $log = findstr $prefix$tool $env:APPDATA\Composer\composer.log
if(Test-Path $composer_bin\composer) { if(Test-Path $composer_bin\composer) {
Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force
@ -470,8 +485,7 @@ $composer_lock = "$env:APPDATA\Composer\composer.lock"
$current_profile = "$env:TEMP\setup-php.ps1" $current_profile = "$env:TEMP\setup-php.ps1"
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
$jit_versions = '8.[0-9]' $jit_versions = '8.[0-9]'
$nightly_versions = '8.[1-9]' $nightly_versions = '8.[2-9]'
$cert_source='CurrentUser'
$enable_extensions = ('openssl', 'curl', 'mbstring') $enable_extensions = ('openssl', 'curl', 'mbstring')
$arch = 'x64' $arch = 'x64'
@ -487,7 +501,6 @@ if($env:RUNNER -eq 'self-hosted') {
$bin_dir = 'C:\tools\bin' $bin_dir = 'C:\tools\bin'
$php_dir = "$php_dir$version" $php_dir = "$php_dir$version"
$ext_dir = "$php_dir\ext" $ext_dir = "$php_dir\ext"
$cert_source='Curl'
Get-CleanPSProfile >$null 2>&1 Get-CleanPSProfile >$null 2>&1
New-Item $bin_dir -Type Directory -Force > $null 2>&1 New-Item $bin_dir -Type Directory -Force > $null 2>&1
Add-Path -PathItem $bin_dir Add-Path -PathItem $bin_dir
@ -520,7 +533,13 @@ Step-Log "Setup PHP"
$installed = $null $installed = $null
if (Test-Path -LiteralPath $php_dir -PathType Container) { if (Test-Path -LiteralPath $php_dir -PathType Container) {
try { try {
$installed = Get-Php -Path $php_dir if(Test-Path $php_dir\php.ini) {
Rename-Item -Path $php_dir\php.ini -NewName 'php.ini.bak'
}
$installed = Get-Php -Path $php_dir -ErrorAction SilentlyContinue 2>$null 3>$null
if(Test-Path $php_dir\php.ini.bak) {
Rename-Item -Path $php_dir\php.ini.bak -NewName 'php.ini'
}
} catch { } } catch { }
} }
$status = "Installed" $status = "Installed"
@ -533,7 +552,9 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
if ($version -match $nightly_versions) { if ($version -match $nightly_versions) {
Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/latest/download/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1 Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/latest/download/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1 & $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
if(Test-Path $php_dir\COMMIT) {
$extra_version = " ($( Get-Content $php_dir\COMMIT ))" $extra_version = " ($( Get-Content $php_dir\COMMIT ))"
}
} else { } else {
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1 Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
} }
@ -563,8 +584,8 @@ if($version -lt "5.5") {
$enable_extensions += ('opcache') $enable_extensions += ('opcache')
} }
Enable-PhpExtension -Extension $enable_extensions -Path $php_dir Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
Update-PhpCAInfo -Path $php_dir -Source $cert_source Add-PhpCAInfo
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE Copy-Item -Path $dist\..\src\configs\pm\*.json -Destination $env:RUNNER_TOOL_CACHE
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1 New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
Write-Output "::set-output name=php-version::$($installed.FullVersion)" Write-Output "::set-output name=php-version::$($installed.FullVersion)"
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)$extra_version" Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)$extra_version"

View File

@ -193,7 +193,13 @@ export async function addArchive(data: RS): Promise<string> {
export async function addPackage(data: RS): Promise<string> { export async function addPackage(data: RS): Promise<string> {
const command = await utils.getCommand(data['os_version'], 'composertool'); const command = await utils.getCommand(data['os_version'], 'composertool');
const parts: string[] = data['repository'].split('/'); const parts: string[] = data['repository'].split('/');
return command + parts[1] + ' ' + data['release'] + ' ' + parts[0] + '/'; const args: string = await utils.joins(
parts[1],
data['release'],
parts[0] + '/',
data['scope']
);
return command + args;
} }
/** /**
@ -220,9 +226,9 @@ export async function addBlackfirePlayer(data: RS): Promise<string> {
export async function addComposer(data: RS): Promise<string> { export async function addComposer(data: RS): Promise<string> {
const github = data['github']; const github = data['github'];
const getcomposer = data['domain']; const getcomposer = data['domain'];
let cache_url = `${github}/shivammathur/composer-cache/releases/latest/download/composer-${data[ let cache_url = `${github}/shivammathur/composer-cache/releases/latest/download/composer-${
'version' data['php_version']
].replace('latest', 'stable')}.phar`; }-${data['version'].replace('latest', 'stable')}.phar`;
let source_url = `${getcomposer}/composer.phar`; let source_url = `${getcomposer}/composer.phar`;
switch (true) { switch (true) {
case /^snapshot$/.test(data['version']): case /^snapshot$/.test(data['version']):
@ -319,26 +325,20 @@ export async function addPhive(data: RS): Promise<string> {
data['os_version'] data['os_version']
); );
case /5\.6|7\.0/.test(data['php_version']): case /5\.6|7\.0/.test(data['php_version']):
data['version'] = data['version'].replace('latest', '0.12.1'); data['version'] = '0.12.1';
break; break;
case /7\.1/.test(data['php_version']): case /7\.1/.test(data['php_version']):
data['version'] = data['version'].replace('latest', '0.13.5'); data['version'] = '0.13.5';
break; break;
case /7\.2/.test(data['php_version']): case /7\.2/.test(data['php_version']):
data['version'] = data['version'].replace('latest', '0.14.5'); data['version'] = '0.14.5';
break;
case /^latest$/.test(data['version']):
data['version'] = await getLatestVersion(data);
break; break;
} }
if (data['version'] === 'latest') { data['extension'] = '-' + data['version'] + data['extension'];
data['domain'] = data['domain'] + '/releases'; data['url'] = await getUrl(data);
} else {
data['domain'] = [
data['github'],
data['repository'],
'releases/download',
data['version']
].join('/');
}
data['url'] = await getPharUrl(data);
return await addArchive(data); return await addArchive(data);
} }
@ -449,6 +449,7 @@ export async function getData(
data['prefix'] = data['github'] === data['domain'] ? 'releases' : ''; data['prefix'] = data['github'] === data['domain'] ? 'releases' : '';
data['verb'] = data['github'] === data['domain'] ? 'download' : ''; data['verb'] = data['github'] === data['domain'] ? 'download' : '';
data['fetch_latest'] ??= 'false'; data['fetch_latest'] ??= 'false';
data['scope'] ??= 'global';
data['version_parameter'] = JSON.stringify(data['version_parameter']) || ''; data['version_parameter'] = JSON.stringify(data['version_parameter']) || '';
data['version_prefix'] ??= ''; data['version_prefix'] ??= '';
data['release'] = await getRelease(release, data); data['release'] = await getRelease(release, data);

View File

@ -292,7 +292,7 @@ export async function extensionArray(
return extension return extension
.trim() .trim()
.toLowerCase() .toLowerCase()
.replace(/^(:)?(php[-_]|none|zend )/, '$1'); .replace(/^(:)?(php[-_]|none|zend )|(-[^-]*)-/, '$1$3');
}) })
].filter(Boolean); ].filter(Boolean);
} }