Compare commits

..
Author SHA1 Message Date
Shivam Mathur 084302964f Add thin PIE CLI extension installation helpers 2026-11-08 04:13:55 +05:30
31 changed files with 337 additions and 325 deletions
-1
View File
@@ -14,7 +14,6 @@ This security policy only applies to the latest patch releases of the following
| 8.3 | :white_check_mark: |
| 8.4 | :white_check_mark: |
| 8.5 | :white_check_mark: |
| 8.6 | :white_check_mark: |
## Reporting a Vulnerability
+3 -3
View File
@@ -26,13 +26,13 @@ jobs:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4
with:
config-file: ./.github/codeql/codeql-configuration.yml
languages: javascript
- name: Autobuild
uses: github/codeql-action/autobuild@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
uses: github/codeql-action/autobuild@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4
+2 -2
View File
@@ -23,7 +23,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
default-php-version: '8.6'
default-php-version: '8.5'
jobs:
run:
name: Run
@@ -48,7 +48,7 @@ jobs:
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@695b1b465eba861efe67cbbc31252c27f5ed253d # v1
uses: shivammathur/cache-extensions@d894929efeece5f8d386bd667369b321947064ad # v1
with:
php-version: ${{ matrix.php-versions || env.default-php-version }}
extensions: ${{ env.extensions }}
+38 -77
View File
@@ -17,9 +17,6 @@
<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>
</p>
<p align="center">
<a target="_blank" href="https://namespace.so/github-actions/?utm_source=oss&utm_campaign=setup-php"><img src="https://namespace.so/oss/badge.svg" alt="CI powered by Namespace" height="32" align="middle"></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 the [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
@@ -44,7 +41,6 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
- [Nightly Build Setup](#nightly-build-setup)
- [Debug Build Setup](#debug-build-setup)
- [Thread Safe Setup](#thread-safe-setup)
- [ASAN Build Setup](#asan-build-setup)
- [Force Update Setup](#force-update-setup)
- [Verbose Setup](#verbose-setup)
- [Multi-Arch Setup](#multi-arch-setup)
@@ -115,7 +111,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.
- PHP 5.3 to PHP 8.7 on supported GitHub-hosted runners, including macOS ARM64 runners.
- PHP 5.3 to PHP 8.7 on GitHub-hosted runners, except for macOS ARM64 runners.
- PHP 5.6 to PHP 8.7 on GitHub-hosted macOS ARM64 runners.
- PHP 5.6 to PHP 8.7 on self-hosted runners.
| PHP Version | Stability | Release Support | Runner Support |
@@ -135,12 +132,12 @@ On all supported OS/Platforms, the following PHP versions can be set up as per t
| `8.3` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.5` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.6` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.6` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
| `8.7` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
> [!Note]
> - Specifying `8.6` in the `php-version` input selects the PHP 8.6 stable series. Specifying `8.7`, `nightly`, or `master` installs a nightly build of PHP 8.7 from the master branch of PHP. See [nightly build setup](#nightly-build-setup) for more information.
> - Specifying `8.7` or `master` in `php-version` input installs a nightly build of `PHP 8.7.0-dev` from the master branch of PHP. Specifying `8.6` or `nightly` installs a nightly build of `PHP 8.6.0-dev` from the PHP-8.6 branch. 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.
## :heavy_plus_sign: PHP Extension Support
@@ -244,7 +241,7 @@ This disables all core and third-party shared extensions and thus, can break som
These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
[`backward-compatibility-check`], [`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cpx`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`laravel-cloud`] or [`cloud-cli`], [`mago`], [`name-collision-detector`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`upsun`] or [`upsun-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
[`backward-compatibility-check`], [`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cpx`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`laravel-cloud`] or [`cloud-cli`], [`mago`], [`name-collision-detector`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
```yaml
- name: Setup PHP with tools
@@ -436,7 +433,7 @@ Disable coverage for these reasons:
- Accepts a `string`. For example `'8.5'`.
- Accepts `lowest` to set up the lowest supported PHP version.
- Accepts `highest` or `latest` to set up the latest stable PHP version.
- Accepts `nightly` to set up a nightly build of the next PHP release (`8.7`).
- Accepts `nightly` to set up a nightly build of the next PHP release (`8.6`).
- Accepts `master` to set up a nightly build from the master branch of PHP (`8.7`).
- Accepts `pre-installed` to set up the highest pre-installed PHP version. You can combine this with `update: true` to update the pre-installed PHP version.
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
@@ -532,13 +529,6 @@ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the s
- By default, it is set to `nts`.
- See [thread safe setup](#thread-safe-setup) for more info.
#### `asan` (optional)
- Specify to set up PHP with AddressSanitizer (ASAN) for memory error detection.
- Accepts `true` or `false`.
- Only available for PHP 8.0 and above on Linux runners.
- See [ASAN build setup](#asan-build-setup) for more info.
#### `update` (optional)
- Specify to update PHP on the runner to the latest patch version.
@@ -601,10 +591,10 @@ jobs:
### Nightly Build Setup
> Set up a nightly build of `PHP 8.7`.
> Set up a nightly build of `PHP 8.6` or `PHP 8.7`.
- PHP 8.7 is in active development and might contain bugs and breaking changes.
- Some extensions might not support PHP 8.7 yet.
- These PHP versions are currently in active development and might contain bugs and breaking changes.
- Some user space extensions might not support these versions currently.
```yaml
steps:
@@ -660,44 +650,6 @@ jobs:
phpts: ts # specify ts or nts
```
### ASAN Build Setup
> Set up PHP with AddressSanitizer (ASAN) for memory error detection.
- ASAN builds include both `AddressSanitizer` and `UndefinedBehaviorSanitizer (UBSan)`.
- Only available for PHP 8.0 and above on Linux based runners.
- Useful for detecting memory errors such as buffer overflows, use-after-free, and memory leaks.
```yaml
jobs:
run:
runs-on: ubuntu-latest
name: Setup PHP with ASAN
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
env:
asan: true
```
You can combine ASAN with other options:
```yaml
- name: Setup PHP with ASAN and thread safety
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
env:
asan: true
phpts: ts
```
> [!NOTE]
> - ASAN builds have a performance overhead due to the instrumentation, so they are recommended for testing and debugging only.
> - You can configure ASAN behavior using the `ASAN_OPTIONS` environment variable in your test steps.
### Force Update Setup
> Update to the latest patch of PHP versions.
@@ -738,7 +690,7 @@ You can combine ASAN with other options:
> Set up PHP on multiple architectures on Ubuntu GitHub Runners.
- `PHP 5.6` to `PHP 8.6` are supported by `setup-php` on multiple architectures on `Ubuntu` and `Debian`.
- `PHP 5.6` to `PHP 8.5` are supported by `setup-php` on multiple architecture on `Ubuntu` and `Debian`.
- For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` and `PHP` installed for `setup-php`.
```yaml
@@ -1094,23 +1046,34 @@ Examples of using `setup-php` with various PHP frameworks and packages.
These companies generously provide setup-php their products and services to aid in the development of this project.
<p align="center">
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-light-mode-only"><img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140"></a>
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/jetbrains-white.svg" alt="JetBrains" width="140"></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only"><img src="https://setup-php.com/sponsors/cloudflare.svg" alt="Cloudflare" width="240"></a>
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/cloudflare-white.svg" alt="Cloudflare" width="240"></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-light-mode-only"><img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="200"></a>
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200"></a>
</p>
<p align="center">
<a target="_blank" href="https://namespace.so/github-actions/?utm_source=oss&utm_campaign=setup-php#gh-light-mode-only"><img src="https://setup-php.com/sponsors/namespace.svg?v=2" alt="Namespace" width="180" align="middle"></a>
<a target="_blank" href="https://namespace.so/github-actions/?utm_source=oss&utm_campaign=setup-php#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/namespace-white.svg?v=2" alt="Namespace" width="180" align="middle"></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a target="_blank" href="https://www.blacksmith.sh/#gh-light-mode-only"><img src="https://setup-php.com/sponsors/blacksmith.svg?v=2" alt="Blacksmith" width="180" align="middle"></a>
<a target="_blank" href="https://www.blacksmith.sh/#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/blacksmith-white.svg?v=2" alt="Blacksmith" width="180" align="middle"></a>
<p>
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-light-mode-only">
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="100">
</a>
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-dark-mode-only">
<img src="https://setup-php.com/sponsors/jetbrains-white.svg" alt="JetBrains" width="140" height="100">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only">
<img src="https://setup-php.com/sponsors/cloudflare.svg" alt="Cloudflare" width="240" height="80">
</a>
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-dark-mode-only">
<img src="https://setup-php.com/sponsors/cloudflare-white.svg" alt="Cloudflare" width="240" height="80">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-light-mode-only">
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="200" height="80">
</a>
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-dark-mode-only">
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200" height="80">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a target="_blank" href="https://m.do.co/c/f1a8ee1277b0#gh-light-mode-only">
<img src="https://setup-php.com/sponsors/digitalocean.svg" alt="Digitalocean" width="100" height="100">
</a>
<a target="_blank" href="https://m.do.co/c/f1a8ee1277b0#gh-dark-mode-only">
<img src="https://setup-php.com/sponsors/digitalocean-white.svg" alt="Digitalocean" width="100" height="100">
</a>
</p>
Many users and organizations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
@@ -1201,8 +1164,6 @@ Many users and organizations support setup-php via [GitHub Sponsors](https://git
[`rector`]: https://getrector.org/
[`symfony`]: https://symfony.com/download
[`symfony-cli`]: https://symfony.com/download
[`upsun`]: https://docs.upsun.com/administration/cli.html
[`upsun-cli`]: https://docs.upsun.com/administration/cli.html
[`vapor`]: https://docs.vapor.build/
[`vapor-cli`]: https://docs.vapor.build/
[`wp`]: https://wp-cli.org/
-2
View File
@@ -72,7 +72,6 @@ describe('Extension tests', () => {
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
${'relay'} | ${'7.4'} | ${'add_relay relay'}
${'relay-v1.2.3'} | ${'7.4'} | ${'add_relay relay-v1.2.3'}
${'relay-nightly'} | ${'8.6'} | ${'add_relay relay-nightly'}
${'sqlite'} | ${'7.4'} | ${'add_extension sqlite3'}
${'sqlsrv-1.2.3-beta1'} | ${'7.4'} | ${'add_pecl_extension sqlsrv 1.2.3beta1 extension'}
${'Xdebug'} | ${'7.4'} | ${'add_extension xdebug'}
@@ -108,7 +107,6 @@ describe('Extension tests', () => {
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
${'pecl_http'} | ${'7.3'} | ${'add_http'}
${'relay-1.2.3'} | ${'7.4'} | ${'add_relay relay-1.2.3'}
${'relay-nightly'} | ${'8.6'} | ${'add_relay relay-nightly'}
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
${'xdebug2'} | ${'7.4'} | ${'add_brew_extension xdebug2 zend_extension 2.9.8'}
${'zephir_parser-v1.2.3'} | ${'7.2'} | ${'add_zephir_parser zephir_parser-v1.2.3'}
-4
View File
@@ -21,10 +21,6 @@ it('checking fetch', async () => {
nock(host_url)
.get('/manifest')
.matchHeader(
'user-agent',
`setup-php (${process.platform}; ${process.arch}; +https://setup-php.com)`
)
.reply(200, {latest: 'latest'})
.get('/manifest')
.matchHeader('authorization', 'Bearer invalid_token')
+3 -6
View File
@@ -669,7 +669,7 @@ describe('Tools tests', () => {
it.each([
[
'blackfire, blackfire-player, box, churn, cloud-cli, cpx, cs2pr, flex, grpc_php_plugin, mago, name-collision-detector, 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, upsun, vapor, wp, pie',
'blackfire, blackfire-player, box, churn, cloud-cli, cpx, cs2pr, flex, grpc_php_plugin, mago, name-collision-detector, 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, pie',
[
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/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',
@@ -702,7 +702,6 @@ describe('Tools tests', () => {
'add_devtools phpize',
'add_protoc latest',
'add_symfony latest',
'add_upsun latest',
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
'add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
@@ -717,7 +716,7 @@ describe('Tools tests', () => {
it.each([
[
'backward-compatibility-check, behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cpx:2.0.0, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, laravel-cloud, mago:0.26.1, name-collision-detector, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, upsun-cli:5.16.0, vapor-cli, wp-cli, pie',
'backward-compatibility-check, behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cpx:2.0.0, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, laravel-cloud, mago:0.26.1, name-collision-detector, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli, pie',
[
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/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_composer_tool behat behat behat/ scoped',
@@ -756,7 +755,6 @@ describe('Tools tests', () => {
'add_composer_tool rector rector rector/ scoped',
'add_composer_tool backward-compatibility-check backward-compatibility-check roave/ scoped',
'add_symfony latest',
'add_upsun 5.16.0',
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
'add_composer_tool easy-coding-standard easy-coding-standard symplify/ scoped',
@@ -772,7 +770,7 @@ describe('Tools tests', () => {
it.each([
[
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, mago, name-collision-detector, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, upsun-cli, wp, pie',
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, mago, name-collision-detector, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp, pie',
[
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/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',
@@ -791,7 +789,6 @@ describe('Tools tests', () => {
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
'Add-ComposerTool phpunit-bridge phpunit-bridge symfony/ global',
'Add-Symfony',
'Add-Upsun latest',
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
'Add-Tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
]
+2 -4
View File
@@ -51,10 +51,8 @@ describe('Utils tests', () => {
'utf8'
)
});
expect(await utils.parseVersion('latest')).toBe('8.6');
expect(await utils.parseVersion('highest')).toBe('8.6');
expect(await utils.parseVersion('8.x')).toBe('8.6');
expect(await utils.parseVersion('nightly')).toBe('8.7');
expect(await utils.parseVersion('latest')).toBe('8.5');
expect(await utils.parseVersion('nightly')).toBe('8.6');
expect(await utils.parseVersion('master')).toBe('8.7');
expect(await utils.parseVersion('8.7')).toBe('8.7');
expect(await utils.parseVersion('8.7.0')).toBe('8.7');
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -3
View File
@@ -3468,9 +3468,10 @@
"license": "MIT"
},
"node_modules/deepmerge": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
"name": "@shivammathur/deepmerge",
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/@shivammathur/deepmerge/-/deepmerge-4.3.2.tgz",
"integrity": "sha512-OBZnBsXwbBITC90wXf9Ph8W7OAUkhFdM+BGRYeIQwt5nILxy5wkk2plUoabi9Yp6xm0c/Yv9PuLiGBXnfizAMA==",
"dev": true,
"license": "MIT",
"engines": {
+8 -7
View File
@@ -44,26 +44,27 @@
"@eslint/js": "^10.0.1",
"@types/jest": "^30.0.0",
"@types/node": "^26.6.6",
"@typescript-eslint/eslint-plugin": "^8.73.0",
"@typescript-eslint/parser": "^8.73.0",
"@typescript-eslint/eslint-plugin": "^8.72.1",
"@typescript-eslint/parser": "^8.72.1",
"@typescript/native": "npm:typescript@^7.0.2",
"@vercel/ncc": "^0.45.0",
"eslint": "^10.15.0",
"eslint": "^10.14.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.5",
"eslint-plugin-import-x": "^4.18.1",
"eslint-plugin-jest": "^29.17.1",
"eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-jest": "^29.17.0",
"eslint-plugin-prettier": "^5.5.7",
"globals": "^17.14.0",
"jest": "^30.5.2",
"jest-circus": "^30.5.2",
"nock": "^15.0.6",
"prettier": "^3.10.1",
"nock": "^15.0.5",
"prettier": "^3.9.10",
"simple-git-hooks": "^2.14.0",
"ts-jest": "^29.4.15",
"typescript": "npm:@typescript/typescript6@^6.0.2"
},
"overrides": {
"deepmerge": "npm:@shivammathur/deepmerge@4.3.2",
"glob": "^14.0.3",
"minimatch": "^11.0.3"
},
+4 -4
View File
@@ -1,10 +1,10 @@
{
"lowest": "8.1",
"highest": "8.6",
"latest": "8.6",
"nightly": "8.7",
"highest": "8.5",
"latest": "8.5",
"nightly": "8.6",
"master": "8.7",
"5.x": "5.6",
"7.x": "7.4",
"8.x": "8.6"
"8.x": "8.5"
}
+111
View File
@@ -0,0 +1,111 @@
{
"amqp": "php-amqp/php-amqp",
"apcu": "apcu/apcu",
"apfd": "m6w6/ext-apfd",
"arrow": "flow-php/arrow-ext",
"ast": "nikic/php-ast",
"biscuit_php": "ptondereau/biscuit-php",
"bitset": "pecl/bitset",
"brotli": "kjdev/brotli",
"bsdiff": "bsdiff/bsdiff",
"csv": "girgias/csv",
"dbus": "pecl/dbus",
"decimal": "php-decimal/ext-decimal",
"deepclone": "symfony/deepclone",
"dio": "pecl/dio",
"ds": "php-ds/ext-ds",
"ev": "osmanov/pecl-ev",
"event": "osmanov/pecl-event",
"excel": "iliaal/php-excel",
"excimer": "wikimedia/excimer",
"fast_uuid": "iliaal/fast_uuid",
"fastchart": "iliaal/fastchart",
"fastjson": "iliaal/fastjson",
"geospatial": "php-geospatial/geospatial",
"glfw": "mario-deluna/php-glfw",
"grpc": "grpc/grpc-php-ext",
"hdr_histogram": "beberlei/hdrhistogram",
"hdrhistogram": "beberlei/hdrhistogram",
"highlighter": "yiipress/highlighter",
"http": "m6w6/ext-http",
"igbinary": "igbinary/igbinary",
"imagick": "imagick/imagick",
"inotify": "arnaud-lb/inotify",
"ip2location": "ip2location/ip2location-pie",
"ip2proxy": "ip2location/ip2proxy-pie",
"json_post": "m6w6/ext-json_post",
"jsonpath": "supermetrics/jsonpath",
"judy": "orieg/judy",
"krb5": "pecl/krb5",
"lchash": "iliaal/lchash",
"luasandbox": "wikimedia/luasandbox",
"lz4": "kjdev/lz4",
"lzf": "pecl/lzf",
"mailparse": "pecl/mailparse",
"maxminddb": "maxmind-db/reader-ext",
"mcrypt": "pecl/mcrypt",
"mdparser": "iliaal/mdparser",
"memcached": "php-memcached/php-memcached",
"memprof": "arnaud-lb/memprof",
"mjml": "kcs/mjml",
"mongodb": "mongodb/mongodb-extension",
"msgpack": "msgpack/msgpack-php",
"mustache": "jbboehr/php-mustache",
"oci8": "oci8/oci8",
"openswoole": "openswoole/ext-openswoole",
"opentelemetry": "open-telemetry/ext-opentelemetry",
"operator": "jblo/operator",
"parallel": "pecl/parallel",
"pcov": "pecl/pcov",
"pdo_duckdb": "thomas-0816/pdo-duckdb-php",
"pdo_oci": "pecl/pdo_oci",
"pdo_sqlsrv": "microsoft/pdo_sqlsrv",
"pecl_http": "m6w6/ext-http",
"phalcon": "phalcon/cphalcon",
"phonetic": "iliaal/phonetic",
"phpser": "iliaal/phpser",
"phpstan_turbo": "phpstan/turbo",
"pkcs11": "gamringer/pkcs11",
"pq": "m6w6/ext-pq",
"quickhash": "derickr/quickhash",
"raphf": "m6w6/ext-raphf",
"rar": "cataphract/rar",
"rdkafka": "rdkafka/rdkafka",
"redis": "phpredis/phpredis",
"relay": "cachewerk/ext-relay",
"rpminfo": "remi/rpminfo",
"scrypt": "woohoolabs/php-scrypt",
"selinux": "pecl/selinux",
"snappy": "kjdev/snappy",
"solr": "pecl/solr",
"spx": "noisebynorthwest/php-spx",
"sqlsrv": "microsoft/sqlsrv",
"statgrab": "iliaal/statgrab",
"swoole": "swoole/swoole",
"swow": "swow/swow-extension",
"taint": "laruence/taint",
"tensor": "rubix/tensor_ext",
"timezonedb": "pecl/timezonedb",
"translit": "derickr/translit",
"uopz": "krakjoe/uopz",
"uuid": "pecl/uuid",
"uv": "amphp/uv",
"valkey_glide": "valkey-io/valkey-glide-php",
"vld": "derickr/vld",
"wikidiff2": "wikimedia/wikidiff2",
"win32service": "win32service/win32service",
"xattr": "pecl/xattr",
"xdebug": "xdebug/xdebug",
"xdiff": "pecl/xdiff",
"xlswriter": "viest/xlswriter",
"xmldiff": "pecl/xml-xmldiff",
"xpass": "remi/xpass",
"yac": "laruence/yac",
"yaconf": "laruence/yaconf",
"yaf": "laruence/yaf",
"yaml": "pecl/yaml",
"yar": "laruence/yar",
"yaz": "indexdata/yaz",
"zip": "pecl/zip",
"zstd": "kjdev/zstd"
}
-8
View File
@@ -288,14 +288,6 @@
"version_prefix": "v",
"version_parameter": "-V"
},
"upsun-cli": {
"alias": "upsun",
"type": "custom-package",
"repository": "upsun/cli",
"domain": "https://github.com",
"version_prefix": "v",
"version_parameter": "--version"
},
"blackfire-player": {
"type": "custom-function",
"domain": "https://get.blackfire.io",
+4 -4
View File
@@ -31,14 +31,14 @@ export async function addExtensionDarwin(
case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.parseExtensionSource(extension, ext_prefix);
return;
// match 7.4relay...8.6relay
// match 7.4relay...8.5relay
// match 5.3blackfire...8.5blackfire
// match 5.3blackfire-(semver)...8.5blackfire-(semver)
// match couchbase, event, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...8.5ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
// match 7.0zephir_parser...8.5zephir_parser
case /^(7\.4|8\.[0-6])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
version_extension
):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
@@ -277,7 +277,7 @@ export async function addExtensionLinux(
case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.parseExtensionSource(extension, ext_prefix);
return;
// match 7.4relay...8.6relay
// match 7.4relay...8.5relay
// match 5.3blackfire...8.5blackfire
// match 5.3blackfire-(semver)...8.5blackfire-(semver)
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
@@ -285,7 +285,7 @@ export async function addExtensionLinux(
// match 5.3ioncube...8.5ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
// match 7.0zephir_parser...8.5zephir_parser
case /^(7\.4|8\.[0-6])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
version_extension
):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
+1 -1
View File
@@ -16,7 +16,7 @@ export async function fetch(
redirect_count = 5
): Promise<Record<string, string>> {
const headers: Record<string, string> = {
'User-Agent': `setup-php (${process.platform}; ${process.arch}; +https://setup-php.com)`
'User-Agent': `Mozilla/5.0 (${process.platform} ${process.arch}) setup-php`
};
if (auth_token) {
headers['Authorization'] = 'Bearer ' + auth_token;
+1 -1
View File
@@ -333,7 +333,7 @@ setup_php() {
}
# Variables
version=${1:-'8.6'}
version=${1:-'8.5'}
ini=${2:-'production'}
src=${0%/*}/..
php_formula=shivammathur/php/php@"$version"
+61
View File
@@ -85,6 +85,67 @@ Function Add-ExtensionFromGithub {
}
}
# Function to install a PIE package or mapped version. Windows uses prebuilt DLLs.
Function Add-PieExtension {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$extension,
[Parameter(Position = 1, Mandatory = $false)]
[string]
$package = '',
[Parameter(Position = 2, Mandatory = $false)]
[Alias('AllowSourceBuild')]
[bool]
$allow_source = $false
)
$requested = ($package -split ':', 2)[-1]
if ($package -notmatch '/') {
$mapping = Get-Content "$src\configs\pie-extensions.json" -Raw | ConvertFrom-Json
$package = $mapping.$extension
if (-not $package) { throw "No PIE package mapping for $extension" }
if ($requested -in @('', 'latest', 'stable')) { $requested = '' } else { $package += ":$requested" }
} elseif ($package -notmatch ':') {
$requested = ''
}
& "$php_dir\php.exe" -r 'exit(extension_loaded($argv[1]) && ($argv[2] === "" || phpversion($argv[1]) === $argv[2]) ? 0 : 1);' -- $extension "$requested" >$null 2>&1
if ($LASTEXITCODE -eq 0) {
Add-Log $tick $extension 'Enabled'
return
}
$pie_args = @('install', $package, '--no-interaction', '--skip-enable-extension', '--no-build-tools-check', '--no-system-dependencies-check', "--with-php-path=$php_dir\php.exe")
if (-not $allow_source) {
# Skip CPU detection when compilation is disabled.
$pie_args += @('--suppress-download-url-method=composer-default', '--suppress-download-url-method=pre-packaged-source', '--make-parallel-jobs=1')
}
New-Item -ItemType Directory -Path $composer_home -Force >$null
Set-ComposerAuth
$pie_log = Join-Path ([System.IO.Path]::GetTempPath()) "pie-$extension.log"
$pie_path = Join-Path $bin_dir 'pie'
if ([version]$installed.MajorMinorVersion -lt [version]'8.1') {
$pie_path = Join-Path $bin_dir 'pie-cli.exe'
if (-not (Test-Path $pie_path -PathType Leaf)) {
Get-File -Url https://github.com/php/pie/releases/latest/download/pie-Windows-X64.exe -OutFile $pie_path
}
& $pie_path @pie_args >$pie_log 2>&1
} else {
if (-not (Test-Path $pie_path -PathType Leaf)) {
Add-Tool https://github.com/php/pie/releases/latest/download/pie.phar pie '-V' >$null 2>&1
}
& "$php_dir\php.exe" $pie_path @pie_args >$pie_log 2>&1
}
if ($LASTEXITCODE -ne 0) {
Get-Content $pie_log | ForEach-Object { Write-Host $_ }
throw "Could not install $package using PIE (exit code $LASTEXITCODE)"
}
Enable-ExtensionDependencies $extension
Enable-PhpExtension -Extension $extension -Path $php_dir
& "$php_dir\php.exe" -r 'exit(extension_loaded($argv[1]) ? 0 : 1);' -- $extension >$null 2>&1
if ($LASTEXITCODE -ne 0) { throw "Could not load $extension after installing $package using PIE" }
Add-Log $tick $extension 'Installed and enabled'
}
# Function to add PHP extensions.
Function Add-Extension {
Param (
+48
View File
@@ -188,6 +188,54 @@ get_pecl_version() {
echo "$response" | grep -Eio "$pattern" | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
}
# Install a PIE package or mapped version: extension, package, allow_source=false, prefix.
pie_install() {
local extension=$1 package=${2:-} allow_source=${3:-false}
local prefix=${4:-$(get_extension_prefix "$extension")} requested pie_path php_config asset arch
requested=${package##*:}
if [[ "$package" != */* ]]; then
package=$(jq -er --arg extension "$extension" '.[$extension]' "${src:?}/configs/pie-extensions.json") || return 1
case "$requested" in ''|latest|stable) requested= ;; *) package="$package:$requested" ;; esac
elif [[ "$package" != *:* ]]; then
requested=
fi
if php -d display_errors=0 -r 'exit(extension_loaded($argv[1]) && ($argv[2] === "" || phpversion($argv[1]) === $argv[2]) ? 0 : 1);' -- "$extension" "$requested"; then
return 0
fi
local pie_args=(install "$package" --no-interaction --skip-enable-extension --no-build-tools-check --no-system-dependencies-check)
php_config=$(command -v php-config) || return 1
pie_args+=("--with-php-config=$php_config")
if [ "$allow_source" != true ]; then
# Skip CPU detection when compilation is disabled.
pie_args+=(--suppress-download-url-method=composer-default --suppress-download-url-method=pre-packaged-source --make-parallel-jobs=1)
fi
if php -r 'exit(PHP_VERSION_ID >= 80100 ? 0 : 1);'; then
if ! command -v pie >/dev/null 2>&1; then
add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie '-V' >/dev/null 2>&1 || return 1
fi
pie_path=$(command -v pie) || return 1
else
arch=$(uname -m)
case "$arch" in x86_64|amd64) arch=X64 ;; arm64|aarch64) arch=ARM64 ;; *) return 1 ;; esac
asset="pie-$(uname -s)-$arch"
[ "$(uname -s)" != Darwin ] || asset="pie-macOS-$arch"
pie_path="${tool_path_dir:?}/pie-cli"
if [ ! -x "$pie_path" ]; then
[ "$(get -v -e "$pie_path" "https://github.com/php/pie/releases/latest/download/$asset")" = 200 ] || return 1
fi
fi
mkdir -p "${composer_home:?}"
set_composer_auth
sudo -E "$pie_path" "${pie_args[@]}" >"/tmp/pie-$extension.log" 2>&1 || {
local status=$?
cat "/tmp/pie-$extension.log" >&2
return "$status"
}
sudo rm -f /tmp/php"${version:?}"_extensions
enable_extension "$extension" "$prefix" || return 1
check_extension "$extension"
}
# Function to install PECL extensions and accept default options
pecl_install() {
local extension=$1
+1 -1
View File
@@ -31,7 +31,7 @@ add_cubrid_helper() {
set_cubrid_repo
set_cubrid_branch
patch_phpize
read -r "${ext}_CONFIGURE_PREFIX_OPTS" <<< "SED=sed CMAKE_POLICY_VERSION_MINIMUM=3.5 CFLAGS=-std=gnu17"
read -r "${ext}_PREFIX_CONFIGURE_OPTS" <<< "CFLAGS=-Wno-implicit-function-declaration"
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config)"
add_extension_from_source "$ext" https://github.com CUBRID "$cubrid_repo" "$cubrid_branch" extension
restore_phpize
+1 -30
View File
@@ -51,32 +51,6 @@ Function Get-Oci8DLL() {
return $null
}
# Function to restore OCI DLLs missing from a cached PHP build.
Function Add-BundledOci() {
$bundleVersion = $installed.FullVersion
# PHP 8.2.34 is the last Windows PHP 8.2 release containing the OCI DLLs.
if($version -eq '8.2' -and [version]$installed.Version -gt [version]'8.2.34') {
$bundleVersion = '8.2.34'
}
$threadSafety = if($ts) { '' } else { '-nts' }
$compiler = if($installed.VCVersion -ge 16) { 'vs' } elseif($version -eq '7.4') { 'vc' } else { 'VC' }
$asset = "php-$bundleVersion$threadSafety-Win32-$compiler$($installed.VCVersion)-$arch.zip"
$bundleDir = Join-Path ([IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
New-Item -ItemType Directory -Path $bundleDir > $null
try {
Get-File -Url "$php_windows/releases/$asset" -FallbackUrl "$php_windows/releases/archives/$asset" -OutFile "$bundleDir\php.zip"
Expand-Archive -Path "$bundleDir\php.zip" -DestinationPath $bundleDir -Force
Get-ChildItem "$bundleDir\ext\php_*oci*.dll" | ForEach-Object {
$dll = Get-PhpExtension -Path $_.FullName
if($dll.PhpVersion -eq $version -and $dll.Architecture -eq $arch -and $dll.ThreadSafe -eq $ts) {
Copy-Item $_.FullName $ext_dir -Force
}
}
} finally {
Remove-Item $bundleDir -Recurse -Force
}
}
# Function to install oci8 and pdo_oci.
Function Add-Oci() {
Param (
@@ -89,10 +63,7 @@ Function Add-Oci() {
try {
$status = 'Enabled'
Add-InstantClient
if($version -lt '8.3') {
if(-not(Get-ChildItem "$ext_dir\php_$extension*.dll")) {
Add-BundledOci
}
if($version -lt '8.4') {
if($version -lt '5.6' -and $extension -eq 'oci8') {
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
} else {
@@ -1,11 +0,0 @@
patch_pdo_cubrid() {
if [[ ${version:?} =~ ^7\.[0-2]$ ]] && [ -f cubrid_driver7.c ]; then
# Match the PHP 7 PDO callbacks and store zvals with the PHP 7 hash API.
sed -i.bak \
-e 's/const char \*sql, long sql_len/const char *sql, size_t sql_len/g' \
-e 's/static long cubrid_handle_doer/static zend_long cubrid_handle_doer/' \
-e 's/zend_hash_index_update_ptr(HASH_OF(arg), index, (void \*)\&tmp_zval)/zend_hash_index_update(HASH_OF(arg), index, \&tmp_zval)/' \
-e 's/(cubrid_retval = zend_hash_update(HASH_OF(arg), key, (void \*) \&tmp_zval)) == FAILURE/zend_hash_str_update(HASH_OF(arg), key, strlen(key), \&tmp_zval) == NULL/' \
cubrid_driver7.c
fi
}
+3 -9
View File
@@ -35,16 +35,12 @@ get_openssl_suffix() {
# Change library paths in relay binary.
change_library_paths() {
if [ "$os" = "Darwin" ]; then
dylibs="$(otool -L "${ext_dir:?}"/relay.so | grep -Eo '.*\.dylib' | cut -f1 -d ' ')"
openssl_version="$(echo "$dylibs" | sed -nE 's|.*libssl\.([0-9.]+)\.dylib$|\1|p' | head -n 1)"
if [ -z "$openssl_version" ]; then
openssl_version="$(echo "$dylibs" | sed -nE 's|.*/openssl@([0-9.]+)/lib/libssl\.dylib$|\1|p' | head -n 1)"
fi
openssl_version="${openssl_version:-1.1}"
otool -L "${ext_dir:?}"/relay.so | grep -q 'ssl.3.' && openssl_version='3' || openssl_version='1.1'
[ -e "${brew_prefix:?}"/opt/openssl@"$openssl_version" ] || {
safe_brew install --skip-link openssl@"$openssl_version" &&
brew link --overwrite --force openssl@"$openssl_version"
}
dylibs="$(otool -L "${ext_dir:?}"/relay.so | grep -Eo '.*\.dylib' | cut -f1 -d ' ')"
install_name_tool -change "$(echo "${dylibs}" | grep -E "libzstd.*dylib" | xargs)" "$brew_prefix"/opt/zstd/lib/libzstd.dylib "$ext_dir"/relay.so
install_name_tool -change "$(echo "${dylibs}" | grep -E "liblz4.*dylib" | xargs)" "$brew_prefix"/opt/lz4/lib/liblz4.dylib "$ext_dir"/relay.so
install_name_tool -change "$(echo "${dylibs}" | grep -E "libssl.*dylib" | xargs)" "$brew_prefix"/opt/openssl@"$openssl_version"/lib/libssl.dylib "$ext_dir"/relay.so
@@ -134,9 +130,7 @@ add_relay_helper() {
fi
if [ -e /tmp/relay.tar.gz ] && file /tmp/relay.tar.gz | grep -q 'gzip'; then
sudo tar --strip-components=1 -xzf /tmp/relay.tar.gz -C "${ext_dir:?}"
if [ -e "${ext_dir:?}"/relay-pkg.so ]; then
sudo mv "${ext_dir:?}"/relay-pkg.so "${ext_dir:?}"/relay.so
fi
sudo mv "${ext_dir:?}"/relay-pkg.so "${ext_dir:?}"/relay.so
fi
}
+5 -11
View File
@@ -122,10 +122,6 @@ patch_extension() {
fetch_extension() {
local extension=$1
local fetch=$2
local curl_opts=("${curl_opts[@]}" --retry 2)
if curl --help all 2>/dev/null | grep -- '--retry-all-errors' >/dev/null; then
curl_opts+=(--retry-all-errors)
fi
if [ "$fetch" = "clone" ]; then
run_group "git clone -nv $url/$org/$repo /tmp/$repo-$release" "git clone"
cd /tmp/"$repo-$release" || exit 1
@@ -136,17 +132,15 @@ fetch_extension() {
run_group "git submodule update --jobs $jobs --init --recursive" "git submodule"
fi
elif [ "$fetch" = "get" ]; then
get -q -n /tmp/"$extension".tar.gz "$url/$org/$repo/archive/$release.tar.gz" || return 1
tar -tzf /tmp/"$extension".tar.gz >/dev/null 2>&1 || return 1
tar -xzf /tmp/"$extension".tar.gz -C /tmp || return 1
get -q -n /tmp/"$extension".tar.gz "$url/$org/$repo/archive/$release.tar.gz"
tar -xzf /tmp/"$extension".tar.gz -C /tmp
cd /tmp/"$repo"-"$release"/"$sub_dir" || exit
elif [ "$fetch" = "pecl" ]; then
source="pecl"
pecl_name=${extension/http/pecl_http}
capital_pecl_name=$(echo "$pecl_name" | tr '[:lower:]' '[:upper:]')
get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz https://pecl.php.net/get/"$capital_pecl_name"-"$release".tgz || return 1
tar -tzf /tmp/"$pecl_name".tgz >/dev/null 2>&1 || return 1
tar -xzf /tmp/"$pecl_name".tgz -C /tmp || return 1
get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz https://pecl.php.net/get/"$capital_pecl_name"-"$release".tgz
tar -xzf /tmp/"$pecl_name".tgz -C /tmp
cd /tmp/"$pecl_name"-"$release" 2>/dev/null || cd /tmp/"$capital_pecl_name"-"$release" 2>/dev/null || exit
fi
}
@@ -171,7 +165,7 @@ add_extension_from_source() {
(
add_devtools phpize >/dev/null 2>&1
disable_extension_helper "$extension"
fetch_extension "$extension" "$fetch" || exit 1
fetch_extension "$extension" "$fetch"
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
add_log "${cross:?}" "$source" "$source does not have a PHP extension"
else
+20 -14
View File
@@ -6,15 +6,20 @@ add_sudo() {
fi
}
# Function to select the package installer.
set_apt_install() {
local apt=apt-get
command -v apt-fast >/dev/null && apt=apt-fast
apt_install="sudo $debconf_fix $apt install -y --no-install-recommends -o Dpkg::Options::=--force-confnew"
# Function to link apt-fast to apt-get
link_apt_fast() {
if ! command -v apt-fast >/dev/null; then
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
fi
}
# Function to setup environment for self-hosted runners.
self_hosted_helper() {
if ! command -v apt-fast >/dev/null; then
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
fi
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
local packages=()
mapfile -t packages < <(filter_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg)
@@ -25,12 +30,16 @@ self_hosted_helper() {
# Function to fix broken packages.
fix_broken_packages() {
sudo apt --fix-broken install -o Dpkg::Options::=--force-confnew >/dev/null 2>&1
sudo apt --fix-broken install >/dev/null 2>&1
}
# Function to install a package
install_packages() {
packages=("$@")
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew >/dev/null 2>&1
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
fi
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
}
@@ -124,11 +133,7 @@ add_devtools() {
# Function to setup PHP from the shivammathur/php-builder builds.
setup_php_builder() {
if [[ -n "${asan:-}" && "$version" =~ ${no_asan_builds:?} ]]; then
add_log "${cross:?}" "PHP" "ASAN is only supported for PHP 8.0+"
exit 1
fi
run_script "php-builder" "${runner:?}" "$version" "${debug:?}" "${ts:?}" "${asan:-}"
run_script "php-builder" "${runner:?}" "$version" "${debug:?}" "${ts:?}"
}
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
@@ -241,7 +246,7 @@ update_php() {
# Function to install PHP.
add_php() {
if [ "${runner:?}" = "self-hosted" ] || [ "${use_builds_cache:-true}" = "false" ]; then
if [[ "$version" =~ ${php_builder_versions:?} || "$ts" = "zts" || -n "${asan:-}" ]]; then
if [[ "$version" =~ ${php_builder_versions:?} || "$ts" = "zts" ]]; then
setup_php_builder
else
add_packaged_php
@@ -348,14 +353,15 @@ setup_php() {
}
# Variables
version=${1:-'8.6'}
version=${1:-'8.5'}
ini=${2:-'production'}
src=${0%/*}/..
debconf_fix="DEBIAN_FRONTEND=noninteractive"
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
scripts="$src"/scripts
add_sudo >/dev/null 2>&1
set_apt_install >/dev/null 2>&1
link_apt_fast >/dev/null 2>&1
. /etc/os-release
# shellcheck source=.
+2 -3
View File
@@ -304,10 +304,9 @@ Function Add-Tool() {
} else {
$backup_path = "$tool_path.bak"
if (Test-Path $tool_path) { Copy-Item $tool_path -Destination $backup_path -Force }
$user_agent = "setup-php ($env:RUNNER_OS; $env:RUNNER_ARCH; +https://setup-php.com)"
foreach ($url in $urls){
try {
$status_code = (Invoke-WebRequest -Passthru -Uri $url -UserAgent $user_agent -OutFile $tool_path).StatusCode
$status_code = (Invoke-WebRequest -Passthru -Uri $url -OutFile $tool_path).StatusCode
} catch {
$status_code = 0
if($url -match '^https://github\.com/[^/]+/[^/]+/releases/latest/download/[^/?#]+$') {
@@ -315,7 +314,7 @@ Function Add-Tool() {
$release_url = Get-LastRelease $url
if ($release_url) {
$url = $release_url
$status_code = (Invoke-WebRequest -Passthru -Uri $url -UserAgent $user_agent -OutFile $tool_path).StatusCode
$status_code = (Invoke-WebRequest -Passthru -Uri $url -OutFile $tool_path).StatusCode
}
} catch {
$status_code = 0
+4 -17
View File
@@ -224,12 +224,6 @@ get_last_release() {
done
}
# Download a tool with the setup-php user agent.
download_tool() {
local curl_opts=("${curl_opts[@]}" -A "setup-php ($RUNNER_OS; $RUNNER_ARCH; +https://setup-php.com)")
get -v -e "$@"
}
# Function to setup a remote tool.
add_tool() {
url=$1
@@ -269,15 +263,12 @@ add_tool() {
fi
else
[ -f "$tool_path" ] && sudo cp -a "$tool_path" "$tool_path.bak"
# Tools are single files, so let servers gzip them in transit when curl can decode it.
local curl_opts=("${curl_opts[@]}")
curl -V | grep -qw libz && curl_opts+=(--compressed)
status_code=$(download_tool "$tool_path" "${url[@]}")
status_code=$(get -v -e "$tool_path" "${url[@]}")
if [ "$status_code" != "200" ] && [[ "${url[0]}" =~ ^https://github\.com/[^/]+/[^/]+/releases/latest/download/[^/?#]+$ ]]; then
local release_url
if release_url=$(get_last_release "${url[0]}"); then
url[0]="$release_url"
status_code=$(download_tool "$tool_path" "${url[0]}")
status_code=$(get -v -e "$tool_path" "${url[0]}")
fi
fi
if [ "$status_code" = "200" ]; then
@@ -288,12 +279,8 @@ add_tool() {
sudo cp -a "$tool_path" "$cache_path"
fi
fi
if [ "$status_code" != "200" ]; then
if [ -f "$tool_path.bak" ]; then
sudo mv "$tool_path.bak" "$tool_path"
else
sudo rm -f "$tool_path"
fi
if [ "$status_code" != "200" ] && [ -f "$tool_path.bak" ]; then
sudo mv "$tool_path.bak" "$tool_path"
fi
sudo rm -f "$tool_path.bak"
fi
-30
View File
@@ -1,30 +0,0 @@
Function Add-Upsun() {
param(
[Parameter(Mandatory = $true, Position = 0, HelpMessage = 'Upsun CLI version to be installed')]
[string] $upsun_tag
)
$upsun_tag = $upsun_tag.replace('v', '')
if($upsun_tag -ne 'latest' -and $upsun_tag -notmatch '^\d+(\.\d+)*$') {
Add-Log $cross "upsun-cli" "Invalid upsun-cli version: $upsun_tag"
} elseif(-not([Environment]::Is64BitOperatingSystem)) {
Add-Log $cross "upsun-cli" "upsun-cli is only available for 64-bit Windows"
} else {
$upsun_releases = "https://github.com/upsun/cli/releases"
if ($upsun_tag -eq 'latest') {
$upsun_tag = (Get-File -Url $upsun_releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1].replace('v', '')
}
$url = "$upsun_releases/download/v$upsun_tag/upsun_${upsun_tag}_windows_amd64.zip"
Get-File -Url $url -OutFile $bin_dir\upsun.zip > $null 2>&1
Expand-Archive -Path $bin_dir\upsun.zip -DestinationPath $bin_dir\upsun -Force > $null 2>&1
if (Test-Path $bin_dir\upsun\upsun.exe) {
Move-Item -Path $bin_dir\upsun\upsun.exe -Destination $bin_dir\upsun.exe -Force
Copy-Item -Path $bin_dir\upsun.exe -Destination $bin_dir\upsun-cli.exe > $null 2>&1
Add-ToProfile $current_profile 'upsun' "New-Alias upsun $bin_dir\upsun.exe"
Add-ToProfile $current_profile 'upsun_cli' "New-Alias upsun-cli $bin_dir\upsun-cli.exe"
$tool_version = Get-ToolVersion upsun "--version"
Add-Log $tick "upsun-cli" "Added upsun-cli $tool_version"
} else {
Add-Log $cross "upsun-cli" "Could not setup upsun-cli"
}
}
}
-49
View File
@@ -1,49 +0,0 @@
get_upsun_tag() {
local upsun_tag=$1
if [ "$upsun_tag" = "latest" ]; then
get -s -n "" https://github.com/upsun/cli/releases/latest 2<&1 | grep -m 1 -Eo "tag/v[0-9]+(\.[0-9]+)*" | head -n 1 | cut -d '/' -f 2
else
echo "v$upsun_tag"
fi
}
add_upsun_helper() {
local upsun_tag=$1
local install_dir=/usr/local/bin
local os
local arch
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
arch="$(uname -m)"
case "$arch" in
aarch64*|armv8*|arm64) arch="arm64" ;;
x86_64|amd64) arch="amd64" ;;
esac
if [ "$os" = "darwin" ]; then
arch="all"
install_dir=${brew_prefix:?}/bin
fi
get -q -n /tmp/upsun.tar.gz "https://github.com/upsun/cli/releases/download/$upsun_tag/upsun_${upsun_tag#v}_${os}_${arch}.tar.gz"
mkdir -p /tmp/upsun
tar -xzf /tmp/upsun.tar.gz -C /tmp/upsun
sudo mv /tmp/upsun/upsun "$install_dir"/upsun
sudo chmod a+x "$install_dir"/upsun
rm -rf /tmp/upsun /tmp/upsun.tar.gz
}
add_upsun() {
local upsun_tag="${1/v/}"
if ! [[ "$upsun_tag" =~ ^[0-9]+(\.[0-9]+)*$ || "$upsun_tag" == 'latest' ]]; then
add_log "${cross:?}" "upsun-cli" "Version '$upsun_tag' is not valid for upsun-cli"
else
upsun_tag="$(get_upsun_tag "$upsun_tag")"
add_upsun_helper "$upsun_tag" >/dev/null 2>&1
upsun_path="$(command -v upsun)"
if [[ -n "$upsun_path" ]]; then
sudo ln -s "$upsun_path" "${tool_path_dir:?}"/upsun-cli
tool_version=$(get_tool_version "upsun" "--version")
add_log "${tick:?}" "upsun-cli" "Added upsun-cli $tool_version"
else
add_log "${cross:?}" "upsun-cli" "Could not setup upsun-cli"
fi
fi
}
+7 -19
View File
@@ -5,9 +5,8 @@ export curl_opts=(-sL)
export old_versions="5.[3-5]"
export jit_versions="8.[0-9]"
export php_builder_versions="8.[3-9]"
export nightly_versions="8.[7-9]"
export nightly_versions="8.[6-9]"
export xdebug3_versions="7.[2-4]|8.[0-9]"
export no_asan_builds="5.[3-6]|7.[0-4]"
export latest="releases/latest/download"
export github="https://github.com/shivammathur"
export jsdeliver="https://cdn.jsdelivr.net/gh/shivammathur"
@@ -66,10 +65,10 @@ check_builds_cache_runner() {
local pid=$PPID executable
while [[ "$pid" =~ ^[0-9]+$ && "$pid" -gt 1 ]]; do
executable="$(readlink -f "/proc/$pid/exe")" || return 1
if [[ "$executable" = */bin/Runner.Worker || "$executable" = */bin/Runner.Worker.exe ]]; then
if [[ "$executable" = */bin/Runner.Worker ]]; then
jq -e --arg name "${RUNNER_NAME:-}" \
'(.AgentName // .agentName) | . == $name and test("^(blacksmith|depot|nsc-runner)-")' \
"${executable%/bin/*}/.runner" >/dev/null 2>&1
'.AgentName == $name and (.AgentName | test("^(blacksmith|depot)-"))' \
"${executable%/bin/Runner.Worker}/.runner" >/dev/null 2>&1
return $?
fi
pid="$(awk '$1 == "PPid:" {print $2}' "/proc/$pid/status")" || return 1
@@ -85,7 +84,6 @@ read_env() {
update="${update:-${UPDATE:-false}}"
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
[[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
[[ "${asan:-${ASAN:-false}}" = "true" ]] && asan=asan && update=true || asan=
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
use_builds_cache="${use_builds_cache:-${use_package_cache:-}}"
[[ ( -z "$ImageOS" && -z "$ImageVersion" ) ||
@@ -95,7 +93,7 @@ read_env() {
if [[ $_runner = "self-hosted" && "${use_builds_cache:-false}" = "true" ]]; then
runner=github
if [[ "${ID:-}" = "ubuntu" && -z "$ACT" && -z "$CONTAINER" &&
( -n "${BLACKSMITH_VM_ID:-}" || "${RUNNER_NAME:-}" =~ ^(blacksmith|depot|nsc-runner)- ) ]] && check_builds_cache_runner; then
( -n "${BLACKSMITH_VM_ID:-}" || "${RUNNER_NAME:-}" =~ ^(blacksmith|depot)- ) ]] && check_builds_cache_runner; then
_runner=github
builds_cache_warning=true
fi
@@ -122,7 +120,6 @@ read_env() {
export runner
export update
export ts
export asan
export tool_path_dir
export tool_cache_path_dir
}
@@ -188,7 +185,6 @@ verify_checksum() {
# mode: -s pipe to stdout, -v save file and return status code
# execute: -e save file as executable
get() {
local download_status=1 status_code=000
mode=$1
execute=$2
file_path=$3
@@ -208,20 +204,12 @@ get() {
trap 'release_lock "$lock_path"' EXIT SIGINT SIGTERM
fi
for link in "${links[@]}"; do
if status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link"); then
if [ "$status_code" = "200" ]; then
download_status=0
break
fi
else
status_code=000
fi
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
[ "$status_code" = "200" ] && break
done
[ "$download_status" -ne 0 ] && sudo rm -f "$file_path"
[[ "$execute" = "-e" && -e "$file_path" ]] && sudo chmod a+x "$file_path"
[ "$mode" = "-v" ] && echo "$status_code"
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
return "$download_status"
fi
}
+3 -3
View File
@@ -3,7 +3,7 @@ param (
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$version = '8.6',
$version = '8.4',
[Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
@@ -343,7 +343,7 @@ $php_manifest = $null
$current_profile = "$env:TEMP\setup-php.ps1"
$ProgressPreference = 'SilentlyContinue'
$jit_versions = '8.[0-9]'
$nightly_versions = '8.[7-9]'
$nightly_versions = '8.[6-9]'
$xdebug3_versions = "7.[2-4]|8.[0-9]"
$enable_extensions = ('openssl', 'curl', 'mbstring')
@@ -439,7 +439,7 @@ if($version -eq 'pre') {
}
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
Install-PSPackage VcRedist VcRedist-4.1.527\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/v4.1.527.zip" Get-VcList >$null 2>&1
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
}
try {
if ($version -match $nightly_versions) {