Compare commits

...

82 Commits

Author SHA1 Message Date
e6f75134d3 Update phpts section in README 2023-11-27 18:07:02 +05:30
1874353919 Fix linking grpc on macos but installed along protoc 2023-11-27 17:08:32 +05:30
eea39ea741 Disable xdebug and pcov when blackfire extension is installed 2023-11-27 16:39:18 +05:30
bac56c8d91 Add patch for geos 2023-11-27 15:47:27 +05:30
124d256c78 Add back support for nightly builds on self-hosted 2023-11-27 14:52:14 +05:30
eeddcfe955 Bump version to 2.28.0
Update Node.js dependencies
2023-11-27 13:57:32 +05:30
de2903ad82 Fix installing zts builds 2023-11-26 03:55:45 +05:30
bbe1204148 Use cached builds for zts 2023-11-26 03:34:57 +05:30
99a92d54d5 Test cache for PHP 8.3 and PHP 8.4 2023-11-24 01:06:24 +05:30
7c6c249257 Mark PHP 8.3 as stable 2023-11-23 17:12:56 +05:30
e6d44f159a Add PHP 8.4 to wiki extension pages 2023-11-23 12:12:26 +05:30
dc513528da Update os in docs workflow 2023-11-23 11:57:50 +05:30
bfbd3882c0 Merge pull request #787 from jrfnl/feature/ghactions-update-for-php-8.3
GH Actions/docs workflow: generate extensions page for PHP 8.3
2023-11-22 20:37:08 -08:00
3c525df325 GH Actions/docs workflow: generate extensions page for PHP 8.3 2023-11-23 03:19:38 +01:00
a36e1e52ff Bump version to 2.27.1
Bump Node.js dependencies
2023-11-07 13:55:37 +05:30
04ff9b08a2 Add HOMEBREW_NO_INSTALL_FROM_API=1 to darwin.sh 2023-11-07 13:43:28 +05:30
65fad67e88 Fix updating homebrew dependencies after sharding in core tap 2023-11-07 13:11:56 +05:30
6668249e24 Merge pull request #778 from shivammathur/dependabot/github_actions/develop/actions/setup-node-4
Bump actions/setup-node from 3 to 4
2023-11-06 04:04:01 -08:00
81c255f988 Bump actions/setup-node from 3 to 4
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-06 11:00:34 +00:00
81cd5ae092 Bump version to 2.27.0 2023-11-01 19:56:15 +05:30
29a9813921 Add required extensions for box 2023-11-01 10:23:55 +05:30
f60e7de98e Add PHP 8.4 to the php workflow
Enable PHP 8.3 for macOS in the php workflow
2023-11-01 09:35:10 +05:30
b5efb21934 Add tests for box and php-scoper 2023-11-01 09:29:02 +05:30
26e6a92f3b Merge pull request #776 from theofidry/patch-1
feat: Add Box and PHP-Scoper as tools
2023-11-01 08:53:26 +05:30
28b68529b5 feat: Add Box and PHP-Scoper as tools 2023-11-01 08:53:26 +05:30
4e4861ec30 Fix support for couchbase on PHP 7.4 2023-10-30 08:11:09 +05:30
70169700c3 Try to improve couchbase compilation 2023-10-30 06:58:16 +05:30
f4e27c9ead Bump Node.js dependencies
Bump version to 2.26.1
2023-10-30 01:47:34 +05:30
9855c76987 Set keepAlive to false. After Node 19 it is true by default. 2023-10-30 01:38:35 +05:30
546935924a Merge pull request #771 from shivammathur/dependabot/npm_and_yarn/babel/traverse-7.23.2
Bump @babel/traverse from 7.22.5 to 7.23.2
2023-10-19 16:04:25 +05:30
491e9de600 Bump @babel/traverse from 7.22.5 to 7.23.2
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.5 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-19 09:40:39 +00:00
e3bda5bed8 Add support for macOS Sonoma (14) and drop support for Big Sur (11) 2023-10-01 19:03:17 +05:30
e70f6d9e7c Fallback to pecl in add_brew_extension on macOS 2023-10-01 18:49:44 +05:30
92e992b198 Update versioning section in the README 2023-09-23 04:32:24 +05:30
99680be1df Rename branch in README 2023-09-23 03:29:31 +05:30
e83e329355 Fix find call in darwin.sh in copy_brew_extensions on failure 2023-09-22 14:07:12 +05:30
10c12b9377 Fix checking for existing php formula on macOS 2023-09-22 14:00:55 +05:30
91026460e4 Create tool_path_dir if it does not exist 2023-09-22 08:15:57 +05:30
7fdd3ece87 Fix blackfire-player on Linux and macOS
Drop support for blackfire-player on Windows
2023-09-14 02:51:49 +05:30
0de5aa9140 Bump version to 2.26.0 2023-09-14 02:51:49 +05:30
a6e0b1404f Bump Node.js dependencies 2023-09-14 02:51:48 +05:30
5d259c66b1 Bump node version to 20 in action.yml
Node 16 is EOL on 2023-09-11 so we update it to Node 20 that was added in the actions/runner in v2.308.0
2023-09-14 02:51:48 +05:30
6207829361 Update use of actions/checkout to v4 2023-09-14 02:51:47 +05:30
319feb83c2 Add support to install sqlsrv and pdo_sqlsrv from GitHub releases 2023-09-14 02:51:41 +05:30
661ad4bf75 Fix enabling latest pecl extensions 2023-09-09 08:53:07 +05:30
04c15e2314 Remove hardcoded latest version for sqlsrv and pdo_sqlsrv 2023-09-09 08:05:42 +05:30
5aa416d77b Merge pull request #766 from GrahamCampbell/patch-1
Use sqlsvr 5.11.1 on PHP 8
2023-09-09 07:18:11 +05:30
a9a661ccd4 Use sqlsvr 5.11.1 on PHP 8 2023-09-09 00:45:36 +01:00
321f8d7d9a Add PHP 8.4 in the README 2023-08-30 15:15:56 +05:30
7af6c0fe6f Update Node.js dependencies 2023-08-30 15:15:56 +05:30
36e04fc85c Merge pull request #754 from jasongill/develop
Add automatic detection of required PHP version from Composer's platform setting
2023-07-30 08:50:55 +05:30
95916a72b1 Only use config.platform.php, as it's guaranteed to be the required version of PHP 2023-07-29 19:48:28 -04:00
a5fb328c6a Add support for reading PHP version from composer.lock or composer.json 2023-07-29 19:46:06 -04:00
72ae4ccbe5 Update Node.js dependenices
Remove semver override

Bump version to 2.25.5
2023-07-29 22:03:23 +05:30
5b2015e8fe Link opcache to ext_dir on macOS 2023-07-29 21:45:53 +05:30
9c77701ae5 Remove workaround of Debian 12 in ppa.sh 2023-07-03 07:38:22 +05:30
394503cb8a Override semver version to 7.5.3 GHSA-c2qf-rxjj-qqgw/CVE-2022-25883 2023-07-02 02:34:06 +05:30
f1cc14e3d5 Fix grep call in ppa.sh
When distros use DEB822-STYLE .sources file or a custom default list file the list_file is not present, so we check if it exists before calling grep on it
2023-07-02 02:16:13 +05:30
9d529a72e0 Only check castor version if castor.php is present 2023-06-24 02:25:43 +05:30
c63f07d82e Fix version prefix for castor 2023-06-23 23:28:05 +05:30
e40aa32c04 Update Node.js dependencies 2023-06-23 23:23:33 +05:30
a683e80307 Merge pull request #746 from pyrech/support-castor
Add support for tool jolicode/castor
2023-06-23 22:59:01 +05:30
7ce22e0264 Add support for jolicode/castor 2023-06-23 16:13:17 +02:00
4bd44f22a9 Bump version to 2.25.4
Update Node.js dependencies
2023-06-13 03:25:48 +05:30
d2f333de6f Fix regression in major/minor.major version support for phpunit 2023-06-13 03:16:19 +05:30
948bd8df3c Fix fs import in utlts.test.ts 2023-06-12 17:14:07 +05:30
8cac79fdb1 Bump version to 2.25.3
Update Node.js dependencies
2023-06-12 15:28:42 +05:30
6cc8b47c6f Add support to fetch tool versions from packagist 2023-06-12 15:27:46 +05:30
0be6fa1958 Remove quotes after : in CSVArray 2023-06-12 15:27:21 +05:30
22d9c80367 Cannot get release to run, so forced in changes 2023-06-12 15:27:21 +05:30
4630172078 Added what should be compensation for phpunit versions 2023-06-12 15:27:20 +05:30
1b02c009e7 Add npm run build to CONTRIBUTING.md 2023-06-12 04:45:59 +05:30
12282c9597 Add support for ts intl builds 2023-06-07 09:26:20 +05:30
592bbc7716 Shorten grep call in add_extensions.sh 2023-06-07 09:24:56 +05:30
fb5054b163 Use correct prefix for zend_extensions when installed using PECL 2023-06-06 19:27:14 +05:30
3f2a402846 Mark runner as self-hosted on nektos/act 2023-06-05 16:28:04 +05:30
c5fc0d8281 Fix disabling extensions with common substring 2023-05-24 23:01:34 +05:30
48037d201f Add priority config for couchbase and psr 2023-05-24 19:58:13 +05:30
71b43c4f65 Bump version to 2.25.2
Bump Node.js dependencies
2023-05-24 19:58:13 +05:30
3818224063 Fix to avoid double activation
Fix parsing extension input
2023-05-24 19:58:08 +05:30
5b29e8a454 Merge pull request #726 from yassinehamouten/fix/typo-in-sage-example
docs(example): fix a typo in the strategy of the sage example
2023-05-08 08:25:15 +05:30
2a798336a0 docs(example): fix a typo in the strategy of the sage example 2023-05-08 03:11:22 +02:00
68 changed files with 4541 additions and 2168 deletions

View File

@ -71,6 +71,7 @@ npm test
Creating a release means compiling all the TypeScript code to a single file which `setup-php` can run. Run this, before you push your changes. Creating a release means compiling all the TypeScript code to a single file which `setup-php` can run. Run this, before you push your changes.
```bash ```bash
npm run build
npm run release npm run release
``` ```

3
.github/SECURITY.md vendored
View File

@ -10,10 +10,9 @@ This security policy only applies to the latest patches of the following PHP ver
| Version | Supported | | Version | Supported |
|---------|--------------------| |---------|--------------------|
| 7.4 | :white_check_mark: |
| 8.0 | :white_check_mark: |
| 8.1 | :white_check_mark: | | 8.1 | :white_check_mark: |
| 8.2 | :white_check_mark: | | 8.2 | :white_check_mark: |
| 8.3 | :white_check_mark: |
## Reporting a Vulnerability ## Reporting a Vulnerability

View File

@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 2 fetch-depth: 2

View File

@ -15,8 +15,8 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2022, macos-11] operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2022, macos-12]
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', '8.3', '8.4']
steps: steps:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: ${{ github.repository }}.wiki repository: ${{ github.repository }}.wiki
- name: Download artifacts - name: Download artifacts
@ -70,11 +70,11 @@ jobs:
git config --local user.name "${{ github.repository_owner }}" git config --local user.name "${{ github.repository_owner }}"
- name: Combine - name: Combine
run: | run: |
for os in ubuntu-22.04 ubuntu-20.04 windows-2022 windows-2019 macos-11 macos-10.15; do for os in ubuntu-22.04 ubuntu-20.04 windows-2022 windows-2019 macos-11 macos-12 macos-13; do
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2; do for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4; do
if [ "$os" = "macos-10.15" ]; then if [[ "$os" = "macos-11" || "$os" = "macos-13" ]]; then
cat lists/php"$version"-macos-11.md >> Php-extensions-loaded-on-"$os".md cat lists/php"$version"-macos-12.md >> Php-extensions-loaded-on-"$os".md
elif [ "$os" = "windows-2019" ]; then elif [ "$os" = "windows-2019" ]; then
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
else else

