mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-01 12:43:17 +07:00
Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
73963f5001 | |||
f4fb0af4d5 | |||
eb73c01f76 | |||
3d8c10397e | |||
db8db3c7c7 | |||
31bfabaf56 | |||
21eeae309a | |||
48e0de2ea6 | |||
88841d1465 | |||
a4e22b60bb | |||
4f6ab99328 | |||
a870b0a9be | |||
67271131b1 | |||
a6ce3f5633 | |||
1a5ac4aa9a | |||
765279d5ef | |||
d71d15b3b3 | |||
ad24e86677 | |||
73dfd2f824 | |||
6d7209f44a | |||
2ee6851e7b | |||
353ba41d44 | |||
5c424d6c81 | |||
e927136b25 | |||
35557a3770 | |||
43e870b2d0 | |||
dc1a77b457 | |||
812360879e | |||
201dd6c1db | |||
97e0a9729a | |||
5a2bd88cb3 | |||
7ba520ae30 | |||
f47a6e7ca3 | |||
e1c6cff579 | |||
6e825ca69e | |||
7b1eaadfbb | |||
5b709ff10e | |||
ed98159fe9 | |||
58f08c5f7c | |||
9e24ffafe7 | |||
5eca5d1c47 | |||
c085ca391e | |||
93745da978 | |||
c088c0cfeb | |||
86b90110cb | |||
1a102bc9f2 | |||
131ba03b0d | |||
e8cd65f444 | |||
2810265746 | |||
dab726e922 | |||
e6f75134d3 | |||
1874353919 | |||
eea39ea741 | |||
bac56c8d91 | |||
124d256c78 | |||
eeddcfe955 | |||
de2903ad82 | |||
bbe1204148 | |||
99a92d54d5 | |||
7c6c249257 | |||
e6d44f159a | |||
dc513528da | |||
bfbd3882c0 | |||
3c525df325 |
3
.github/SECURITY.md
vendored
3
.github/SECURITY.md
vendored
@ -10,10 +10,9 @@ This security policy only applies to the latest patches of the following PHP ver
|
||||
|
||||
| Version | Supported |
|
||||
|---------|--------------------|
|
||||
| 7.4 | :white_check_mark: |
|
||||
| 8.0 | :white_check_mark: |
|
||||
| 8.1 | :white_check_mark: |
|
||||
| 8.2 | :white_check_mark: |
|
||||
| 8.3 | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
|
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
@ -20,13 +20,13 @@ jobs:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
config-file: ./.github/codeql/codeql-configuration.yml
|
||||
languages: javascript
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
22
.github/workflows/docs.yml
vendored
22
.github/workflows/docs.yml
vendored
@ -15,8 +15,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2022, macos-11]
|
||||
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']
|
||||
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', '8.3', '8.4']
|
||||
steps:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
@ -45,9 +45,9 @@ jobs:
|
||||
php -m | Out-File -FilePath "$env:file" -Append
|
||||
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: lists
|
||||
name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
||||
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
||||
update:
|
||||
permissions:
|
||||
@ -61,20 +61,22 @@ jobs:
|
||||
with:
|
||||
repository: ${{ github.repository }}.wiki
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}
|
||||
path: ${{ github.workspace }}/lists
|
||||
pattern: lists-*
|
||||
merge-multiple: true
|
||||
- name: Configure Git
|
||||
run : |
|
||||
git config --local user.email "${{ secrets.email }}"
|
||||
git config --local user.name "${{ github.repository_owner }}"
|
||||
- name: Combine
|
||||
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
|
||||
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
|
||||
if [ "$os" = "macos-10.15" ]; then
|
||||
cat lists/php"$version"-macos-11.md >> 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 8.3 8.4; do
|
||||
if [[ "$os" = "macos-11" || "$os" = "macos-13" ]]; then
|
||||
cat lists/php"$version"-macos-12.md >> Php-extensions-loaded-on-"$os".md
|
||||
elif [ "$os" = "windows-2019" ]; then
|
||||
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
|
||||
else
|
||||
|
2
.github/workflows/node.yml
vendored
2
.github/workflows/node.yml
vendored
@ -54,7 +54,7 @@ jobs:
|
||||
run: npm audit
|
||||
|
||||
- name: Send Coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: coverage/lcov.info
|
||||
|
4
.github/workflows/php.yml
vendored
4
.github/workflows/php.yml
vendored
@ -50,7 +50,7 @@ jobs:
|
||||
key: ${{ env.key }}
|
||||
|
||||
- name: Cache extensions
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ steps.cache-env.outputs.dir }}
|
||||
key: ${{ steps.cache-env.outputs.key }}
|
||||
@ -90,4 +90,4 @@ jobs:
|
||||
php -r "if(ini_get('memory_limit')!='-1') {throw new Exception('memory_limit not disabled');}"
|
||||
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
|
||||
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
|
||||
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
|
||||
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
|
||||
|
156
README.md
156
README.md
@ -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 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.
|
||||
|
||||
@ -74,11 +71,12 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
|
||||
| Virtual environment | YAML workflow label | Pre-installed PHP |
|
||||
|---------------------|------------------------------------|------------------------|
|
||||
| Ubuntu 22.04 | `ubuntu-latest` or `ubuntu-22.04` | `PHP 8.1` |
|
||||
| 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 2019 | `windows-2019` | `PHP 8.2` |
|
||||
| macOS Ventura 13.x | `macos-13` | `PHP 8.2` |
|
||||
| macOS Monterey 12.x | `macos-latest` or `macos-12` | `PHP 8.2` |
|
||||
| Ubuntu 20.04 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.3` |
|
||||
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.3` |
|
||||
| Windows Server 2019 | `windows-2019` | `PHP 8.3` |
|
||||
| macOS Sonoma 14.x | `macos-14` | - |
|
||||
| macOS Ventura 13.x | `macos-13` | `PHP 8.3` |
|
||||
| macOS Monterey 12.x | `macos-latest` or `macos-12` | `PHP 8.3` |
|
||||
|
||||
### Self-Hosted Runners
|
||||
|
||||
@ -116,14 +114,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.3` | `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.1` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||
| `8.0` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
|
||||
| `8.1` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
|
||||
| `8.2` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||
| `8.3` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
||||
| `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||
| `8.4` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
||||
|
||||
**Notes:**
|
||||
- Specifying `8.3` and `8.4` in `php-version` input installs a nightly build of `PHP 8.3.0-dev` and `PHP 8.4.0-dev` respectively. 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.
|
||||
|
||||
## :heavy_plus_sign: PHP Extension Support
|
||||
@ -136,7 +134,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
||||
- name: Setup PHP with PECL extension
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
extensions: imagick, swoole
|
||||
```
|
||||
|
||||
@ -164,7 +162,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
||||
- name: Setup PHP with pre-release PECL extension
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
extensions: xdebug-beta
|
||||
```
|
||||
|
||||
@ -176,7 +174,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
||||
- name: Setup PHP and disable opcache
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
extensions: :opcache
|
||||
```
|
||||
|
||||
@ -188,7 +186,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
||||
- name: Setup PHP without any shared extensions except mbstring
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
extensions: none, mbstring
|
||||
```
|
||||
|
||||
@ -198,7 +196,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
||||
- name: Setup PHP with intl
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
extensions: intl-70.1
|
||||
```
|
||||
|
||||
@ -215,7 +213,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
||||
- name: Setup PHP with fail-fast
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
extensions: oci8
|
||||
env:
|
||||
fail-fast: true
|
||||
@ -225,13 +223,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.
|
||||
|
||||
[`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`]
|
||||
[`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`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`], [`php-scoper`], [`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
|
||||
- name: Setup PHP with tools
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
tools: php-cs-fixer, phpunit
|
||||
```
|
||||
|
||||
@ -241,7 +239,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
||||
- name: Setup PHP with tools
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
tools: vimeo/psalm
|
||||
```
|
||||
|
||||
@ -261,8 +259,8 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
||||
- name: Setup PHP with tools
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
tools: php-cs-fixer:3.5, phpunit:9.5
|
||||
php-version: '8.3'
|
||||
tools: php-cs-fixer:3.39, phpunit:10.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
@ -273,7 +271,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
||||
- name: Setup PHP with composer v2
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
tools: composer:v2
|
||||
```
|
||||
|
||||
@ -283,7 +281,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
||||
- name: Setup PHP without composer
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
tools: none
|
||||
```
|
||||
|
||||
@ -299,7 +297,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
||||
- name: Setup PHP with fail-fast
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
tools: deployer
|
||||
env:
|
||||
fail-fast: true
|
||||
@ -310,6 +308,16 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
||||
- If you do not want to use all your dev-dependencies in workflow, you can run composer with `--no-dev` and install required tools using `tools` input to speed up your workflow.
|
||||
- By default, `COMPOSER_NO_INTERACTION` is set to `1` and `COMPOSER_PROCESS_TIMEOUT` is set to `0`. In effect, this means that Composer commands in your scripts do not need to specify `--no-interaction`.
|
||||
- Also, `COMPOSER_NO_AUDIT` is set to `1`. So if you want to audit your dependencies for security vulnerabilities, it is recommended to add a `composer audit` step before you install them.
|
||||
- If you want to set a different `COMPOSER_PROCESS_TIMEOUT`, you can set it in your workflow file using the `env` keyword.
|
||||
|
||||
```yaml
|
||||
- name: Setup PHP with composer and custom process timeout
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.3'
|
||||
env:
|
||||
COMPOSER_PROCESS_TIMEOUT: 300
|
||||
```
|
||||
|
||||
## :signal_strength: Coverage Support
|
||||
|
||||
@ -322,7 +330,7 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
|
||||
- name: Setup PHP with Xdebug
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
coverage: xdebug
|
||||
```
|
||||
|
||||
@ -350,7 +358,7 @@ Runs on PHP 7.1 and newer PHP versions.
|
||||
- name: Setup PHP with PCOV
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
ini-values: pcov.directory=api #optional, see above for usage.
|
||||
coverage: pcov
|
||||
```
|
||||
@ -380,7 +388,7 @@ Disable coverage for these reasons:
|
||||
- name: Setup PHP with no coverage driver
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
coverage: none
|
||||
```
|
||||
|
||||
@ -393,12 +401,16 @@ Disable coverage for these reasons:
|
||||
#### `php-version` (optional)
|
||||
|
||||
- Specify the PHP version you want to set up.
|
||||
- Accepts a `string`. For example `'8.0'`.
|
||||
- Accepts `latest` to set up the latest stable PHP version.
|
||||
- Accepts a `string`. For example `'8.3'`.
|
||||
- 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 from the master branch of PHP.
|
||||
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
|
||||
- See [PHP support](#tada-php-support) for the supported PHP versions.
|
||||
- If not specified, it looks for `php-version-file` input.
|
||||
- If not specified, it looks for the following in order:
|
||||
- The `php-version-file` input if it exists
|
||||
- A `composer.lock` file and the `platform-overrides.php` value
|
||||
- A `composer.json` file and the `config.platform.php` value
|
||||
|
||||
#### `php-version-file` (optional)
|
||||
|
||||
@ -453,7 +465,7 @@ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the s
|
||||
id: setup-php
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
|
||||
- name: Print PHP version
|
||||
run: echo ${{ steps.setup-php.outputs.php-version }}
|
||||
@ -472,8 +484,8 @@ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the s
|
||||
|
||||
#### `phpts` (optional)
|
||||
|
||||
- Specify to set up a thread-safe build of PHP on Linux and Windows.
|
||||
- Accepts `ts` and `nts`.
|
||||
- Specify to set up a thread-safe build of PHP.
|
||||
- Accepts `nts` for non-thread-safe and `zts` or `ts` for thread-safe.
|
||||
- By default, it is set to `nts`.
|
||||
- See [thread safe setup](#thread-safe-setup) for more info.
|
||||
|
||||
@ -495,7 +507,7 @@ steps:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
extensions: mbstring, intl
|
||||
ini-values: post_max_size=256M, max_execution_time=180
|
||||
coverage: xdebug
|
||||
@ -534,7 +546,7 @@ jobs:
|
||||
|
||||
### Nightly Build Setup
|
||||
|
||||
> Set up a nightly build of `PHP 8.3` or `PHP 8.4`.
|
||||
> Set up a nightly build of `PHP 8.4`.
|
||||
|
||||
- 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.
|
||||
@ -544,7 +556,7 @@ steps:
|
||||
- name: Setup nightly PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.3'
|
||||
php-version: '8.4'
|
||||
extensions: mbstring
|
||||
ini-values: post_max_size=256M, max_execution_time=180
|
||||
coverage: xdebug
|
||||
@ -558,34 +570,37 @@ steps:
|
||||
- Production release builds of PHP without debugging symbols are set up by default.
|
||||
- You can use the `debug` environment variable to set up a build with debugging symbols for PHP 5.6 and above.
|
||||
|
||||
**Notes**
|
||||
- On Linux, the debug symbols are added as [debug info files](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Separate-Debug-Files.html) in the `/usr/lib/debug/.build-id` directory. These files match the `build-id` in the ELF section of the PHP binaries and debugging tools like `gdb` are able to resolve the symbols from these files.
|
||||
- On Windows, the debug symbols are added as `pdb` files in the PHP installation directory.
|
||||
- On macOS, the debug symbols are compiled into the binaries.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- name: Setup PHP with debugging symbols
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
env:
|
||||
debug: true # specify true or false
|
||||
```
|
||||
|
||||
### Thread Safe Setup
|
||||
|
||||
> Set up `TS` or `NTS` PHP on `Linux` and `Windows`.
|
||||
> Set up `TS` or `NTS` PHP.
|
||||
|
||||
- `NTS` versions are set up by default.
|
||||
- On `macOS` only `NTS` versions are supported currently.
|
||||
- On `Linux` and `Windows` both `TS` and `NTS` versions are supported.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
run:
|
||||
runs-on: [ubuntu-latest, windows-latest]
|
||||
runs-on: [ubuntu-latest, windows-latest, macos-latest]
|
||||
name: Setup PHP TS
|
||||
steps:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
env:
|
||||
phpts: ts # specify ts or nts
|
||||
```
|
||||
@ -602,7 +617,7 @@ jobs:
|
||||
- name: Setup PHP with latest versions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
env:
|
||||
update: true # specify true or false
|
||||
```
|
||||
@ -617,14 +632,14 @@ To debug any issues, you can use the `verbose` tag instead of `v2`.
|
||||
- name: Setup PHP with logs
|
||||
uses: shivammathur/setup-php@verbose
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
```
|
||||
|
||||
### Multi-Arch Setup
|
||||
|
||||
> 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`.
|
||||
- Currently, for `ARM` based setup, you will need [self-hosted runners](#self-hosted-setup).
|
||||
|
||||
@ -640,7 +655,7 @@ jobs:
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
```
|
||||
|
||||
### Self Hosted Setup
|
||||
@ -662,7 +677,7 @@ jobs:
|
||||
runs-on: self-hosted
|
||||
strategy:
|
||||
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 }}
|
||||
steps:
|
||||
- name: Setup PHP
|
||||
@ -690,7 +705,7 @@ jobs:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
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.
|
||||
@ -723,7 +738,7 @@ For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
|
||||
- name: Setup PHP with JIT in tracing mode
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
coverage: none
|
||||
ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
|
||||
```
|
||||
@ -743,7 +758,7 @@ If your project uses composer, you can persist the composer's internal cache dir
|
||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
@ -776,7 +791,7 @@ The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHU
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
@ -789,7 +804,7 @@ If you use Private Packagist for your private composer dependencies, you can set
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
env:
|
||||
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
|
||||
```
|
||||
@ -803,7 +818,7 @@ Please refer to the authentication section in [`composer documentation`](https:/
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
env:
|
||||
COMPOSER_AUTH_JSON: |
|
||||
{
|
||||
@ -826,7 +841,7 @@ Put the code in the run property of a step and specify the shell as `php {0}`.
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
|
||||
- name: Run PHP code
|
||||
shell: php {0}
|
||||
@ -866,7 +881,7 @@ PHPStan supports error reporting in GitHub Actions, so it does not require probl
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
tools: phpstan
|
||||
|
||||
- name: Run PHPStan
|
||||
@ -881,7 +896,7 @@ Psalm supports error reporting in GitHub Actions with an output format `github`.
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
tools: psalm
|
||||
|
||||
- name: Run Psalm
|
||||
@ -899,7 +914,7 @@ For examples refer to the [cs2pr documentation](https://github.com/staabm/annota
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.3'
|
||||
tools: cs2pr, phpcs
|
||||
|
||||
- name: Run phpcs
|
||||
@ -944,7 +959,7 @@ Examples of using `setup-php` with various PHP frameworks and packages.
|
||||
- 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.
|
||||
- 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` is not supported anymore.
|
||||
|
||||
## :scroll: License
|
||||
|
||||
@ -980,25 +995,18 @@ These companies generously provide setup-php their products and services to aid
|
||||
|
||||
<p>
|
||||
<a href="https://www.jetbrains.com/?from=setup-php">
|
||||
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
|
||||
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="212" height="120">
|
||||
</a>
|
||||
|
||||
<a href="https://www.macstadium.com/opensource/members#gh-light-mode-only">
|
||||
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="148" height="60">
|
||||
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="296" height="120">
|
||||
</a>
|
||||
<a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only">
|
||||
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="148" height="60">
|
||||
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="296" height="120">
|
||||
</a>
|
||||
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
||||
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="70" height="60">
|
||||
</a>
|
||||
|
||||
<a href="https://www.scaleway.com/en/about-us/open-source-program#gh-light-mode-only">
|
||||
<img src="https://setup-php.com/sponsors/scaleway.png" alt="Scaleway" width="174" height="60">
|
||||
</a>
|
||||
<a href="https://www.scaleway.com/en/about-us/open-source-program#gh-dark-mode-only">
|
||||
<img src="https://setup-php.com/sponsors/scaleway-white.png" alt="Scaleway" width="174" height="60">
|
||||
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="140" height="120">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@ -1030,6 +1038,7 @@ These companies generously provide setup-php their products and services to aid
|
||||
[`behat`]: https://docs.behat.org/en/latest/
|
||||
[`blackfire`]: https://blackfire.io/docs/php/index
|
||||
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
|
||||
[`box`]: https://github.com/humbug/box
|
||||
[`castor`]: https://github.com/jolicode/castor
|
||||
[`churn`]: https://github.com/bmitch/churn-php
|
||||
[`codeception`]: https://codeception.com/
|
||||
@ -1051,9 +1060,10 @@ These companies generously provide setup-php their products and services to aid
|
||||
[`phive`]: https://phar.io/
|
||||
[`php-config`]: https://www.php.net/manual/en/install.pecl.php-config.php
|
||||
[`php-cs-fixer`]: https://cs.symfony.com/
|
||||
[`phpcbf`]: https://github.com/squizlabs/php_codesniffer
|
||||
[`php-scoper`]: https://github.com/humbug/php-scoper
|
||||
[`phpcbf`]: https://github.com/PHPCSStandards/php_codesniffer
|
||||
[`phpcpd`]: https://github.com/sebastianbergmann/phpcpd
|
||||
[`phpcs`]: https://github.com/squizlabs/php_codesniffer
|
||||
[`phpcs`]: https://github.com/PHPCSStandards/php_codesniffer
|
||||
[`phpdoc`]: https://phpdoc.org/
|
||||
[`phpDocumentor`]: https://phpdoc.org/
|
||||
[`phpize`]: https://www.php.net/manual/en/install.pecl.phpize.php
|
||||
|
@ -38,25 +38,30 @@ jest.mock('../src/install', () => ({
|
||||
*/
|
||||
jest.mock('../src/fetch', () => ({
|
||||
fetch: jest.fn().mockImplementation(() => {
|
||||
return {data: '{ "latest": "8.1", "5.x": "5.6" }'};
|
||||
return {
|
||||
data: '{ "latest": "8.3", "lowest": "8.1", "highest": "8.3", "nightly": "8.4", "5.x": "5.6" }'
|
||||
};
|
||||
})
|
||||
}));
|
||||
|
||||
describe('Install', () => {
|
||||
it.each`
|
||||
version | os | extension_csv | ini_file | ini_values_csv | coverage_driver | tools | output
|
||||
${'7.3'} | ${'darwin'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.3 production'}
|
||||
${'7.3'} | ${'darwin'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${''} | ${'bash darwin.sh 7.3 development install extensions set coverage driver edit php.ini'}
|
||||
${'7.4.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.4 none'}
|
||||
${'8'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 production'}
|
||||
${'8.0'} | ${'darwin'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 development'}
|
||||
${'8.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.1 none'}
|
||||
${'7.3'} | ${'linux'} | ${''} | ${'invalid'} | ${''} | ${''} | ${''} | ${'bash linux.sh 7.3 production'}
|
||||
${'7.3'} | ${'linux'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${'phpunit'} | ${'bash linux.sh 7.3 development install extensions add_tool set coverage driver edit php.ini'}
|
||||
${'latest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.1 none'}
|
||||
${'7.0'} | ${'win32'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.0 production'}
|
||||
${'7.3'} | ${'win32'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.3 development'}
|
||||
${'7.3'} | ${'win32'} | ${'a, b'} | ${'none'} | ${'a=b'} | ${'x'} | ${''} | ${'pwsh win32.ps1 7.3 none install extensions set coverage driver edit php.ini'}
|
||||
version | os | extension_csv | ini_file | ini_values_csv | coverage_driver | tools | output
|
||||
${'7.3'} | ${'darwin'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.3 production'}
|
||||
${'7.3'} | ${'darwin'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${''} | ${'bash darwin.sh 7.3 development install extensions set coverage driver edit php.ini'}
|
||||
${'7.4.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.4 none'}
|
||||
${'8'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 production'}
|
||||
${'8.0'} | ${'darwin'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 development'}
|
||||
${'8.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.1 none'}
|
||||
${'7.3'} | ${'linux'} | ${''} | ${'invalid'} | ${''} | ${''} | ${''} | ${'bash linux.sh 7.3 production'}
|
||||
${'7.3'} | ${'linux'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${'phpunit'} | ${'bash linux.sh 7.3 development install extensions add_tool set coverage driver edit php.ini'}
|
||||
${'latest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.3 none'}
|
||||
${'lowest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.1 none'}
|
||||
${'highest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.3 none'}
|
||||
${'nightly'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.4 none'}
|
||||
${'7.0'} | ${'win32'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.0 production'}
|
||||
${'7.3'} | ${'win32'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.3 development'}
|
||||
${'7.3'} | ${'win32'} | ${'a, b'} | ${'none'} | ${'a=b'} | ${'x'} | ${''} | ${'pwsh win32.ps1 7.3 none install extensions set coverage driver edit php.ini'}
|
||||
`(
|
||||
'Test install on $os for $version with extensions=$extension_csv, ini_values=$ini_values_csv, coverage_driver=$coverage_driver, tools=$tools',
|
||||
async ({
|
||||
|
@ -95,7 +95,7 @@ describe('Tools tests', () => {
|
||||
${'beta_token'} | ${'1.2.3-beta1'}
|
||||
${''} | ${'1.2.3'}
|
||||
`('checking getSemverVersion: $token', async ({token, version}) => {
|
||||
process.env['COMPOSER_TOKEN'] = token;
|
||||
process.env['GITHUB_TOKEN'] = token;
|
||||
expect(
|
||||
await tools.getSemverVersion(getData({tool: 'tool', version: '1.2'}))
|
||||
).toBe(version);
|
||||
@ -454,9 +454,9 @@ describe('Tools tests', () => {
|
||||
'add_composer_tool phinx phinx robmorgan/ scoped',
|
||||
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive',
|
||||
'add_devtools php-config',
|
||||
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
|
||||
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
|
||||
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
|
||||
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
|
||||
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
|
||||
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
|
||||
'add_devtools phpize',
|
||||
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
||||
@ -574,7 +574,7 @@ describe('Tools tests', () => {
|
||||
${'phpunit:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "phpunit" "Invalid token"'}
|
||||
${'phpunit:0.1'} | ${'no_data'} | ${'add_log "$cross" "phpunit" "No version found with prefix 0.1."'}
|
||||
`('checking error: $tools_csv', async ({tools_csv, token, script}) => {
|
||||
process.env['COMPOSER_TOKEN'] = token;
|
||||
process.env['GITHUB_TOKEN'] = token;
|
||||
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
||||
});
|
||||
|
||||
|
5723
dist/index.js
vendored
5723
dist/index.js
vendored
File diff suppressed because one or more lines are too long
1387
package-lock.json
generated
1387
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
32
package.json
32
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-php",
|
||||
"version": "2.27.1",
|
||||
"version": "2.30.1",
|
||||
"private": false,
|
||||
"description": "Setup PHP for use with GitHub Actions",
|
||||
"main": "lib/install.js",
|
||||
@ -19,7 +19,7 @@
|
||||
"lint": "eslint **/src/*.ts **/__tests__/*.ts --cache --fix",
|
||||
"format": "prettier --write **/src/*.ts **/__tests__/*.ts && git add -f __tests__/ ",
|
||||
"format-check": "prettier --check **/src/*.ts **/__tests__/*.ts",
|
||||
"release": "ncc build -o dist && git add -f dist/",
|
||||
"release": "ncc build -m -o dist && git add -f dist/",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
@ -40,23 +40,23 @@
|
||||
"compare-versions": "^6.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.7",
|
||||
"@types/node": "^20.8.10",
|
||||
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
||||
"@typescript-eslint/parser": "^6.10.0",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/node": "^20.11.30",
|
||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||
"@typescript-eslint/parser": "^7.3.1",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-import": "^2.29.0",
|
||||
"eslint-plugin-jest": "^27.6.0",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jest": "^27.9.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"nock": "^13.3.8",
|
||||
"prettier": "^3.0.3",
|
||||
"simple-git-hooks": "^2.9.0",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.2.2"
|
||||
"nock": "^13.5.4",
|
||||
"prettier": "^3.2.5",
|
||||
"simple-git-hooks": "^2.11.0",
|
||||
"ts-jest": "^29.1.2",
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/shivammathur/setup-php/issues"
|
||||
|
@ -17,3 +17,6 @@
|
||||
21.04,hirsute
|
||||
21.10,impish
|
||||
22.04,jammy
|
||||
23.04,lunar
|
||||
23.10,mantic
|
||||
24.04,noble
|
||||
|
|
@ -1,7 +1,9 @@
|
||||
{
|
||||
"latest": "8.2",
|
||||
"nightly": "8.3",
|
||||
"lowest": "8.1",
|
||||
"highest": "8.3",
|
||||
"latest": "8.3",
|
||||
"nightly": "8.4",
|
||||
"5.x": "5.6",
|
||||
"7.x": "7.4",
|
||||
"8.x": "8.2"
|
||||
}
|
||||
"8.x": "8.3"
|
||||
}
|
||||
|
@ -84,7 +84,7 @@
|
||||
},
|
||||
"phpcbf": {
|
||||
"type": "phar",
|
||||
"repository": "squizlabs/PHP_CodeSniffer",
|
||||
"repository": "PHPCSStandards/PHP_CodeSniffer",
|
||||
"extension": ".phar",
|
||||
"domain": "https://github.com",
|
||||
"version_prefix": "",
|
||||
@ -92,7 +92,7 @@
|
||||
},
|
||||
"phpcs": {
|
||||
"type": "phar",
|
||||
"repository": "squizlabs/PHP_CodeSniffer",
|
||||
"repository": "PHPCSStandards/PHP_CodeSniffer",
|
||||
"extension": ".phar",
|
||||
"domain": "https://github.com",
|
||||
"version_prefix": "",
|
||||
|
@ -32,21 +32,21 @@ export async function addExtensionDarwin(
|
||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||
return;
|
||||
// match 7.4relay...8.3relay
|
||||
// match 5.3blackfire...8.2blackfire
|
||||
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
|
||||
// match 5.3blackfire...8.3blackfire
|
||||
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
||||
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
|
||||
// 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.3phalcon5
|
||||
// match 7.0zephir_parser...8.2zephir_parser
|
||||
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
|
||||
):
|
||||
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\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-2])phalcon5/.test(
|
||||
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-3])phalcon5?/.test(
|
||||
version_extension
|
||||
):
|
||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||
@ -134,19 +134,19 @@ export async function addExtensionWindows(
|
||||
case /^none$/.test(ext_name):
|
||||
add_script += '\nDisable-AllShared';
|
||||
break;
|
||||
// match 5.3blackfire...8.2blackfire
|
||||
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
|
||||
// match 5.3blackfire...8.3blackfire
|
||||
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
||||
// match pdo_oci and oci8
|
||||
// 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.3phalcon5
|
||||
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
|
||||
// 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
|
||||
):
|
||||
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(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(
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-3])phalcon5?$/.test(
|
||||
version_extension
|
||||
):
|
||||
case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
|
||||
@ -264,15 +264,15 @@ export async function addExtensionLinux(
|
||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||
return;
|
||||
// match 7.4relay...8.3relay
|
||||
// match 5.3blackfire...8.2blackfire
|
||||
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
|
||||
// match 5.3blackfire...8.3blackfire
|
||||
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||
// 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.3phalcon5
|
||||
// match 7.0zephir_parser...8.2zephir_parser
|
||||
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
|
||||
):
|
||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
||||
@ -283,7 +283,7 @@ export async function addExtensionLinux(
|
||||
):
|
||||
case /(?<!5\.[3-5])intl-\d+\.\d+$/.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(
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-3])phalcon5?$/.test(
|
||||
version_extension
|
||||
):
|
||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||
|
@ -14,7 +14,7 @@ import * as utils from './utils';
|
||||
* @param os
|
||||
*/
|
||||
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 script_path = path.join(__dirname, '../src/scripts', filename);
|
||||
const run_path = script_path.replace(os, 'run');
|
||||
@ -40,8 +40,8 @@ export async function getScript(os: string): Promise<string> {
|
||||
if (ini_values_csv) {
|
||||
script += await config.addINIValues(ini_values_csv, os);
|
||||
}
|
||||
script += '\n' + (await utils.stepLog(`#StandWithUkraine`, os));
|
||||
script += '\n' + (await utils.addLog('$tick', 'read-more', url, os));
|
||||
script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os));
|
||||
script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os));
|
||||
|
||||
fs.writeFileSync(run_path, script, {mode: 0o755});
|
||||
|
||||
|
@ -1,13 +1,23 @@
|
||||
# Disable dependency extensions
|
||||
disable_dependency_extensions() {
|
||||
local extension=$1
|
||||
# Handle dependency extensions
|
||||
handle_dependency_extensions() {
|
||||
local formula=$1
|
||||
local extension=$2
|
||||
formula_file="${tap_dir:?}/$ext_tap/Formula/$extension@${version:?}.rb"
|
||||
[ -e "$formula_file" ] || formula_file="$tap_dir/$ext_tap/Formula/$formula@$version.rb"
|
||||
if [ -e "$formula_file" ]; then
|
||||
IFS=" " read -r -a dependency_extensions <<< "$(grep -Eo "shivammathur.*@" "$formula_file" | xargs -I {} -n 1 basename '{}' | cut -d '@' -f 1 | tr '\n' ' ')"
|
||||
for dependency_extension in "${dependency_extensions[@]}"; do
|
||||
sudo sed -Ei '' "/=(.*\/)?\"?$dependency_extension(.so)?$/d" "${ini_file:?}"
|
||||
done
|
||||
fi
|
||||
suffix="$(get_php_formula_suffix)"
|
||||
if [[ -n "$suffix" ]]; then
|
||||
brew_opts=(-sf)
|
||||
patch_abstract_file >/dev/null 2>&1
|
||||
for dependency_extension in "${dependency_extensions[@]}"; do
|
||||
brew install "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 && copy_brew_extensions "$dependency_extension"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to disable an extension.
|
||||
@ -61,12 +71,21 @@ add_brew_extension() {
|
||||
add_brew_tap "$ext_tap"
|
||||
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "${core_repo:?}/Formula/" 2>/dev/null || true
|
||||
update_dependencies >/dev/null 2>&1
|
||||
disable_dependency_extensions "$extension" >/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
|
||||
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
|
||||
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
|
||||
add_extension_log "$extension" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to patch the abstract file in the extensions tap.
|
||||
patch_abstract_file() {
|
||||
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
|
||||
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
|
||||
echo '' | sudo tee /tmp/abstract_patch >/dev/null 2>&1
|
||||
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to add an extension.
|
||||
add_extension_helper() {
|
||||
local extension=$1
|
||||
@ -94,17 +113,6 @@ add_pecl() {
|
||||
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
|
||||
}
|
||||
|
||||
# Function to link all libraries of a formula.
|
||||
link_libraries() {
|
||||
formula=$1
|
||||
formula_prefix="$(brew --prefix "$formula")"
|
||||
sudo mkdir -p "$formula_prefix"/lib
|
||||
for lib in "$formula_prefix"/lib/*.dylib; do
|
||||
lib_name=$(basename "$lib")
|
||||
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
|
||||
done
|
||||
}
|
||||
|
||||
# Link opcache extension to extensions directory.
|
||||
link_opcache() {
|
||||
opcache_ini="$brew_prefix"/etc/php/"$version"/conf.d/ext-opcache.ini
|
||||
@ -123,45 +131,15 @@ patch_brew() {
|
||||
trap "sudo sed -Ei '' 's/$code.*/$code, overwrite: overwrite?\)/' $formula_installer" exit
|
||||
}
|
||||
|
||||
# Helper function to update the dependencies.
|
||||
update_dependencies_helper() {
|
||||
dependency=$1
|
||||
[[ "${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"
|
||||
}
|
||||
|
||||
# Function to update dependencies.
|
||||
update_dependencies() {
|
||||
patch_brew
|
||||
if ! [ -e /tmp/update_dependencies ]; then
|
||||
if [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
||||
deps_file="$tap_dir/$php_tap/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
||||
if [ -e "$deps_file" ]; then
|
||||
while read -r dependency; do
|
||||
update_dependencies_helper "$dependency" &
|
||||
to_wait+=($!)
|
||||
done <"$deps_file"
|
||||
fi
|
||||
wait "${to_wait[@]}"
|
||||
else
|
||||
git -C "$core_repo" fetch origin master && git -C "$core_repo" reset --hard origin/master
|
||||
fi
|
||||
git_retry -C "$core_repo" fetch origin master && git -C "$core_repo" reset --hard origin/master
|
||||
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to fix dependencies on install PHP version.
|
||||
fix_dependencies() {
|
||||
broken_deps_paths=$(php -v 2>&1 | grep -Eo '/opt/[a-zA-Z0-9@\.]+')
|
||||
if [ "x$broken_deps_paths" != "x" ]; then
|
||||
update_dependencies
|
||||
IFS=" " read -r -a formulae <<< "$(echo "$broken_deps_paths" | tr '\n' ' ' | sed 's|/opt/||g' 2>&1)$php_formula"
|
||||
brew reinstall "${formulae[@]}"
|
||||
brew link --force --overwrite "$php_formula" || true
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to get PHP version if it is already installed using Homebrew.
|
||||
get_brewed_php() {
|
||||
cellar="$brew_prefix"/Cellar
|
||||
@ -181,8 +159,9 @@ add_php() {
|
||||
existing_version=$2
|
||||
add_brew_tap "$php_tap"
|
||||
update_dependencies
|
||||
[ "${debug:?}" = "debug" ] && php_formula="$php_formula-debug"
|
||||
if [ "$existing_version" != "false" ]; then
|
||||
suffix="$(get_php_formula_suffix)"
|
||||
php_formula="shivammathur/php/php@$version$suffix"
|
||||
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
|
||||
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
|
||||
else
|
||||
brew install -f "$php_formula"
|
||||
@ -190,6 +169,14 @@ add_php() {
|
||||
brew link --force --overwrite "$php_formula"
|
||||
}
|
||||
|
||||
# Function to get formula suffix
|
||||
get_php_formula_suffix() {
|
||||
local suffix
|
||||
[ "${debug:?}" = "debug" ] && suffix="-debug"
|
||||
[ "${ts:?}" = "zts" ] && suffix="$suffix-zts"
|
||||
echo "$suffix"
|
||||
}
|
||||
|
||||
# Function to get extra version.
|
||||
php_extra_version() {
|
||||
php_formula_file="$tap_dir"/"$php_tap"/Formula/php@"$version".rb
|
||||
@ -234,8 +221,8 @@ setup_php() {
|
||||
add_php "upgrade" "$existing_version" >/dev/null 2>&1
|
||||
status="Updated to"
|
||||
else
|
||||
status="Found"
|
||||
fix_dependencies >/dev/null 2>&1
|
||||
add_php "upgrade" "$existing_version" >/dev/null 2>&1
|
||||
status="Updated to"
|
||||
fi
|
||||
php_config="$(command -v php-config)"
|
||||
ext_dir="$(grep 'extension_dir=' "$php_config" | cut -d "'" -f 2)"
|
||||
@ -259,7 +246,7 @@ setup_php() {
|
||||
}
|
||||
|
||||
# Variables
|
||||
version=${1:-'8.2'}
|
||||
version=${1:-'8.3'}
|
||||
ini=${2:-'production'}
|
||||
src=${0%/*}/..
|
||||
php_formula=shivammathur/php/php@"$version"
|
||||
@ -277,6 +264,7 @@ export HOMEBREW_NO_INSTALL_FROM_API=1
|
||||
# shellcheck source=.
|
||||
. "${scripts:?}"/unix.sh
|
||||
. "${scripts:?}"/tools/brew.sh
|
||||
. "${scripts:?}"/tools/retry.sh
|
||||
. "${scripts:?}"/tools/add_tools.sh
|
||||
. "${scripts:?}"/extensions/source.sh
|
||||
. "${scripts:?}"/extensions/add_extensions.sh
|
||||
|
@ -125,9 +125,9 @@ Function Add-Extension {
|
||||
if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) {
|
||||
Add-NightlyExtension $extension
|
||||
} else {
|
||||
# Patch till DLLs for PHP 8.1 and 8.2 are released as stable.
|
||||
# Patch till DLLs for PHP 8.1 and above are released as stable.
|
||||
$minimumStability = $stability
|
||||
if ($version -match '8.[1-2]' -and $stability -eq 'stable') {
|
||||
if ($version -match '8.[1-4]' -and $stability -eq 'stable') {
|
||||
$minimumStability = 'snapshot'
|
||||
}
|
||||
|
||||
|
@ -176,21 +176,30 @@ pecl_install() {
|
||||
local extension=$1
|
||||
local prefix=${2:-extension}
|
||||
add_pecl >/dev/null 2>&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'"
|
||||
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)"
|
||||
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
|
||||
disable_extension_helper "${extension%-*}" >/dev/null 2>&1
|
||||
if [ "$version" = "5.3" ]; then
|
||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
|
||||
# Compare version with 8.3 so it runs only on 8.4 and above
|
||||
# Install using the source interface as it allows for patching.
|
||||
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
||||
extension_version=${extension##*-};
|
||||
[ "$extension_version" = "${extension%-*}" ] && extension_version=$(get_pecl_version "$extension" "stable")
|
||||
add_extension_from_source "${extension%-*}" https://pecl.php.net "${extension%-*}" "${extension%-*}" "$extension_version" "$prefix" pecl
|
||||
check_extension "${extension%-*}" && return 0 || return 1;
|
||||
else
|
||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&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'"
|
||||
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)"
|
||||
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
|
||||
if [ "$version" = "5.3" ]; then
|
||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
|
||||
else
|
||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
|
||||
fi
|
||||
local exit_code=$?
|
||||
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
|
||||
enable_extension "${extension%-*}" "$prefix"
|
||||
return "$exit_code"
|
||||
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.
|
||||
|
@ -22,6 +22,8 @@ Function Add-Blackfire() {
|
||||
} 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
|
||||
Disable-Extension xdebug > $null 2>&1
|
||||
Disable-Extension pcov > $null 2>&1
|
||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||
$status="Installed and enabled"
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ add_blackfire() {
|
||||
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
|
||||
fi
|
||||
disable_extension xdebug >/dev/null 2>&1
|
||||
disable_extension pcov >/dev/null 2>&1
|
||||
enable_extension blackfire extension
|
||||
add_extension_log blackfire "$status"
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ get_event_configure_opts() {
|
||||
)
|
||||
else
|
||||
event_opts+=(
|
||||
--with-openssl-dir="$(brew --prefix openssl@1.1)"
|
||||
--with-openssl-dir="$(brew --prefix openssl@3)"
|
||||
--with-event-libevent-dir="$(brew --prefix libevent)"
|
||||
)
|
||||
fi
|
||||
|
@ -39,9 +39,13 @@ add_oci_helper() {
|
||||
status='Installed and enabled'
|
||||
read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
|
||||
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
|
||||
read -r "${ext}_PATH" <<< "ext/$ext"
|
||||
patch_phpize
|
||||
add_extension_from_source "$ext" https://github.com php php-src "$(php_src_tag)" extension get
|
||||
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
||||
add_extension_from_source "$ext" https://github.com php pecl-database-"$ext" main extension get
|
||||
else
|
||||
read -r "${ext}_PATH" <<< "ext/$ext"
|
||||
add_extension_from_source "$ext" https://github.com php php-src "$(php_src_tag)" extension get
|
||||
fi
|
||||
restore_phpize
|
||||
else
|
||||
enable_extension "$ext" extension
|
||||
|
12
src/scripts/extensions/patches/common.sh
Normal file
12
src/scripts/extensions/patches/common.sh
Normal file
@ -0,0 +1,12 @@
|
||||
process_file() {
|
||||
local file=$1
|
||||
sed -i '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//\#include <ext\/random\/php_random.h>/' "$file"
|
||||
sed -i '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' "$file"
|
||||
}
|
||||
|
||||
export -f process_file
|
||||
|
||||
# Compare with 8.3 so it runs only on 8.4 and above
|
||||
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
||||
find . -type f \( -name "*.c" -o -name "*.h" \) -exec bash -c 'process_file "$0"' {} \;
|
||||
fi
|
@ -3,5 +3,7 @@ patch_geos() {
|
||||
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
|
||||
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/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/toString.patch 2>/dev/null || true
|
||||
}
|
||||
|
@ -8,19 +8,36 @@ Function Get-PhalconReleaseAssetUrl() {
|
||||
)
|
||||
$domain = 'https://api.github.com/repos'
|
||||
$releases = 'phalcon/cphalcon/releases'
|
||||
$match = $null
|
||||
if($extension_version -match '[3-4]') {
|
||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||
try {
|
||||
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
||||
} catch {
|
||||
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
||||
} catch { }
|
||||
if($null -eq $match) {
|
||||
try {
|
||||
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
||||
} catch { }
|
||||
}
|
||||
} else {
|
||||
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
|
||||
try {
|
||||
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||
} catch {
|
||||
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||
} catch { }
|
||||
if($null -eq $match) {
|
||||
try {
|
||||
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||
} catch { }
|
||||
}
|
||||
if($null -eq $match) {
|
||||
try {
|
||||
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||
} catch { }
|
||||
}
|
||||
if($null -eq $match) {
|
||||
try {
|
||||
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
if($NULL -ne $match) {
|
||||
@ -54,6 +71,8 @@ Function Get-PhalconSemver() {
|
||||
return '3.4.5'
|
||||
} elseif (($extension_version -eq '4') -and ($version -eq '7.2')) {
|
||||
return '4.1.0'
|
||||
} elseif (($extension_version -eq '5') -and ($version -eq '7.4')) {
|
||||
return '5.4.0'
|
||||
}
|
||||
return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ add_phalcon_helper() {
|
||||
else
|
||||
package="php${version:?}-$extension"
|
||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
||||
[ "$extension" = "phalcon4" ] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
||||
[[ "$extension" =~ phalcon[4|5] ]] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
||||
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
|
||||
fi
|
||||
}
|
||||
@ -87,6 +87,7 @@ add_phalcon5() {
|
||||
add_phalcon() {
|
||||
local extension=$1
|
||||
status='Enabled'
|
||||
[ "$extension" = "phalcon" ] && extension=phalcon5
|
||||
extension_major_version=${extension: -1}
|
||||
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
||||
add_phalcon"$extension_major_version" >/dev/null 2>&1
|
||||
|
@ -89,6 +89,8 @@ run_group() {
|
||||
|
||||
patch_extension() {
|
||||
local extension=$1
|
||||
# shellcheck source=.
|
||||
. "${scripts:?}"/extensions/patches/common.sh
|
||||
if [ -e "${scripts:?}"/extensions/patches/"$extension".sh ]; then
|
||||
# shellcheck source=.
|
||||
. "${scripts:?}"/extensions/patches/"$extension".sh
|
||||
|
@ -7,6 +7,8 @@ Function Get-SqlsrvReleaseVersion() {
|
||||
return '5.9.0'
|
||||
} elseif ($version -eq '7.4') {
|
||||
return '5.10.1'
|
||||
} elseif ($version -eq '8.0') {
|
||||
return '5.11.1'
|
||||
} else {
|
||||
return 'latest'
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ get_sqlsrv_version() {
|
||||
echo '5.9.0'
|
||||
elif [[ "${version:?}" =~ 7.4 ]]; then
|
||||
echo '5.10.1'
|
||||
elif [[ "${version:?}" =~ 8.0 ]]; then
|
||||
echo '5.11.1'
|
||||
else
|
||||
# Return an empty string so that pecl will install the latest version.
|
||||
echo ''
|
||||
|
@ -109,6 +109,11 @@ setup_old_versions() {
|
||||
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.
|
||||
add_pecl() {
|
||||
add_devtools phpize >/dev/null 2>&1
|
||||
@ -149,13 +154,9 @@ get_php_packages() {
|
||||
|
||||
# Function to install 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
|
||||
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
||||
install_packages "${packages[@]}"
|
||||
else
|
||||
run_script "php-ubuntu" "$version" "${debug:?}"
|
||||
fi
|
||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
||||
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
||||
install_packages "${packages[@]}"
|
||||
}
|
||||
|
||||
# Function to update PHP.
|
||||
@ -172,14 +173,18 @@ update_php() {
|
||||
|
||||
# Function to install PHP.
|
||||
add_php() {
|
||||
if [[ "$version" =~ ${nightly_versions:?} ]] || [[ "${ts:?}" = "zts" ]]; then
|
||||
setup_nightly
|
||||
if [ "${runner:?}" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
|
||||
if [[ "$version" =~ ${nightly_versions:?} ]]; then
|
||||
setup_nightly
|
||||
else
|
||||
add_packaged_php
|
||||
switch_version >/dev/null 2>&1
|
||||
add_pecl
|
||||
fi
|
||||
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
||||
setup_old_versions
|
||||
else
|
||||
add_packaged_php
|
||||
switch_version >/dev/null 2>&1
|
||||
add_pecl
|
||||
setup_cached_versions
|
||||
fi
|
||||
status="Installed"
|
||||
}
|
||||
@ -272,7 +277,7 @@ setup_php() {
|
||||
}
|
||||
|
||||
# Variables
|
||||
version=${1:-'8.2'}
|
||||
version=${1:-'8.3'}
|
||||
ini=${2:-'production'}
|
||||
src=${0%/*}/..
|
||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||
|
@ -23,7 +23,7 @@ Function Edit-ComposerConfig() {
|
||||
if (-not(Test-Path $composer_json)) {
|
||||
Set-Content -Path $composer_json -Value "{}"
|
||||
}
|
||||
Add-EnvPATH $src\configs\composer.env
|
||||
Set-ComposerEnv
|
||||
Add-Path $composer_bin
|
||||
Set-ComposerAuth
|
||||
}
|
||||
@ -52,6 +52,14 @@ Function Set-ComposerAuth() {
|
||||
}
|
||||
}
|
||||
|
||||
# Function to set composer environment variables.
|
||||
Function Set-ComposerEnv() {
|
||||
if ($env:COMPOSER_PROCESS_TIMEOUT) {
|
||||
(Get-Content $src\configs\composer.env -Raw) -replace '(?m)^COMPOSER_PROCESS_TIMEOUT=.*$', "COMPOSER_PROCESS_TIMEOUT=$env:COMPOSER_PROCESS_TIMEOUT" | Set-Content $src\configs\composer.env
|
||||
}
|
||||
Add-EnvPATH $src\configs\composer.env
|
||||
}
|
||||
|
||||
# Function to extract tool version.
|
||||
Function Get-ToolVersion() {
|
||||
Param (
|
||||
|
@ -42,7 +42,7 @@ configure_composer() {
|
||||
echo '{}' | tee "$composer_json" >/dev/null
|
||||
chmod 644 "$composer_json"
|
||||
fi
|
||||
add_env_path "${src:?}"/configs/composer.env
|
||||
set_composer_env
|
||||
add_path "$composer_bin"
|
||||
set_composer_auth
|
||||
}
|
||||
@ -68,6 +68,16 @@ set_composer_auth() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to set composer environment variables.
|
||||
set_composer_env() {
|
||||
composer_env="${src:?}"/configs/composer.env
|
||||
if [ -n "$COMPOSER_PROCESS_TIMEOUT" ]; then
|
||||
sed_arg="s/COMPOSER_PROCESS_TIMEOUT.*/COMPOSER_PROCESS_TIMEOUT=$COMPOSER_PROCESS_TIMEOUT/"
|
||||
sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env"
|
||||
fi
|
||||
add_env_path "$composer_env"
|
||||
}
|
||||
|
||||
# Helper function to configure tools.
|
||||
add_tools_helper() {
|
||||
tool=$1
|
||||
|
@ -62,6 +62,7 @@ configure_brew() {
|
||||
add_brew
|
||||
brew_path="$(command -v brew)"
|
||||
fi
|
||||
brew_opts=(-f)
|
||||
brew_path_dir="$(dirname "$brew_path")"
|
||||
brew_prefix="$brew_path_dir"/..
|
||||
brew_repo="$brew_path_dir/$(dirname "$(readlink "$brew_path")")"/..
|
||||
@ -74,6 +75,7 @@ configure_brew() {
|
||||
export HOMEBREW_NO_ENV_HINTS=1
|
||||
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
||||
export brew_opts
|
||||
export brew_path
|
||||
export brew_path_dir
|
||||
export brew_prefix
|
||||
|
@ -24,8 +24,10 @@ get_grpc_tag() {
|
||||
add_grpc_php_plugin_brew() {
|
||||
. "${0%/*}"/tools/brew.sh
|
||||
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 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]+")"
|
||||
license_path="$(brew --prefix grpc)/LICENSE"
|
||||
}
|
||||
|
20
src/scripts/tools/retry.sh
Normal file
20
src/scripts/tools/retry.sh
Normal file
@ -0,0 +1,20 @@
|
||||
function retry {
|
||||
local try=0
|
||||
|
||||
until "$@"; do
|
||||
exit_code="$?"
|
||||
try=$((try + 1))
|
||||
|
||||
if [ $try -lt 10 ]; then
|
||||
sleep "$((2 ** try))"
|
||||
else
|
||||
return $exit_code
|
||||
fi
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function git_retry {
|
||||
retry git "$@"
|
||||
}
|
@ -51,7 +51,7 @@ set_output() {
|
||||
read_env() {
|
||||
update="${update:-${UPDATE:-false}}"
|
||||
[ "${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}}"
|
||||
[[ -z "${ImageOS}" && -z "${ImageVersion}" || -n ${ACT} ]] && _runner=self-hosted || _runner=github
|
||||
runner="${runner:-${RUNNER:-$_runner}}"
|
||||
|
@ -133,14 +133,14 @@ Function Get-File {
|
||||
param (
|
||||
[string]$Url,
|
||||
[string]$FallbackUrl,
|
||||
[string]$OutFile,
|
||||
[string]$OutFile = '',
|
||||
[int]$Retries = 3,
|
||||
[int]$TimeoutSec = 0
|
||||
)
|
||||
|
||||
for ($i = 0; $i -lt $Retries; $i++) {
|
||||
try {
|
||||
if($null -ne $OutFile) {
|
||||
if($OutFile -ne '') {
|
||||
Invoke-WebRequest -Uri $Url -OutFile $OutFile -TimeoutSec $TimeoutSec
|
||||
} else {
|
||||
Invoke-WebRequest -Uri $Url -TimeoutSec $TimeoutSec
|
||||
@ -150,7 +150,7 @@ Function Get-File {
|
||||
if ($i -eq ($Retries - 1)) {
|
||||
if($FallbackUrl) {
|
||||
try {
|
||||
if($null -ne $OutFile) {
|
||||
if($OutFile -ne '') {
|
||||
Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
|
||||
} else {
|
||||
Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec
|
||||
@ -332,8 +332,8 @@ if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||
$arch = 'x86'
|
||||
}
|
||||
|
||||
$ts = $env:PHPTS -eq 'ts'
|
||||
if($env:PHPTS -ne 'ts') {
|
||||
$ts = ($env:PHPTS -match '^z?ts$')
|
||||
if(-not($ts)) {
|
||||
$env:PHPTS = '-nts'
|
||||
} else {
|
||||
$env:PHPTS = ''
|
||||
|
@ -22,11 +22,9 @@ interface IRef {
|
||||
export async function getSemverVersion(data: RS): Promise<string> {
|
||||
const search: string = data['version_prefix'] + data['version'];
|
||||
const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`;
|
||||
let github_token: string = await utils.readEnv('GITHUB_TOKEN');
|
||||
const composer_token: string = await utils.readEnv('COMPOSER_TOKEN');
|
||||
if (composer_token && !github_token) {
|
||||
github_token = composer_token;
|
||||
}
|
||||
const github_token: string =
|
||||
(await utils.readEnv('GITHUB_TOKEN')) ||
|
||||
(await utils.readEnv('COMPOSER_TOKEN'));
|
||||
const response: RS = await fetch.fetch(url, github_token);
|
||||
if (response.error || response.data === '[]') {
|
||||
data['error'] = response.error ?? `No version found with prefix ${search}.`;
|
||||
|
@ -59,7 +59,7 @@ export async function getManifestURL(): Promise<string> {
|
||||
*/
|
||||
export async function parseVersion(version: string): Promise<string> {
|
||||
switch (true) {
|
||||
case /^(latest|nightly|\d+\.x)$/.test(version):
|
||||
case /^(latest|lowest|highest|nightly|\d+\.x)$/.test(version):
|
||||
return JSON.parse((await fetch.fetch(await getManifestURL()))['data'])[
|
||||
version
|
||||
];
|
||||
|
Reference in New Issue
Block a user