mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-15 19:40:34 +07:00
Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
4a4c5a48bb | |||
3514a658eb | |||
7aefaa0b54 | |||
048eb79ef3 | |||
29247235f0 | |||
e84efebd6e | |||
0f7f1d08e3 | |||
433bdeeaf0 | |||
1c5378302c | |||
c251c791ff | |||
36fada6981 | |||
27853eb8b4 | |||
18b776ee45 | |||
2ec652d38d | |||
8d8f975af3 | |||
12b910a04d | |||
962fc445e2 | |||
6ba658ae8d | |||
c954e9c756 | |||
b595b415e2 | |||
9c22be2b20 | |||
ac0e29410e | |||
2cae8ac286 | |||
df8d123345 | |||
d371420c90 | |||
287979ae16 | |||
dd942787eb | |||
d000f49d9a | |||
dc7e73e115 | |||
755f6046e1 | |||
ec0360b904 | |||
373563aabe | |||
cf4cade272 | |||
316da6edfb | |||
34061fa6b4 | |||
b7bd9e4655 | |||
78e1c95060 | |||
310e481b83 | |||
42a9487ddd | |||
f5d98d1683 | |||
1a94db50cb | |||
1489f576c9 | |||
f25b1cfdcc | |||
3209251719 | |||
8ad85316fe | |||
297b3cde3c | |||
4eb1919d22 | |||
d8af2f43ce | |||
d3fead0baf | |||
6cd838e903 | |||
3bfebc13bc | |||
89a5bffb0b | |||
260b35cca0 | |||
f902cc7bd9 | |||
ad03a92562 | |||
a99dd2408e | |||
a7d262f1d8 | |||
c1750d382b | |||
6516e9cb24 | |||
783c77d669 | |||
b0064cd05b | |||
fd913ba092 | |||
21e092a3e0 | |||
64652c947d |
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
@ -42,7 +42,7 @@ body:
|
|||||||
id: operating-systems
|
id: operating-systems
|
||||||
attributes:
|
attributes:
|
||||||
label: "Operating systems"
|
label: "Operating systems"
|
||||||
placeholder: "e.g., Ubuntu 20.04, Windows Server 2019, etc."
|
placeholder: "e.g., Ubuntu 22.04, Windows Server 2022, etc."
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
4
.github/workflows/docs.yml
vendored
4
.github/workflows/docs.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, windows-2022, macos-13]
|
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-13]
|
||||||
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', '8.5']
|
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', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@ -114,7 +114,7 @@ jobs:
|
|||||||
git config --local user.name "${{ github.repository_owner }}"
|
git config --local user.name "${{ github.repository_owner }}"
|
||||||
- name: Combine
|
- name: Combine
|
||||||
run: |
|
run: |
|
||||||
for os in ubuntu-24.04 ubuntu-22.04 ubuntu-20.04 windows-2022 windows-2019 macos-13 macos-14 macos-15; do
|
for os in ubuntu-24.04 ubuntu-22.04 windows-2022 windows-2019 macos-13 macos-14 macos-15; do
|
||||||
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
|
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
|
||||||
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5; do
|
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5; do
|
||||||
if [[ "${os%-*}" = "macos" ]]; then
|
if [[ "${os%-*}" = "macos" ]]; then
|
||||||
|
4
.github/workflows/node.yml
vendored
4
.github/workflows/node.yml
vendored
@ -2,7 +2,7 @@ name: Node workflow
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -10,7 +10,7 @@ on:
|
|||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
|
6
.github/workflows/php.yml
vendored
6
.github/workflows/php.yml
vendored
@ -3,7 +3,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -11,7 +11,7 @@ on:
|
|||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -28,7 +28,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, windows-2022, macos-13]
|
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-13]
|
||||||
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', '8.5']
|
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', '8.5']
|
||||||
include:
|
include:
|
||||||
- operating-system: ubuntu-24.04
|
- operating-system: ubuntu-24.04
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@ node_modules/
|
|||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
lib/
|
lib/
|
||||||
|
|
||||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/main/Node.gitignore
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
|
1
.node-version
Normal file
1
.node-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
20
|
95
README.md
95
README.md
@ -68,17 +68,18 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
|
|||||||
|
|
||||||
### GitHub-Hosted Runners
|
### GitHub-Hosted Runners
|
||||||
|
|
||||||
| Virtual environment | YAML workflow label | Pre-installed PHP |
|
| Virtual environment | Arch | YAML workflow label | Pre-installed PHP |
|
||||||
|---------------------|------------------------------------|------------------------|
|
|---------------------|---------|------------------------------------|------------------------|
|
||||||
| Ubuntu 24.04 | `ubuntu-24.04` | `PHP 8.3` |
|
| Ubuntu 24.04 | x86_64 | `ubuntu-latest` or `ubuntu-24.04` | `PHP 8.3` |
|
||||||
| Ubuntu 22.04 | `ubuntu-latest` or `ubuntu-22.04` | `PHP 8.1` |
|
| Ubuntu 22.04 | x86_64 | `ubuntu-22.04` | `PHP 8.1` |
|
||||||
| Ubuntu 20.04 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.3` |
|
| Ubuntu 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` |
|
||||||
| Windows Server 2025 | `windows-2025` | `PHP 8.3` |
|
| Ubuntu 22.04 | aarch64 | `ubuntu-22.04-arm` | `PHP 8.1` |
|
||||||
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.3` |
|
| Windows Server 2025 | x64 | `windows-2025` | `PHP 8.3` |
|
||||||
| Windows Server 2019 | `windows-2019` | `PHP 8.3` |
|
| Windows Server 2022 | x64 | `windows-latest` or `windows-2022` | `PHP 8.3` |
|
||||||
| macOS Sequoia 15.x | `macos-15` | - |
|
| Windows Server 2019 | x64 | `windows-2019` | `PHP 8.3` |
|
||||||
| macOS Sonoma 14.x | `macos-latest` or `macos-14` | - |
|
| macOS Sequoia 15.x | arm64 | `macos-15` | - |
|
||||||
| macOS Ventura 13.x | `macos-13` | `PHP 8.3` |
|
| macOS Sonoma 14.x | arm64 | `macos-latest` or `macos-14` | - |
|
||||||
|
| macOS Ventura 13.x | x86_64 | `macos-13` | `PHP 8.3` |
|
||||||
|
|
||||||
### Self-Hosted Runners
|
### Self-Hosted Runners
|
||||||
|
|
||||||
@ -86,7 +87,6 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
|
|||||||
|----------------------------------|----------------------------|
|
|----------------------------------|----------------------------|
|
||||||
| Ubuntu 24.04 | `self-hosted` or `Linux` |
|
| Ubuntu 24.04 | `self-hosted` or `Linux` |
|
||||||
| Ubuntu 22.04 | `self-hosted` or `Linux` |
|
| Ubuntu 22.04 | `self-hosted` or `Linux` |
|
||||||
| Ubuntu 20.04 | `self-hosted` or `Linux` |
|
|
||||||
| Debian 12 | `self-hosted` or `Linux` |
|
| Debian 12 | `self-hosted` or `Linux` |
|
||||||
| Debian 11 | `self-hosted` or `Linux` |
|
| Debian 11 | `self-hosted` or `Linux` |
|
||||||
| Windows 7 and newer | `self-hosted` or `Windows` |
|
| Windows 7 and newer | `self-hosted` or `Windows` |
|
||||||
@ -120,14 +120,15 @@ On all supported OS/Platforms the following PHP versions can be set up as per th
|
|||||||
| `7.4` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
|
| `7.4` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.0` | `Stable` | `End of life` | `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.1` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.2` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
| `8.2` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
| `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.5` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
| `8.5` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
||||||
|
|
||||||
**Notes:**
|
|
||||||
- Specifying `8.5` in `php-version` input installs a nightly build of `PHP 8.5.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
|
> [!Note]
|
||||||
- To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section.
|
> - Specifying `8.5` in `php-version` input installs a nightly build of `PHP 8.5.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
|
## :heavy_plus_sign: PHP Extension Support
|
||||||
|
|
||||||
@ -185,7 +186,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
|||||||
|
|
||||||
- All shared extensions can be disabled by specifying `none`. When `none` is specified along with other extensions, it is hoisted to the start of the input. So, all the shared extensions will be disabled first, then rest of the extensions in the input will be processed.
|
- All shared extensions can be disabled by specifying `none`. When `none` is specified along with other extensions, it is hoisted to the start of the input. So, all the shared extensions will be disabled first, then rest of the extensions in the input will be processed.
|
||||||
|
|
||||||
**Note:** This disables all core and third-party shared extensions and thus, can break some tools which need them. Required extensions are enabled again when the tools are set up on a best-effort basis. So it is recommended to add the extensions required for your tools after `none` in the `extensions` input to avoid any issues.
|
This disables all core and third-party shared extensions and thus, can break some tools which need them. Required extensions are enabled again when the tools are set up on a best-effort basis. So it is recommended to add the extensions required for your tools after `none` in the `extensions` input to avoid any issues.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP without any shared extensions except mbstring
|
- name: Setup PHP without any shared extensions except mbstring
|
||||||
@ -228,7 +229,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
|||||||
|
|
||||||
These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
|
These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
|
||||||
|
|
||||||
[`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`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`]
|
[`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`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`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with tools
|
- name: Setup PHP with tools
|
||||||
@ -257,7 +258,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
|||||||
|
|
||||||
When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
|
When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
|
||||||
|
|
||||||
With the exception of major versions of `composer`, if you specify only the `major` version or the version in `major.minor` format for a tool you can get rate limited by GitHub's API. To avoid this, it is recommended to provide a [`GitHub` OAuth token](https://github.com/shivammathur/setup-php#composer-github-oauth "Composer GitHub OAuth").
|
With the exception of major versions of `composer`, if you specify only the `major` version or the version in `major.minor` format for a tool you can get rate limited by GitHub's API. To avoid this, it is recommended to provide a [`GitHub` OAuth token](https://github.com/shivammathur/setup-php#github-composer-authentication "Composer GitHub OAuth").
|
||||||
You can do that by setting `GITHUB_TOKEN` environment variable. The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
|
You can do that by setting `GITHUB_TOKEN` environment variable. The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -277,7 +278,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.4'
|
php-version: '8.4'
|
||||||
tools: composer:v2
|
tools: composer:v1
|
||||||
```
|
```
|
||||||
|
|
||||||
- If you do not use composer in your workflow, you can specify `tools: none` to skip it.
|
- If you do not use composer in your workflow, you can specify `tools: none` to skip it.
|
||||||
@ -308,12 +309,23 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
|||||||
fail-fast: true
|
fail-fast: true
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes**
|
- By default, `composer` blocks all its plugins. If you are using the `tools` input to install a composer plugin it will be added to the allow list, alternatively if your dependencies have composer plugins, you can allow them by setting `COMPOSER_ALLOW_PLUGINS` that accepts a csv string of plugin names.
|
||||||
- Input `tools` is useful to set up tools which are only used in CI workflows, thus keeping your `composer.json` tidy.
|
|
||||||
- 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.
|
```yaml
|
||||||
- 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`.
|
- name: Setup PHP with fail-fast
|
||||||
- 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.
|
uses: shivammathur/setup-php@v2
|
||||||
- If you want to set a different `COMPOSER_PROCESS_TIMEOUT`, you can set it in your workflow file using the `env` keyword.
|
with:
|
||||||
|
php-version: '8.4'
|
||||||
|
env:
|
||||||
|
COMPOSER_ALLOW_PLUGINS: composer/installers, composer/satis
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> - Input `tools` is useful to set up tools which are only used in CI workflows, thus keeping your `composer.json` tidy.
|
||||||
|
> - 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
|
```yaml
|
||||||
- name: Setup PHP with composer and custom process timeout
|
- name: Setup PHP with composer and custom process timeout
|
||||||
@ -350,7 +362,8 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
|
|||||||
coverage: xdebug2
|
coverage: xdebug2
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note**: Xdebug is enabled by default on Ubuntu GitHub Actions images, so if you are not using it in your workflow it is recommended to disable it as that will have a positive impact on your PHP performance. Please refer to the [disable coverage](#disable-coverage) section for details.
|
> [!NOTE]
|
||||||
|
> Xdebug is enabled by default on Ubuntu GitHub Actions images, so if you are not using it in your workflow it is recommended to disable it as that will have a positive impact on your PHP performance. Please refer to the [disable coverage](#disable-coverage) section for details.
|
||||||
|
|
||||||
### PCOV
|
### PCOV
|
||||||
|
|
||||||
@ -578,10 +591,10 @@ steps:
|
|||||||
- Production release builds of PHP without debugging symbols are set up by default.
|
- 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.
|
- You can use the `debug` environment variable to set up a build with debugging symbols for PHP 5.6 and above.
|
||||||
|
|
||||||
**Notes**
|
> [!NOTE]
|
||||||
- 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 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 Windows, the debug symbols are added as `pdb` files in the PHP installation directory.
|
||||||
- On macOS, the debug symbols are compiled into the binaries.
|
> - On macOS, the debug symbols are compiled into the binaries.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
@ -696,10 +709,10 @@ jobs:
|
|||||||
runner: self-hosted
|
runner: self-hosted
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes**
|
> [!NOTE]
|
||||||
- Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
|
> - Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
|
||||||
- Do not set up self-hosted runners on the side on your development environment or your production server.
|
> - Do not set up self-hosted runners on the side on your development environment or your production server.
|
||||||
- Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
|
> - Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
|
||||||
|
|
||||||
### Local Testing Setup
|
### Local Testing Setup
|
||||||
|
|
||||||
@ -718,7 +731,7 @@ jobs:
|
|||||||
|
|
||||||
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
|
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
|
||||||
|
|
||||||
Choose the image tag which matches the `runs-on` property in your workflow. For example, if you are using `ubuntu-20.04` in your workflow, run `act -P ubuntu-20.04=shivammathur/node:2004`.
|
Choose the image tag which matches the `runs-on` property in your workflow. For example, if you are using `ubuntu-22.04` in your workflow, run `act -P ubuntu-22.04=shivammathur/node:2204`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# For runs-on: ubuntu-latest
|
# For runs-on: ubuntu-latest
|
||||||
@ -729,9 +742,6 @@ act -P ubuntu-24.04=shivammathur/node:2404
|
|||||||
|
|
||||||
# For runs-on: ubuntu-22.04
|
# For runs-on: ubuntu-22.04
|
||||||
act -P ubuntu-22.04=shivammathur/node:2204
|
act -P ubuntu-22.04=shivammathur/node:2204
|
||||||
|
|
||||||
# For runs-on: ubuntu-20.04
|
|
||||||
act -P ubuntu-20.04=shivammathur/node:2004
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### JIT Configuration
|
### JIT Configuration
|
||||||
@ -779,9 +789,9 @@ If your project uses composer, you can persist the composer's internal cache dir
|
|||||||
run: composer install --prefer-dist
|
run: composer install --prefer-dist
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes**
|
> [!NOTE]
|
||||||
- Please do not cache `vendor` directory using `action/cache` as that will have side effects.
|
> - Please do not cache `vendor` directory using `action/cache` as that will have side effects.
|
||||||
- If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
|
> - If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
|
||||||
```yaml
|
```yaml
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
```
|
```
|
||||||
@ -1087,6 +1097,7 @@ These companies generously provide setup-php their products and services to aid
|
|||||||
[`phpunit`]: https://phpunit.de/
|
[`phpunit`]: https://phpunit.de/
|
||||||
[`phpunit-bridge`]: https://symfony.com/doc/current/components/phpunit_bridge.html
|
[`phpunit-bridge`]: https://symfony.com/doc/current/components/phpunit_bridge.html
|
||||||
[`phpunit-polyfills`]: https://github.com/Yoast/PHPUnit-Polyfills
|
[`phpunit-polyfills`]: https://github.com/Yoast/PHPUnit-Polyfills
|
||||||
|
[`pie`]: https://github.com/php/pie
|
||||||
[`pint`]: https://github.com/laravel/pint
|
[`pint`]: https://github.com/laravel/pint
|
||||||
[`prestissimo`]: https://github.com/hirak/prestissimo
|
[`prestissimo`]: https://github.com/hirak/prestissimo
|
||||||
[`protoc`]: https://developers.google.com/protocol-buffers/
|
[`protoc`]: https://developers.google.com/protocol-buffers/
|
||||||
|
@ -258,8 +258,9 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | php_version | os | script
|
version | php_version | os | script
|
||||||
${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'}
|
${'latest'} | ${'8.0'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'}
|
||||||
${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
|
${'1.2.3'} | ${'8.0'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
|
||||||
|
${'1.2.3'} | ${'7.4'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive'}
|
||||||
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
|
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
|
||||||
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
|
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
|
||||||
${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
|
${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
|
||||||
@ -392,7 +393,7 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp',
|
'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp, pie',
|
||||||
[
|
[
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||||
'add_blackfire',
|
'add_blackfire',
|
||||||
@ -403,17 +404,17 @@ describe('Tools tests', () => {
|
|||||||
'add_composer_tool flex flex symfony/ global',
|
'add_composer_tool flex flex symfony/ global',
|
||||||
'add_grpc_php_plugin latest',
|
'add_grpc_php_plugin latest',
|
||||||
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
|
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
|
||||||
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
|
'add_tool https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
|
||||||
'add_tool https://github.com/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"',
|
'add_tool https://github.com/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"',
|
||||||
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
|
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
|
||||||
'add_composer_tool phplint phplint overtrue/',
|
'add_composer_tool phplint phplint overtrue/',
|
||||||
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
|
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
|
||||||
'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"',
|
'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"',
|
||||||
'add_pecl',
|
'add_pecl',
|
||||||
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
|
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
|
||||||
'add_composer_tool phinx phinx robmorgan/ scoped',
|
'add_composer_tool phinx phinx robmorgan/ scoped',
|
||||||
'add_composer_tool phinx phinx:1.2.3 robmorgan/ scoped',
|
'add_composer_tool phinx phinx:1.2.3 robmorgan/ scoped',
|
||||||
'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive "status"',
|
'add_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status"',
|
||||||
'add_composer_tool phpunit-bridge phpunit-bridge symfony/ global',
|
'add_composer_tool phpunit-bridge phpunit-bridge symfony/ global',
|
||||||
'add_composer_tool phpunit-polyfills phpunit-polyfills yoast/ global',
|
'add_composer_tool phpunit-polyfills phpunit-polyfills yoast/ global',
|
||||||
'add_tool https://github.com/laravel/pint/releases/latest/download/pint.phar pint "-V"',
|
'add_tool https://github.com/laravel/pint/releases/latest/download/pint.phar pint "-V"',
|
||||||
@ -422,7 +423,8 @@ describe('Tools tests', () => {
|
|||||||
'add_protoc latest',
|
'add_protoc latest',
|
||||||
'add_symfony latest',
|
'add_symfony latest',
|
||||||
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
|
'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/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"'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on linux', async (tools_csv, scripts) => {
|
])('checking addTools on linux', async (tools_csv, scripts) => {
|
||||||
@ -434,14 +436,14 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli',
|
'behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, 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://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||||
'add_composer_tool behat behat behat/ scoped',
|
'add_composer_tool behat behat behat/ scoped',
|
||||||
'add_blackfire',
|
'add_blackfire',
|
||||||
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
|
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
|
||||||
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
|
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
|
||||||
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"',
|
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "diagnose"',
|
||||||
'add_composer_tool composer-dependency-analyser composer-dependency-analyser shipmonk/ scoped',
|
'add_composer_tool composer-dependency-analyser composer-dependency-analyser shipmonk/ scoped',
|
||||||
'add_composer_tool composer-require-checker composer-require-checker maglnet/ scoped',
|
'add_composer_tool composer-require-checker composer-require-checker maglnet/ scoped',
|
||||||
'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused "-V"',
|
'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused "-V"',
|
||||||
@ -453,7 +455,7 @@ describe('Tools tests', () => {
|
|||||||
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
||||||
'add_tool https://www.phing.info/get/phing-1.2.3.phar,https://github.com/phingofficial/phing/releases/download/1.2.3/phing-1.2.3.phar phing "-v"',
|
'add_tool https://www.phing.info/get/phing-1.2.3.phar,https://github.com/phingofficial/phing/releases/download/1.2.3/phing-1.2.3.phar phing "-v"',
|
||||||
'add_composer_tool phinx phinx robmorgan/ scoped',
|
'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_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive',
|
||||||
'add_devtools php-config',
|
'add_devtools php-config',
|
||||||
'add_tool https://github.com/PHPCSStandards/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://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
|
||||||
@ -470,7 +472,8 @@ describe('Tools tests', () => {
|
|||||||
'add_symfony latest',
|
'add_symfony latest',
|
||||||
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
|
'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/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'
|
'add_composer_tool easy-coding-standard easy-coding-standard symplify/ scoped',
|
||||||
|
'add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on darwin', async (tools_csv, scripts) => {
|
])('checking addTools on darwin', async (tools_csv, scripts) => {
|
||||||
@ -482,7 +485,7 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp',
|
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, 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://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||||
'Add-Blackfire',
|
'Add-Blackfire',
|
||||||
@ -493,13 +496,14 @@ describe('Tools tests', () => {
|
|||||||
'Tool does_not_exist is not supported',
|
'Tool does_not_exist is not supported',
|
||||||
'Add-ComposerTool flex flex symfony/ global',
|
'Add-ComposerTool flex flex symfony/ global',
|
||||||
'Add-ComposerTool phinx phinx robmorgan/ scoped',
|
'Add-ComposerTool phinx phinx robmorgan/ scoped',
|
||||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive "status"',
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status"',
|
||||||
'php-config is not a windows tool',
|
'php-config is not a windows tool',
|
||||||
'phpize is not a windows tool',
|
'phpize is not a windows tool',
|
||||||
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
||||||
'Add-ComposerTool phpunit-bridge phpunit-bridge symfony/ global',
|
'Add-ComposerTool phpunit-bridge phpunit-bridge symfony/ global',
|
||||||
'Add-Symfony',
|
'Add-Symfony',
|
||||||
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
|
||||||
|
'Add-Tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on Windows', async (tools_csv, scripts) => {
|
])('checking addTools on Windows', async (tools_csv, scripts) => {
|
||||||
@ -562,7 +566,7 @@ describe('Tools tests', () => {
|
|||||||
it.each`
|
it.each`
|
||||||
tools_csv | script
|
tools_csv | script
|
||||||
${'none'} | ${''}
|
${'none'} | ${''}
|
||||||
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"'}
|
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"'}
|
||||||
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
|
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
|
||||||
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
|
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
|
||||||
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
|
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as utils from '../src/utils';
|
import * as utils from '../src/utils';
|
||||||
|
import * as fetchModule from '../src/fetch';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock @actions/core
|
* Mock @actions/core
|
||||||
@ -12,15 +13,6 @@ jest.mock('@actions/core', () => ({
|
|||||||
info: jest.fn()
|
info: jest.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
|
||||||
* Mock fetch.ts
|
|
||||||
*/
|
|
||||||
jest.mock('../src/fetch', () => ({
|
|
||||||
fetch: jest.fn().mockImplementation(() => {
|
|
||||||
return {data: '{ "latest": "8.1", "5.x": "5.6" }'};
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('Utils tests', () => {
|
describe('Utils tests', () => {
|
||||||
it('checking readEnv', async () => {
|
it('checking readEnv', async () => {
|
||||||
process.env['test'] = 'setup-php';
|
process.env['test'] = 'setup-php';
|
||||||
@ -43,15 +35,27 @@ describe('Utils tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking getManifestURL', async () => {
|
it('checking getManifestURL', async () => {
|
||||||
expect(await utils.getManifestURL()).toContain('php-versions.json');
|
for (const url of await utils.getManifestURLS()) {
|
||||||
|
expect(url).toContain('php-versions.json');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking parseVersion', async () => {
|
it('checking parseVersion', async () => {
|
||||||
|
const fetchSpy = jest
|
||||||
|
.spyOn(fetchModule, 'fetch')
|
||||||
|
.mockResolvedValue({data: '{ "latest": "8.1", "5.x": "5.6" }'});
|
||||||
expect(await utils.parseVersion('latest')).toBe('8.1');
|
expect(await utils.parseVersion('latest')).toBe('8.1');
|
||||||
expect(await utils.parseVersion('7')).toBe('7.0');
|
expect(await utils.parseVersion('7')).toBe('7.0');
|
||||||
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
||||||
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
||||||
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
||||||
|
|
||||||
|
fetchSpy.mockReset();
|
||||||
|
fetchSpy.mockResolvedValueOnce({}).mockResolvedValueOnce({});
|
||||||
|
await expect(utils.parseVersion('latest')).rejects.toThrow(
|
||||||
|
'Could not fetch the PHP version manifest.'
|
||||||
|
);
|
||||||
|
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking parseIniFile', async () => {
|
it('checking parseIniFile', async () => {
|
||||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
File diff suppressed because one or more lines are too long
4237
package-lock.json
generated
4237
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
43
package.json
43
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.32.0",
|
"version": "2.34.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "lib/install.js",
|
"main": "lib/install.js",
|
||||||
@ -40,26 +40,29 @@
|
|||||||
"compare-versions": "^6.1.1"
|
"compare-versions": "^6.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/compat": "^1.2.4",
|
"@eslint/compat": "^1.3.1",
|
||||||
"@eslint/js": "9.17.0",
|
"@eslint/js": "9.30.1",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^22.10.2",
|
"@types/node": "^24.0.11",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
||||||
"@typescript-eslint/parser": "^8.18.2",
|
"@typescript-eslint/parser": "^8.36.0",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"eslint": "9.17.0",
|
"eslint": "9.30.1",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^10.1.5",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.32.0",
|
||||||
"eslint-plugin-jest": "^28.10.0",
|
"eslint-plugin-jest": "^29.0.1",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.5.1",
|
||||||
"globals": "^15.14.0",
|
"globals": "^16.3.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^30.0.4",
|
||||||
"jest-circus": "^29.7.0",
|
"jest-circus": "^30.0.4",
|
||||||
"nock": "^13.5.6",
|
"nock": "^14.0.5",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.6.2",
|
||||||
"simple-git-hooks": "^2.11.1",
|
"simple-git-hooks": "^2.13.0",
|
||||||
"ts-jest": "^29.2.5",
|
"ts-jest": "^29.4.0",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.8.3"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"test-exclude": "^7.0.1"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/shivammathur/setup-php/issues"
|
"url": "https://github.com/shivammathur/setup-php/issues"
|
||||||
|
@ -11,7 +11,6 @@ grpc=30
|
|||||||
http=25
|
http=25
|
||||||
pecl_http=25
|
pecl_http=25
|
||||||
pecl-http=25
|
pecl-http=25
|
||||||
psr=15
|
|
||||||
inotify=30
|
inotify=30
|
||||||
libvirt-php=40
|
libvirt-php=40
|
||||||
mailparse=25
|
mailparse=25
|
||||||
@ -20,6 +19,7 @@ memcached=25
|
|||||||
mysqlnd=10
|
mysqlnd=10
|
||||||
mysqlnd_ms=30
|
mysqlnd_ms=30
|
||||||
opcache=10
|
opcache=10
|
||||||
|
openswoole=25
|
||||||
pdo=10
|
pdo=10
|
||||||
phalcon=35
|
phalcon=35
|
||||||
protobuf=30
|
protobuf=30
|
||||||
|
@ -20,3 +20,5 @@
|
|||||||
23.04,lunar
|
23.04,lunar
|
||||||
23.10,mantic
|
23.10,mantic
|
||||||
24.04,noble
|
24.04,noble
|
||||||
|
24.10,oracular
|
||||||
|
25.10,plucky
|
||||||
|
|
@ -35,7 +35,7 @@
|
|||||||
"extension": ".phar",
|
"extension": ".phar",
|
||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "diagnose"
|
||||||
},
|
},
|
||||||
"cs2pr": {
|
"cs2pr": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
@ -71,7 +71,7 @@
|
|||||||
},
|
},
|
||||||
"php-cs-fixer": {
|
"php-cs-fixer": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "FriendsOfPHP/PHP-CS-Fixer",
|
"repository": "PHP-CS-Fixer/PHP-CS-Fixer",
|
||||||
"extension": ".phar",
|
"extension": ".phar",
|
||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"fetch_latest": "true",
|
"fetch_latest": "true",
|
||||||
@ -136,6 +136,14 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
|
"pie": {
|
||||||
|
"type": "phar",
|
||||||
|
"repository": "php/pie",
|
||||||
|
"extension": ".phar",
|
||||||
|
"domain": "https://github.com",
|
||||||
|
"version_prefix": "",
|
||||||
|
"version_parameter": "-V"
|
||||||
|
},
|
||||||
"pint": {
|
"pint": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "laravel/pint",
|
"repository": "laravel/pint",
|
||||||
|
@ -32,25 +32,25 @@ export async function addExtensionDarwin(
|
|||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 7.4relay...8.5relay
|
// match 7.4relay...8.5relay
|
||||||
// match 5.3blackfire...8.3blackfire
|
// match 5.3blackfire...8.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
|
||||||
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
|
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...8.2ioncube
|
// match 5.3ioncube...8.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.3phalcon5
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
|
||||||
// match 7.0zephir_parser...8.3zephir_parser
|
// match 7.0zephir_parser...8.4zephir_parser
|
||||||
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-3])phalcon5?/.test(
|
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-4])phalcon5?/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
case /^(7\.[0-4]|8\.[0-3])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
@ -134,24 +134,24 @@ export async function addExtensionWindows(
|
|||||||
case /^none$/.test(ext_name):
|
case /^none$/.test(ext_name):
|
||||||
add_script += '\nDisable-AllShared';
|
add_script += '\nDisable-AllShared';
|
||||||
break;
|
break;
|
||||||
// match 5.3blackfire...8.3blackfire
|
// match 5.3blackfire...8.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
// match 5.3ioncube...8.2ioncube
|
// match 5.3ioncube...8.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.3phalcon5
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
|
||||||
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
|
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
|
||||||
// match 7.0zephir_parser...8.3zephir_parser
|
// match 7.0zephir_parser...8.4zephir_parser
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-3])phalcon5?$/.test(
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
|
case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
case /^(7\.[0-4]|8\.[0-3])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
@ -264,15 +264,15 @@ export async function addExtensionLinux(
|
|||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 7.4relay...8.5relay
|
// match 7.4relay...8.5relay
|
||||||
// match 5.3blackfire...8.3blackfire
|
// match 5.3blackfire...8.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
|
||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...8.2ioncube
|
// match 5.3ioncube...8.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.3phalcon5
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
|
||||||
// match 7.0zephir_parser...8.3zephir_parser
|
// match 7.0zephir_parser...8.4zephir_parser
|
||||||
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
||||||
@ -282,12 +282,12 @@ export async function addExtensionLinux(
|
|||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
|
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-3])phalcon5?$/.test(
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
case /^(7\.[0-4]|8\.[0-3])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
|
@ -69,7 +69,6 @@ add_brew_extension() {
|
|||||||
else
|
else
|
||||||
add_brew_tap "$php_tap"
|
add_brew_tap "$php_tap"
|
||||||
add_brew_tap "$ext_tap"
|
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
|
update_dependencies >/dev/null 2>&1
|
||||||
handle_dependency_extensions "$formula" "$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
|
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
|
||||||
@ -136,7 +135,9 @@ update_dependencies() {
|
|||||||
patch_brew
|
patch_brew
|
||||||
if ! [ -e /tmp/update_dependencies ]; then
|
if ! [ -e /tmp/update_dependencies ]; then
|
||||||
for repo in "$brew_repo" "$core_repo"; do
|
for repo in "$brew_repo" "$core_repo"; do
|
||||||
|
if [ -e "$repo" ]; then
|
||||||
git_retry -C "$repo" fetch origin master && git -C "$repo" reset --hard origin/master
|
git_retry -C "$repo" fetch origin master && git -C "$repo" reset --hard origin/master
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
@ -209,6 +210,11 @@ get_scan_dir() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to handle self-hosted runner setup.
|
||||||
|
self_hosted_helper() {
|
||||||
|
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
|
||||||
|
}
|
||||||
|
|
||||||
# Function to Setup PHP.
|
# Function to Setup PHP.
|
||||||
setup_php() {
|
setup_php() {
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
install_icu() {
|
install_icu() {
|
||||||
icu=$1
|
icu=$1
|
||||||
if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
|
if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
|
||||||
get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu.tar.zst"
|
get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu$arch_suffix.tar.zst"
|
||||||
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
|
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
|
||||||
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
|
sudo cp -r /usr/local/icu/lib/* /usr/lib/"$(uname -m)"-linux-gnu/
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,8 +17,11 @@ add_intl() {
|
|||||||
else
|
else
|
||||||
[ "${ts:?}" = 'zts' ] && suffix='-zts'
|
[ "${ts:?}" = 'zts' ] && suffix='-zts'
|
||||||
install_icu "$icu" >/dev/null 2>&1
|
install_icu "$icu" >/dev/null 2>&1
|
||||||
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix.so"
|
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix$arch_suffix.so"
|
||||||
enable_extension intl extension
|
enable_extension intl extension
|
||||||
add_extension_log intl "Installed and enabled with ICU $icu"
|
add_extension_log intl "Installed and enabled with ICU $icu"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arch="$(uname -m)"
|
||||||
|
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch_suffix='-arm64' || arch_suffix=''
|
||||||
|
@ -11,28 +11,36 @@ add_license_log() {
|
|||||||
add_client() {
|
add_client() {
|
||||||
if [ ! -e "$oracle_client" ]; then
|
if [ ! -e "$oracle_client" ]; then
|
||||||
sudo mkdir -p -m 777 "$oracle_home" "$oracle_client"
|
sudo mkdir -p -m 777 "$oracle_home" "$oracle_client"
|
||||||
|
arch="$(uname -m)"
|
||||||
for package in basiclite sdk; do
|
for package in basiclite sdk; do
|
||||||
if [ "$os" = 'Linux' ]; then
|
if [ "$os" = 'Linux' ]; then
|
||||||
libs='/usr/lib/'
|
libs='/usr/lib/'
|
||||||
os_name='linux'
|
os_name='linux'
|
||||||
arch='linuxx64'
|
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch_suffix='linux-arm64' || arch_suffix='linuxx64'
|
||||||
lib_ext='so'
|
lib_ext='so'
|
||||||
elif [ "$os" = 'Darwin' ]; then
|
elif [ "$os" = 'Darwin' ]; then
|
||||||
libs='/usr/local/lib/'
|
libs='/usr/local/lib/'
|
||||||
os_name='mac'
|
os_name='mac'
|
||||||
arch='macos'
|
arch_suffix='macos'
|
||||||
lib_ext='dylib'
|
lib_ext='dylib'
|
||||||
fi
|
fi
|
||||||
get -q -n "/opt/oracle/$package.zip" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
|
if [[ "$os" = 'Darwin' && ("$arch" = 'arm64' || "$arch" = 'aarch64') ]]; then
|
||||||
|
get -q -n "/opt/oracle/$package.dmg" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-macos-arm64.dmg"
|
||||||
|
sudo hdiutil attach "/opt/oracle/$package.dmg"
|
||||||
|
(cd /Volumes/instantclient-"$package"-macos.arm64-* && bash install_ic.sh)
|
||||||
|
sudo cp -a ~/Downloads/instantclient_* /opt/oracle/
|
||||||
|
else
|
||||||
|
get -q -n "/opt/oracle/$package.zip" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch_suffix.zip"
|
||||||
unzip -o "/opt/oracle/$package.zip" -d "$oracle_home"
|
unzip -o "/opt/oracle/$package.zip" -d "$oracle_home"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
for icdir in /opt/oracle/instantclient_*; do
|
for icdir in /opt/oracle/instantclient_*; do
|
||||||
sudo mv "$icdir"/* "$oracle_client"/
|
sudo mv "$icdir"/* "$oracle_client"/
|
||||||
done
|
done
|
||||||
|
sudo mkdir -p "$libs"
|
||||||
sudo ln -sf /opt/oracle/instantclient/*.$lib_ext* $libs
|
sudo ln -sf /opt/oracle/instantclient/*.$lib_ext* $libs
|
||||||
if [ "$os" = "Linux" ]; then
|
if [ "$os" = "Linux" ]; then
|
||||||
arch="$(uname -m)"
|
[ -e "$libs/$arch"-linux-gnu/libaio.so.1 ] || sudo ln -sf "$libs/$arch"-linux-gnu/libaio.so.1t64 "$libs/$arch"-linux-gnu/libaio.so.1
|
||||||
[ -e "$libs/$arch"-linux-gnu/libaio.so.1t64 ] && sudo ln -sf "$libs/$arch"-linux-gnu/libaio.so.1t64 "$libs/$arch"-linux-gnu/libaio.so.1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
process_file() {
|
process_file() {
|
||||||
local file=$1
|
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'' -e '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"
|
sed -i'' -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' "$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
export -f process_file
|
export -f process_file
|
||||||
|
@ -80,9 +80,9 @@ Function Get-PhalconSemver() {
|
|||||||
# Function to install phalcon
|
# Function to install phalcon
|
||||||
Function Add-PhalconHelper() {
|
Function Add-PhalconHelper() {
|
||||||
$semver = Get-PhalconSemver
|
$semver = Get-PhalconSemver
|
||||||
if (($extension_version -eq '3') -or ($extension_version -eq '5')) {
|
if ($extension_version -eq '3') {
|
||||||
Add-PhalconFromGitHub $semver
|
Add-PhalconFromGitHub $semver
|
||||||
} elseif ($extension_version -eq '4') {
|
} else {
|
||||||
Add-Extension -Extension phalcon -Stability stable -Extension_version $semver
|
Add-Extension -Extension phalcon -Stability stable -Extension_version $semver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ add_phalcon4() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add phalcon3.
|
# Function to add phalcon5.
|
||||||
add_phalcon5() {
|
add_phalcon5() {
|
||||||
if shared_extension phalcon; then
|
if shared_extension phalcon; then
|
||||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
|
@ -48,6 +48,19 @@ change_library_paths() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add hiredis library
|
||||||
|
add_hiredis() {
|
||||||
|
hiredis_url=https://github.com/redis/hiredis/archive/v1.1.0.tar.gz
|
||||||
|
hiredis_sha=fe6d21741ec7f3fc9df409d921f47dfc73a4d8ff64f4ac6f1d95f951bf7f53d6
|
||||||
|
sed -Ei.bak -e "s#^ url.*# url \"$hiredis_url\"#" -e "s#^ sha256.*# sha256 \"$hiredis_sha\"#" ${core_repo:?}/Formula/h/hiredis.rb
|
||||||
|
brew install -s hiredis
|
||||||
|
lib_dir="${brew_prefix:?}"/opt/hiredis/lib
|
||||||
|
if [ -e "$lib_dir"/libhiredis_ssl.1.1.0.dylib ]; then
|
||||||
|
sudo ln -sf "$lib_dir"/libhiredis_ssl.1.1.0.dylib "$lib_dir"/libhiredis_ssl.dylib.1.1.0
|
||||||
|
fi
|
||||||
|
mv ${core_repo:?}/Formula/h/hiredis.rb.bak ${core_repo:?}/Formula/h/hiredis.rb
|
||||||
|
}
|
||||||
|
|
||||||
# Add relay dependencies
|
# Add relay dependencies
|
||||||
add_relay_dependencies() {
|
add_relay_dependencies() {
|
||||||
add_extension json
|
add_extension json
|
||||||
@ -56,7 +69,8 @@ add_relay_dependencies() {
|
|||||||
if [ "$os" = "Darwin" ]; then
|
if [ "$os" = "Darwin" ]; then
|
||||||
. "${0%/*}"/tools/brew.sh
|
. "${0%/*}"/tools/brew.sh
|
||||||
configure_brew
|
configure_brew
|
||||||
brew install hiredis lz4 zstd concurrencykit
|
brew install lz4 zstd concurrencykit
|
||||||
|
add_hiredis
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +83,10 @@ run_group() {
|
|||||||
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
|
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
|
||||||
echo "$GROUP$log"
|
echo "$GROUP$log"
|
||||||
. ./run_group.sh
|
. ./run_group.sh
|
||||||
|
local status=$?
|
||||||
rm ./run_group.sh
|
rm ./run_group.sh
|
||||||
echo "$END_GROUP"
|
echo "$END_GROUP"
|
||||||
|
return $status
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_extension() {
|
patch_extension() {
|
||||||
@ -150,10 +152,10 @@ add_extension_from_source() {
|
|||||||
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
||||||
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
||||||
patch_extension "$extension" >/dev/null 2>&1
|
patch_extension "$extension" >/dev/null 2>&1
|
||||||
run_group "phpize" "phpize"
|
run_group "phpize" "phpize" && \
|
||||||
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
|
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure" && \
|
||||||
run_group "sudo $prefix_opts make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make"
|
run_group "sudo $prefix_opts make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make" && \
|
||||||
run_group "sudo make install" "make install"
|
run_group "sudo make install" "make install" && \
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
@ -31,6 +31,9 @@ Function Get-ZephirParserVersion() {
|
|||||||
$repo = 'zephir-lang/php-zephir-parser'
|
$repo = 'zephir-lang/php-zephir-parser'
|
||||||
$zp_releases = "$github/$repo/releases"
|
$zp_releases = "$github/$repo/releases"
|
||||||
if($extension -eq 'zephir_parser') {
|
if($extension -eq 'zephir_parser') {
|
||||||
|
if($version -lt '7.2') {
|
||||||
|
return 'v1.6.1'
|
||||||
|
}
|
||||||
return (Get-File -Url $zp_releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
return (Get-File -Url $zp_releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
} else {
|
} else {
|
||||||
return 'v' + ($extension.split('-')[1] -replace 'v')
|
return 'v' + ($extension.split('-')[1] -replace 'v')
|
||||||
|
@ -20,6 +20,7 @@ self_hosted_helper() {
|
|||||||
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
||||||
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
||||||
fi
|
fi
|
||||||
|
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
|
||||||
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
|
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,11 @@ Function Set-ComposerEnv() {
|
|||||||
(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
|
(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
|
Add-EnvPATH $src\configs\composer.env
|
||||||
|
if($env:COMPOSER_ALLOW_PLUGINS) {
|
||||||
|
$env:COMPOSER_ALLOW_PLUGINS -split '\s*,\s*' | Where-Object { $_ } | ForEach-Object {
|
||||||
|
& composer global config --no-plugins "allow-plugins.$_" true > $null 2>&1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to extract tool version.
|
# Function to extract tool version.
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# Variables
|
# Variables
|
||||||
export tool_path_dir="/usr/local/bin"
|
|
||||||
export composer_home="$HOME/.composer"
|
export composer_home="$HOME/.composer"
|
||||||
export composer_bin="$composer_home/vendor/bin"
|
export composer_bin="$composer_home/vendor/bin"
|
||||||
export composer_json="$composer_home/composer.json"
|
export composer_json="$composer_home/composer.json"
|
||||||
@ -76,6 +75,11 @@ set_composer_env() {
|
|||||||
sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env"
|
sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env"
|
||||||
fi
|
fi
|
||||||
add_env_path "$composer_env"
|
add_env_path "$composer_env"
|
||||||
|
if [ -n "$COMPOSER_ALLOW_PLUGINS" ]; then
|
||||||
|
echo "$COMPOSER_ALLOW_PLUGINS" | tr ',' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | grep -v '^$' | while IFS= read -r plugin; do
|
||||||
|
composer global config --no-plugins "allow-plugins.$plugin" true >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper function to configure tools.
|
# Helper function to configure tools.
|
||||||
|
@ -9,7 +9,13 @@ Function Add-Msys2() {
|
|||||||
|
|
||||||
Function Add-GrpcPhpPlugin() {
|
Function Add-GrpcPhpPlugin() {
|
||||||
$msys_location = Add-Msys2
|
$msys_location = Add-Msys2
|
||||||
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
$arch = arch
|
||||||
|
if($arch -eq 'arm64' -or $arch -eq 'aarch64') {
|
||||||
|
$grpc_package = 'mingw-w64-clang-aarch64-grpc'
|
||||||
|
} else {
|
||||||
|
$grpc_package = 'mingw-w64-x86_64-grpc'
|
||||||
|
}
|
||||||
|
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package" >$null 2>&1
|
||||||
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
||||||
Add-Path $msys_location\mingw64\bin
|
Add-Path $msys_location\mingw64\bin
|
||||||
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
|
@ -67,7 +67,7 @@ update_lists() {
|
|||||||
# Function to get fingerprint from an Ubuntu PPA.
|
# Function to get fingerprint from an Ubuntu PPA.
|
||||||
ubuntu_fingerprint() {
|
ubuntu_fingerprint() {
|
||||||
ppa=$1
|
ppa=$1
|
||||||
get -s -n "" "$lp_api"/~"${ppa%/*}"/+archive/"${ppa##*/}" | jq -r '.signing_key_fingerprint'
|
get -s -n "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get fingerprint from a Debian PPA.
|
# Function to get fingerprint from a Debian PPA.
|
||||||
@ -88,7 +88,7 @@ add_key() {
|
|||||||
key_source=$4
|
key_source=$4
|
||||||
key_file=$5
|
key_file=$5
|
||||||
key_urls=("$key_source")
|
key_urls=("$key_source")
|
||||||
if [[ "$key_source" =~ launchpad.net|debian.org ]]; then
|
if [[ "$key_source" =~ launchpadcontent.net|debian.org ]]; then
|
||||||
fingerprint="$("${ID}"_fingerprint "$ppa" "$ppa_url" "$package_dist")"
|
fingerprint="$("${ID}"_fingerprint "$ppa" "$ppa_url" "$package_dist")"
|
||||||
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
|
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
|
||||||
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
|
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
|
||||||
@ -117,7 +117,7 @@ check_lists() {
|
|||||||
# Function to add a sources list.
|
# Function to add a sources list.
|
||||||
add_list() {
|
add_list() {
|
||||||
ppa=${1-ondrej/php}
|
ppa=${1-ondrej/php}
|
||||||
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
|
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
|
||||||
key_source=${3:-"$ppa_url"}
|
key_source=${3:-"$ppa_url"}
|
||||||
package_dist=${4:-"$VERSION_CODENAME"}
|
package_dist=${4:-"$VERSION_CODENAME"}
|
||||||
branches=${5:-main}
|
branches=${5:-main}
|
||||||
@ -129,7 +129,8 @@ add_list() {
|
|||||||
arch=$(dpkg --print-architecture)
|
arch=$(dpkg --print-architecture)
|
||||||
[ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
|
[ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
|
||||||
add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
|
add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
|
||||||
echo "deb [arch=$arch signed-by=$key_file] $ppa_url $package_dist $branches" | sudo tee -a "$list_dir"/"${ppa/\//-}".list >/dev/null 2>&1
|
sudo rm -rf "$list_dir"/"${ppa/\//-}".list || true
|
||||||
|
echo "deb [arch=$arch signed-by=$key_file] $ppa_url $package_dist $branches" | sudo tee -a "$list_dir"/"${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$package_dist".list >/dev/null 2>&1
|
||||||
update_lists "$ppa" "$ppa_search"
|
update_lists "$ppa" "$ppa_search"
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
fi
|
fi
|
||||||
@ -139,7 +140,7 @@ add_list() {
|
|||||||
# Function to check if a PPA exists
|
# Function to check if a PPA exists
|
||||||
check_ppa() {
|
check_ppa() {
|
||||||
ppa=$1
|
ppa=$1
|
||||||
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
|
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
|
||||||
package_dist=${3:-"$VERSION_CODENAME"}
|
package_dist=${3:-"$VERSION_CODENAME"}
|
||||||
branches=${4:-main}
|
branches=${4:-main}
|
||||||
ppa_search="deb .*$ppa_url $package_dist .*$branches$"
|
ppa_search="deb .*$ppa_url $package_dist .*$branches$"
|
||||||
@ -163,7 +164,7 @@ remove_list() {
|
|||||||
# Function to check if ubuntu ppa is up
|
# Function to check if ubuntu ppa is up
|
||||||
is_ubuntu_ppa_up() {
|
is_ubuntu_ppa_up() {
|
||||||
ppa=${1:-ondrej/php}
|
ppa=${1:-ondrej/php}
|
||||||
curl -s --connect-timeout 5 --max-time 5 --head --fail "$lp_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
|
curl -s --connect-timeout 5 --max-time 5 --head --fail "$lpc_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add the PPA mirror.
|
# Function to add the PPA mirror.
|
||||||
@ -181,7 +182,8 @@ add_ppa() {
|
|||||||
ppa=${1:-ondrej/php}
|
ppa=${1:-ondrej/php}
|
||||||
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
||||||
if is_ubuntu_ppa_up "$ppa" ; then
|
if is_ubuntu_ppa_up "$ppa" ; then
|
||||||
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lp_ppa/$ppa/ubuntu" "$lp_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
|
[ "${runner:?}" = "self-hosted" ] && find "$list_dir" -type f -name 'sp*' -exec grep -qF "$sp" {} \; -delete
|
||||||
|
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lpc_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
|
||||||
add_list "$ppa"
|
add_list "$ppa"
|
||||||
else
|
else
|
||||||
add_ppa_sp_mirror "$ppa"
|
add_ppa_sp_mirror "$ppa"
|
||||||
@ -201,7 +203,7 @@ add_ppa() {
|
|||||||
update_ppa() {
|
update_ppa() {
|
||||||
set_base_version
|
set_base_version
|
||||||
ppa=${1:-ondrej/php}
|
ppa=${1:-ondrej/php}
|
||||||
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
|
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
|
||||||
package_dist=${4:-"$VERSION_CODENAME"}
|
package_dist=${4:-"$VERSION_CODENAME"}
|
||||||
branches=${5:-main}
|
branches=${5:-main}
|
||||||
ppa_search="deb .*$ppa_url $package_dist .*$branches"
|
ppa_search="deb .*$ppa_url $package_dist .*$branches"
|
||||||
@ -214,7 +216,10 @@ list_dir='/etc/apt/sources.list.d'
|
|||||||
list_file="/etc/apt/sources.list.d/$ID.sources"
|
list_file="/etc/apt/sources.list.d/$ID.sources"
|
||||||
[ -e "$list_file" ] || list_file='/etc/apt/sources.list'
|
[ -e "$list_file" ] || list_file='/etc/apt/sources.list'
|
||||||
upstream_lsb='/etc/upstream-release/lsb-release'
|
upstream_lsb='/etc/upstream-release/lsb-release'
|
||||||
lp_api='https://api.launchpad.net/1.0'
|
lp_api=(
|
||||||
|
'https://api.launchpad.net/1.0'
|
||||||
|
'https://api.launchpad.net/devel'
|
||||||
|
)
|
||||||
lp_ppa='http://ppa.launchpad.net'
|
lp_ppa='http://ppa.launchpad.net'
|
||||||
lpc_ppa='https://ppa.launchpadcontent.net'
|
lpc_ppa='https://ppa.launchpadcontent.net'
|
||||||
key_dir='/usr/share/keyrings'
|
key_dir='/usr/share/keyrings'
|
||||||
|
@ -17,7 +17,9 @@ add_protoc() {
|
|||||||
(
|
(
|
||||||
platform='linux'
|
platform='linux'
|
||||||
[ "$(uname -s)" = "Darwin" ] && platform='osx'
|
[ "$(uname -s)" = "Darwin" ] && platform='osx'
|
||||||
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-x86_64.zip"
|
arch="$(uname -m)"
|
||||||
|
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch='aarch_64'
|
||||||
|
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-$arch.zip"
|
||||||
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
||||||
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
||||||
) >/dev/null 2>&1
|
) >/dev/null 2>&1
|
||||||
|
@ -53,8 +53,11 @@ read_env() {
|
|||||||
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
|
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
|
||||||
[[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
|
[[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
|
||||||
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
||||||
[[ -z "${ImageOS}" && -z "${ImageVersion}" || -n ${ACT} ]] && _runner=self-hosted || _runner=github
|
[[ ( -z "$ImageOS" && -z "$ImageVersion" ) ||
|
||||||
|
( -n "$RUNNER_ENVIRONMENT" && "$RUNNER_ENVIRONMENT" = "self-hosted" ) ||
|
||||||
|
-n "$ACT" || -n "$CONTAINER" ]] && _runner=self-hosted || _runner=github
|
||||||
runner="${runner:-${RUNNER:-$_runner}}"
|
runner="${runner:-${RUNNER:-$_runner}}"
|
||||||
|
tool_path_dir="${setup_php_tools_dir:-${SETUP_PHP_TOOLS_DIR:-/usr/local/bin}}"
|
||||||
|
|
||||||
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then
|
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then
|
||||||
fail_fast=true
|
fail_fast=true
|
||||||
@ -75,6 +78,45 @@ read_env() {
|
|||||||
export runner
|
export runner
|
||||||
export update
|
export update
|
||||||
export ts
|
export ts
|
||||||
|
export tool_path_dir
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to create a lock.
|
||||||
|
acquire_lock() {
|
||||||
|
lock_path="$1"
|
||||||
|
while true; do
|
||||||
|
if sudo mkdir "$lock_path" 2>/dev/null; then
|
||||||
|
echo $$ | sudo tee "$lock_path/pid" >/dev/null
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
if sudo test -f "$lock_path/pid"; then
|
||||||
|
lock_pid=$(sudo cat "$lock_path/pid")
|
||||||
|
if ! ps -p "$lock_pid" >/dev/null 2>&1; then
|
||||||
|
sudo rm -rf "$lock_path"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to release the lock.
|
||||||
|
release_lock() {
|
||||||
|
lock_path="$1"
|
||||||
|
sudo rm -rf "$lock_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get the SHA256 hash of a string.
|
||||||
|
get_sha256() {
|
||||||
|
local input=$1
|
||||||
|
if command -v sha256sum >/dev/null; then
|
||||||
|
printf '%s' "$input" | sha256sum | cut -d' ' -f1
|
||||||
|
elif command -v shasum >/dev/null; then
|
||||||
|
printf '%s' "$input" | shasum -a 256 | cut -d' ' -f1
|
||||||
|
elif command -v openssl >/dev/null; then
|
||||||
|
printf '%s' "$input" | openssl dgst -sha256 | cut -d' ' -f2
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to download a file using cURL.
|
# Function to download a file using cURL.
|
||||||
@ -89,23 +131,23 @@ get() {
|
|||||||
if [ "$mode" = "-s" ]; then
|
if [ "$mode" = "-s" ]; then
|
||||||
sudo curl "${curl_opts[@]}" "${links[0]}"
|
sudo curl "${curl_opts[@]}" "${links[0]}"
|
||||||
else
|
else
|
||||||
lock_path="$file_path.lock"
|
if [ "$runner" = "self-hosted" ]; then
|
||||||
until sudo mkdir "$lock_path" 2>/dev/null; do
|
lock_path="/tmp/sp-lck-$(get_sha256 "$file_path")"
|
||||||
sleep 1
|
acquire_lock "$lock_path"
|
||||||
done
|
|
||||||
if [ "$execute" = "-e" ]; then
|
if [ "$execute" = "-e" ]; then
|
||||||
until [ -z "$(fuser "$file_path" 2>/dev/null)" ]; do
|
until [ -z "$(fuser "$file_path" 2>/dev/null)" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
trap 'sudo rm -rf "$lock_path"' EXIT SIGINT SIGTERM
|
trap 'release_lock "$lock_path"' EXIT SIGINT SIGTERM
|
||||||
|
fi
|
||||||
for link in "${links[@]}"; do
|
for link in "${links[@]}"; do
|
||||||
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
|
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
|
||||||
[ "$status_code" = "200" ] && break
|
[ "$status_code" = "200" ] && break
|
||||||
done
|
done
|
||||||
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
|
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
|
||||||
[ "$mode" = "-v" ] && echo "$status_code"
|
[ "$mode" = "-v" ] && echo "$status_code"
|
||||||
sudo rm -rf "$lock_path" >/dev/null 2>&1 || true
|
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +221,7 @@ self_hosted_setup() {
|
|||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
self_hosted_helper >/dev/null 2>&1
|
self_hosted_helper >/dev/null 2>&1
|
||||||
add_env RUNNER_TOOL_CACHE /tmp
|
add_env RUNNER_TOOL_CACHE /opt/hostedtoolcache
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -401,6 +401,9 @@ export async function addPhive(data: RS): Promise<string> {
|
|||||||
case /7\.2/.test(data['php_version']):
|
case /7\.2/.test(data['php_version']):
|
||||||
data['version'] = '0.14.5';
|
data['version'] = '0.14.5';
|
||||||
break;
|
break;
|
||||||
|
case /7\.3|7\.4/.test(data['php_version']):
|
||||||
|
data['version'] = '0.15.3';
|
||||||
|
break;
|
||||||
case /^latest$/.test(data['version']):
|
case /^latest$/.test(data['version']):
|
||||||
data['version'] = await getLatestVersion(data);
|
data['version'] = await getLatestVersion(data);
|
||||||
break;
|
break;
|
||||||
@ -416,12 +419,16 @@ export async function addPhive(data: RS): Promise<string> {
|
|||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
export async function addPHPUnitTools(data: RS): Promise<string> {
|
export async function addPHPUnitTools(data: RS): Promise<string> {
|
||||||
|
/* istanbul ignore next */
|
||||||
if (data['version'] === 'latest') {
|
if (data['version'] === 'latest') {
|
||||||
data['version'] =
|
data['version'] =
|
||||||
(await packagist.search(data['packagist'], data['php_version'])) ??
|
(await packagist.search(data['packagist'], data['php_version'])) ??
|
||||||
'latest';
|
'latest';
|
||||||
}
|
}
|
||||||
data['url'] = await getPharUrl(data);
|
data['url'] = await getPharUrl(data);
|
||||||
|
if (data['url'].match(/-\d+/)) {
|
||||||
|
data['url'] += ',' + data['url'].replace(/-(\d+)\.\d+\.\d+/, '-$1');
|
||||||
|
}
|
||||||
return await addArchive(data);
|
return await addArchive(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
src/utils.ts
19
src/utils.ts
@ -48,8 +48,11 @@ export async function getInput(
|
|||||||
/**
|
/**
|
||||||
* Function to get manifest URL
|
* Function to get manifest URL
|
||||||
*/
|
*/
|
||||||
export async function getManifestURL(): Promise<string> {
|
export async function getManifestURLS(): Promise<string[]> {
|
||||||
return 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json';
|
return [
|
||||||
|
'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json',
|
||||||
|
'https://setup-php.com/php-versions.json'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,9 +63,13 @@ export async function getManifestURL(): Promise<string> {
|
|||||||
export async function parseVersion(version: string): Promise<string> {
|
export async function parseVersion(version: string): Promise<string> {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case /^(latest|lowest|highest|nightly|\d+\.x)$/.test(version):
|
case /^(latest|lowest|highest|nightly|\d+\.x)$/.test(version):
|
||||||
return JSON.parse((await fetch.fetch(await getManifestURL()))['data'])[
|
for (const manifestURL of await getManifestURLS()) {
|
||||||
version
|
const fetchResult = await fetch.fetch(manifestURL);
|
||||||
];
|
if (fetchResult['data'] ?? false) {
|
||||||
|
return JSON.parse(fetchResult['data'])[version];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error(`Could not fetch the PHP version manifest.`);
|
||||||
default:
|
default:
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case version.length > 1:
|
case version.length > 1:
|
||||||
@ -449,6 +456,7 @@ export async function readPHPVersion(): Promise<string> {
|
|||||||
const composerLock = path.join(composerProjectDir, 'composer.lock');
|
const composerLock = path.join(composerProjectDir, 'composer.lock');
|
||||||
if (fs.existsSync(composerLock)) {
|
if (fs.existsSync(composerLock)) {
|
||||||
const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
|
const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
|
||||||
|
/* istanbul ignore next */
|
||||||
if (
|
if (
|
||||||
lockFileContents['platform-overrides'] &&
|
lockFileContents['platform-overrides'] &&
|
||||||
lockFileContents['platform-overrides']['php']
|
lockFileContents['platform-overrides']['php']
|
||||||
@ -462,6 +470,7 @@ export async function readPHPVersion(): Promise<string> {
|
|||||||
const composerFileContents = JSON.parse(
|
const composerFileContents = JSON.parse(
|
||||||
fs.readFileSync(composerJson, 'utf8')
|
fs.readFileSync(composerJson, 'utf8')
|
||||||
);
|
);
|
||||||
|
/* istanbul ignore next */
|
||||||
if (
|
if (
|
||||||
composerFileContents['config'] &&
|
composerFileContents['config'] &&
|
||||||
composerFileContents['config']['platform'] &&
|
composerFileContents['config']['platform'] &&
|
||||||
|
Reference in New Issue
Block a user