View File

@ -29,12 +29,12 @@ jobs:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Setup Node.js 16.x - name: Setup Node.js 16.x
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 16.x node-version: 16.x

View File

@ -29,20 +29,17 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2019, macos-latest] operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2019, macos-latest]
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', '8.3'] 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', '8.3', '8.4']
include: include:
- operating-system: ubuntu-22.04 - operating-system: ubuntu-22.04
php-versions: '' php-versions: ''
php-version-file: 'php-version-file' php-version-file: 'php-version-file'
exclude:
- operating-system: macos-latest
php-versions: '8.3'
env: env:
extensions: xml, opcache, xdebug, pcov, gd extensions: xml, opcache, xdebug, pcov, gd
key: cache-v5 key: cache-v5
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Setup cache environment - name: Setup cache environment
id: cache-env id: cache-env

View File

@ -19,16 +19,16 @@ jobs:
steps: steps:
- name: Checkout release - name: Checkout release
if: github.event_name != 'workflow_dispatch' if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Checkout tag - name: Checkout tag
uses: actions/checkout@v3 uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch' if: github.event_name == 'workflow_dispatch'
with: with:
ref: ${{ github.event.inputs.tag }} ref: ${{ github.event.inputs.tag }}
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: '16.x' node-version: '16.x'
registry-url: https://registry.npmjs.org registry-url: https://registry.npmjs.org
@ -46,7 +46,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Change to GitHub Packages registry - name: Change to GitHub Packages registry
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
registry-url: https://npm.pkg.github.com registry-url: https://npm.pkg.github.com
scope: '@shivammathur' scope: '@shivammathur'

108
README.md
View File

