mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-20 05:43:29 +07:00
Compare commits
89 Commits
Author | SHA1 | Date | |
---|---|---|---|
5f2fe8cb6c | |||
e1dc734412 | |||
20169f80b7 | |||
ec1e2c6601 | |||
5581e61575 | |||
de4f59c442 | |||
26dc9b4fed | |||
8d11cf02d2 | |||
8aee7c58b7 | |||
725b40730f | |||
b8f4bf011c | |||
f9fbb516a6 | |||
987ba5bfe9 | |||
9dffd40113 | |||
2dfe351907 | |||
1897d72bb4 | |||
879090af77 | |||
a3845d84ae | |||
24d382d1f8 | |||
7a5da9d8dc | |||
011ab6e363 | |||
545bc26d45 | |||
55463ffe4f | |||
2a3befd7ab | |||
7cc4441283 | |||
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
|
157
README.md
157
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`]
|
[`backward-compatibility-check`], [`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`], [`mago`], [`name-collision-detector`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with tools
|
- name: Setup PHP with tools
|
||||||
@ -251,25 +252,12 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
|||||||
- To set up a particular version of a tool, specify it in the form `tool:version`.
|
- To set up a particular version of a tool, specify it in the form `tool:version`.
|
||||||
|
|
||||||
Version can be in the following format:
|
Version can be in the following format:
|
||||||
- Semver. For example `tool:1.2.3` or `tool:1.2.3-beta1`.
|
- Semver. For example `tool:1.2.3` or `tool:1.2.3-beta1`.
|
||||||
- Major version. For example `tool:1` or `tool:1.x`.
|
- Major version. For example `tool:1` or `tool:1.x`.
|
||||||
- Major and minor version. For example `tool:1.2` or `tool:1.2.x`.
|
- Major and minor version. For example `tool:1.2` or `tool:1.2.x`.
|
||||||
|
|
||||||
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").
|
|
||||||
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
|
|
||||||
- name: Setup PHP with tools
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '8.4'
|
|
||||||
tools: php-cs-fixer:3.64, phpunit:11.4
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
|
||||||
|
|
||||||
- The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format. Additionally, for composer `snapshot` and `preview` can also be specified to set up the respective releases.
|
- The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format. Additionally, for composer `snapshot` and `preview` can also be specified to set up the respective releases.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -277,7 +265,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 +296,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 +349,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
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ Disable coverage for these reasons:
|
|||||||
- The `php-version-file` input if it exists
|
- The `php-version-file` input if it exists
|
||||||
- A `composer.lock` file and the `platform-overrides.php` value
|
- A `composer.lock` file and the `platform-overrides.php` value
|
||||||
- A `composer.json` file and the `config.platform.php` value
|
- A `composer.json` file and the `config.platform.php` value
|
||||||
- If the `composer.lock` or `composer.json` file is in a sub-directory in your repository, please specify the subdirectory path in `COMPOSER_PROJECT_DIR` env.
|
- If the `composer.lock` or `composer.json` file is in a subdirectory in your repository, please specify the subdirectory path in `COMPOSER_PROJECT_DIR` env.
|
||||||
|
|
||||||
#### `php-version-file` (optional)
|
#### `php-version-file` (optional)
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ Disable coverage for these reasons:
|
|||||||
- Accepts a `string`. For example `'.phpenv-version'`.
|
- Accepts a `string`. For example `'.phpenv-version'`.
|
||||||
- See [PHP support](#tada-php-support) for the supported PHP versions.
|
- See [PHP support](#tada-php-support) for the supported PHP versions.
|
||||||
- By default, `.php-version` file is used.
|
- By default, `.php-version` file is used.
|
||||||
- The file either have the PHP version as its content, or follow the asdf `.tool-versions` format.
|
- The file needs to either have the PHP version as its content or follows the asdf `.tool-versions` format.
|
||||||
- If not specified and the default `.php-version` file is not found, the latest stable PHP version is set up.
|
- If not specified and the default `.php-version` file is not found, the latest stable PHP version is set up.
|
||||||
|
|
||||||
#### `extensions` (optional)
|
#### `extensions` (optional)
|
||||||
@ -460,6 +460,12 @@ Disable coverage for these reasons:
|
|||||||
- Accepts a `string` in csv-format. For example: `phpunit, phpcs`
|
- Accepts a `string` in csv-format. For example: `phpunit, phpcs`
|
||||||
- See [tools support](#wrench-tools-support) for tools supported.
|
- See [tools support](#wrench-tools-support) for tools supported.
|
||||||
|
|
||||||
|
#### `github-token` (optional)
|
||||||
|
|
||||||
|
- Specify the GitHub token to use for authentication.
|
||||||
|
- Accepts a `string`.
|
||||||
|
- By default, `GITHUB_TOKEN` secret provided by GitHub Actions is used.
|
||||||
|
|
||||||
### Outputs
|
### Outputs
|
||||||
|
|
||||||
#### `php-version`
|
#### `php-version`
|
||||||
@ -548,8 +554,6 @@ jobs:
|
|||||||
ini-values: post_max_size=256M, max_execution_time=180
|
ini-values: post_max_size=256M, max_execution_time=180
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
|
tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Nightly Build Setup
|
### Nightly Build Setup
|
||||||
@ -578,10 +582,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 +700,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 +722,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 +733,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 +780,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') }}
|
||||||
```
|
```
|
||||||
@ -794,17 +795,16 @@ restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-
|
|||||||
|
|
||||||
### GitHub Composer Authentication
|
### GitHub Composer Authentication
|
||||||
|
|
||||||
If you have a number of workflows which set up multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. Also, if you specify only the major version or the version in `major.minor` format, you can hit the rate limit. To avoid this you can specify an `OAuth` token by setting `GITHUB_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
|
By default, setup-php uses the `GITHUB_TOKEN` secret that is generated for each workflow run. In case you want to use a Personal Access Token (PAT) instead, you can set the `github-token` input.
|
||||||
|
|
||||||
The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
|
The `COMPOSER_TOKEN` and `GITHUB_TOKEN` environment variables have been deprecated in favor of the `github-token` input and will be removed in the next major version.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.4'
|
php-version: '8.4'
|
||||||
env:
|
github-token: ${{ secrets.YOUR_PAT_TOKEN }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Private Packagist Authentication
|
### Private Packagist Authentication
|
||||||
@ -1005,19 +1005,26 @@ Many users and organisations support setup-php via [GitHub Sponsors](https://git
|
|||||||
These companies generously provide setup-php their products and services to aid in the development of this project.
|
These companies generously provide setup-php their products and services to aid in the development of this project.
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="https://www.jetbrains.com/?from=setup-php">
|
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php">
|
||||||
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="212" height="120">
|
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="80">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://www.macstadium.com/opensource/members#gh-light-mode-only">
|
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only">
|
||||||
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="296" height="120">
|
<img src="https://setup-php.com/sponsors/cloudflare.svg" alt="Cloudflare" width="240" height="80">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only">
|
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-dark-mode-only">
|
||||||
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="296" height="120">
|
<img src="https://setup-php.com/sponsors/cloudflare-white.svg" alt="Cloudflare" width="240" height="80">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-light-mode-only">
|
||||||
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="140" height="120">
|
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="200" height="80">
|
||||||
|
</a>
|
||||||
|
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-dark-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200" height="80">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a target="_blank" href="#">
|
||||||
|
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="94" height="80">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -1046,6 +1053,7 @@ These companies generously provide setup-php their products and services to aid
|
|||||||
|
|
||||||
|
|
||||||
<!-- Links to tools -->
|
<!-- Links to tools -->
|
||||||
|
[`backward-compatibility-check`]: https://github.com/Roave/BackwardCompatibilityCheck
|
||||||
[`behat`]: https://docs.behat.org/en/latest/
|
[`behat`]: https://docs.behat.org/en/latest/
|
||||||
[`blackfire`]: https://blackfire.io/docs/php/index
|
[`blackfire`]: https://blackfire.io/docs/php/index
|
||||||
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
|
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
|
||||||
@ -1065,6 +1073,8 @@ These companies generously provide setup-php their products and services to aid
|
|||||||
[`flex`]: https://flex.symfony.com/
|
[`flex`]: https://flex.symfony.com/
|
||||||
[`grpc_php_plugin`]: https://grpc.io/
|
[`grpc_php_plugin`]: https://grpc.io/
|
||||||
[`infection`]: https://infection.github.io/
|
[`infection`]: https://infection.github.io/
|
||||||
|
[`mago`]: https://github.com/carthage-software/mago
|
||||||
|
[`name-collision-detector`]: https://github.com/shipmonk/name-collision-detector
|
||||||
[`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint
|
[`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint
|
||||||
[`pecl`]: https://pecl.php.net/
|
[`pecl`]: https://pecl.php.net/
|
||||||
[`phan`]: https://github.com/phan/phan/wiki
|
[`phan`]: https://github.com/phan/phan/wiki
|
||||||
@ -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, mago, name-collision-detector, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp, pie',
|
||||||
[
|
[
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://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',
|
||||||
@ -402,18 +403,20 @@ describe('Tools tests', () => {
|
|||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
|
||||||
'add_composer_tool flex flex symfony/ global',
|
'add_composer_tool flex flex symfony/ global',
|
||||||
'add_grpc_php_plugin latest',
|
'add_grpc_php_plugin latest',
|
||||||
|
'add_mago',
|
||||||
|
'add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped',
|
||||||
'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 +425,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 +438,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',
|
'backward-compatibility-check, 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, mago:0.26.1, name-collision-detector, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli, pie',
|
||||||
[
|
[
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://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"',
|
||||||
@ -449,11 +453,13 @@ describe('Tools tests', () => {
|
|||||||
'add_composer_tool flex flex symfony/ global',
|
'add_composer_tool flex flex symfony/ global',
|
||||||
'add_grpc_php_plugin 1.2.3',
|
'add_grpc_php_plugin 1.2.3',
|
||||||
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
|
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
|
||||||
|
'add_mago 0.26.1',
|
||||||
|
'add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped',
|
||||||
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
|
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
|
||||||
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
||||||
'add_tool https://www.phing.info/get/phing-1.2.3.phar,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"',
|
||||||
@ -467,10 +473,12 @@ describe('Tools tests', () => {
|
|||||||
'add_protoc 1.2.3',
|
'add_protoc 1.2.3',
|
||||||
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
||||||
'add_composer_tool rector rector rector/ scoped',
|
'add_composer_tool rector rector rector/ scoped',
|
||||||
|
'add_composer_tool backward-compatibility-check backward-compatibility-check roave/ scoped',
|
||||||
'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 +490,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, mago, name-collision-detector, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp, pie',
|
||||||
[
|
[
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://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',
|
||||||
@ -492,14 +500,17 @@ describe('Tools tests', () => {
|
|||||||
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
|
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
|
||||||
'Tool does_not_exist is not supported',
|
'Tool does_not_exist is not supported',
|
||||||
'Add-ComposerTool flex flex symfony/ global',
|
'Add-ComposerTool flex flex symfony/ global',
|
||||||
|
'Add-Mago',
|
||||||
|
'Add-ComposerTool name-collision-detector name-collision-detector shipmonk/ scoped',
|
||||||
'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 +573,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 () => {
|
||||||
@ -177,9 +181,9 @@ describe('Utils tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking suppressOutput', async () => {
|
it('checking suppressOutput', async () => {
|
||||||
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
expect(await utils.suppressOutput('win32')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('linux')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('darwin')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('openbsd')).toContain(
|
expect(await utils.suppressOutput('openbsd')).toContain(
|
||||||
'Platform openbsd is not supported'
|
'Platform openbsd is not supported'
|
||||||
);
|
);
|
||||||
|
@ -27,6 +27,9 @@ inputs:
|
|||||||
tools:
|
tools:
|
||||||
description: 'Setup popular tools globally.'
|
description: 'Setup popular tools globally.'
|
||||||
required: false
|
required: false
|
||||||
|
github-token:
|
||||||
|
description: 'GitHub token to use for authentication.'
|
||||||
|
default: ${{ github.token }}
|
||||||
outputs:
|
outputs:
|
||||||
php-version:
|
php-version:
|
||||||
description: 'PHP version in semver format'
|
description: 'PHP version in semver format'
|
||||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
File diff suppressed because one or more lines are too long
4239
package-lock.json
generated
4239
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"
|
||||||
|
@ -17,7 +17,7 @@ export async function addINIValuesUnix(
|
|||||||
return (
|
return (
|
||||||
'echo "' +
|
'echo "' +
|
||||||
ini_values.join('\n') +
|
ini_values.join('\n') +
|
||||||
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
|
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" ' +
|
||||||
script
|
script
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"backward-compatibility-check": {
|
||||||
|
"type": "composer",
|
||||||
|
"repository": "roave/backward-compatibility-check",
|
||||||
|
"scope": "scoped"
|
||||||
|
},
|
||||||
"box": {
|
"box": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "box-project/box",
|
"repository": "box-project/box",
|
||||||
@ -35,7 +40,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",
|
||||||
@ -45,6 +50,12 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
|
"easy-coding-standard": {
|
||||||
|
"type": "composer",
|
||||||
|
"alias": "ecs",
|
||||||
|
"repository": "symplify/easy-coding-standard",
|
||||||
|
"scope": "scoped"
|
||||||
|
},
|
||||||
"infection": {
|
"infection": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "infection/infection",
|
"repository": "infection/infection",
|
||||||
@ -53,6 +64,11 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
|
"name-collision-detector": {
|
||||||
|
"type": "composer",
|
||||||
|
"repository": "shipmonk/name-collision-detector",
|
||||||
|
"scope": "scoped"
|
||||||
|
},
|
||||||
"phan": {
|
"phan": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "phan/phan",
|
"repository": "phan/phan",
|
||||||
@ -71,7 +87,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 +152,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",
|
||||||
@ -225,6 +249,12 @@
|
|||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "v"
|
"version_prefix": "v"
|
||||||
},
|
},
|
||||||
|
"mago": {
|
||||||
|
"type": "custom-package",
|
||||||
|
"repository": "carthage-software/mago",
|
||||||
|
"domain": "https://github.com",
|
||||||
|
"version_prefix": ""
|
||||||
|
},
|
||||||
"protoc": {
|
"protoc": {
|
||||||
"type": "custom-package",
|
"type": "custom-package",
|
||||||
"repository": "protocolbuffers/protobuf",
|
"repository": "protocolbuffers/protobuf",
|
||||||
@ -323,11 +353,5 @@
|
|||||||
"extension": ".phar",
|
"extension": ".phar",
|
||||||
"version_parameter": "--version",
|
"version_parameter": "--version",
|
||||||
"version_prefix": "v"
|
"version_prefix": "v"
|
||||||
},
|
|
||||||
"easy-coding-standard": {
|
|
||||||
"type": "composer",
|
|
||||||
"alias": "ecs",
|
|
||||||
"repository": "symplify/easy-coding-standard",
|
|
||||||
"scope": "scoped"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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(
|
||||||
|
@ -18,7 +18,6 @@ export async function getScript(os: string): Promise<string> {
|
|||||||
const filename = os + (await utils.scriptExtension(os));
|
const filename = os + (await utils.scriptExtension(os));
|
||||||
const script_path = path.join(__dirname, '../src/scripts', filename);
|
const script_path = path.join(__dirname, '../src/scripts', filename);
|
||||||
const run_path = script_path.replace(os, 'run');
|
const run_path = script_path.replace(os, 'run');
|
||||||
process.env['fail_fast'] = await utils.getInput('fail-fast', false);
|
|
||||||
const extension_csv: string = await utils.getInput('extensions', false);
|
const extension_csv: string = await utils.getInput('extensions', false);
|
||||||
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
||||||
const coverage_driver: string = await utils.getInput('coverage', false);
|
const coverage_driver: string = await utils.getInput('coverage', false);
|
||||||
@ -48,6 +47,14 @@ export async function getScript(os: string): Promise<string> {
|
|||||||
return run_path;
|
return run_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to set environment variables based on inputs.
|
||||||
|
*/
|
||||||
|
export async function setEnv(): Promise<void> {
|
||||||
|
process.env['fail_fast'] = await utils.getInput('fail-fast', false);
|
||||||
|
process.env['GITHUB_TOKEN'] ??= await utils.getInput('github-token', false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the script
|
* Run the script
|
||||||
*/
|
*/
|
||||||
@ -55,6 +62,7 @@ export async function run(): Promise<void> {
|
|||||||
const os: string = process.platform;
|
const os: string = process.platform;
|
||||||
const tool = await utils.scriptTool(os);
|
const tool = await utils.scriptTool(os);
|
||||||
const run_path = await getScript(os);
|
const run_path = await getScript(os);
|
||||||
|
await setEnv();
|
||||||
await exec(tool + run_path);
|
await exec(tool + run_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ handle_dependency_extensions() {
|
|||||||
suffix="$(get_php_formula_suffix)"
|
suffix="$(get_php_formula_suffix)"
|
||||||
if [[ -n "$suffix" ]]; then
|
if [[ -n "$suffix" ]]; then
|
||||||
brew_opts=(-sf)
|
brew_opts=(-sf)
|
||||||
patch_abstract_file >/dev/null 2>&1
|
patch_abstract_file
|
||||||
for dependency_extension in "${dependency_extensions[@]}"; do
|
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"
|
brew install "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" && copy_brew_extensions "$dependency_extension"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ disable_extension_helper() {
|
|||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
|
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
|
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get extension name from brew formula.
|
# Function to get extension name from brew formula.
|
||||||
@ -69,10 +69,9 @@ 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
|
||||||
update_dependencies >/dev/null 2>&1
|
handle_dependency_extensions "$formula" "$extension"
|
||||||
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
|
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" && copy_brew_extensions "$formula") || pecl_install "$extension"
|
||||||
(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"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -81,7 +80,7 @@ add_brew_extension() {
|
|||||||
patch_abstract_file() {
|
patch_abstract_file() {
|
||||||
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
|
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
|
||||||
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
|
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
|
||||||
echo '' | sudo tee /tmp/abstract_patch >/dev/null 2>&1
|
echo '' | sudo tee /tmp/abstract_patch
|
||||||
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
|
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -91,9 +90,9 @@ add_extension_helper() {
|
|||||||
local extension=$1
|
local extension=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
|
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
|
||||||
run_script "php5-darwin" "${version/./}" "$extension" >/dev/null 2>&1
|
run_script "php5-darwin" "${version/./}" "$extension"
|
||||||
else
|
else
|
||||||
pecl_install "$extension" >/dev/null 2>&1 &&
|
pecl_install "$extension" &&
|
||||||
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
||||||
fi
|
fi
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
@ -107,8 +106,8 @@ add_devtools() {
|
|||||||
|
|
||||||
# Function to handle request to add PECL.
|
# Function to handle request to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
enable_extension xml extension >/dev/null 2>&1
|
enable_extension xml extension
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl
|
||||||
pear_version=$(get_tool_version "pecl" "version")
|
pear_version=$(get_tool_version "pecl" "version")
|
||||||
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
|
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
|
||||||
}
|
}
|
||||||
@ -136,9 +135,11 @@ 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
|
||||||
git_retry -C "$repo" fetch origin master && git -C "$repo" reset --hard origin/master
|
if [ -e "$repo" ]; then
|
||||||
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +197,7 @@ add_php_config() {
|
|||||||
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
|
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
|
||||||
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
|
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
|
||||||
elif [ "$ini" = "none" ]; then
|
elif [ "$ini" = "none" ]; then
|
||||||
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
|
echo '' | sudo tee "${ini_file[@]}"
|
||||||
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 || true
|
||||||
|
}
|
||||||
|
|
||||||
# Function to Setup PHP.
|
# Function to Setup PHP.
|
||||||
setup_php() {
|
setup_php() {
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
@ -217,14 +223,14 @@ setup_php() {
|
|||||||
check_pre_installed
|
check_pre_installed
|
||||||
existing_version=$(get_brewed_php)
|
existing_version=$(get_brewed_php)
|
||||||
if [[ "$version" =~ ${old_versions:?} ]]; then
|
if [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
|
run_script "php5-darwin" "${version/./}"
|
||||||
status="Installed"
|
status="Installed"
|
||||||
elif [ "$existing_version" != "$version" ]; then
|
elif [ "$existing_version" != "$version" ]; then
|
||||||
add_php "install" "$existing_version" >/dev/null 2>&1
|
add_php "install" "$existing_version"
|
||||||
status="Installed"
|
status="Installed"
|
||||||
elif [ "$existing_version" = "$version" ]; then
|
elif [ "$existing_version" = "$version" ]; then
|
||||||
if [ "${update:?}" = "true" ]; then
|
if [ "${update:?}" = "true" ]; then
|
||||||
add_php "upgrade" "$existing_version" >/dev/null 2>&1
|
add_php "upgrade" "$existing_version"
|
||||||
status="Updated to"
|
status="Updated to"
|
||||||
else
|
else
|
||||||
status="Found"
|
status="Found"
|
||||||
|
@ -48,7 +48,7 @@ enable_extension() {
|
|||||||
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
||||||
enable_extension_dependencies "$1" "$2"
|
enable_extension_dependencies "$1" "$2"
|
||||||
enable_cache_extension_dependencies "$1" "$2"
|
enable_cache_extension_dependencies "$1" "$2"
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod >/dev/null 2>&1; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod ; then
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
|
||||||
mod="${ini_dir:?}"/../mods-available/"$1".ini
|
mod="${ini_dir:?}"/../mods-available/"$1".ini
|
||||||
if ! [ -e "$mod" ]; then
|
if ! [ -e "$mod" ]; then
|
||||||
@ -57,7 +57,7 @@ enable_extension() {
|
|||||||
[ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2)
|
[ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2)
|
||||||
(echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null
|
(echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null
|
||||||
fi
|
fi
|
||||||
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
|
sudo phpenmod -v "$version" "$1"
|
||||||
else
|
else
|
||||||
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
||||||
fi
|
fi
|
||||||
@ -69,7 +69,7 @@ enable_extensions() {
|
|||||||
local extensions=("$@")
|
local extensions=("$@")
|
||||||
to_wait=()
|
to_wait=()
|
||||||
for ext in "${extensions[@]}"; do
|
for ext in "${extensions[@]}"; do
|
||||||
enable_extension "$ext" extension >/dev/null 2>&1 &
|
enable_extension "$ext" extension &
|
||||||
to_wait+=($!)
|
to_wait+=($!)
|
||||||
done
|
done
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
@ -77,7 +77,7 @@ enable_extensions() {
|
|||||||
|
|
||||||
# Function to get a map of extensions and their dependent shared extensions.
|
# Function to get a map of extensions and their dependent shared extensions.
|
||||||
get_extension_map() {
|
get_extension_map() {
|
||||||
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig >/dev/null 2>&1
|
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to enable extension dependencies which are also extensions.
|
# Function to enable extension dependencies which are also extensions.
|
||||||
@ -123,7 +123,7 @@ disable_extension() {
|
|||||||
disable_all_shared() {
|
disable_all_shared() {
|
||||||
get_extension_map
|
get_extension_map
|
||||||
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
|
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
|
||||||
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
|
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
sudo rm -f /tmp/php"$version"_extensions
|
sudo rm -f /tmp/php"$version"_extensions
|
||||||
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -I{} touch /tmp/extdisabled/"$version"/{}
|
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -I{} touch /tmp/extdisabled/"$version"/{}
|
||||||
@ -137,7 +137,7 @@ configure_pecl() {
|
|||||||
for script in pear pecl; do
|
for script in pear pecl; do
|
||||||
sudo "$script" channel-update "$script".php.net
|
sudo "$script" channel-update "$script".php.net
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
echo '' | sudo tee /tmp/pecl_config
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,8 +175,8 @@ get_pecl_version() {
|
|||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
local prefix=${2:-extension}
|
local prefix=${2:-extension}
|
||||||
add_pecl >/dev/null 2>&1
|
add_pecl
|
||||||
disable_extension_helper "${extension%-*}" >/dev/null 2>&1
|
disable_extension_helper "${extension%-*}"
|
||||||
# Compare version with 8.3 so it runs only on 8.4 and above
|
# Compare version with 8.3 so it runs only on 8.4 and above
|
||||||
# Install using the source interface as it allows for patching.
|
# Install using the source interface as it allows for patching.
|
||||||
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
||||||
@ -189,11 +189,11 @@ pecl_install() {
|
|||||||
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
|
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
|
||||||
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
||||||
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
||||||
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
|
(( ${#libraries[@]} )) && add_libs "${libraries[@]}"
|
||||||
if [ "$version" = "5.3" ]; then
|
if [ "$version" = "5.3" ]; then
|
||||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
|
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension"
|
||||||
else
|
else
|
||||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
|
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension"
|
||||||
fi
|
fi
|
||||||
local exit_code=$?
|
local exit_code=$?
|
||||||
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
|
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
|
||||||
@ -216,7 +216,7 @@ add_pecl_extension() {
|
|||||||
add_log "${tick:?}" "$extension" "Enabled"
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
|
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
|
||||||
pecl_install "$extension$pecl_version" || add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1
|
pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" )
|
||||||
extension_version="$(php -r "echo phpversion('$extension');")"
|
extension_version="$(php -r "echo phpversion('$extension');")"
|
||||||
[ -n "$extension_version" ] && extension_version="-$extension_version"
|
[ -n "$extension_version" ] && extension_version="-$extension_version"
|
||||||
add_extension_log "$extension$extension_version" "Installed and enabled"
|
add_extension_log "$extension$extension_version" "Installed and enabled"
|
||||||
|
@ -19,11 +19,11 @@ add_blackfire() {
|
|||||||
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so >/dev/null 2>&1
|
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so
|
||||||
fi
|
fi
|
||||||
if [ -e "${ext_dir:?}/blackfire.so" ]; then
|
if [ -e "${ext_dir:?}/blackfire.so" ]; then
|
||||||
disable_extension xdebug >/dev/null 2>&1
|
disable_extension xdebug
|
||||||
disable_extension pcov >/dev/null 2>&1
|
disable_extension pcov
|
||||||
enable_extension blackfire extension
|
enable_extension blackfire extension
|
||||||
add_extension_log blackfire "$status"
|
add_extension_log blackfire "$status"
|
||||||
else
|
else
|
||||||
|
@ -59,9 +59,9 @@ add_couchbase() {
|
|||||||
ext=$(get_couchbase_version)
|
ext=$(get_couchbase_version)
|
||||||
fi
|
fi
|
||||||
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
|
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
|
||||||
add_couchbase_clibs "$ext" >/dev/null 2>&1
|
add_couchbase_clibs "$ext"
|
||||||
else
|
else
|
||||||
add_couchbase_cxxlibs >/dev/null 2>&1
|
add_couchbase_cxxlibs
|
||||||
fi
|
fi
|
||||||
enable_extension "couchbase" "extension"
|
enable_extension "couchbase" "extension"
|
||||||
if check_extension "couchbase"; then
|
if check_extension "couchbase"; then
|
||||||
@ -72,9 +72,9 @@ add_couchbase() {
|
|||||||
n_proc="$(nproc)"
|
n_proc="$(nproc)"
|
||||||
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
|
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
|
||||||
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
|
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
|
||||||
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
|
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl
|
||||||
else
|
else
|
||||||
pecl_install "${ext}" >/dev/null 2>&1
|
pecl_install "${ext}"
|
||||||
fi
|
fi
|
||||||
add_extension_log "couchbase" "Installed and enabled"
|
add_extension_log "couchbase" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
|
@ -51,7 +51,7 @@ add_cubrid_helper() {
|
|||||||
add_cubrid() {
|
add_cubrid() {
|
||||||
ext=$1
|
ext=$1
|
||||||
status='Enabled'
|
status='Enabled'
|
||||||
add_cubrid_helper "$ext" >/dev/null 2>&1
|
add_cubrid_helper "$ext"
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ add_event() {
|
|||||||
add_log "${tick:?}" "event" "Enabled"
|
add_log "${tick:?}" "event" "Enabled"
|
||||||
else
|
else
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
|
||||||
add_brew_extension event extension >/dev/null 2>&1
|
add_brew_extension event extension
|
||||||
else
|
else
|
||||||
add_event_helper "$ext" >/dev/null 2>&1
|
add_event_helper "$ext"
|
||||||
fi
|
fi
|
||||||
add_extension_log "event" "Installed and enabled"
|
add_extension_log "event" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
|
@ -24,7 +24,7 @@ add_firebird_helper() {
|
|||||||
|
|
||||||
add_firebird() {
|
add_firebird() {
|
||||||
if [ "$(uname -s )" = "Darwin" ]; then
|
if [ "$(uname -s )" = "Darwin" ]; then
|
||||||
add_firebird_client_darwin >/dev/null 2>&1
|
add_firebird_client_darwin
|
||||||
fi
|
fi
|
||||||
enable_extension pdo_firebird extension
|
enable_extension pdo_firebird extension
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
@ -32,12 +32,12 @@ add_firebird() {
|
|||||||
status="Installed and enabled"
|
status="Installed and enabled"
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
|
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
|
||||||
add_firebird_helper /usr >/dev/null 2>&1
|
add_firebird_helper /usr
|
||||||
else
|
else
|
||||||
add_pdo_extension firebird >/dev/null 2>&1
|
add_pdo_extension firebird
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
add_firebird_helper /opt/firebird >/dev/null 2>&1
|
add_firebird_helper /opt/firebird
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
add_extension_log pdo_firebird "$status"
|
add_extension_log pdo_firebird "$status"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# Helper function to add gearman extension.
|
# Helper function to add gearman extension.
|
||||||
add_gearman_helper() {
|
add_gearman_helper() {
|
||||||
add_ppa ondrej/pkg-gearman
|
|
||||||
install_packages libgearman-dev
|
install_packages libgearman-dev
|
||||||
enable_extension gearman extension
|
enable_extension gearman extension
|
||||||
if ! check_extension gearman; then
|
if ! check_extension gearman; then
|
||||||
@ -18,7 +17,7 @@ add_gearman_helper() {
|
|||||||
add_gearman() {
|
add_gearman() {
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
if [ "$(uname -s)" = 'Linux' ]; then
|
if [ "$(uname -s)" = 'Linux' ]; then
|
||||||
add_gearman_helper >/dev/null 2>&1
|
add_gearman_helper
|
||||||
add_extension_log "gearman" "$status"
|
add_extension_log "gearman" "$status"
|
||||||
else
|
else
|
||||||
add_brew_extension gearman extension
|
add_brew_extension gearman extension
|
||||||
|
@ -11,7 +11,7 @@ add_geos() {
|
|||||||
if check_extension "geos"; then
|
if check_extension "geos"; then
|
||||||
add_log "${tick:?}" "geos" "Enabled"
|
add_log "${tick:?}" "geos" "Enabled"
|
||||||
else
|
else
|
||||||
add_geos_helper >/dev/null 2>&1
|
add_geos_helper
|
||||||
add_extension_log "geos" "Installed and enabled"
|
add_extension_log "geos" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -40,12 +40,12 @@ Function Repair-ICU() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Http() {
|
Function Add-Http() {
|
||||||
Add-Extension iconv >$null 2>&1
|
Add-Extension iconv
|
||||||
Add-Extension raphf >$null 2>&1
|
Add-Extension raphf
|
||||||
if($version -lt '8.0') {
|
if($version -lt '8.0') {
|
||||||
Add-Extension propro >$null 2>&1
|
Add-Extension propro
|
||||||
}
|
}
|
||||||
Add-Extension pecl_http >$null 2>&1
|
Add-Extension pecl_http
|
||||||
Repair-ICU
|
Repair-ICU
|
||||||
Add-ExtensionLog http "Installed and enabled"
|
Add-ExtensionLog http "Installed and enabled"
|
||||||
}
|
}
|
@ -75,7 +75,7 @@ add_http_latest() {
|
|||||||
if [ "$os" = "Linux" ]; then
|
if [ "$os" = "Linux" ]; then
|
||||||
add_http_dependencies
|
add_http_dependencies
|
||||||
package="php$version-http"
|
package="php$version-http"
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
|
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
|
||||||
else
|
else
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
||||||
@ -103,9 +103,9 @@ add_http() {
|
|||||||
ext=$1
|
ext=$1
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
||||||
add_http_latest >/dev/null 2>&1
|
add_http_latest
|
||||||
else
|
else
|
||||||
add_http_version "$ext" >/dev/null 2>&1
|
add_http_version "$ext"
|
||||||
fi
|
fi
|
||||||
add_extension_log "http" "$status"
|
add_extension_log "http" "$status"
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,9 +16,12 @@ add_intl() {
|
|||||||
add_log "${cross:?}" "intl" "ICU $icu is not supported"
|
add_log "${cross:?}" "intl" "ICU $icu is not supported"
|
||||||
else
|
else
|
||||||
[ "${ts:?}" = 'zts' ] && suffix='-zts'
|
[ "${ts:?}" = 'zts' ] && suffix='-zts'
|
||||||
install_icu "$icu" >/dev/null 2>&1
|
install_icu "$icu"
|
||||||
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=''
|
||||||
|
@ -24,10 +24,10 @@ add_ioncube() {
|
|||||||
if [ -e "$loader_file" ]; then
|
if [ -e "$loader_file" ]; then
|
||||||
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
|
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
|
||||||
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
|
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
|
||||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
|
||||||
fi
|
fi
|
||||||
add_extension_log "ioncube" "$status"
|
add_extension_log "ioncube" "$status"
|
||||||
check_extension "ioncube" && add_license_log
|
check_extension "ioncube" && add_license_log
|
||||||
|
@ -71,7 +71,7 @@ Function Add-Oci() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
Add-ExtensionLog $extension $status
|
Add-ExtensionLog $extension $status
|
||||||
Add-LicenseLog
|
Add-LicenseLog
|
||||||
|
@ -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
|
||||||
unzip -o "/opt/oracle/$package.zip" -d "$oracle_home"
|
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"
|
||||||
|
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
|
||||||
}
|
}
|
||||||
@ -63,8 +71,8 @@ add_oci() {
|
|||||||
oracle_home='/opt/oracle'
|
oracle_home='/opt/oracle'
|
||||||
oracle_client=$oracle_home/instantclient
|
oracle_client=$oracle_home/instantclient
|
||||||
os=$(uname -s)
|
os=$(uname -s)
|
||||||
add_client >/dev/null 2>&1
|
add_client
|
||||||
add_oci_helper >/dev/null 2>&1
|
add_oci_helper
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ add_phalcon_helper() {
|
|||||||
add_brew_extension "$extension" extension
|
add_brew_extension "$extension" extension
|
||||||
else
|
else
|
||||||
package="php${version:?}-$extension"
|
package="php${version:?}-$extension"
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
[[ "$extension" =~ phalcon[4|5] ]] && (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
|
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
|
||||||
fi
|
fi
|
||||||
@ -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)
|
||||||
@ -94,7 +94,7 @@ add_phalcon() {
|
|||||||
[ "$extension" = "phalcon" ] && extension=phalcon5
|
[ "$extension" = "phalcon" ] && extension=phalcon5
|
||||||
extension_major_version=${extension: -1}
|
extension_major_version=${extension: -1}
|
||||||
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
||||||
add_phalcon"$extension_major_version" >/dev/null 2>&1
|
add_phalcon"$extension_major_version"
|
||||||
fi
|
fi
|
||||||
add_extension_log "phalcon" "$status"
|
add_extension_log "phalcon" "$status"
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,13 +152,13 @@ add_relay() {
|
|||||||
relay_releases=https://github.com/cachewerk/relay/releases
|
relay_releases=https://github.com/cachewerk/relay/releases
|
||||||
relay_trunk=https://builds.r2.relay.so
|
relay_trunk=https://builds.r2.relay.so
|
||||||
relay_version=$(get_relay_version "$ext")
|
relay_version=$(get_relay_version "$ext")
|
||||||
add_relay_dependencies >/dev/null 2>&1
|
add_relay_dependencies
|
||||||
if shared_extension relay; then
|
if shared_extension relay; then
|
||||||
message="Enabled"
|
message="Enabled"
|
||||||
else
|
else
|
||||||
add_relay_helper >/dev/null 2>&1
|
add_relay_helper
|
||||||
message="Installed and enabled"
|
message="Installed and enabled"
|
||||||
fi
|
fi
|
||||||
configure_relay >/dev/null 2>&1
|
configure_relay
|
||||||
add_extension_log relay "$message"
|
add_extension_log relay "$message"
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ check_lib() {
|
|||||||
add_linux_libs() {
|
add_linux_libs() {
|
||||||
local lib=$1
|
local lib=$1
|
||||||
if ! check_lib "$lib"; then
|
if ! check_lib "$lib"; then
|
||||||
install_packages "$lib" >/dev/null 2>&1 || true
|
install_packages "$lib" || true
|
||||||
fi
|
fi
|
||||||
add_lib_log "$lib"
|
add_lib_log "$lib"
|
||||||
}
|
}
|
||||||
@ -56,9 +56,9 @@ add_linux_libs() {
|
|||||||
add_darwin_libs() {
|
add_darwin_libs() {
|
||||||
local lib=$1
|
local lib=$1
|
||||||
if ! check_lib "$lib"; then
|
if ! check_lib "$lib"; then
|
||||||
brew install "$lib" >/dev/null 2>&1 || true
|
brew install "$lib" || true
|
||||||
if [[ "$lib" = *@* ]]; then
|
if [[ "$lib" = *@* ]]; then
|
||||||
brew link --overwrite --force "$lib" >/dev/null 2>&1 || true
|
brew link --overwrite --force "$lib" || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
add_lib_log "$lib"
|
add_lib_log "$lib"
|
||||||
@ -80,11 +80,13 @@ add_libs() {
|
|||||||
run_group() {
|
run_group() {
|
||||||
local command=$1
|
local command=$1
|
||||||
local log=$2
|
local log=$2
|
||||||
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
|
echo "$command" | sudo tee ./run_group.sh
|
||||||
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() {
|
||||||
@ -141,7 +143,7 @@ add_extension_from_source() {
|
|||||||
sub_dir="$(parse_args "$extension" PATH)"
|
sub_dir="$(parse_args "$extension" PATH)"
|
||||||
step_log "Setup $slug"
|
step_log "Setup $slug"
|
||||||
(
|
(
|
||||||
add_devtools phpize >/dev/null 2>&1
|
add_devtools phpize
|
||||||
disable_extension_helper "$extension"
|
disable_extension_helper "$extension"
|
||||||
fetch_extension "$extension" "$fetch"
|
fetch_extension "$extension" "$fetch"
|
||||||
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
|
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
|
||||||
@ -149,11 +151,11 @@ add_extension_from_source() {
|
|||||||
else
|
else
|
||||||
[[ -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"
|
||||||
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
|
||||||
)
|
)
|
||||||
|
@ -67,10 +67,10 @@ Function Add-Sqlsrv() {
|
|||||||
Add-ExtensionFromGithub $extension > $null 2>&1
|
Add-ExtensionFromGithub $extension > $null 2>&1
|
||||||
} catch {}
|
} catch {}
|
||||||
if (-not(Test-Extension $extension)) {
|
if (-not(Test-Extension $extension)) {
|
||||||
Add-SqlsrvFromMSGithub $extension >$null 2>&1
|
Add-SqlsrvFromMSGithub $extension
|
||||||
}
|
}
|
||||||
if (-not(Test-Extension $extension)) {
|
if (-not(Test-Extension $extension)) {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
}
|
}
|
||||||
|
@ -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')
|
||||||
@ -74,7 +77,7 @@ Function Add-ZephirParser() {
|
|||||||
try {
|
try {
|
||||||
Add-ZephirParserFromGitHub $extension
|
Add-ZephirParserFromGitHub $extension
|
||||||
} catch {
|
} catch {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Add-ExtensionLog zephir_parser $status
|
Add-ExtensionLog zephir_parser $status
|
||||||
|
@ -33,7 +33,7 @@ add_zephir_parser() {
|
|||||||
zp_releases=https://github.com/"$repo"/releases
|
zp_releases=https://github.com/"$repo"/releases
|
||||||
if ! shared_extension zephir_parser; then
|
if ! shared_extension zephir_parser; then
|
||||||
message='Installed and enabled'
|
message='Installed and enabled'
|
||||||
add_zephir_parser_helper "$ext" >/dev/null 2>&1
|
add_zephir_parser_helper "$ext"
|
||||||
else
|
else
|
||||||
message='Enabled'
|
message='Enabled'
|
||||||
enable_extension zephir_parser extension
|
enable_extension zephir_parser extension
|
||||||
|
@ -20,22 +20,23 @@ 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 || 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
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to fix broken packages.
|
# Function to fix broken packages.
|
||||||
fix_broken_packages() {
|
fix_broken_packages() {
|
||||||
sudo apt --fix-broken install >/dev/null 2>&1
|
sudo apt --fix-broken install
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install a package
|
# Function to install a package
|
||||||
install_packages() {
|
install_packages() {
|
||||||
packages=("$@")
|
packages=("$@")
|
||||||
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
|
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
|
||||||
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew >/dev/null 2>&1
|
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew
|
||||||
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
|
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
|
||||||
fi
|
fi
|
||||||
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
|
$apt_install "${packages[@]}" || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" )
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to disable an extension.
|
# Function to disable an extension.
|
||||||
@ -47,10 +48,10 @@ disable_extension_helper() {
|
|||||||
disable_extension_dependents "$extension"
|
disable_extension_dependents "$extension"
|
||||||
fi
|
fi
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "${ini_file[@]}" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "${ini_file[@]}" "$pecl_file"
|
||||||
sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
|
sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
|
||||||
sudo rm -f /tmp/php"$version"_extensions
|
sudo rm -f /tmp/php"$version"_extensions
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
|
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add PDO extension.
|
# Function to add PDO extension.
|
||||||
@ -63,7 +64,7 @@ add_pdo_extension() {
|
|||||||
ext_name=$1
|
ext_name=$1
|
||||||
if shared_extension pdo; then
|
if shared_extension pdo; then
|
||||||
disable_extension_helper pdo
|
disable_extension_helper pdo
|
||||||
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}"
|
||||||
fi
|
fi
|
||||||
if [ "$ext" = "mysql" ]; then
|
if [ "$ext" = "mysql" ]; then
|
||||||
enable_extension "mysqlnd" "extension"
|
enable_extension "mysqlnd" "extension"
|
||||||
@ -71,15 +72,15 @@ add_pdo_extension() {
|
|||||||
elif [ "$ext" = "dblib" ]; then
|
elif [ "$ext" = "dblib" ]; then
|
||||||
ext_name="sybase"
|
ext_name="sybase"
|
||||||
elif [ "$ext" = "firebird" ]; then
|
elif [ "$ext" = "firebird" ]; then
|
||||||
install_packages libfbclient2 >/dev/null 2>&1
|
install_packages libfbclient2
|
||||||
enable_extension "pdo_firebird" "extension"
|
enable_extension "pdo_firebird" "extension"
|
||||||
ext_name="interbase"
|
ext_name="interbase"
|
||||||
elif [ "$ext" = "sqlite" ]; then
|
elif [ "$ext" = "sqlite" ]; then
|
||||||
ext="sqlite3"
|
ext="sqlite3"
|
||||||
ext_name="sqlite3"
|
ext_name="sqlite3"
|
||||||
fi
|
fi
|
||||||
add_extension "$ext_name" "extension" >/dev/null 2>&1
|
add_extension "$ext_name" "extension"
|
||||||
add_extension "$pdo_ext" "extension" >/dev/null 2>&1
|
add_extension "$pdo_ext" "extension"
|
||||||
add_extension_log "$pdo_ext" "Enabled"
|
add_extension_log "$pdo_ext" "Enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -93,7 +94,7 @@ check_package() {
|
|||||||
add_extension_helper() {
|
add_extension_helper() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
packages=(php"$version"-"$extension")
|
packages=(php"$version"-"$extension")
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
||||||
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
|
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
@ -107,7 +108,7 @@ add_devtools() {
|
|||||||
install_packages "php$version-dev"
|
install_packages "php$version-dev"
|
||||||
fi
|
fi
|
||||||
switch_version "phpize" "php-config"
|
switch_version "phpize" "php-config"
|
||||||
add_extension xml extension >/dev/null 2>&1
|
add_extension xml extension
|
||||||
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,11 +129,11 @@ setup_cached_versions() {
|
|||||||
|
|
||||||
# Function to add PECL.
|
# Function to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
add_devtools phpize >/dev/null 2>&1
|
add_devtools phpize
|
||||||
if ! command -v pecl >/dev/null; then
|
if ! command -v pecl >/dev/null; then
|
||||||
install_packages php-pear
|
install_packages php-pear
|
||||||
fi
|
fi
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl
|
||||||
pear_version=$(get_tool_version "pecl" "version")
|
pear_version=$(get_tool_version "pecl" "version")
|
||||||
add_log "${tick:?}" "PECL" "Added PECL $pear_version"
|
add_log "${tick:?}" "PECL" "Added PECL $pear_version"
|
||||||
}
|
}
|
||||||
@ -166,7 +167,7 @@ get_php_packages() {
|
|||||||
|
|
||||||
# Function to install packaged PHP
|
# Function to install packaged PHP
|
||||||
add_packaged_php() {
|
add_packaged_php() {
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
||||||
install_packages "${packages[@]}"
|
install_packages "${packages[@]}"
|
||||||
}
|
}
|
||||||
@ -190,7 +191,7 @@ add_php() {
|
|||||||
setup_php_builder
|
setup_php_builder
|
||||||
else
|
else
|
||||||
add_packaged_php
|
add_packaged_php
|
||||||
switch_version >/dev/null 2>&1
|
switch_version
|
||||||
add_pecl
|
add_pecl
|
||||||
fi
|
fi
|
||||||
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
@ -203,7 +204,7 @@ add_php() {
|
|||||||
|
|
||||||
# Function to ini file for pear and link it to each SAPI.
|
# Function to ini file for pear and link it to each SAPI.
|
||||||
link_pecl_file() {
|
link_pecl_file() {
|
||||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
echo '' | sudo tee "$pecl_file"
|
||||||
for file in "${ini_file[@]}"; do
|
for file in "${ini_file[@]}"; do
|
||||||
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
|
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
|
||||||
if [ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ]; then
|
if [ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ]; then
|
||||||
@ -236,9 +237,9 @@ add_php_config() {
|
|||||||
elif [ "$ini" = "development" ]; then
|
elif [ "$ini" = "development" ]; then
|
||||||
echo "${ini_file[@]}" | xargs -n 1 -P 6 sudo cp "$php_lib_dir"/php.ini-development
|
echo "${ini_file[@]}" | xargs -n 1 -P 6 sudo cp "$php_lib_dir"/php.ini-development
|
||||||
elif [ "$ini" = "none" ]; then
|
elif [ "$ini" = "none" ]; then
|
||||||
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
|
echo '' | sudo tee "${ini_file[@]}"
|
||||||
fi
|
fi
|
||||||
echo "$ini" | sudo tee "$current_ini" >/dev/null 2>&1
|
echo "$ini" | sudo tee "$current_ini"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to Setup PHP
|
# Function to Setup PHP
|
||||||
@ -249,13 +250,13 @@ setup_php() {
|
|||||||
check_pre_installed
|
check_pre_installed
|
||||||
if [[ -z "$php_config" ]] || [ "$(php_semver | cut -c 1-3)" != "$version" ]; then
|
if [[ -z "$php_config" ]] || [ "$(php_semver | cut -c 1-3)" != "$version" ]; then
|
||||||
if [ ! -e "/usr/bin/php$version" ] || [ ! -e "/usr/bin/php-config$version" ]; then
|
if [ ! -e "/usr/bin/php$version" ] || [ ! -e "/usr/bin/php-config$version" ]; then
|
||||||
add_php >/dev/null 2>&1
|
add_php
|
||||||
else
|
else
|
||||||
if ! [[ "$version" =~ ${old_versions:?} ]]; then
|
if ! [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
switch_version >/dev/null 2>&1
|
switch_version
|
||||||
fi
|
fi
|
||||||
if [ "${update:?}" = "true" ]; then
|
if [ "${update:?}" = "true" ]; then
|
||||||
update_php >/dev/null 2>&1
|
update_php
|
||||||
else
|
else
|
||||||
status="Switched to"
|
status="Switched to"
|
||||||
fi
|
fi
|
||||||
@ -263,7 +264,7 @@ setup_php() {
|
|||||||
php_config="$(command -v php-config)"
|
php_config="$(command -v php-config)"
|
||||||
else
|
else
|
||||||
if [ "$update" = "true" ]; then
|
if [ "$update" = "true" ]; then
|
||||||
update_php >/dev/null 2>&1
|
update_php
|
||||||
else
|
else
|
||||||
status="Found"
|
status="Found"
|
||||||
fi
|
fi
|
||||||
@ -283,7 +284,7 @@ setup_php() {
|
|||||||
link_pecl_file
|
link_pecl_file
|
||||||
configure_php
|
configure_php
|
||||||
set_output "php-version" "$semver"
|
set_output "php-version" "$semver"
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit
|
||||||
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
||||||
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
||||||
@ -297,8 +298,8 @@ debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
|||||||
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
|
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
|
||||||
scripts="$src"/scripts
|
scripts="$src"/scripts
|
||||||
|
|
||||||
add_sudo >/dev/null 2>&1
|
add_sudo
|
||||||
link_apt_fast >/dev/null 2>&1
|
link_apt_fast
|
||||||
|
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
# shellcheck source=.
|
# shellcheck source=.
|
||||||
|
@ -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.
|
||||||
@ -121,7 +126,7 @@ Function Add-ToolsHelper() {
|
|||||||
$extensions += @('json', 'tokenizer')
|
$extensions += @('json', 'tokenizer')
|
||||||
} elseif($tool -eq "phpDocumentor") {
|
} elseif($tool -eq "phpDocumentor") {
|
||||||
$extensions+=('ctype', 'hash', 'json', 'fileinfo', 'iconv', 'mbstring', 'simplexml', 'xml')
|
$extensions+=('ctype', 'hash', 'json', 'fileinfo', 'iconv', 'mbstring', 'simplexml', 'xml')
|
||||||
Add-Extension fileinfo >$null 2>&1
|
Add-Extension fileinfo
|
||||||
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
||||||
} elseif($tool -eq "phpunit") {
|
} elseif($tool -eq "phpunit") {
|
||||||
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
|
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
|
||||||
@ -134,7 +139,7 @@ Function Add-ToolsHelper() {
|
|||||||
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
||||||
}
|
}
|
||||||
foreach($extension in $extensions) {
|
foreach($extension in $extensions) {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +186,7 @@ Function Add-Tool() {
|
|||||||
$bat_content += "php %BIN_TARGET% %*"
|
$bat_content += "php %BIN_TARGET% %*"
|
||||||
Set-Content -Path $bin_dir\$tool.bat -Value $bat_content
|
Set-Content -Path $bin_dir\$tool.bat -Value $bat_content
|
||||||
Add-ToolsHelper $tool
|
Add-ToolsHelper $tool
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat" >$null 2>&1
|
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat"
|
||||||
$tool_version = Get-ToolVersion $tool $ver_param
|
$tool_version = Get-ToolVersion $tool $ver_param
|
||||||
Add-Log $tick $tool "Added $tool $tool_version"
|
Add-Log $tick $tool "Added $tool $tool_version"
|
||||||
} else {
|
} else {
|
||||||
@ -221,9 +226,9 @@ Function Add-ComposerToolHelper() {
|
|||||||
Remove-Item -Path $composer_lock -Force
|
Remove-Item -Path $composer_lock -Force
|
||||||
}
|
}
|
||||||
if((composer global show $prefix$tool $tool_version -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
if((composer global show $prefix$tool $tool_version -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
||||||
composer global config --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
|
composer global config --no-plugins allow-plugins."$prefix$tool" true
|
||||||
}
|
}
|
||||||
composer global require $prefix$release $composer_args >$null 2>&1
|
composer global require $prefix$release $composer_args
|
||||||
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
||||||
} else {
|
} else {
|
||||||
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
||||||
@ -234,9 +239,9 @@ Function Add-ComposerToolHelper() {
|
|||||||
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
|
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
|
||||||
Set-Content -Path $scoped_dir\composer.json -Value "{}"
|
Set-Content -Path $scoped_dir\composer.json -Value "{}"
|
||||||
if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
||||||
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
|
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true
|
||||||
}
|
}
|
||||||
composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1
|
composer require $prefix$release -d $unix_scoped_dir $composer_args
|
||||||
}
|
}
|
||||||
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")
|
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")
|
||||||
Add-Path $scoped_dir\vendor\bin
|
Add-Path $scoped_dir\vendor\bin
|
||||||
|
@ -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
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper function to configure tools.
|
# Helper function to configure tools.
|
||||||
@ -132,7 +136,7 @@ add_tools_helper() {
|
|||||||
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}"
|
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}"
|
||||||
fi
|
fi
|
||||||
for extension in "${extensions[@]}"; do
|
for extension in "${extensions[@]}"; do
|
||||||
add_extension "$extension" extension >/dev/null 2>&1
|
add_extension "$extension" extension
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,22 +183,22 @@ add_composer_tool_helper() {
|
|||||||
enable_extensions curl mbstring openssl
|
enable_extensions curl mbstring openssl
|
||||||
tool_version=${release##*:}; [ "$tool_version" = "$tool" ] && tool_version="*"
|
tool_version=${release##*:}; [ "$tool_version" = "$tool" ] && tool_version="*"
|
||||||
if [ "$scope" = "global" ]; then
|
if [ "$scope" = "global" ]; then
|
||||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
sudo rm -f "$composer_lock" || true
|
||||||
if composer global show "$prefix$tool" "$tool_version" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
if composer global show "$prefix$tool" "$tool_version" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
||||||
composer global config --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
|
composer global config --no-plugins allow-plugins."$prefix$tool" true
|
||||||
fi
|
fi
|
||||||
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
|
composer global require "$prefix$release" "$composer_args"
|
||||||
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log
|
||||||
else
|
else
|
||||||
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
||||||
if ! [ -d "$scoped_dir" ]; then
|
if ! [ -d "$scoped_dir" ]; then
|
||||||
mkdir -p "$scoped_dir"
|
mkdir -p "$scoped_dir"
|
||||||
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
|
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
|
||||||
if composer show "$prefix$tool" "$tool_version" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
if composer show "$prefix$tool" "$tool_version" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
||||||
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
|
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true
|
||||||
fi
|
fi
|
||||||
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
|
composer require "$prefix$release" -d "$scoped_dir" "$composer_args"
|
||||||
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log
|
||||||
fi
|
fi
|
||||||
add_path "$scoped_dir"/vendor/bin
|
add_path "$scoped_dir"/vendor/bin
|
||||||
fi
|
fi
|
||||||
|
@ -6,14 +6,14 @@ Function Add-Blackfire() {
|
|||||||
}
|
}
|
||||||
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
||||||
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
||||||
Get-File -Url $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\blackfire.zip
|
||||||
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force
|
||||||
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
||||||
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
||||||
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1
|
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN
|
||||||
}
|
}
|
||||||
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
||||||
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
|
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem
|
||||||
}
|
}
|
||||||
Add-Log $tick "blackfire" "Added blackfire $cli_version"
|
Add-Log $tick "blackfire" "Added blackfire $cli_version"
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ blackfire_config() {
|
|||||||
# Function to add blackfire cli.
|
# Function to add blackfire cli.
|
||||||
add_blackfire() {
|
add_blackfire() {
|
||||||
os="$(uname -s)"
|
os="$(uname -s)"
|
||||||
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
[ "$os" = "Linux" ] && add_blackfire_linux
|
||||||
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
|
[ "$os" = "Darwin" ] && add_blackfire_darwin
|
||||||
blackfire_config >/dev/null 2>&1
|
blackfire_config
|
||||||
tool_version=$(get_tool_version "blackfire" "version")
|
tool_version=$(get_tool_version "blackfire" "version")
|
||||||
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ add_brew_tap() {
|
|||||||
tap=$1
|
tap=$1
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
if [ "${runner:?}" = "self-hosted" ]; then
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
brew tap "$tap" >/dev/null 2>&1
|
brew tap "$tap"
|
||||||
else
|
else
|
||||||
fetch_brew_tap "$tap" >/dev/null 2>&1
|
fetch_brew_tap "$tap"
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
brew tap "$tap" >/dev/null 2>&1
|
brew tap "$tap"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -49,7 +49,7 @@ add_brew() {
|
|||||||
brew_prefix="$(get_brew_prefix)"
|
brew_prefix="$(get_brew_prefix)"
|
||||||
if ! [ -d "$brew_prefix"/bin ]; then
|
if ! [ -d "$brew_prefix"/bin ]; then
|
||||||
step_log "Setup Brew"
|
step_log "Setup Brew"
|
||||||
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/master/install.sh" | bash -s >/dev/null 2>&1
|
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/master/install.sh" | bash -s
|
||||||
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
||||||
fi
|
fi
|
||||||
add_brew_bins_to_path "$brew_prefix"
|
add_brew_bins_to_path "$brew_prefix"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Function Add-Msys2() {
|
Function Add-Msys2() {
|
||||||
$msys_location = 'C:\msys64'
|
$msys_location = 'C:\msys64'
|
||||||
if (-not(Test-Path $msys_location)) {
|
if (-not(Test-Path $msys_location)) {
|
||||||
choco install msys2 -y >$null 2>&1
|
choco install msys2 -y
|
||||||
$msys_location = 'C:\tools\msys64'
|
$msys_location = 'C:\tools\msys64'
|
||||||
}
|
}
|
||||||
return $msys_location
|
return $msys_location
|
||||||
@ -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"
|
||||||
$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"
|
||||||
|
@ -26,7 +26,7 @@ add_grpc_php_plugin_brew() {
|
|||||||
configure_brew
|
configure_brew
|
||||||
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
|
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
|
||||||
brew install grpc
|
brew install grpc
|
||||||
brew link --force --overwrite grpc >/dev/null 2>&1
|
brew link --force --overwrite grpc
|
||||||
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
|
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
|
||||||
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
||||||
license_path="$(brew --prefix grpc)/LICENSE"
|
license_path="$(brew --prefix grpc)/LICENSE"
|
||||||
@ -50,9 +50,9 @@ add_grpc_php_plugin() {
|
|||||||
grpc_tag=$1
|
grpc_tag=$1
|
||||||
license_path=""
|
license_path=""
|
||||||
if [ "$grpc_tag" = "latest" ]; then
|
if [ "$grpc_tag" = "latest" ]; then
|
||||||
add_grpc_php_plugin_brew >/dev/null 2>&1
|
add_grpc_php_plugin_brew
|
||||||
else
|
else
|
||||||
add_grpc_php_plugin_compile >/dev/null 2>&1
|
add_grpc_php_plugin_compile
|
||||||
fi
|
fi
|
||||||
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
||||||
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
||||||
|
36
src/scripts/tools/mago.ps1
Normal file
36
src/scripts/tools/mago.ps1
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Function Get-MagoTag() {
|
||||||
|
$releases = 'https://github.com/carthage-software/mago/releases'
|
||||||
|
if("$mago_tag" -eq "latest") {
|
||||||
|
$mago_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
[net.httpWebRequest] $request = [net.webRequest]::create("$releases/tag/$mago_tag")
|
||||||
|
$request.Method = "HEAD"
|
||||||
|
[net.httpWebResponse] $response = $request.getResponse()
|
||||||
|
$response.Close()
|
||||||
|
$mago_tag = "$mago_tag"
|
||||||
|
} catch {
|
||||||
|
$mago_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $mago_tag
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Add-Mago() {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true, Position = 0, HelpMessage = 'The mago version to be installed')]
|
||||||
|
[ValidatePattern('^latest$|^\d+\.\d+\.\d+$')]
|
||||||
|
[string] $mago_tag
|
||||||
|
)
|
||||||
|
$mago_tag = Get-MagoTag
|
||||||
|
$arch_name = 'x86_64'
|
||||||
|
if(-not([Environment]::Is64BitOperatingSystem)) {
|
||||||
|
$arch_name = 'i686'
|
||||||
|
}
|
||||||
|
$url = "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch_name-pc-windows-msvc.zip"
|
||||||
|
Get-File -Url $url -OutFile $bin_dir\mago.zip
|
||||||
|
Expand-Archive -Path $bin_dir\mago.zip -DestinationPath $bin_dir\mago -Force
|
||||||
|
Move-Item -Path $bin_dir\mago\mago-$mago_tag-$arch_name-pc-windows-msvc\mago.exe -Destination $bin_dir\mago.exe -Force
|
||||||
|
Add-ToProfile $current_profile 'mago' "New-Alias mago $bin_dir\mago.exe"
|
||||||
|
Add-Log $tick "mago" "Added mago $mago_tag"
|
||||||
|
}
|
29
src/scripts/tools/mago.sh
Normal file
29
src/scripts/tools/mago.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
get_mago_tag() {
|
||||||
|
if [ "$mago_tag" = "latest" ]; then
|
||||||
|
mago_tag=$(get -s -n "" https://github.com/carthage-software/mago/releases/latest 2<&1 | grep -m 1 -Eo "tag/([0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
|
||||||
|
else
|
||||||
|
status_code=$(get -v -n /tmp/mago.tmp "https://github.com/carthage-software/mago/releases/tag/$mago_tag")
|
||||||
|
if [ "$status_code" = "200" ]; then
|
||||||
|
mago_tag="$mago_tag"
|
||||||
|
else
|
||||||
|
mago_tag=$(get -s -n "" https://github.com/carthage-software/mago/releases/latest 2<&1 | grep -m 1 -Eo "tag/([0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_mago() {
|
||||||
|
mago_tag=$1
|
||||||
|
get_mago_tag
|
||||||
|
(
|
||||||
|
platform='unknown-linux-gnu'
|
||||||
|
[ "$(uname -s)" = "Darwin" ] && platform='apple-darwin'
|
||||||
|
arch="$(uname -m)"
|
||||||
|
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch='aarch64'
|
||||||
|
[[ "$arch" = 'x86_64' || "$arch" = 'amd64' ]] && arch='x86_64'
|
||||||
|
get -q -n /tmp/mago.tar.gz "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch-$platform.tar.gz"
|
||||||
|
sudo tar -xzf /tmp/mago.tar.gz -C /tmp/
|
||||||
|
sudo mv /tmp/mago-$mago_tag-$arch-$platform/mago /usr/local/bin/mago
|
||||||
|
sudo chmod +x /usr/local/bin/mago
|
||||||
|
)
|
||||||
|
add_log "${tick:?}" "mago" "Added mago $mago_tag"
|
||||||
|
}
|
@ -31,7 +31,7 @@ set_base_version() {
|
|||||||
else
|
else
|
||||||
set_base_version_codename
|
set_base_version_codename
|
||||||
set_base_version_id
|
set_base_version_id
|
||||||
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release >/dev/null 2>&1
|
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,15 +59,15 @@ update_lists() {
|
|||||||
list="$list_file"
|
list="$list_file"
|
||||||
fi
|
fi
|
||||||
if [ ! -e "$status_file" ]; then
|
if [ ! -e "$status_file" ]; then
|
||||||
update_lists_helper "$list" >/dev/null 2>&1
|
update_lists_helper "$list"
|
||||||
echo '' | tee "$status_file" >/dev/null 2>&1
|
echo '' | tee "$status_file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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,14 +88,14 @@ 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"}")
|
||||||
fi
|
fi
|
||||||
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
||||||
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
||||||
sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"
|
sudo gpg --batch --yes --dearmor "$key_file" && sudo mv "$key_file".gpg "$key_file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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
|
||||||
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 10 --max-time 10 --head --fail "$lpc_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add the PPA mirror.
|
# Function to add the PPA mirror.
|
||||||
@ -171,8 +172,8 @@ add_ppa_sp_mirror() {
|
|||||||
ppa=$1
|
ppa=$1
|
||||||
ppa_name="$(basename "$ppa")"
|
ppa_name="$(basename "$ppa")"
|
||||||
remove_list "$ppa" || true
|
remove_list "$ppa" || true
|
||||||
[ "${debug:?}" = "debug" ] && add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg" "$VERSION_CODENAME" "main/debug"
|
[ "${debug:?}" = "debug" ] && add_list sp/"$ppa_name" "$ppa_sp/$ppa/ubuntu" "$ppa_sp/$ppa/ubuntu/key.gpg" "$VERSION_CODENAME" "main/debug"
|
||||||
add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg"
|
add_list sp/"$ppa_name" "$ppa_sp/$ppa/ubuntu" "$ppa_sp/$ppa/ubuntu/key.gpg"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add a PPA.
|
# Function to add a PPA.
|
||||||
@ -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/https:\/\/}" {} \; -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,12 +216,16 @@ 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'
|
||||||
dist_info_dir='/usr/share/distro-info'
|
dist_info_dir='/usr/share/distro-info'
|
||||||
sury='https://packages.sury.org'
|
sury='https://packages.sury.org'
|
||||||
|
ppa_sp='https://ppa.setup-php.com'
|
||||||
sp='https://setup-php.com'
|
sp='https://setup-php.com'
|
||||||
sks=(
|
sks=(
|
||||||
'https://keyserver.ubuntu.com'
|
'https://keyserver.ubuntu.com'
|
||||||
|
@ -29,8 +29,8 @@ Function Add-Protoc() {
|
|||||||
$arch_num = '32'
|
$arch_num = '32'
|
||||||
}
|
}
|
||||||
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
||||||
Get-File -Url $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\protoc.zip
|
||||||
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force
|
||||||
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
||||||
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
||||||
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
||||||
|
@ -17,10 +17,12 @@ 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
|
)
|
||||||
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
||||||
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
||||||
|
@ -4,8 +4,8 @@ Function Add-Symfony() {
|
|||||||
$arch_name = '386'
|
$arch_name = '386'
|
||||||
}
|
}
|
||||||
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
||||||
Get-File -Url $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\symfony.zip
|
||||||
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force
|
||||||
if(Test-Path $bin_dir\symfony.exe) {
|
if(Test-Path $bin_dir\symfony.exe) {
|
||||||
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
||||||
Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
|
Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
|
||||||
|
@ -29,7 +29,7 @@ add_symfony_helper() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_symfony() {
|
add_symfony() {
|
||||||
add_symfony_helper >/dev/null 2>&1
|
add_symfony_helper
|
||||||
symfony_path="$(command -v symfony)"
|
symfony_path="$(command -v symfony)"
|
||||||
if [[ -n "$symfony_path" ]]; then
|
if [[ -n "$symfony_path" ]]; then
|
||||||
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
|
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
|
||||||
|
@ -43,7 +43,7 @@ set_output() {
|
|||||||
name=$1
|
name=$1
|
||||||
value=$2
|
value=$2
|
||||||
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
||||||
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT" >/dev/null 2>&1
|
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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
|
||||||
@ -65,7 +68,7 @@ read_env() {
|
|||||||
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
|
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
|
||||||
if ! check_ppa ondrej/php; then
|
if ! check_ppa ondrej/php; then
|
||||||
update=true
|
update=true
|
||||||
echo '' | sudo tee /tmp/sp_update >/dev/null 2>&1
|
echo '' | sudo tee /tmp/sp_update
|
||||||
elif [ -e /tmp/sp_update ]; then
|
elif [ -e /tmp/sp_update ]; then
|
||||||
update=true
|
update=true
|
||||||
fi
|
fi
|
||||||
@ -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" ; 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
|
||||||
|
trap 'release_lock "$lock_path"' EXIT SIGINT SIGTERM
|
||||||
fi
|
fi
|
||||||
trap 'sudo rm -rf "$lock_path"' EXIT SIGINT SIGTERM
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,10 +171,10 @@ add_path() {
|
|||||||
path_to_add=$1
|
path_to_add=$1
|
||||||
[[ ":$PATH:" == *":$path_to_add:"* ]] && return
|
[[ ":$PATH:" == *":$path_to_add:"* ]] && return
|
||||||
if [[ -n "$GITHUB_PATH" ]]; then
|
if [[ -n "$GITHUB_PATH" ]]; then
|
||||||
echo "$path_to_add" | tee -a "$GITHUB_PATH" >/dev/null 2>&1
|
echo "$path_to_add" | tee -a "$GITHUB_PATH"
|
||||||
else
|
else
|
||||||
profile=$(get_shell_profile)
|
profile=$(get_shell_profile)
|
||||||
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile" >/dev/null 2>&1
|
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile"
|
||||||
fi
|
fi
|
||||||
export PATH="${PATH:+${PATH}:}$path_to_add"
|
export PATH="${PATH:+${PATH}:}$path_to_add"
|
||||||
}
|
}
|
||||||
@ -154,10 +196,10 @@ add_env() {
|
|||||||
env_name=$1
|
env_name=$1
|
||||||
env_value=$2
|
env_value=$2
|
||||||
if [[ -n "$GITHUB_ENV" ]]; then
|
if [[ -n "$GITHUB_ENV" ]]; then
|
||||||
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV" >/dev/null 2>&1
|
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV"
|
||||||
else
|
else
|
||||||
profile=$(get_shell_profile)
|
profile=$(get_shell_profile)
|
||||||
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile" >/dev/null 2>&1
|
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile"
|
||||||
fi
|
fi
|
||||||
export "$env_name"="$env_value"
|
export "$env_name"="$env_value"
|
||||||
}
|
}
|
||||||
@ -178,8 +220,8 @@ self_hosted_setup() {
|
|||||||
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
|
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
self_hosted_helper >/dev/null 2>&1
|
self_hosted_helper
|
||||||
add_env RUNNER_TOOL_CACHE /tmp
|
add_env RUNNER_TOOL_CACHE /opt/hostedtoolcache
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -204,8 +246,8 @@ configure_php() {
|
|||||||
ini_config_files=("$ini_config_dir"/php.ini)
|
ini_config_files=("$ini_config_dir"/php.ini)
|
||||||
jit_config_files=("$ini_config_dir"/jit.ini)
|
jit_config_files=("$ini_config_dir"/jit.ini)
|
||||||
[[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
|
[[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
|
||||||
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}" >/dev/null 2>&1
|
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}"
|
||||||
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1
|
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get PHP version in semver format.
|
# Function to get PHP version in semver format.
|
||||||
|
@ -355,7 +355,7 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|||||||
$bin_dir = 'C:\tools\bin'
|
$bin_dir = 'C:\tools\bin'
|
||||||
$php_dir = "$php_dir$version"
|
$php_dir = "$php_dir$version"
|
||||||
$ext_dir = "$php_dir\ext"
|
$ext_dir = "$php_dir\ext"
|
||||||
Get-CleanPSProfile >$null 2>&1
|
Get-CleanPSProfile
|
||||||
New-Item $bin_dir -Type Directory -Force > $null 2>&1
|
New-Item $bin_dir -Type Directory -Force > $null 2>&1
|
||||||
Add-Path -PathItem $bin_dir
|
Add-Path -PathItem $bin_dir
|
||||||
if($version -lt 5.6) {
|
if($version -lt 5.6) {
|
||||||
@ -368,12 +368,12 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|||||||
}
|
}
|
||||||
New-Item $php_dir -Type Directory -Force > $null 2>&1
|
New-Item $php_dir -Type Directory -Force > $null 2>&1
|
||||||
Add-Path -PathItem $php_dir
|
Add-Path -PathItem $php_dir
|
||||||
setx PHPROOT $php_dir >$null 2>&1
|
setx PHPROOT $php_dir
|
||||||
Add-Env -EnvName RUNNER_TOOL_CACHE -EnvValue $env:TEMP
|
Add-Env -EnvName RUNNER_TOOL_CACHE -EnvValue $env:TEMP
|
||||||
} else {
|
} else {
|
||||||
$current_profile = "$PSHOME\Profile.ps1"
|
$current_profile = "$PSHOME\Profile.ps1"
|
||||||
if(-not(Test-Path -LiteralPath $current_profile)) {
|
if(-not(Test-Path -LiteralPath $current_profile)) {
|
||||||
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
|
New-Item -Path $current_profile -ItemType "file" -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,9 +381,9 @@ $src = Join-Path -Path $PSScriptRoot -ChildPath \..
|
|||||||
. $src\scripts\tools\add_tools.ps1
|
. $src\scripts\tools\add_tools.ps1
|
||||||
. $src\scripts\extensions\add_extensions.ps1
|
. $src\scripts\extensions\add_extensions.ps1
|
||||||
|
|
||||||
Add-Printf >$null 2>&1
|
Add-Printf
|
||||||
Step-Log "Setup PhpManager"
|
Step-Log "Setup PhpManager"
|
||||||
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php >$null 2>&1
|
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php
|
||||||
Add-Log $tick "PhpManager" "Installed"
|
Add-Log $tick "PhpManager" "Installed"
|
||||||
|
|
||||||
Step-Log "Setup PHP"
|
Step-Log "Setup PHP"
|
||||||
@ -412,7 +412,7 @@ if($version -eq 'pre') {
|
|||||||
}
|
}
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
||||||
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ($version -match $nightly_versions) {
|
if ($version -match $nightly_versions) {
|
||||||
@ -425,7 +425,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
} catch { }
|
} catch { }
|
||||||
} else {
|
} else {
|
||||||
if($env:update -eq 'true') {
|
if($env:update -eq 'true') {
|
||||||
Update-Php $php_dir >$null 2>&1
|
Update-Php $php_dir
|
||||||
$status = "Updated to"
|
$status = "Updated to"
|
||||||
} else {
|
} else {
|
||||||
$status = "Found"
|
$status = "Found"
|
||||||
@ -443,7 +443,7 @@ if($installed.MajorMinorVersion -ne $version) {
|
|||||||
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
if($version -lt "5.5") {
|
if($version -lt "5.5") {
|
||||||
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ }
|
||||||
} else {
|
} else {
|
||||||
$enable_extensions += ('opcache')
|
$enable_extensions += ('opcache')
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
23
src/utils.ts
23
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:
|
||||||
@ -278,10 +285,10 @@ export async function getExtensionPrefix(extension: string): Promise<string> {
|
|||||||
export async function suppressOutput(os: string): Promise<string> {
|
export async function suppressOutput(os: string): Promise<string> {
|
||||||
switch (os) {
|
switch (os) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return ' >$null 2>&1';
|
return ' ';
|
||||||
case 'linux':
|
case 'linux':
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return ' >/dev/null 2>&1';
|
return ' ';
|
||||||
default:
|
default:
|
||||||
return await log('Platform ' + os + ' is not supported', os, 'error');
|
return await log('Platform ' + os + ' is not supported', os, 'error');
|
||||||
}
|
}
|
||||||
@ -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