@ -9,17 +9,14 @@
<p align="center"> <p align="center">
<a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a> <a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://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/main/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.3-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.4-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></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>
<a href="https://twitter.com/setup_php" title="setup-php twitter"><img alt="setup-php twitter" src="https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555"></a> <a href="https://twitter.com/setup_php" title="setup-php twitter"><img alt="setup-php twitter" src="https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555"></a>
<a href="https://status.setup-php.com" title="setup-php status"><img alt="setup-php status" src="https://img.shields.io/badge/status-subscribe-28A745?logo=statuspage&logoColor=28A745&labelColor=555555"></a> <a href="https://status.setup-php.com" title="setup-php status"><img alt="setup-php status" src="https://img.shields.io/badge/status-subscribe-28A745?logo=statuspage&logoColor=28A745&labelColor=555555"></a>
</p> </p>
<p align="center">
<a href="https://setup-php.com/support-ukraine" title="#StandWithUkraine"><img alt="#StandWithUkraine" src="https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg"></a>
</p>
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross-platform interface to set up the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this. Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross-platform interface to set up the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
@ -77,8 +74,8 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
| Ubuntu 20.04 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.2` | | Ubuntu 20.04 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.2` |
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.2` | | Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.2` |
| Windows Server 2019 | `windows-2019` | `PHP 8.2` | | Windows Server 2019 | `windows-2019` | `PHP 8.2` |
| macOS Monterey 12.x | `macos-12` | `PHP 8.2` | | macOS Ventura 13.x | `macos-13` | `PHP 8.2` |
| macOS Big Sur 11.x | `macos-latest` or `macos-11` | `PHP 8.2` | | macOS Monterey 12.x | `macos-latest` or `macos-12` | `PHP 8.2` |
### Self-Hosted Runners ### Self-Hosted Runners
@ -90,9 +87,9 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
| Debian 10 | `self-hosted` or `Linux` | | Debian 10 | `self-hosted` or `Linux` |
| Windows 7 and newer | `self-hosted` or `Windows` | | Windows 7 and newer | `self-hosted` or `Windows` |
| Windows Server 2012 R2 and newer | `self-hosted` or `Windows` | | Windows Server 2012 R2 and newer | `self-hosted` or `Windows` |
| macOS Sonoma 14.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Ventura 13.x x86_64/arm64 | `self-hosted` or `macOS` | | macOS Ventura 13.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Monterey 12.x x86_64/arm64 | `self-hosted` or `macOS` | | macOS Monterey 12.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Big Sur 11.x x86_64/arm64 | `self-hosted` or `macOS` |
- Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners. - Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
- Operating systems based on the above Ubuntu and Debian versions are also supported on best effort basis. - Operating systems based on the above Ubuntu and Debian versions are also supported on best effort basis.
@ -102,8 +99,8 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
On all supported OS/Platforms the following PHP versions can be set up as per the runner. On all supported OS/Platforms the following PHP versions can be set up as per the runner.
- PHP 5.3 to PHP 8.3 on GitHub-hosted runners. - PHP 5.3 to PHP 8.4 on GitHub-hosted runners.
- PHP 5.6 to PHP 8.3 on self-hosted runners. - PHP 5.6 to PHP 8.4 on self-hosted runners.
| PHP Version | Stability | Release Support | Runner Support | | PHP Version | Stability | Release Support | Runner Support |
|-------------|-----------|-----------------------|--------------------------------| |-------------|-----------|-----------------------|--------------------------------|
@ -116,13 +113,14 @@ On all supported OS/Platforms the following PHP versions can be set up as per th
| `7.2` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` | | `7.2` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
| `7.3` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` | | `7.3` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
| `7.4` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` | | `7.4` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
| `8.0` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` | | `8.0` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
| `8.1` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` | | `8.1` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
| `8.2` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` | | `8.2` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.3` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` | | `8.3` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
| `8.4` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
**Notes:** **Notes:**
- Specifying `8.3` in `php-version` input installs a nightly build of `PHP 8.3.0-dev`. See [nightly build setup](#nightly-build-setup) for more information. - Specifying `8.4` in `php-version` input installs a nightly build of `PHP 8.4.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
@ -135,7 +133,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with PECL extension - name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
extensions: imagick, swoole extensions: imagick, swoole
``` ```
@ -163,7 +161,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with pre-release PECL extension - name: Setup PHP with pre-release PECL extension
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
extensions: xdebug-beta extensions: xdebug-beta
``` ```
@ -175,7 +173,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP and disable opcache - name: Setup PHP and disable opcache
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
extensions: :opcache extensions: :opcache
``` ```
@ -187,7 +185,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP without any shared extensions except mbstring - name: Setup PHP without any shared extensions except mbstring
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
extensions: none, mbstring extensions: none, mbstring
``` ```
@ -197,7 +195,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with intl - name: Setup PHP with intl
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
extensions: intl-70.1 extensions: intl-70.1
``` ```
@ -214,7 +212,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with fail-fast - name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
extensions: oci8 extensions: oci8
env: env:
fail-fast: true fail-fast: true
@ -224,13 +222,13 @@ 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`], [`churn`], [`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`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`] [`behat`], [`blackfire`], [`blackfire-player`], [`castor`], [`churn`], [`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`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
```yaml ```yaml
- name: Setup PHP with tools - name: Setup PHP with tools
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: php-cs-fixer, phpunit tools: php-cs-fixer, phpunit
``` ```
@ -240,7 +238,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with tools - name: Setup PHP with tools
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: vimeo/psalm tools: vimeo/psalm
``` ```
@ -260,8 +258,8 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with tools - name: Setup PHP with tools
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: php-cs-fixer:3.5, phpunit:9.5 tools: php-cs-fixer:3.39, phpunit:10.4
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
``` ```
@ -272,7 +270,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with composer v2 - name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: composer:v2 tools: composer:v2
``` ```
@ -282,7 +280,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP without composer - name: Setup PHP without composer
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: none tools: none
``` ```
@ -298,7 +296,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with fail-fast - name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: deployer tools: deployer
env: env:
fail-fast: true fail-fast: true
@ -321,7 +319,7 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
- name: Setup PHP with Xdebug - name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
coverage: xdebug coverage: xdebug
``` ```
@ -349,7 +347,7 @@ Runs on PHP 7.1 and newer PHP versions.
- name: Setup PHP with PCOV - name: Setup PHP with PCOV
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
ini-values: pcov.directory=api #optional, see above for usage. ini-values: pcov.directory=api #optional, see above for usage.
coverage: pcov coverage: pcov
``` ```
@ -379,7 +377,7 @@ Disable coverage for these reasons:
- name: Setup PHP with no coverage driver - name: Setup PHP with no coverage driver
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
coverage: none coverage: none
``` ```
@ -452,7 +450,7 @@ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the s
id: setup-php id: setup-php
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
- name: Print PHP version - name: Print PHP version
run: echo ${{ steps.setup-php.outputs.php-version }} run: echo ${{ steps.setup-php.outputs.php-version }}
@ -472,7 +470,7 @@ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the s
#### `phpts` (optional) #### `phpts` (optional)
- Specify to set up a thread-safe build of PHP on Linux and Windows. - Specify to set up a thread-safe build of PHP on Linux and Windows.
- Accepts `ts` and `nts`. - Accepts `nts` for non-thread-safe and `zts` or `ts` for thread-safe.
- By default, it is set to `nts`. - By default, it is set to `nts`.
- See [thread safe setup](#thread-safe-setup) for more info. - See [thread safe setup](#thread-safe-setup) for more info.
@ -494,7 +492,7 @@ steps:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
extensions: mbstring, intl extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180 ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug coverage: xdebug
@ -533,9 +531,9 @@ jobs:
### Nightly Build Setup ### Nightly Build Setup
> Set up a nightly build of `PHP 8.3`. > Set up a nightly build of `PHP 8.4`.
- This PHP version is currently in active development and might contain bugs and breaking changes. - These PHP versions are currently in active development and might contain bugs and breaking changes.
- Some user space extensions might not support this version currently. - Some user space extensions might not support this version currently.
```yaml ```yaml
@ -543,7 +541,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.3' php-version: '8.4'
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
@ -562,7 +560,7 @@ steps:
- name: Setup PHP with debugging symbols - name: Setup PHP with debugging symbols
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
env: env:
debug: true # specify true or false debug: true # specify true or false
``` ```
@ -584,7 +582,7 @@ jobs:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
env: env:
phpts: ts # specify ts or nts phpts: ts # specify ts or nts
``` ```
@ -601,7 +599,7 @@ jobs:
- name: Setup PHP with latest versions - name: Setup PHP with latest versions
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
env: env:
update: true # specify true or false update: true # specify true or false
``` ```
@ -616,14 +614,14 @@ To debug any issues, you can use the `verbose` tag instead of `v2`.
- name: Setup PHP with logs - name: Setup PHP with logs
uses: shivammathur/setup-php@verbose uses: shivammathur/setup-php@verbose
with: with:
php-version: '8.2' php-version: '8.3'
``` ```
### Multi-Arch Setup ### Multi-Arch Setup
> Set up PHP on multiple architecture on Ubuntu GitHub Runners. > Set up PHP on multiple architecture on Ubuntu GitHub Runners.
- `PHP 5.6` to `PHP 8.2` are supported by `setup-php` on multiple architecture on `Ubuntu`. - `PHP 5.6` to `PHP 8.3` are supported by `setup-php` on multiple architecture on `Ubuntu`.
- For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` installed for `setup-php`. - For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` installed for `setup-php`.
- Currently, for `ARM` based setup, you will need [self-hosted runners](#self-hosted-setup). - Currently, for `ARM` based setup, you will need [self-hosted runners](#self-hosted-setup).
@ -639,7 +637,7 @@ jobs:
- name: Install PHP - name: Install PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
``` ```
### Self Hosted Setup ### Self Hosted Setup
@ -661,7 +659,7 @@ jobs:
runs-on: self-hosted runs-on: self-hosted
strategy: strategy:
matrix: matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
name: PHP ${{ matrix.php-versions }} name: PHP ${{ matrix.php-versions }}
steps: steps:
- name: Setup PHP - name: Setup PHP
@ -689,7 +687,7 @@ jobs:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
``` ```
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images. Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
@ -722,7 +720,7 @@ For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
- name: Setup PHP with JIT in tracing mode - name: Setup PHP with JIT in tracing mode
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
coverage: none coverage: none
ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
``` ```
@ -775,7 +773,7 @@ The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHU
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
``` ```
@ -788,7 +786,7 @@ If you use Private Packagist for your private composer dependencies, you can set
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
env: env:
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }} PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
``` ```
@ -802,7 +800,7 @@ Please refer to the authentication section in [`composer documentation`](https:/
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
env: env:
COMPOSER_AUTH_JSON: | COMPOSER_AUTH_JSON: |
{ {
@ -825,7 +823,7 @@ Put the code in the run property of a step and specify the shell as `php {0}`.
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
- name: Run PHP code - name: Run PHP code
shell: php {0} shell: php {0}
@ -865,7 +863,7 @@ PHPStan supports error reporting in GitHub Actions, so it does not require probl
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: phpstan tools: phpstan
- name: Run PHPStan - name: Run PHPStan
@ -880,7 +878,7 @@ Psalm supports error reporting in GitHub Actions with an output format `github`.
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: psalm tools: psalm
- name: Run Psalm - name: Run Psalm
@ -898,7 +896,7 @@ For examples refer to the [cs2pr documentation](https://github.com/staabm/annota
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.2' php-version: '8.3'
tools: cs2pr, phpcs tools: cs2pr, phpcs
- name: Run phpcs - name: Run phpcs
@ -939,9 +937,10 @@ Examples of using `setup-php` with various PHP frameworks and packages.
- Use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with the latest minor and patch releases. With `v2` you automatically get the bug fixes, security patches, new features and support for latest PHP releases. - Use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with the latest minor and patch releases. With `v2` you automatically get the bug fixes, security patches, new features and support for latest PHP releases.
- Semantic release versions can also be used. It is recommended to [use dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot "Setup Dependabot with GitHub Actions") with semantic versioning to keep the actions in your workflows up to date. - Semantic release versions can also be used. It is recommended to [use dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot "Setup Dependabot with GitHub Actions") with semantic versioning to keep the actions in your workflows up to date.
- Commit SHA can also be used, but are not recommended. They have to be updated with every release manually, without which you will not get any bug fixes, security patches or new features. - Commit SHA can also be used, but are not recommended unless you set up tooling to update them with each release of the action.
- A new major version of the action will only be tagged when there are breaking changes in the setup-php API i.e. inputs, outputs, and environment flags.
- For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases. - For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
- It is highly discouraged to use the `master` branch as version, it might break your workflow after major releases as they have breaking changes. - It is highly discouraged to use the `main` branch as version, it might break your workflow after major releases as they have breaking changes.
- If you are using the `v1` tag or a `1.x.y` version, you should [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` only gets critical bug fixes. Maintenance support for `v1` will be dropped with the last `PHP 8.0` release. - If you are using the `v1` tag or a `1.x.y` version, you should [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` only gets critical bug fixes. Maintenance support for `v1` will be dropped with the last `PHP 8.0` release.
## :scroll: License ## :scroll: License
@ -1028,6 +1027,7 @@ These companies generously provide setup-php their products and services to aid
[`behat`]: https://docs.behat.org/en/latest/ [`behat`]: https://docs.behat.org/en/latest/
[`blackfire`]: https://blackfire.io/docs/php/index [`blackfire`]: https://blackfire.io/docs/php/index
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player [`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
[`castor`]: https://github.com/jolicode/castor
[`churn`]: https://github.com/bmitch/churn-php [`churn`]: https://github.com/bmitch/churn-php
[`codeception`]: https://codeception.com/ [`codeception`]: https://codeception.com/
[`composer`]: https://getcomposer.org/ [`composer`]: https://getcomposer.org/

View File

@ -19,9 +19,12 @@ describe('Extension tests', () => {
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'} ${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'} ${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
${'pecl_http'} | ${'7.4'} | ${'Add-Http'} ${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
${'pdo_sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv pdo_sqlsrv'}
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'} ${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'} ${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'}
${'sqlite'} | ${'7.4'} | ${'Add-Extension sqlite3'} ${'sqlite'} | ${'7.4'} | ${'Add-Extension sqlite3'}
${'sqlsrv'} | ${'5.6'} | ${'Add-Extension sqlsrv'}
${'sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv sqlsrv'}
${'sqlsrv-1.2.3preview1'} | ${'7.4'} | ${'Add-Extension sqlsrv devel 1.2.3'} ${'sqlsrv-1.2.3preview1'} | ${'7.4'} | ${'Add-Extension sqlsrv devel 1.2.3'}
${'Xdebug'} | ${'7.4'} | ${'Add-Extension xdebug'} ${'Xdebug'} | ${'7.4'} | ${'Add-Extension xdebug'}
${'xdebug2'} | ${'7.2'} | ${'Add-Extension xdebug stable 2.9.8'} ${'xdebug2'} | ${'7.2'} | ${'Add-Extension xdebug stable 2.9.8'}
@ -49,6 +52,7 @@ describe('Extension tests', () => {
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'} ${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
${'intl-65.1'} | ${'5.6'} | ${'add_intl intl-65.1'} ${'intl-65.1'} | ${'5.6'} | ${'add_intl intl-65.1'}
${'ioncube'} | ${'7.3'} | ${'add_ioncube'} ${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
${'memcache-8.2'} | ${'8.2'} | ${'add_pecl_extension memcache 8.2 extension'}
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'} ${'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'} ${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'} ${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}

View File

@ -0,0 +1,50 @@
import * as packagist from '../src/packagist';
import nock = require('nock');
describe('search function', () => {
const mockResponse = {
packages: {
'test-package': [
{
require: {
php: '8.0.0'
},
version: '1.0.0'
},
{
version: '2.0.0'
}
]
}
};
test('should return the version if matching php version is found', async () => {
nock('https://repo.packagist.org')
.get('/p2/test-package.json')
.reply(200, mockResponse);
const result = await packagist.search('test-package', '8.0');
expect(result).toBe('1.0.0');
});
test('should return null if no matching php version is found', async () => {
nock('https://repo.packagist.org')
.get('/p2/test-package.json')
.reply(200, mockResponse);
const result = await packagist.search('test-package', '5.6');
expect(result).toBeNull();
});
test('should return null if fetch fails', async () => {
nock('https://repo.packagist.org').get('/p2/test-package.json').reply(404);
const result = await packagist.search('test-package', '8.0');
expect(result).toBeNull();
});
test('should return null if the response is empty', async () => {
nock('https://repo.packagist.org')
.get('/p2/test-package.json')
.reply(200, {error: true, data: '[]'});
const result = await packagist.search('test-package', '8.0');
expect(result).toBeNull();
});
});

View File

@ -1,3 +1,4 @@
import fs = require('fs');
import * as tools from '../src/tools'; import * as tools from '../src/tools';
interface IData { interface IData {
@ -70,6 +71,22 @@ jest.mock('../src/fetch', () => ({
) )
})); }));
jest.mock('../src/packagist', () => ({
search: jest
.fn()
.mockImplementation(
async (
package_name: string,
php_version: string
): Promise<string | null> => {
if (package_name === 'phpunit/phpunit') {
return php_version + '.0';
}
return null;
}
)
}));
describe('Tools tests', () => { describe('Tools tests', () => {
it.each` it.each`
token | version token | version
@ -264,16 +281,18 @@ describe('Tools tests', () => {
); );
it.each` it.each`
version | php_version | url os | version | php_version | url
${'latest'} | ${'8.1'} | ${'https://get.blackfire.io/blackfire-player.phar'} ${'linux'} | ${'latest'} | ${'8.1'} | ${'https://get.blackfire.io/blackfire-player.phar'}
${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'} ${'linux'} | ${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.22.0.phar'} ${'linux'} | ${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.22.0.phar'}
${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'} ${'linux'} | ${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'} ${'linux'} | ${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
${'win32'} | ${'latest'} | ${'7.0'} | ${'blackfire-player is not a windows tool'}
`( `(
'checking addBlackfirePlayer: $version, $php_version', 'checking addBlackfirePlayer: $os, $version, $php_version',
async ({version, php_version, url}) => { async ({os, version, php_version, url}) => {
const data = getData({ const data = getData({
os: os,
tool: 'blackfire-player', tool: 'blackfire-player',
domain: 'https://get.blackfire.io', domain: 'https://get.blackfire.io',
version_prefix: 'v', version_prefix: 'v',
@ -373,21 +392,23 @@ describe('Tools tests', () => {
it.each([ it.each([
[ [
'blackfire, blackfire-player, churn, 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, pint, php-config, phpize, protoc, symfony, vapor, wp', 'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-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://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/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.22.0.phar blackfire-player "-V"', 'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
'add_tool https://github.com/box-project/box/releases/latest/download/box.phar box "--version"',
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"', 'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-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_composer_tool flex flex symfony/ global', 'add_composer_tool 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/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/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"',
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"', 'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
'add_composer_tool phplint phplint overtrue/', 'add_composer_tool 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-7.4.0.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_composer_tool phinx phinx robmorgan/ scoped', 'add_composer_tool phinx phinx robmorgan/ scoped',
@ -463,7 +484,7 @@ describe('Tools tests', () => {
[ [
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-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://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/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"', 'blackfire-player is not a windows tool',
'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://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"', 'Add-Tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
'Add-Tool https://deployer.org/deployer.phar deployer "-V"', 'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
@ -510,10 +531,36 @@ describe('Tools tests', () => {
} }
); );
it.each`
version | os | uri
${'latest'} | ${'linux'} | ${'releases/latest/download/castor.linux-amd64.phar'}
${'0.5.1'} | ${'linux'} | ${'releases/download/v0.5.1/castor.linux-amd64.phar'}
${'latest'} | ${'darwin'} | ${'releases/latest/download/castor.darwin-amd64.phar'}
${'0.5.1'} | ${'darwin'} | ${'releases/download/v0.5.1/castor.darwin-amd64.phar'}
${'latest'} | ${'win32'} | ${'releases/latest/download/castor.windows-amd64.phar'}
${'0.5.1'} | ${'win32'} | ${'releases/download/v0.5.1/castor.windows-amd64.phar castor -V'}
${'latest'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
`('checking addCastor: $version, $os', async ({version, os, uri}) => {
const data = getData({
tool: 'castor',
php_version: '8.1',
version_prefix: 'v',
version: version,
os: os
});
if (os === 'win32' && version === '0.5.1') {
fs.writeFileSync('castor.php', '');
expect(await tools.addCastor(data)).toContain(uri);
fs.unlinkSync('castor.php');
} else {
expect(await tools.addCastor(data)).toContain(uri);
}
});
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-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-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://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"'}
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-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://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/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-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-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://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/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-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-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://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
@ -540,4 +587,22 @@ describe('Tools tests', () => {
process.env['GITHUB_TOKEN'] = token; process.env['GITHUB_TOKEN'] = token;
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script); expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
}); });
it.each`
tools_csv | php_version | resolved
${'phpunit'} | ${'8.2'} | ${'/phpunit-8.2.0.phar'}
${'phpunit'} | ${'8.1'} | ${'/phpunit-8.1.0.phar'}
${'phpunit'} | ${'8.0'} | ${'/phpunit-8.0.0.phar'}
${'phpunit'} | ${'7.3'} | ${'/phpunit-7.3.0.phar'}
${'phpunit'} | ${'7.2'} | ${'/phpunit-7.2.0.phar'}
${'phpunit'} | ${'7.1'} | ${'/phpunit-7.1.0.phar'}
${'phpunit'} | ${'7.0'} | ${'/phpunit-7.0.0.phar'}
`(
'checking error: $tools_csv',
async ({tools_csv, php_version, resolved}) => {
expect(await tools.addTools(tools_csv, php_version, 'linux')).toContain(
resolved
);
}
);
}); });

View File

@ -1,4 +1,4 @@
import fs from 'fs'; import fs = require('fs');
import * as path from 'path'; import * as path from 'path';
import * as utils from '../src/utils'; import * as utils from '../src/utils';
@ -282,6 +282,24 @@ describe('Utils tests', () => {
process.env['php-version'] = '8.2'; process.env['php-version'] = '8.2';
expect(await utils.readPHPVersion()).toBe('8.2'); expect(await utils.readPHPVersion()).toBe('8.2');
delete process.env['php-version-file'];
delete process.env['php-version'];
existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true);
readFileSync.mockReturnValue(
'{ "platform-overrides": { "php": "7.3.25" } }'
);
expect(await utils.readPHPVersion()).toBe('7.3.25');
existsSync
.mockReturnValueOnce(false)
.mockReturnValueOnce(false)
.mockReturnValueOnce(true);
readFileSync.mockReturnValue(
'{ "config": { "platform": { "php": "7.4.33" } } }'
);
expect(await utils.readPHPVersion()).toBe('7.4.33');
existsSync.mockClear(); existsSync.mockClear();
readFileSync.mockClear(); readFileSync.mockClear();
}); });

View File

@ -31,5 +31,5 @@ outputs:
php-version: php-version:
description: 'PHP version in semver format' description: 'PHP version in semver format'
runs: runs:
using: 'node16' using: 'node20'
main: 'dist/index.js' main: 'dist/index.js'

353
dist/index.js vendored
View File

@ -249,7 +249,7 @@ async function addExtensionDarwin(extension_csv, version) {
add_script += await utils.parseExtensionSource(extension, ext_prefix); add_script += await utils.parseExtensionSource(extension, ext_prefix);
return; return;
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension): case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension): case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(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|(7\.4|8\.[0-2])phalcon5/.test(version_extension): case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-2])phalcon5/.test(version_extension):
@ -260,7 +260,7 @@ async function addExtensionDarwin(extension_csv, version) {
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension): case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix); add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
return; return;
case /.+-\d+\.\d+\.\d+.*/.test(extension): case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix); add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
return; return;
case /(5\.[3-6]|7\.0)pcov/.test(version_extension): case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
@ -299,11 +299,12 @@ async function addExtensionWindows(extension_csv, version) {
case /^none$/.test(ext_name): case /^none$/.test(ext_name):
add_script += '\nDisable-AllShared'; add_script += '\nDisable-AllShared';
break; break;
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension): case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(version_extension): case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(version_extension):
case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension): case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(version_extension): case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
add_script += await utils.customPackage(ext_name, 'extensions', extension, 'win32'); add_script += await utils.customPackage(ext_name, 'extensions', extension, 'win32');
return; return;
@ -313,13 +314,13 @@ async function addExtensionWindows(extension_csv, version) {
case /.+-.+\/.+@.+/.test(extension): case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.getUnsupportedLog(extension, version, 'win32'); add_script += await utils.getUnsupportedLog(extension, version, 'win32');
break; break;
case /.+-\d+\.\d+\.\d+$/.test(extension):
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
break;
case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension): case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension):
matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec(version_extension); matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec(version_extension);
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]); add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]);
break; break;
case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
break;
case /7\.[2-4]xdebug2/.test(version_extension): case /7\.[2-4]xdebug2/.test(version_extension):
add_script += '\nAdd-Extension xdebug stable 2.9.8'; add_script += '\nAdd-Extension xdebug stable 2.9.8';
break; break;
@ -366,7 +367,7 @@ async function addExtensionLinux(extension_csv, version) {
add_script += await utils.parseExtensionSource(extension, ext_prefix); add_script += await utils.parseExtensionSource(extension, ext_prefix);
return; return;
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension): case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension): case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension): case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension): case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
@ -379,7 +380,7 @@ async function addExtensionLinux(extension_csv, version) {
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension): case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix); add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
return; return;
case /.+-\d+\.\d+\.\d+.*/.test(extension): case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix); add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
return; return;
case /(5\.[3-6]|7\.0)pcov/.test(version_extension): case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
@ -475,7 +476,8 @@ async function fetch(input_url, auth_token, redirect_count = 5) {
const options = { const options = {
hostname: url_object.hostname, hostname: url_object.hostname,
path: url_object.pathname, path: url_object.pathname,
headers: headers headers: headers,
agent: new https.Agent({ keepAlive: false })
}; };
const req = https.get(options, (res) => { const req = https.get(options, (res) => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
@ -548,7 +550,7 @@ const extensions = __importStar(__nccwpck_require__(3390));
const tools = __importStar(__nccwpck_require__(7740)); const tools = __importStar(__nccwpck_require__(7740));
const utils = __importStar(__nccwpck_require__(918)); const utils = __importStar(__nccwpck_require__(918));
async function getScript(os) { async function getScript(os) {
const url = 'https://setup-php.com/support-ukraine'; const url = 'https://setup-php.com/sponsor';
const filename = os + (await utils.scriptExtension(os)); const filename = os + (await utils.scriptExtension(os));
const script_path = path_1.default.join(__dirname, '../src/scripts', filename); const script_path = path_1.default.join(__dirname, '../src/scripts', filename);
const run_path = script_path.replace(os, 'run'); const run_path = script_path.replace(os, 'run');
@ -570,8 +572,8 @@ async function getScript(os) {
if (ini_values_csv) { if (ini_values_csv) {
script += await config.addINIValues(ini_values_csv, os); script += await config.addINIValues(ini_values_csv, os);
} }
script += '\n' + (await utils.stepLog(`#StandWithUkraine`, os)); script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os));
script += '\n' + (await utils.addLog('$tick', 'read-more', url, os)); script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os));
fs_1.default.writeFileSync(run_path, script, { mode: 0o755 }); fs_1.default.writeFileSync(run_path, script, { mode: 0o755 });
return run_path; return run_path;
} }
@ -592,6 +594,64 @@ exports.run = run;
/***/ }), /***/ }),
/***/ 5151:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.search = void 0;
const cv = __importStar(__nccwpck_require__(4773));
const fetch = __importStar(__nccwpck_require__(2387));
async function search(package_name, php_version) {
const response = await fetch.fetch(`https://repo.packagist.org/p2/${package_name}.json`);
if (response.error || response.data === '[]') {
return null;
}
const data = JSON.parse(response['data']);
if (data && data.packages) {
const versions = data.packages[package_name];
versions.sort((a, b) => cv.compareVersions(b.version, a.version));
const result = versions.find((versionData) => {
if (versionData?.require?.php) {
return versionData?.require?.php
.split('|')
.some(require => require && cv.satisfies(php_version + '.0', require));
}
return false;
});
return result ? result.version : null;
}
return null;
}
exports.search = search;
//# sourceMappingURL=packagist.js.map
/***/ }),
/***/ 7740: /***/ 7740:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
@ -624,10 +684,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.addTools = exports.functionRecord = exports.getData = exports.addWPCLI = exports.addPHPUnitTools = exports.addPhive = exports.addPhing = exports.addPECL = exports.addDevTools = exports.addDeployer = exports.addComposer = exports.addBlackfirePlayer = exports.addPackage = exports.addArchive = exports.getPharUrl = exports.getUrl = exports.filterList = exports.getRelease = exports.getVersion = exports.getLatestVersion = exports.getSemverVersion = void 0; exports.addTools = exports.functionRecord = exports.getData = exports.addWPCLI = exports.addPHPUnitTools = exports.addPhive = exports.addPhing = exports.addPECL = exports.addDevTools = exports.addDeployer = exports.addComposer = exports.addCastor = exports.addBlackfirePlayer = exports.addPackage = exports.addArchive = exports.getPharUrl = exports.getUrl = exports.filterList = exports.getRelease = exports.getVersion = exports.getLatestVersion = exports.getSemverVersion = void 0;
const path_1 = __importDefault(__nccwpck_require__(1017)); const path_1 = __importDefault(__nccwpck_require__(1017));
const fs_1 = __importDefault(__nccwpck_require__(7147)); const fs_1 = __importDefault(__nccwpck_require__(7147));
const fetch = __importStar(__nccwpck_require__(2387)); const fetch = __importStar(__nccwpck_require__(2387));
const packagist = __importStar(__nccwpck_require__(5151));
const utils = __importStar(__nccwpck_require__(918)); const utils = __importStar(__nccwpck_require__(918));
async function getSemverVersion(data) { async function getSemverVersion(data) {
const search = data['version_prefix'] + data['version']; const search = data['version_prefix'] + data['version'];
@ -766,6 +827,10 @@ async function addPackage(data) {
} }
exports.addPackage = addPackage; exports.addPackage = addPackage;
async function addBlackfirePlayer(data) { async function addBlackfirePlayer(data) {
switch (data['os']) {
case 'win32':
return await utils.addLog('$cross', data['tool'], data['tool'] + ' is not a windows tool', 'win32');
default:
if (data['version'] == 'latest') { if (data['version'] == 'latest') {
if (/5\.[5-6]|7\.0/.test(data['php_version'])) { if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3'; data['version'] = '1.9.3';
@ -776,8 +841,19 @@ async function addBlackfirePlayer(data) {
} }
data['url'] = await getPharUrl(data); data['url'] = await getPharUrl(data);
return addArchive(data); return addArchive(data);
}
} }
exports.addBlackfirePlayer = addBlackfirePlayer; exports.addBlackfirePlayer = addBlackfirePlayer;
async function addCastor(data) {
data['tool'] = 'castor.' + data['os'].replace('win32', 'windows') + '-amd64';
data['url'] = await getUrl(data);
data['tool'] = 'castor';
data['version_parameter'] = fs_1.default.existsSync('castor.php')
? data['version_parameter']
: '';
return await addArchive(data);
}
exports.addCastor = addCastor;
async function addComposer(data) { async function addComposer(data) {
const channel = data['version'].replace('latest', 'stable'); const channel = data['version'].replace('latest', 'stable');
const github = data['github']; const github = data['github'];
@ -885,6 +961,11 @@ async function addPhive(data) {
} }
exports.addPhive = addPhive; exports.addPhive = addPhive;
async function addPHPUnitTools(data) { async function addPHPUnitTools(data) {
if (data['version'] === 'latest') {
data['version'] =
(await packagist.search(data['packagist'], data['php_version'])) ??
'latest';
}
data['url'] = await getPharUrl(data); data['url'] = await getPharUrl(data);
return await addArchive(data); return await addArchive(data);
} }
@ -936,6 +1017,7 @@ async function getData(release, php_version, os) {
data['extension'] ??= '.phar'; data['extension'] ??= '.phar';
data['os'] = os; data['os'] = os;
data['php_version'] = php_version; data['php_version'] = php_version;
data['packagist'] ??= data['repository'];
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';
@ -950,6 +1032,7 @@ async function getData(release, php_version, os) {
} }
exports.getData = getData; exports.getData = getData;
exports.functionRecord = { exports.functionRecord = {
castor: addCastor,
composer: addComposer, composer: addComposer,
deployer: addDeployer, deployer: addDeployer,
dev_tools: addDevTools, dev_tools: addDevTools,
@ -1189,7 +1272,8 @@ async function CSVArray(values_csv) {
.trim() .trim()
.replace(/^["']|["']$|(?<==)["']/g, '') .replace(/^["']|["']$|(?<==)["']/g, '')
.replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'") .replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'")
.replace(/=(.*?)(=.*)/, "='$1$2'"); .replace(/=(.*?)(=.*)/, "='$1$2'")
.replace(/:\s*["'](.*?)/g, ':$1');
}) })
.filter(Boolean); .filter(Boolean);
} }
@ -1294,6 +1378,23 @@ async function readPHPVersion() {
else if (versionFile !== '.php-version') { else if (versionFile !== '.php-version') {
throw new Error(`Could not find '${versionFile}' file.`); throw new Error(`Could not find '${versionFile}' file.`);
} }
const composerLock = 'composer.lock';
if (fs_1.default.existsSync(composerLock)) {
const lockFileContents = JSON.parse(fs_1.default.readFileSync(composerLock, 'utf8'));
if (lockFileContents['platform-overrides'] &&
lockFileContents['platform-overrides']['php']) {
return lockFileContents['platform-overrides']['php'];
}
}
const composerJson = 'composer.json';
if (fs_1.default.existsSync(composerJson)) {
const composerFileContents = JSON.parse(fs_1.default.readFileSync(composerJson, 'utf8'));
if (composerFileContents['config'] &&
composerFileContents['config']['platform'] &&
composerFileContents['config']['platform']['php']) {
return composerFileContents['config']['platform']['php'];
}
}
return 'latest'; return 'latest';
} }
exports.readPHPVersion = readPHPVersion; exports.readPHPVersion = readPHPVersion;
@ -1869,7 +1970,7 @@ class OidcClient {
.catch(error => { .catch(error => {
throw new Error(`Failed to get ID Token. \n throw new Error(`Failed to get ID Token. \n
Error Code : ${error.statusCode}\n Error Code : ${error.statusCode}\n
Error Message: ${error.result.message}`); Error Message: ${error.message}`);
}); });
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
if (!id_token) { if (!id_token) {
@ -4302,6 +4403,228 @@ function copyFile(srcFile, destFile, force) {
} }
//# sourceMappingURL=io.js.map //# sourceMappingURL=io.js.map
/***/ }),
/***/ 4773:
/***/ (function(__unused_webpack_module, exports) {
(function (global, factory) {
true ? factory(exports) :
0;
})(this, (function (exports) { 'use strict';
const semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
const validateAndParse = (version) => {
if (typeof version !== 'string') {
throw new TypeError('Invalid argument expected string');
}
const match = version.match(semver);
if (!match) {
throw new Error(`Invalid argument not valid semver ('${version}' received)`);
}
match.shift();
return match;
};
const isWildcard = (s) => s === '*' || s === 'x' || s === 'X';
const tryParse = (v) => {
const n = parseInt(v, 10);
return isNaN(n) ? v : n;
};
const forceType = (a, b) => typeof a !== typeof b ? [String(a), String(b)] : [a, b];
const compareStrings = (a, b) => {
if (isWildcard(a) || isWildcard(b))
return 0;
const [ap, bp] = forceType(tryParse(a), tryParse(b));
if (ap > bp)
return 1;
if (ap < bp)
return -1;
return 0;
};
const compareSegments = (a, b) => {
for (let i = 0; i < Math.max(a.length, b.length); i++) {
const r = compareStrings(a[i] || '0', b[i] || '0');
if (r !== 0)
return r;
}
return 0;
};
/**
* Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
* This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
* @param v1 - First version to compare
* @param v2 - Second version to compare
* @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
*/
const compareVersions = (v1, v2) => {
// validate input and split into segments
const n1 = validateAndParse(v1);
const n2 = validateAndParse(v2);
// pop off the patch
const p1 = n1.pop();
const p2 = n2.pop();
// validate numbers
const r = compareSegments(n1, n2);
if (r !== 0)
return r;
// validate pre-release
if (p1 && p2) {
return compareSegments(p1.split('.'), p2.split('.'));
}
else if (p1 || p2) {
return p1 ? -1 : 1;
}
return 0;
};
/**
* Compare [semver](https://semver.org/) version strings using the specified operator.
*
* @param v1 First version to compare
* @param v2 Second version to compare
* @param operator Allowed arithmetic operator to use
* @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
*
* @example
* ```
* compare('10.1.8', '10.0.4', '>'); // return true
* compare('10.0.1', '10.0.1', '='); // return true
* compare('10.1.1', '10.2.2', '<'); // return true
* compare('10.1.1', '10.2.2', '<='); // return true
* compare('10.1.1', '10.2.2', '>='); // return false
* ```
*/
const compare = (v1, v2, operator) => {
// validate input operator
assertValidOperator(operator);
// since result of compareVersions can only be -1 or 0 or 1
// a simple map can be used to replace switch
const res = compareVersions(v1, v2);
return operatorResMap[operator].includes(res);
};
const operatorResMap = {
'>': [1],
'>=': [0, 1],
'=': [0],
'<=': [-1, 0],
'<': [-1],
'!=': [-1, 1],
};
const allowedOperators = Object.keys(operatorResMap);
const assertValidOperator = (op) => {
if (typeof op !== 'string') {
throw new TypeError(`Invalid operator type, expected string but got ${typeof op}`);
}
if (allowedOperators.indexOf(op) === -1) {
throw new Error(`Invalid operator, expected one of ${allowedOperators.join('|')}`);
}
};
/**
* Match [npm semver](https://docs.npmjs.com/cli/v6/using-npm/semver) version range.
*
* @param version Version number to match
* @param range Range pattern for version
* @returns `true` if the version number is within the range, `false` otherwise.
*
* @example
* ```
* satisfies('1.1.0', '^1.0.0'); // return true
* satisfies('1.1.0', '~1.0.0'); // return false
* ```
*/
const satisfies = (version, range) => {
// clean input
range = range.replace(/([><=]+)\s+/g, '$1');
// handle multiple comparators
if (range.includes('||')) {
return range.split('||').some((r) => satisfies(version, r));
}
else if (range.includes(' - ')) {
const [a, b] = range.split(' - ', 2);
return satisfies(version, `>=${a} <=${b}`);
}
else if (range.includes(' ')) {
return range
.trim()
.replace(/\s{2,}/g, ' ')
.split(' ')
.every((r) => satisfies(version, r));
}
// if no range operator then "="
const m = range.match(/^([<>=~^]+)/);
const op = m ? m[1] : '=';
// if gt/lt/eq then operator compare
if (op !== '^' && op !== '~')
return compare(version, range, op);
// else range of either "~" or "^" is assumed
const [v1, v2, v3, , vp] = validateAndParse(version);
const [r1, r2, r3, , rp] = validateAndParse(range);
const v = [v1, v2, v3];
const r = [r1, r2 !== null && r2 !== void 0 ? r2 : 'x', r3 !== null && r3 !== void 0 ? r3 : 'x'];
// validate pre-release
if (rp) {
if (!vp)
return false;
if (compareSegments(v, r) !== 0)
return false;
if (compareSegments(vp.split('.'), rp.split('.')) === -1)
return false;
}
// first non-zero number
const nonZero = r.findIndex((v) => v !== '0') + 1;
// pointer to where segments can be >=
const i = op === '~' ? 2 : nonZero > 1 ? nonZero : 1;
// before pointer must be equal
if (compareSegments(v.slice(0, i), r.slice(0, i)) !== 0)
return false;
// after pointer must be >=
if (compareSegments(v.slice(i), r.slice(i)) === -1)
return false;
return true;
};
/**
* Validate [semver](https://semver.org/) version strings.
*
* @param version Version number to validate
* @returns `true` if the version number is a valid semver version number, `false` otherwise.
*
* @example
* ```
* validate('1.0.0-rc.1'); // return true
* validate('1.0-rc.1'); // return false
* validate('foo'); // return false
* ```
*/
const validate = (version) => typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version);
/**
* Validate [semver](https://semver.org/) version strings strictly. Will not accept wildcards and version ranges.
*
* @param version Version number to validate
* @returns `true` if the version number is a valid semver version number `false` otherwise
*
* @example
* ```
* validate('1.0.0-rc.1'); // return true
* validate('1.0-rc.1'); // return false
* validate('foo'); // return false
* ```
*/
const validateStrict = (version) => typeof version === 'string' &&
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(version);
exports.compare = compare;
exports.compareVersions = compareVersions;
exports.satisfies = satisfies;
exports.validate = validate;
exports.validateStrict = validateStrict;
}));
//# sourceMappingURL=index.js.map
/***/ }), /***/ }),
/***/ 4294: /***/ 4294:

View File

@ -11,7 +11,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -19,7 +19,7 @@ jobs:
# blackfire-player supports PHP >= 5.5 # blackfire-player supports PHP >= 5.5
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -19,7 +19,7 @@ jobs:
# 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@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -28,7 +28,7 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -28,7 +28,7 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP
@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -37,7 +37,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -39,7 +39,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -12,7 +12,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -37,7 +37,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -39,7 +39,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -12,7 +12,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -36,7 +36,7 @@ jobs:
# php-versions: ['7.0', '7.1', '7.2', '7.3'] # php-versions: ['7.0', '7.1', '7.2', '7.3']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -37,7 +37,7 @@ jobs:
# php-versions: ['7.0', '7.1', '7.2', '7.3'] # php-versions: ['7.0', '7.1', '7.2', '7.3']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -9,10 +9,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
node-versions: [16'] node-versions: ['16']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v1 uses: actions/setup-node@v1

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -23,7 +23,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -23,7 +23,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -12,7 +12,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1'] php-versions: ['7.4', '8.0', '8.1']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
# Docs: https://github.com/shivammathur/setup-php # Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP - name: Setup PHP

View File

@ -29,7 +29,7 @@ jobs:
php-versions: ['7.4', '8.0'] php-versions: ['7.4', '8.0']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Set Node.js 10.x - name: Set Node.js 10.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1

View File

@ -29,7 +29,7 @@ jobs:
php-versions: ['7.4', '8.0'] php-versions: ['7.4', '8.0']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Set Node.js 10.x - name: Set Node.js 10.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1

5512
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.25.1", "version": "2.28.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",
@ -34,28 +34,29 @@
"author": "shivammathur", "author": "shivammathur",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.0", "@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3" "@actions/io": "^1.1.3",
"compare-versions": "^6.1.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.0", "@types/jest": "^29.5.10",
"@types/node": "^18.15.11", "@types/node": "^20.10.0",
"@typescript-eslint/eslint-plugin": "^5.59.0", "@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^5.59.0", "@typescript-eslint/parser": "^6.12.0",
"@vercel/ncc": "^0.36.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.38.0", "eslint": "^8.54.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.27.5", "eslint-plugin-import": "^2.29.0",
"eslint-plugin-jest": "^27.2.1", "eslint-plugin-jest": "^27.6.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^5.0.1",
"jest": "^29.5.0", "jest": "^29.7.0",
"jest-circus": "^29.5.0", "jest-circus": "^29.7.0",
"nock": "^13.3.0", "nock": "^13.3.8",
"prettier": "^2.8.7", "prettier": "^3.1.0",
"simple-git-hooks": "^2.8.1", "simple-git-hooks": "^2.9.0",
"ts-jest": "^29.1.0", "ts-jest": "^29.1.1",
"typescript": "^5.0.4" "typescript": "^5.3.2"
}, },
"bugs": { "bugs": {
"url": "https://github.com/shivammathur/setup-php/issues" "url": "https://github.com/shivammathur/setup-php/issues"

View File

@ -2,6 +2,7 @@ apc=25
apcu_bc=25 apcu_bc=25
apcu-bc=25 apcu-bc=25
blackfire=30 blackfire=30
couchbase=30
decimal=30 decimal=30
ds=30 ds=30
event=30 event=30
@ -9,6 +10,7 @@ grpc=30
http=25 http=25
pecl_http=25 pecl_http=25
pecl-http=25 pecl-http=25
psr=15
inotify=30 inotify=30
libvirt-php=40 libvirt-php=40
mailparse=25 mailparse=25

View File

@ -17,3 +17,6 @@
21.04,hirsute 21.04,hirsute
21.10,impish 21.10,impish
22.04,jammy 22.04,jammy
23.04,lunar
23.10,mantic
24.04,noble

1 8 jessie
17 21.04 hirsute
18 21.10 impish
19 22.04 jammy
20 23.04 lunar
21 23.10 mantic
22 24.04 noble

View File

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

View File

@ -1,4 +1,13 @@
{ {
"box": {
"type": "phar",
"repository": "box-project/box",
"packagist": "humbug/box",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
"version_parameter": "--version"
},
"churn": { "churn": {
"type": "phar", "type": "phar",
"repository": "bmitch/churn-php", "repository": "bmitch/churn-php",
@ -64,6 +73,15 @@
"version_prefix": "v", "version_prefix": "v",
"version_parameter": "-V" "version_parameter": "-V"
}, },
"php-scoper": {
"type": "phar",
"repository": "humbug/php-scoper",
"packagist": "humbug/php-scoper",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
"version_parameter": "--version"
},
"phpcbf": { "phpcbf": {
"type": "phar", "type": "phar",
"repository": "squizlabs/PHP_CodeSniffer", "repository": "squizlabs/PHP_CodeSniffer",
@ -222,6 +240,14 @@
"version_prefix": "v", "version_prefix": "v",
"version_parameter": "-V" "version_parameter": "-V"
}, },
"castor": {
"type": "custom-function",
"domain": "https://github.com",
"repository": "jolicode/castor",
"function": "castor",
"version_prefix": "v",
"version_parameter": "-V"
},
"composer": { "composer": {
"type": "custom-function", "type": "custom-function",
"domain": "https://getcomposer.org", "domain": "https://getcomposer.org",
@ -268,6 +294,7 @@
"phpunit": { "phpunit": {
"type": "custom-function", "type": "custom-function",
"repository": "sebastianbergmann/phpunit", "repository": "sebastianbergmann/phpunit",
"packagist": "phpunit/phpunit",
"domain": "https://phar.phpunit.de", "domain": "https://phar.phpunit.de",
"function": "phpunit", "function": "phpunit",
"version_prefix": "", "version_prefix": "",

View File

@ -13,6 +13,7 @@
"fetch_latest": "true", "fetch_latest": "true",
"function": "function_name", "function": "function_name",
"repository": "user/tool", "repository": "user/tool",
"packagist": "user/tool",
"scope": "global, scoped", "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",
@ -77,6 +78,15 @@
"user/tool" "user/tool"
] ]
}, },
"packagist": {
"$id": "#/items/properties/packagist",
"type": "string",
"title": "The repository schema",
"description": "Packagist repository of the tool in case different from repository.",
"examples": [
"user/tool"
]
},
"scope": { "scope": {
"$id": "#/items/properties/scope", "$id": "#/items/properties/scope",
"type": "string", "type": "string",

View File

@ -32,14 +32,14 @@ export async function addExtensionDarwin(
add_script += await utils.parseExtensionSource(extension, ext_prefix); add_script += await utils.parseExtensionSource(extension, ext_prefix);
return; return;
// match 7.4relay...8.3relay // match 7.4relay...8.3relay
// match 5.3blackfire...8.2blackfire // match 5.3blackfire...8.3blackfire
// match 5.3blackfire-(semver)...8.1blackfire-(semver) // match 5.3blackfire-(semver)...8.3blackfire-(semver)
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http // match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...7.4ioncube // match 5.3ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5 // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5
// match 7.0zephir_parser...8.2zephir_parser // match 7.0zephir_parser...8.2zephir_parser
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension): case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test( case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension version_extension
): ):
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test( case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
@ -70,7 +70,7 @@ export async function addExtensionDarwin(
); );
return; return;
// match semver // match semver
case /.+-\d+\.\d+\.\d+.*/.test(extension): case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
add_script += await utils.joins( add_script += await utils.joins(
'\nadd_pecl_extension', '\nadd_pecl_extension',
ext_name, ext_name,
@ -134,14 +134,14 @@ export async function addExtensionWindows(
case /^none$/.test(ext_name): case /^none$/.test(ext_name):
add_script += '\nDisable-AllShared'; add_script += '\nDisable-AllShared';
break; break;
// match 5.3blackfire...8.2blackfire // match 5.3blackfire...8.3blackfire
// match 5.3blackfire-(semver)...8.1blackfire-(semver) // match 5.3blackfire-(semver)...8.3blackfire-(semver)
// match pdo_oci and oci8 // match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube // match 5.3ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5 // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http // match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
// match 7.0zephir_parser...8.2zephir_parser // match 7.0zephir_parser...8.2zephir_parser
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test( case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension version_extension
): ):
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension): case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
@ -150,6 +150,7 @@ export async function addExtensionWindows(
version_extension version_extension
): ):
case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension): case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test( case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
version_extension version_extension
): ):
@ -176,15 +177,6 @@ export async function addExtensionWindows(
'win32' 'win32'
); );
break; break;
// match semver without state
case /.+-\d+\.\d+\.\d+$/.test(extension):
add_script += await utils.joins(
'\nAdd-Extension',
ext_name,
'stable',
ext_version
);
break;
// match semver with state // match semver with state
case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension): case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension):
matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec( matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec(
@ -197,6 +189,15 @@ export async function addExtensionWindows(
matches[1] matches[1]
); );
break; break;
// match semver without state
case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
add_script += await utils.joins(
'\nAdd-Extension',
ext_name,
'stable',
ext_version
);
break;
// match 7.2xdebug2 to 7.4xdebug2 // match 7.2xdebug2 to 7.4xdebug2
case /7\.[2-4]xdebug2/.test(version_extension): case /7\.[2-4]xdebug2/.test(version_extension):
add_script += '\nAdd-Extension xdebug stable 2.9.8'; add_script += '\nAdd-Extension xdebug stable 2.9.8';
@ -263,15 +264,15 @@ export async function addExtensionLinux(
add_script += await utils.parseExtensionSource(extension, ext_prefix); add_script += await utils.parseExtensionSource(extension, ext_prefix);
return; return;
// match 7.4relay...8.3relay // match 7.4relay...8.3relay
// match 5.3blackfire...8.2blackfire // match 5.3blackfire...8.3blackfire
// match 5.3blackfire-(semver)...8.1blackfire-(semver) // match 5.3blackfire-(semver)...8.3blackfire-(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, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.2phalcon5 // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.2phalcon5
// match 7.0zephir_parser...8.2zephir_parser // match 7.0zephir_parser...8.2zephir_parser
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension): case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test( case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])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(
@ -306,7 +307,7 @@ export async function addExtensionLinux(
); );
return; return;
// match semver versions // match semver versions
case /.+-\d+\.\d+\.\d+.*/.test(extension): case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
add_script += await utils.joins( add_script += await utils.joins(
'\nadd_pecl_extension', '\nadd_pecl_extension',
ext_name, ext_name,

View File

@ -26,7 +26,8 @@ export async function fetch(
const options: https.RequestOptions = { const options: https.RequestOptions = {
hostname: url_object.hostname, hostname: url_object.hostname,
path: url_object.pathname, path: url_object.pathname,
headers: headers headers: headers,
agent: new https.Agent({keepAlive: false})
}; };
const req = https.get(options, (res: IncomingMessage) => { const req = https.get(options, (res: IncomingMessage) => {
if (res.statusCode === 200) { if (res.statusCode === 200) {

View File

@ -14,7 +14,7 @@ import * as utils from './utils';
* @param os * @param os
*/ */
export async function getScript(os: string): Promise<string> { export async function getScript(os: string): Promise<string> {
const url = 'https://setup-php.com/support-ukraine'; const url = 'https://setup-php.com/sponsor';
const filename = os + (await utils.scriptExtension(os)); const filename = os + (await utils.scriptExtension(os));
const script_path = path.join(__dirname, '../src/scripts', filename); const script_path = path.join(__dirname, '../src/scripts', filename);
const run_path = script_path.replace(os, 'run'); const run_path = script_path.replace(os, 'run');
@ -40,8 +40,8 @@ export async function getScript(os: string): Promise<string> {
if (ini_values_csv) { if (ini_values_csv) {
script += await config.addINIValues(ini_values_csv, os); script += await config.addINIValues(ini_values_csv, os);
} }
script += '\n' + (await utils.stepLog(`#StandWithUkraine`, os)); script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os));
script += '\n' + (await utils.addLog('$tick', 'read-more', url, os)); script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os));
fs.writeFileSync(run_path, script, {mode: 0o755}); fs.writeFileSync(run_path, script, {mode: 0o755});

37
src/packagist.ts Normal file
View File

@ -0,0 +1,37 @@
import * as cv from 'compare-versions';
import * as fetch from './fetch';
type RS = Record<string, string>;
type RSRS = Record<string, RS>;
export async function search(
package_name: string,
php_version: string
): Promise<string | null> {
const response = await fetch.fetch(
`https://repo.packagist.org/p2/${package_name}.json`
);
if (response.error || response.data === '[]') {
return null;
}
const data = JSON.parse(response['data']);
if (data && data.packages) {
const versions = data.packages[package_name];
versions.sort((a: RS, b: RS) => cv.compareVersions(b.version, a.version));
const result = versions.find((versionData: RSRS) => {
if (versionData?.require?.php) {
return versionData?.require?.php
.split('|')
.some(
require => require && cv.satisfies(php_version + '.0', require)
);
}
return false;
});
return result ? result.version : null;
}
return null;
}

View File

@ -43,7 +43,9 @@ copy_brew_extensions() {
extension_file="${brew_prefix:?}/opt/$dependency/$(get_extension_from_formula "${dependency%@*}").so" extension_file="${brew_prefix:?}/opt/$dependency/$(get_extension_from_formula "${dependency%@*}").so"
[ -e "$extension_file" ] && sudo cp "$extension_file" "$ext_dir" [ -e "$extension_file" ] && sudo cp "$extension_file" "$ext_dir"
done done
if [ -d "$brew_prefix"/Cellar/"$formula"@"$version" ]; then
sudo find -- "$brew_prefix"/Cellar/"$formula"@"$version" -name "*.dylib" -exec cp {} "$ext_dir" \; sudo find -- "$brew_prefix"/Cellar/"$formula"@"$version" -name "*.dylib" -exec cp {} "$ext_dir" \;
fi
} }
# Function to install a php extension from shivammathur/extensions tap. # Function to install a php extension from shivammathur/extensions tap.
@ -60,8 +62,7 @@ add_brew_extension() {
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "${core_repo:?}/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 disable_dependency_extensions "$extension" >/dev/null 2>&1
brew install -f "$ext_tap/$formula@$version" >/dev/null 2>&1 (brew install -f "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
copy_brew_extensions "$formula"
add_extension_log "$extension" "Installed and enabled" add_extension_log "$extension" "Installed and enabled"
fi fi
} }
@ -104,6 +105,15 @@ link_libraries() {
done done
} }
# Link opcache extension to extensions directory.
link_opcache() {
opcache_ini="$brew_prefix"/etc/php/"$version"/conf.d/ext-opcache.ini
if [ -e "$opcache_ini" ]; then
opcache_ext=$(grep -Eo "zend_extension.*opcache.*\.so" "$opcache_ini" | cut -d '"' -f 2)
sudo ln -sf "$opcache_ext" "$ext_dir"
fi
}
# Patch brew to overwrite packages. # Patch brew to overwrite packages.
patch_brew() { patch_brew() {
formula_installer="${brew_repo:?}"/Library/Homebrew/formula_installer.rb formula_installer="${brew_repo:?}"/Library/Homebrew/formula_installer.rb
@ -116,7 +126,8 @@ 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 "$core_repo/Formula/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$dependency.rb" [[ "${dependency:0:3}" = "lib" ]] && prefix=lib || prefix="${dependency:0:1}"
get -q -n "$core_repo/Formula/$prefix/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$prefix/$dependency.rb"
link_libraries "$dependency" link_libraries "$dependency"
} }
@ -153,8 +164,11 @@ fix_dependencies() {
# Function to get PHP version if it is already installed using Homebrew. # Function to get PHP version if it is already installed using Homebrew.
get_brewed_php() { get_brewed_php() {
php_cellar="$brew_prefix"/Cellar/php cellar="$brew_prefix"/Cellar
if [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then php_cellar="$cellar"/php
if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
php_semver | cut -c 1-3
elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
php_semver | cut -c 1-3 php_semver | cut -c 1-3
else else
echo 'false'; echo 'false';
@ -233,6 +247,7 @@ setup_php() {
semver="$(php_semver)" semver="$(php_semver)"
extra_version="$(php_extra_version)" extra_version="$(php_extra_version)"
configure_php configure_php
link_opcache
set_output "php-version" "$semver" set_output "php-version" "$semver"
if [ "${semver%.*}" != "$version" ]; then if [ "${semver%.*}" != "$version" ]; then
add_log "${cross:?}" "PHP" "Could not setup PHP $version" add_log "${cross:?}" "PHP" "Could not setup PHP $version"
@ -244,7 +259,7 @@ setup_php() {
} }
# Variables # Variables
version=${1:-'8.2'} version=${1:-'8.3'}
ini=${2:-'production'} ini=${2:-'production'}
src=${0%/*}/.. src=${0%/*}/..
php_formula=shivammathur/php/php@"$version" php_formula=shivammathur/php/php@"$version"
@ -257,6 +272,7 @@ export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1 export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1 export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_INSTALL_FROM_API=1
# shellcheck source=. # shellcheck source=.
. "${scripts:?}"/unix.sh . "${scripts:?}"/unix.sh

View File

@ -1,3 +1,16 @@
# Function to check if extension is enabled.
Function Test-Extension() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$extension
)
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
return $null -ne $extension_info
}
# Function to add extension log.
Function Add-ExtensionLog() { Function Add-ExtensionLog() {
Param ( Param (
[Parameter(Position = 0, Mandatory = $true)] [Parameter(Position = 0, Mandatory = $true)]
@ -7,8 +20,7 @@ Function Add-ExtensionLog() {
[ValidateNotNull()] [ValidateNotNull()]
$message $message
) )
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension } if (Test-Extension $extension) {
if ($null -ne $extension_info -and ($extension_info.State -eq 'Enabled' -or $extension_info.State -eq 'Builtin')) {
Add-Log $tick $extension $message Add-Log $tick $extension $message
} else { } else {
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )" Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
@ -113,9 +125,9 @@ Function Add-Extension {
if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) { if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) {
Add-NightlyExtension $extension Add-NightlyExtension $extension
} else { } else {
# Patch till DLLs for PHP 8.1 and 8.2 are released as stable. # Patch till DLLs for PHP 8.2 and above are released as stable.
$minimumStability = $stability $minimumStability = $stability
if ($version -match '8.[1-2]' -and $stability -eq 'stable') { if ($version -match '8.[2-4]' -and $stability -eq 'stable') {
$minimumStability = 'snapshot' $minimumStability = 'snapshot'
} }

View File

@ -49,6 +49,7 @@ enable_extension() {
enable_extension_dependencies "$1" "$2" enable_extension_dependencies "$1" "$2"
enable_cache_extension_dependencies "$1" "$2" enable_cache_extension_dependencies "$1" "$2"
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod >/dev/null 2>&1; then if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod >/dev/null 2>&1; then
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
mod="${ini_dir:?}"/../mods-available/"$1".ini mod="${ini_dir:?}"/../mods-available/"$1".ini
if ! [ -e "$mod" ]; then if ! [ -e "$mod" ]; then
priority="${3:-20}"; priority="${3:-20}";
@ -134,7 +135,6 @@ configure_pecl() {
[ -z "${pecl_file:-${ini_file[@]}}" ] && return [ -z "${pecl_file:-${ini_file[@]}}" ] && return
if ! [ -e /tmp/pecl_config ]; then if ! [ -e /tmp/pecl_config ]; then
for script in pear pecl; do for script in pear pecl; do
sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
sudo "$script" channel-update "$script".php.net sudo "$script" channel-update "$script".php.net
done done
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1 echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
@ -174,17 +174,23 @@ get_pecl_version() {
# Function to install PECL extensions and accept default options # Function to install PECL extensions and accept default options
pecl_install() { pecl_install() {
local extension=$1 local extension=$1
local prefix=${2:-extension}
add_pecl >/dev/null 2>&1 add_pecl >/dev/null 2>&1
cpu_count="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo '1')" cpu_count="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo '1')"
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'" prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)" suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)" IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1 (( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
disable_extension_helper "${extension%-*}" >/dev/null 2>&1
if [ "$version" = "5.3" ]; then if [ "$version" = "5.3" ]; then
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1 yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
else else
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1 yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
fi fi
local exit_code=$?
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
enable_extension "${extension%-*}" "$prefix"
return "$exit_code"
} }
# Function to install a specific version of PECL extension. # Function to install a specific version of PECL extension.
@ -197,10 +203,9 @@ 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 check_extension "$extension" && [[ -z "$pecl_version" || (-n "$pecl_version" && "${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
[ -n "$pecl_version" ] && pecl_version="-$pecl_version" [ -n "$pecl_version" ] && pecl_version="-$pecl_version"
pecl_install "$extension$pecl_version" || add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1 pecl_install "$extension$pecl_version" || add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1
extension_version="$(php -r "echo phpversion('$extension');")" extension_version="$(php -r "echo phpversion('$extension');")"

View File

@ -22,6 +22,8 @@ Function Add-Blackfire() {
} else { } else {
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" } $nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
Get-File -Url "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1 Get-File -Url "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
Disable-Extension xdebug > $null 2>&1
Disable-Extension pcov > $null 2>&1
Enable-PhpExtension -Extension blackfire -Path $php_dir Enable-PhpExtension -Extension blackfire -Path $php_dir
$status="Installed and enabled" $status="Installed and enabled"
} }

View File

@ -17,6 +17,8 @@ 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
disable_extension xdebug >/dev/null 2>&1
disable_extension pcov >/dev/null 2>&1
enable_extension blackfire extension enable_extension blackfire extension
add_extension_log blackfire "$status" add_extension_log blackfire "$status"
} }

View File

@ -32,6 +32,8 @@ get_couchbase_version() {
echo couchbase-3.0.4 echo couchbase-3.0.4
elif [ "${version:?}" = '7.3' ]; then elif [ "${version:?}" = '7.3' ]; then
echo couchbase-3.2.2 echo couchbase-3.2.2
elif [ "${version:?}" = '7.4' ]; then
echo couchbase-4.1.0
else else
echo couchbase echo couchbase
fi fi
@ -55,6 +57,9 @@ add_couchbase() {
else else
if [ "$ext" = "couchbase" ]; then if [ "$ext" = "couchbase" ]; then
ext="couchbase-$(get_pecl_version "couchbase" "stable")" ext="couchbase-$(get_pecl_version "couchbase" "stable")"
n_proc="$(nproc)"
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1 add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
else else
pecl_install "${ext}" >/dev/null 2>&1 pecl_install "${ext}" >/dev/null 2>&1

View File

@ -13,7 +13,7 @@ get_event_configure_opts() {
) )
else else
event_opts+=( event_opts+=(
--with-openssl-dir="$(brew --prefix openssl@1.1)" --with-openssl-dir="$(brew --prefix openssl@3)"
--with-event-libevent-dir="$(brew --prefix libevent)" --with-event-libevent-dir="$(brew --prefix libevent)"
) )
fi fi

View File

@ -15,8 +15,9 @@ add_intl() {
if [ "$icu" != "$supported_version" ]; then if [ "$icu" != "$supported_version" ]; then
add_log "${cross:?}" "intl" "ICU $icu is not supported" add_log "${cross:?}" "intl" "ICU $icu is not supported"
else else
[ "${ts:?}" = 'zts' ] && suffix='-zts'
install_icu "$icu" >/dev/null 2>&1 install_icu "$icu" >/dev/null 2>&1
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu.so" get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix.so"
enable_extension intl extension enable_extension intl extension
add_extension_log intl "Installed and enabled with ICU $icu" add_extension_log intl "Installed and enabled with ICU $icu"
fi fi

View File

@ -3,5 +3,7 @@ patch_geos() {
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
fi fi
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch
patch -p1 < /tmp/php8.patch 2>/dev/null || true patch -p1 < /tmp/php8.patch 2>/dev/null || true
patch -p1 < /tmp/toString.patch 2>/dev/null || true
} }

View File

@ -0,0 +1,69 @@
# Function to get sqlsrv extension version.
Function Get-SqlsrvReleaseVersion() {
if ($version -le '7.2') {
# Use the releases from PECL for these versions
return null;
} elseif($version -eq '7.3') {
return '5.9.0'
} elseif ($version -eq '7.4') {
return '5.10.1'
} else {
return 'latest'
}
}
# Function to get sqlsrv extension release URL.
Function Get-SqlsrvReleaseUrl()
{
$extensionVersion = Get-SqlsrvReleaseVersion
if($extensionVersion) {
$repo = "$github/microsoft/msphpsql"
if($extensionVersion -eq 'latest') {
return "$repo/releases/latest/download/Windows-$version.zip"
} else {
return "$repo/releases/download/v$extensionVersion/Windows-$version.zip"
}
}
}
# Function to add sqlsrv extension from GitHub.
Function Add-SqlsrvFromGithub()
{
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$extension
)
$zipUrl = SqlsrvReleaseUrl
if($zipUrl) {
$nts = if (!$installed.ThreadSafe) { "nts" } else { "ts" }
$noDotVersion = $version.replace('.', '')
$extensionFilePath = "Windows-$version\$arch\php_${extension}_${noDotVersion}_${nts}.dll"
Get-File -Url $zipUrl -OutFile $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip > $null 2>&1
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\sqlsrv -Force > $null 2>&1
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\sqlsrv\$extensionFilePath" -Destination "$ext_dir\php_$extension.dll"
Enable-PhpExtension -Extension $extension -Path $php_dir
}
}
# Function to add sqlsrv extension.
Function Add-Sqlsrv() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$extension
)
$status = 'Enabled'
if (Test-Path $ext_dir\php_$extension.dll) {
Enable-PhpExtension -Extension $extension -Path $php_dir
} else {
Add-SqlsrvFromGithub $extension >$null 2>&1
if (-not(Test-Extension $extension)) {
Add-Extension $extension >$null 2>&1
}
$status = 'Installed and enabled'
}
Add-ExtensionLog $extension $status
}

View File

@ -2,8 +2,11 @@
get_sqlsrv_version() { get_sqlsrv_version() {
if [[ "${version:?}" =~ 7.[0-3] ]]; then if [[ "${version:?}" =~ 7.[0-3] ]]; then
echo '5.9.0' echo '5.9.0'
else elif [[ "${version:?}" =~ 7.4 ]]; then
echo '5.10.1' echo '5.10.1'
else
# Return an empty string so that pecl will install the latest version.
echo ''
fi fi
} }

View File

@ -34,8 +34,8 @@ disable_extension_helper() {
if [ "$disable_dependents" = "true" ]; then if [ "$disable_dependents" = "true" ]; then
disable_extension_dependents "$extension" disable_extension_dependents "$extension"
fi fi
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file[@]}" "$pecl_file" sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "${ini_file[@]}" "$pecl_file"
sudo find "$ini_dir"/.. -name "*$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
sudo rm -f /tmp/php"$version"_extensions sudo rm -f /tmp/php"$version"_extensions
mkdir -p /tmp/extdisabled/"$version" mkdir -p /tmp/extdisabled/"$version"
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1 echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
@ -109,6 +109,11 @@ setup_old_versions() {
run_script "php5-ubuntu" "$version" run_script "php5-ubuntu" "$version"
} }
# Function to setup PHP from the cached builds.
setup_cached_versions() {
run_script "php-ubuntu" "$version" "${debug:?}" "${ts:?}"
}
# Function to add PECL. # Function to add PECL.
add_pecl() { add_pecl() {
add_devtools phpize >/dev/null 2>&1 add_devtools phpize >/dev/null 2>&1
@ -149,13 +154,9 @@ get_php_packages() {
# 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
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
IFS=' ' read -r -a packages <<<"$(get_php_packages)" IFS=' ' read -r -a packages <<<"$(get_php_packages)"
install_packages "${packages[@]}" install_packages "${packages[@]}"
else
run_script "php-ubuntu" "$version" "${debug:?}"
fi
} }
# Function to update PHP. # Function to update PHP.
@ -172,15 +173,19 @@ update_php() {
# Function to install PHP. # Function to install PHP.
add_php() { add_php() {
if [[ "$version" =~ ${nightly_versions:?} ]] || [[ "${ts:?}" = "zts" ]]; then if [ "${runner:?}" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
if [[ "$version" =~ ${nightly_versions:?} ]]; then
setup_nightly setup_nightly
elif [[ "$version" =~ ${old_versions:?} ]]; then
setup_old_versions
else else
add_packaged_php add_packaged_php
switch_version >/dev/null 2>&1 switch_version >/dev/null 2>&1
add_pecl add_pecl
fi fi
elif [[ "$version" =~ ${old_versions:?} ]]; then
setup_old_versions
else
setup_cached_versions
fi
status="Installed" status="Installed"
} }
@ -272,7 +277,7 @@ setup_php() {
} }
# Variables # Variables
version=${1:-'8.2'} version=${1:-'8.3'}
ini=${2:-'production'} ini=${2:-'production'}
src=${0%/*}/.. src=${0%/*}/..
debconf_fix="DEBIAN_FRONTEND=noninteractive" debconf_fix="DEBIAN_FRONTEND=noninteractive"

View File

@ -57,7 +57,7 @@ Function Get-ToolVersion() {
Param ( Param (
[Parameter(Position = 0, Mandatory = $true)] [Parameter(Position = 0, Mandatory = $true)]
$tool, $tool,
[Parameter(Position = 1, Mandatory = $true)] [Parameter(Position = 1, Mandatory = $false)]
$param $param
) )
$alp = "[a-zA-Z0-9\.]" $alp = "[a-zA-Z0-9\.]"
@ -72,7 +72,9 @@ Function Get-ToolVersion() {
Set-Variable -Name 'composer_version' -Value $composer_version -Scope Global Set-Variable -Name 'composer_version' -Value $composer_version -Scope Global
return "$composer_version" return "$composer_version"
} }
if($null -ne $param) {
return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value } return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value }
}
} }
# Helper function to configure tools. # Helper function to configure tools.
@ -83,7 +85,9 @@ Function Add-ToolsHelper() {
$tool $tool
) )
$extensions = @(); $extensions = @();
if($tool -eq "codeception") { if($tool -eq "box") {
$extensions += @('iconv', 'mbstring', 'phar', 'sodium')
} elseif($tool -eq "codeception") {
$extensions += @('json', 'mbstring') $extensions += @('json', 'mbstring')
Copy-Item $env:codeception_bin\codecept.bat -Destination $env:codeception_bin\codeception.bat Copy-Item $env:codeception_bin\codecept.bat -Destination $env:codeception_bin\codeception.bat
} elseif($tool -eq "composer") { } elseif($tool -eq "composer") {
@ -135,8 +139,7 @@ Function Add-Tool() {
[Parameter(Position = 1, Mandatory = $true)] [Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()] [ValidateNotNull()]
$tool, $tool,
[Parameter(Position = 2, Mandatory = $true)] [Parameter(Position = 2, Mandatory = $false)]
[ValidateNotNull()]
$ver_param $ver_param
) )
if (Test-Path $bin_dir\$tool) { if (Test-Path $bin_dir\$tool) {

View File

@ -19,7 +19,7 @@ get_tool_version() {
composer_version="$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")" 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 elif [ -n "$param" ]; then
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1 $tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
fi fi
} }
@ -72,7 +72,11 @@ set_composer_auth() {
add_tools_helper() { add_tools_helper() {
tool=$1 tool=$1
extensions=() extensions=()
if [ "$tool" = "codeception" ]; then if [ "$tool" = "blackfire-player" ]; then
extensions+=(uuid)
elif [ "$tool" = "box" ]; then
extensions+=(iconv mbstring phar sodium)
elif [ "$tool" = "codeception" ]; then
extensions+=(json mbstring) extensions+=(json mbstring)
sudo ln -s "$scoped_dir"/vendor/bin/codecept "$scoped_dir"/vendor/bin/codeception sudo ln -s "$scoped_dir"/vendor/bin/codecept "$scoped_dir"/vendor/bin/codeception
elif [ "$tool" = "composer" ]; then elif [ "$tool" = "composer" ]; then
@ -128,6 +132,9 @@ add_tool() {
tool=$2 tool=$2
ver_param=$3 ver_param=$3
tool_path="$tool_path_dir/$tool" tool_path="$tool_path_dir/$tool"
if ! [ -d "$tool_path_dir" ]; then
sudo mkdir -p "$tool_path_dir"
fi
add_path "$tool_path_dir" add_path "$tool_path_dir"
if [ -e "$tool_path" ]; then if [ -e "$tool_path" ]; then
sudo cp -aL "$tool_path" /tmp/"$tool" sudo cp -aL "$tool_path" /tmp/"$tool"

View File

@ -24,8 +24,10 @@ get_grpc_tag() {
add_grpc_php_plugin_brew() { add_grpc_php_plugin_brew() {
. "${0%/*}"/tools/brew.sh . "${0%/*}"/tools/brew.sh
configure_brew configure_brew
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
brew install grpc brew install grpc
brew link --force --overwrite grpc >/dev/null 2>&1 brew link --force --overwrite grpc >/dev/null 2>&1
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")" grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
license_path="$(brew --prefix grpc)/LICENSE" license_path="$(brew --prefix grpc)/LICENSE"
} }

View File

@ -31,10 +31,6 @@ 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
} }
@ -59,7 +55,7 @@ update_lists() {
if [[ -n "$ppa" && -n "$ppa_search" ]]; then if [[ -n "$ppa" && -n "$ppa_search" ]]; then
list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")" list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
status_file=/tmp/"${ppa/\//_}" status_file=/tmp/"${ppa/\//_}"
elif grep -Eq '^deb ' "$list_file"; then elif [ -e "$list_file" ] && grep -Eq '^deb ' "$list_file"; then
list="$list_file" list="$list_file"
fi fi
if [ ! -e "$status_file" ]; then if [ ! -e "$status_file" ]; then

View File

@ -51,9 +51,9 @@ set_output() {
read_env() { read_env() {
update="${update:-${UPDATE:-false}}" update="${update:-${UPDATE:-false}}"
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release [ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
[ "${phpts:-${PHPTS:-nts}}" = "ts" ] && ts=zts && update=true || ts=nts [[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
fail_fast="${fail_fast:-${FAIL_FAST:-false}}" fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
[[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github [[ -z "${ImageOS}" && -z "${ImageVersion}" || -n ${ACT} ]] && _runner=self-hosted || _runner=github
runner="${runner:-${RUNNER:-$_runner}}" runner="${runner:-${RUNNER:-$_runner}}"
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then

View File

@ -332,8 +332,8 @@ if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
$arch = 'x86' $arch = 'x86'
} }
$ts = $env:PHPTS -eq 'ts' $ts = ($env:PHPTS -match '^z?ts$')
if($env:PHPTS -ne 'ts') { if(-not($ts)) {
$env:PHPTS = '-nts' $env:PHPTS = '-nts'
} else { } else {
$env:PHPTS = '' $env:PHPTS = ''

View File

@ -1,6 +1,7 @@
import path from 'path'; import path from 'path';
import fs from 'fs'; import fs from 'fs';
import * as fetch from './fetch'; import * as fetch from './fetch';
import * as packagist from './packagist';
import * as utils from './utils'; import * as utils from './utils';
type RS = Record<string, string>; type RS = Record<string, string>;
@ -218,6 +219,15 @@ export async function addPackage(data: RS): Promise<string> {
* @param data * @param data
*/ */
export async function addBlackfirePlayer(data: RS): Promise<string> { export async function addBlackfirePlayer(data: RS): Promise<string> {
switch (data['os']) {
case 'win32':
return await utils.addLog(
'$cross',
data['tool'],
data['tool'] + ' is not a windows tool',
'win32'
);
default:
if (data['version'] == 'latest') { if (data['version'] == 'latest') {
if (/5\.[5-6]|7\.0/.test(data['php_version'])) { if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3'; data['version'] = '1.9.3';
@ -227,6 +237,22 @@ export async function addBlackfirePlayer(data: RS): Promise<string> {
} }
data['url'] = await getPharUrl(data); data['url'] = await getPharUrl(data);
return addArchive(data); return addArchive(data);
}
}
/**
* Function to add Castor
*
* @param data
*/
export async function addCastor(data: RS): Promise<string> {
data['tool'] = 'castor.' + data['os'].replace('win32', 'windows') + '-amd64';
data['url'] = await getUrl(data);
data['tool'] = 'castor';
data['version_parameter'] = fs.existsSync('castor.php')
? data['version_parameter']
: '';
return await addArchive(data);
} }
/** /**
@ -392,6 +418,11 @@ export async function addPhive(data: RS): Promise<string> {
* @param data * @param data
*/ */
export async function addPHPUnitTools(data: RS): Promise<string> { export async function addPHPUnitTools(data: RS): Promise<string> {
if (data['version'] === 'latest') {
data['version'] =
(await packagist.search(data['packagist'], data['php_version'])) ??
'latest';
}
data['url'] = await getPharUrl(data); data['url'] = await getPharUrl(data);
return await addArchive(data); return await addArchive(data);
} }
@ -458,6 +489,7 @@ export async function getData(
data['extension'] ??= '.phar'; data['extension'] ??= '.phar';
data['os'] = os; data['os'] = os;
data['php_version'] = php_version; data['php_version'] = php_version;
data['packagist'] ??= data['repository'];
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';
@ -472,6 +504,7 @@ export async function getData(
} }
export const functionRecord: Record<string, (data: RS) => Promise<string>> = { export const functionRecord: Record<string, (data: RS) => Promise<string>> = {
castor: addCastor,
composer: addComposer, composer: addComposer,
deployer: addDeployer, deployer: addDeployer,
dev_tools: addDevTools, dev_tools: addDevTools,

View File

@ -249,7 +249,8 @@ export async function CSVArray(values_csv: string): Promise<Array<string>> {
.trim() .trim()
.replace(/^["']|["']$|(?<==)["']/g, '') .replace(/^["']|["']$|(?<==)["']/g, '')
.replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'") .replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'")
.replace(/=(.*?)(=.*)/, "='$1$2'"); .replace(/=(.*?)(=.*)/, "='$1$2'")
.replace(/:\s*["'](.*?)/g, ':$1');
}) })
.filter(Boolean); .filter(Boolean);
} }
@ -439,6 +440,32 @@ export async function readPHPVersion(): Promise<string> {
} else if (versionFile !== '.php-version') { } else if (versionFile !== '.php-version') {
throw new Error(`Could not find '${versionFile}' file.`); throw new Error(`Could not find '${versionFile}' file.`);
} }
const composerLock = 'composer.lock';
if (fs.existsSync(composerLock)) {
const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
if (
lockFileContents['platform-overrides'] &&
lockFileContents['platform-overrides']['php']
) {
return lockFileContents['platform-overrides']['php'];
}
}
const composerJson = 'composer.json';
if (fs.existsSync(composerJson)) {
const composerFileContents = JSON.parse(
fs.readFileSync(composerJson, 'utf8')
);
if (
composerFileContents['config'] &&
composerFileContents['config']['platform'] &&
composerFileContents['config']['platform']['php']
) {
return composerFileContents['config']['platform']['php'];
}
}
return 'latest'; return 'latest';
} }