Compare commits

..

34 Commits

Author SHA1 Message Date
00242b5fc2 Fix symfony-cli config [skip ci] 2025-10-15 09:17:20 +05:30
319ac00da8 Improve symfony-cli support
Fingers crossed symfony-cli keeps the artifact format in their releases
2025-10-15 08:46:18 +05:30
38e8065d61 Merge pull request #1008 from shyim/fix/flaky-symfony-cli-install
fix: directly download linux archive from symfony-cli releases
2025-10-15 07:52:14 +05:30
91a018aa46 Update SECURITY.md [skip ci] 2025-10-15 07:50:28 +05:30
bdaf698d5d Merge pull request #1009 from shivammathur/dependabot/github_actions/develop/github/codeql-action-4
Bump github/codeql-action from 3 to 4
2025-10-13 22:43:48 +00:00
ab68d9f583 Bump github/codeql-action from 3 to 4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-13 10:36:25 +00:00
d65cf8f3f2 Update sponsors [skip ci] 2025-10-12 12:49:03 +05:30
6beaa7dc34 Update actions in examples 2025-10-12 11:05:16 +05:30
79ab6fe269 ci: use direct link instead of api call 2025-10-07 11:02:25 +02:00
4cbbb6d82c fix: directly download linux archive from symfony-cli releases 2025-10-07 09:50:11 +02:00
4cba65b8c5 Improve workflows 2025-09-25 22:11:11 +05:30
7fea117d1c Add support for PHP 8.6.0-dev 2025-09-25 20:38:18 +05:30
bf6b4fbd49 Improve sorting in tools.getSemverVersion 2025-09-18 16:30:57 +05:30
8f8196743c Fix sorting in tools.getSemverVersion 2025-09-17 19:06:59 +05:30
06512d94ed Update macos-latest in README [skip ci] 2025-09-15 13:08:41 +05:30
1c302aed34 Mark macOS 26 as supported [skip ci] 2025-09-15 13:05:52 +05:30
dcffe28928 Fix jit config on arm 2025-09-11 18:38:04 +05:30
6ffdb3d118 Bump version to 2.35.5
Update Node.js dependencies
2025-09-09 05:57:14 +05:30
c97dacbacf Merge pull request #995 from shivammathur/dependabot/github_actions/develop/actions/setup-node-5
Bump actions/setup-node from 4 to 5
2025-09-08 15:51:50 +05:30
34f574e7aa Bump actions/setup-node from 4 to 5
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 5.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v4...v5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 10:18:19 +00:00
317a051dea Add fallback cache for keys in ppa.sh 2025-09-07 11:58:20 +05:30
dfcda83968 Add fallback url for composer 2025-09-04 20:26:04 +05:30
96d7cf331d Fix warning on chmod on failure in get 2025-09-02 14:42:11 +05:30
baed2d33b8 Provide better error in tools' setup 2025-09-01 12:27:19 +05:30
1398cb4c9f Fix using new github-input for tools.ts 2025-08-27 17:12:07 +05:30
462e7103e4 Add fallback to github api for adding intl 2025-08-27 09:12:14 +05:30
8582cb12d5 Use seperate releases for shivammathur/icu-intl 2025-08-27 07:36:01 +05:30
ec406be512 Bump version to 2.35.4
Update Node.js dependencies
2025-08-25 14:45:11 +05:30
36a27b0262 Move to main branch for protoc 2025-08-25 14:39:29 +05:30
ea2f858afe Move to main branch for brew 2025-08-25 14:39:29 +05:30
507ff06e8d Merge pull request #989 from shivammathur/dependabot/github_actions/develop/actions/checkout-5
Bump actions/checkout from 4 to 5
2025-08-18 22:32:57 +05:30
629475b7b3 Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-18 16:21:04 +00:00
521f2e5b93 Merge pull request #986 from shivammathur/dependabot/github_actions/develop/actions/download-artifact-5
Bump actions/download-artifact from 4 to 5
2025-08-11 21:32:18 +05:30
259d177178 Bump actions/download-artifact from 4 to 5
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 14:51:06 +00:00
49 changed files with 593 additions and 484 deletions

11
.github/SECURITY.md vendored
View File

@ -2,23 +2,20 @@
## Supported Versions
The latest patch versions of `v1` and `v2` releases of this project are supported for security updates.
The latest patch version of `v2` release of this project is supported for security updates.
## Supported PHP Versions
This security policy only applies to the latest patches of the following PHP versions.
This security policy only applies to the latest patch releases of the following PHP versions.
| Version | Supported |
|---------|--------------------|
| 8.1 | :white_check_mark: |
| 8.2 | :white_check_mark: |
| 8.3 | :white_check_mark: |
| 8.4 | :white_check_mark: |
## Reporting a Vulnerability
If you have found any issues that might have security implications in the versions supported, please send a report privately to [contact@shivammathur.com](mailto:contact@shivammathur.com).
If you have found any issues that might have security implications in the versions supported, please send a report privately to [contact@setup-php.com](mailto:contact@setup-php.com).
Do not report security reports publicly.
## Tidelift
If you use this GitHub Action through a Tidelift subscription, please refer to [https://tidelift.com/security](https://tidelift.com/security).

View File

@ -16,18 +16,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 2
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
config-file: ./.github/codeql/codeql-configuration.yml
languages: javascript
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4

View File

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

View File

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

View File

@ -28,8 +28,8 @@ jobs:
strategy:
fail-fast: false
matrix:
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']
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-15-intel]
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', '8.6']
include:
- operating-system: ubuntu-24.04
php-versions: ''
@ -39,7 +39,7 @@ jobs:
key: cache-v5
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup cache environment
id: cache-env

View File

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

View File

@ -10,7 +10,7 @@
<a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://img.shields.io/codecov/c/github/shivammathur/setup-php?logo=codecov"></a>
<a href="https://github.com/shivammathur/setup-php/blob/main/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.5-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.6-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
</p>
<p align="center">
<a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit&logoColor=FF5700&labelColor=555555"></a>
@ -68,18 +68,20 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
### GitHub-Hosted Runners
| Virtual environment | Arch | YAML workflow label | Pre-installed PHP |
|---------------------|---------|------------------------------------|------------------------|
| Ubuntu 24.04 | x86_64 | `ubuntu-latest` or `ubuntu-24.04` | `PHP 8.3` |
| Ubuntu 22.04 | x86_64 | `ubuntu-22.04` | `PHP 8.1` |
| Ubuntu 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` |
| Ubuntu 22.04 | aarch64 | `ubuntu-22.04-arm` | `PHP 8.1` |
| Windows Server 2025 | x64 | `windows-2025` | `PHP 8.3` |
| Windows Server 2022 | x64 | `windows-latest` or `windows-2022` | `PHP 8.3` |
| Windows Server 2019 | x64 | `windows-2019` | `PHP 8.3` |
| macOS Sequoia 15.x | arm64 | `macos-15` | - |
| macOS Sonoma 14.x | arm64 | `macos-latest` or `macos-14` | - |
| macOS Ventura 13.x | x86_64 | `macos-13` | `PHP 8.3` |
| Virtual environment | Arch | YAML workflow label | Pre-installed PHP |
|---------------------|---------|------------------------------------|-------------------|
| Ubuntu 24.04 | x86_64 | `ubuntu-latest` or `ubuntu-24.04` | `PHP 8.3` |
| Ubuntu 22.04 | x86_64 | `ubuntu-22.04` | `PHP 8.1` |
| Ubuntu 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` |
| Ubuntu 22.04 | aarch64 | `ubuntu-22.04-arm` | `PHP 8.1` |
| Windows Server 2025 | x64 | `windows-2025` | `PHP 8.3` |
| Windows Server 2022 | x64 | `windows-latest` or `windows-2022` | `PHP 8.3` |
| Windows Server 2019 | x64 | `windows-2019` | `PHP 8.3` |
| macOS Tahoe 26.x | arm64 | `macos-26` | - |
| macOS Sequoia 15.x | arm64 | `macos-latest` or `macos-15` | - |
| macOS Sonoma 14.x | arm64 | `macos-14` | - |
| macOS Sequoia 15.x | x86_64 | `macos-15-intel` | `PHP 8.3` |
| macOS Ventura 13.x | x86_64 | `macos-13` | `PHP 8.3` |
### Self-Hosted Runners
@ -91,6 +93,7 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
| Debian 11 | `self-hosted` or `Linux` |
| Windows 7 and newer | `self-hosted` or `Windows` |
| Windows Server 2012 R2 and newer | `self-hosted` or `Windows` |
| macOS Tahoe 26.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Sequoia 15.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Sonoma 14.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Ventura 13.x x86_64/arm64 | `self-hosted` or `macOS` |
@ -101,11 +104,11 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
## :tada: PHP Support
On all supported OS/Platforms the following PHP versions can be set up as per the runner.
On all supported OS/Platforms, the following PHP versions can be set up as per the runner.
- PHP 5.3 to PHP 8.5 on GitHub-hosted runners, except for macOS ARM64 runners (macos-14).
- PHP 5.6 to PHP 8.5 on GitHub-hosted macOS ARM64 runners (macos-14).
- PHP 5.6 to PHP 8.5 on self-hosted runners.
- PHP 5.3 to PHP 8.6 on GitHub-hosted runners, except for macOS ARM64 runners (macos-14).
- PHP 5.6 to PHP 8.6 on GitHub-hosted macOS ARM64 runners (macos-14).
- PHP 5.6 to PHP 8.6 on self-hosted runners.
| PHP Version | Stability | Release Support | Runner Support |
|-------------|-----------|-----------------------|--------------------------------|
@ -124,10 +127,11 @@ On all supported OS/Platforms the following PHP versions can be set up as per th
| `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.5` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
| `8.6` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
> [!Note]
> - 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.
> - Specifying `8.6` in `php-version` input installs a nightly build of `PHP 8.6.0-dev` from the master branch of PHP. Specifying `8.5` in `php-version` input installs a nightly build of `PHP 8.5.0-dev` from the PHP-8.5 branch of PHP. 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
@ -559,10 +563,10 @@ jobs:
### Nightly Build Setup
> Set up a nightly build of `PHP 8.5`.
> Set up a nightly build of `PHP 8.5` or `PHP 8.6`.
- These PHP versions are currently in active development and might contain bugs and breaking changes.
- Some user space extensions might not support this version currently.
- Some user space extensions might not support these versions currently.
```yaml
steps:
@ -742,7 +746,7 @@ act -P ubuntu-22.04=shivammathur/node:2204
- To enable JIT, enable `opcache` in cli mode by setting `opcache.enable_cli=1`.
- JIT conflicts with `Xdebug`, `PCOV`, and other extensions which override `zend_execute_ex` function, so set `coverage: none` and disable any such extension if added.
- By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` are set which can be changed using `ini-values` input.
- By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` (`opcache.jit_buffer_size=128M` on ARM-based environments) are set which can be changed using `ini-values` input.
- For detailed information about JIT related directives refer to the [`official PHP documentation`](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit "opcache.jit documentation").
For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
@ -998,18 +1002,14 @@ Examples of using `setup-php` with various PHP frameworks and packages.
## :sparkling_heart: Support This Project
- Please star the project and share it. If you blog, please share your experience of using `setup-php`.
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
Many users and organisations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
These companies generously provide setup-php their products and services to aid in the development of this project.
<p>
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php">
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="80">
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-light-mode-only">
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="100">
</a>
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-dark-mode-only">
<img src="https://setup-php.com/sponsors/jetbrains-white.svg" alt="JetBrains" width="140" height="100">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only">
@ -1026,11 +1026,22 @@ These companies generously provide setup-php their products and services to aid
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200" height="80">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a target="_blank" href="#">
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="94" height="80">
<a target="_blank" href="https://m.do.co/c/f1a8ee1277b0#gh-light-mode-only">
<img src="https://setup-php.com/sponsors/digitalocean.svg" alt="Digitalocean" width="100" height="100">
</a>
<a target="_blank" href="https://m.do.co/c/f1a8ee1277b0#gh-dark-mode-only">
<img src="https://setup-php.com/sponsors/digitalocean-white.svg" alt="Digitalocean" width="100" height="100">
</a>
</p>
Many users and organizations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
- If you use setup-php, please consider starring the project and share it.
- If you blog, please share your experience of using `setup-php`.
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
## :package: Dependencies
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")

View File

@ -61,7 +61,23 @@ jest.mock('../src/fetch', () => ({
} else if (!token || token === 'valid_token') {
return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
} else if (token === 'beta_token') {
return {data: `[{"ref": "refs/tags/1.2.3-beta1", "url": "${url}"}]`};
return {data: `[{"ref": "refs/tags/1.2.3beta1", "url": "${url}"}]`};
} else if (token === 'rc_token') {
return {
data: `[{"ref":"refs/tags/3.0.0RC1"},{"ref":"refs/tags/3.0.0RC2"}]`
};
} else if (token === 'non_semver_tags') {
return {
data: `[{"ref":"refs/tags/release-2025-09-18"},{"ref":"refs/tags/release-2025-09-17"}]`
};
} else if (token === 'undefined_ref') {
return {
data: `[{"url":"${url}"},{"ref":"refs/tags/v1.2.4","url":"${url}"}]`
};
} else if (token === 'multi_refs') {
return {
data: `[{"ref":"refs/tags/v1.2.3","url":"${url}"},{"ref":"refs/tags/1.2.4","url":"${url}"}]`
};
} else if (token === 'no_data') {
return {data: '[]'};
} else {
@ -89,11 +105,14 @@ jest.mock('../src/packagist', () => ({
describe('Tools tests', () => {
it.each`
token | version
${'invalid_token'} | ${'1.2'}
${'valid_token'} | ${'1.2.3'}
${'beta_token'} | ${'1.2.3-beta1'}
${''} | ${'1.2.3'}
token | version
${'invalid_token'} | ${'1.2'}
${'valid_token'} | ${'1.2.3'}
${'beta_token'} | ${'1.2.3beta1'}
${'undefined_ref'} | ${'1.2.4'}
${'multi_refs'} | ${'1.2.4'}
${'non_semver_tags'} | ${'release-2025-09-18'}
${''} | ${'1.2.3'}
`('checking getSemverVersion: $token', async ({token, version}) => {
process.env['GITHUB_TOKEN'] = token;
expect(
@ -101,6 +120,26 @@ describe('Tools tests', () => {
).toBe(version);
});
it('checking getSemverVersion triggers ?? fallback via Map#get mock', async () => {
process.env['GITHUB_TOKEN'] = 'rc_token';
const spy = jest
.spyOn(Map.prototype as Map<string, string>, 'get')
.mockImplementation(function (
this: Map<string, string>,
key: string
): string | undefined {
if (key === '3.0.0-RC2') {
return undefined;
}
return Map.prototype.get.call(this, key);
});
const result = await tools.getSemverVersion(
getData({tool: 'tool', version: '3.0.0'})
);
expect(result).toBe('3.0.0-RC2');
spy.mockRestore();
});
it.each`
tool | fetch_latest | version
${'tool'} | ${'true'} | ${'3.2.1'}
@ -332,6 +371,12 @@ describe('Tools tests', () => {
${'preview'} | ${'7.4'} | ${'true'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
${'1'} | ${'7.4'} | ${'false'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
${'2'} | ${'7.4'} | ${'false'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
${'latest'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
${'stable'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
${'snapshot'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
${'preview'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
${'1'} | ${'7.4'} | ${'false'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
${'2'} | ${'7.4'} | ${'false'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
${'latest'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
${'stable'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
${'snapshot'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-snapshot.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
@ -395,7 +440,7 @@ describe('Tools tests', () => {
[
'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://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
'add_tool https://github.com/box-project/box/releases/latest/download/box.phar box "--version"',
@ -440,7 +485,7 @@ describe('Tools tests', () => {
[
'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://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_composer_tool behat behat behat/ scoped',
'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
@ -492,7 +537,7 @@ describe('Tools tests', () => {
[
'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://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'Add-Blackfire',
'blackfire-player is not a windows tool',
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
@ -524,7 +569,7 @@ describe('Tools tests', () => {
[
'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2',
[
'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',
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://artifacts.setup-php.com/composer/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',
'Add-ComposerTool codeception codeception codeception/ global',
'Add-ComposerTool prestissimo prestissimo hirak/ global',
'Add-ComposerTool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/ global',
@ -573,10 +618,10 @@ describe('Tools tests', () => {
it.each`
tools_csv | script
${'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,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, 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'}
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer 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://artifacts.setup-php.com/composer/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://artifacts.setup-php.com/composer/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://artifacts.setup-php.com/composer/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'}
`('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
});

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@ -19,7 +19,7 @@ jobs:
# Blackfire supports PHP >= 5.3 on Ubuntu and macOS, and PHP >= 5.4 on Windows
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,10 +12,10 @@ jobs:
node-versions: ['16']
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-versions }}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

606
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.35.3",
"version": "2.35.5",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "lib/install.js",
@ -41,21 +41,21 @@
},
"devDependencies": {
"@eslint/compat": "^1.3.2",
"@eslint/js": "9.33.0",
"@eslint/js": "9.35.0",
"@types/jest": "^30.0.0",
"@types/node": "^24.2.1",
"@typescript-eslint/eslint-plugin": "^8.39.0",
"@typescript-eslint/parser": "^8.39.0",
"@types/node": "^24.3.1",
"@typescript-eslint/eslint-plugin": "^8.43.0",
"@typescript-eslint/parser": "^8.43.0",
"@vercel/ncc": "^0.38.3",
"eslint": "9.33.0",
"eslint": "9.35.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-prettier": "^5.5.4",
"globals": "^16.3.0",
"jest": "^30.0.5",
"jest-circus": "^30.0.5",
"nock": "^14.0.9",
"jest": "^30.1.3",
"jest-circus": "^30.1.3",
"nock": "^14.0.10",
"prettier": "^3.6.2",
"simple-git-hooks": "^2.13.1",
"ts-jest": "^29.4.1",

View File

@ -0,0 +1,3 @@
opcache.enable=1
opcache.jit_buffer_size=128M
opcache.jit=1235

View File

@ -3,6 +3,7 @@
"highest": "8.4",
"latest": "8.4",
"nightly": "8.5",
"master": "8.6",
"5.x": "5.6",
"7.x": "7.4",
"8.x": "8.4"

View File

@ -266,7 +266,8 @@
"type": "custom-package",
"repository": "symfony-cli/symfony-cli",
"domain": "https://github.com",
"version_prefix": "-V"
"version_prefix": "v",
"version_parameter": "-V"
},
"blackfire-player": {
"type": "custom-function",

View File

@ -59,10 +59,10 @@ export async function setEnv(): Promise<void> {
* Run the script
*/
export async function run(): Promise<void> {
await setEnv();
const os: string = process.platform;
const tool = await utils.scriptTool(os);
const run_path = await getScript(os);
await setEnv();
await exec(tool + run_path);
}

View File

@ -134,9 +134,9 @@ patch_brew() {
update_dependencies() {
patch_brew
if ! [ -e /tmp/update_dependencies ]; then
for repo in "$brew_repo" "$core_repo"; do
for repo in "$brew_repo" "${core_repo:?}"; do
if [ -e "$repo" ]; then
git_retry -C "$repo" fetch origin master && git -C "$repo" reset --hard origin/master
git_retry -C "$repo" fetch origin main && git -C "$repo" reset --hard origin/main
fi
done
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1

View File

@ -11,13 +11,14 @@ install_icu() {
# Function to add ext-intl with the given version of ICU
add_intl() {
icu=$(echo "$1" | cut -d'-' -f 2)
supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases | grep -Po "${icu//./\\.}" | head -n 1)
if [ "$icu" != "$supported_version" ]; then
add_log "${cross:?}" "intl" "ICU $icu is not supported"
supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases/tags/intl-"$icu" | grep -Po "php${version?}-intl-$icu" | head -n 1)
[ -z "$supported_version" ] && supported_version=$(get -s -n "" https://github.com/shivammathur/icu-intl/releases/expanded_assets/intl-"$icu" | grep -Po "php$version-intl-$icu" | head -n 1)
if [ "php$version-intl-$icu" != "$supported_version" ]; then
add_log "${cross:?}" "intl" "ICU $icu is not supported for PHP $version"
else
[ "${ts:?}" = 'zts' ] && suffix='-zts'
install_icu "$icu" >/dev/null 2>&1
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix$arch_suffix.so"
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl-$icu/php${version:?}-intl-$icu$suffix$arch_suffix.so"
enable_extension intl extension
add_extension_log intl "Installed and enabled with ICU $icu"
fi

View File

@ -200,7 +200,11 @@ add_tool() {
elif [ -e /tmp/"$tool" ]; then
sudo cp -a /tmp/"$tool" "$tool_path"
fi
add_log "$cross" "$tool" "Could not setup $tool"
if [ "$status_code" = "404" ]; then
add_log "$cross" "$tool" "Failed to download $tool from ${url[*]}"
else
add_log "$cross" "$tool" "Could not setup $tool"
fi
fi
}

View File

@ -49,7 +49,7 @@ add_brew() {
brew_prefix="$(get_brew_prefix)"
if ! [ -d "$brew_prefix"/bin ]; then
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/main/install.sh" | bash -s >/dev/null 2>&1
add_log "${tick:?}" "Brew" "Installed Homebrew"
fi
add_brew_bins_to_path "$brew_prefix"

View File

@ -66,10 +66,14 @@ update_lists() {
# Function to get fingerprint from an Ubuntu PPA.
ubuntu_fingerprint() {
ppa=$1
get -s -n "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
ppa="$1"
ppa_uri="~${ppa%/*}/+archive/ubuntu/${ppa##*/}"
get -s -n "" "${lp_api[0]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
|| get -s -n "" "${lp_api[1]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
|| get -s -n "" "$ppa_sp/keys/$ppa.fingerprint"
}
# Function to get fingerprint from a Debian PPA.
debian_fingerprint() {
ppa=$1
@ -93,6 +97,7 @@ add_key() {
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
fi
key_urls+=("$ppa_sp/keys/$ppa.gpg")
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
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"

View File

@ -35,6 +35,6 @@ Function Add-Protoc() {
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/main/LICENSE).Content
Write-Output "$env:END_GROUP"
}

View File

@ -25,6 +25,6 @@ add_protoc() {
) >/dev/null 2>&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"
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/main/LICENSE
echo "$END_GROUP"
}

View File

@ -1,18 +1,32 @@
Function Add-Symfony() {
$arch_name ='amd64'
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
$arch_name = '386'
}
$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
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
if(Test-Path $bin_dir\symfony.exe) {
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_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
$tool_version = Get-ToolVersion symfony "-V"
Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
param(
[Parameter(Mandatory = $true, Position = 0, HelpMessage = 'Symfony version to be installed')]
[string] $protobuf_tag
)
$protobuf_tag = $protobuf_tag.replace('v', '')
if($protobuf_tag -ne 'latest' -and $protobuf_tag -notmatch '^\d+(\.\d+)*$') {
Add-Log $cross "symfony-cli" "Invalid symfony version: $protobuf_tag"
} else {
Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
$arch_name = 'amd64'
if (-not ([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
$arch_name = '386'
}
$symfony_releases = "https://github.com/symfony-cli/symfony-cli/releases"
if ($protobuf_tag -eq 'latest') {
$url = "$symfony_releases/latest/download/symfony-cli_windows_${arch_name}.zip"
} else {
$url = "$symfony_releases/download/v$protobuf_tag/symfony-cli_windows_${arch_name}.zip"
}
Get-File -Url $url -OutFile $bin_dir\symfony.zip > $null 2>&1
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force > $null 2>&1
if (Test-Path $bin_dir\symfony.exe) {
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_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
$tool_version = Get-ToolVersion symfony "-V"
Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
} else {
Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
}
}
}

View File

@ -1,41 +1,44 @@
add_symfony_with_brew() {
add_brew_tap symfony-cli/homebrew-tap
brew install symfony-cli/tap/symfony-cli
}
get_symfony_artifact_url() {
arch=$(dpkg --print-architecture)
url=$(get -s -n "" https://raw.githubusercontent.com/symfony-cli/homebrew-tap/main/Formula/symfony-cli.rb 2<&1 | grep -m 1 "url.*linux.*${arch}" | cut -d\" -f 2)
if [ -z "$url" ]; then
url=$(get -s -n "" https://api.github.com/repos/symfony-cli/symfony-cli/releases 2<&1 | grep -m 1 "url.*linux.*${arch}.*gz\"" | cut -d\" -f 4)
fi
echo "$url"
local symfony_tag=$1
local os
local arch
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
arch="$(uname -m)"
case "$arch" in
arm|armv6*|armv7*) arch="armv6" ;;
aarch64*|armv8*|arm64) arch="arm64" ;;
i[36]86) arch="386" ;;
x86_64|amd64) arch="amd64" ;;
esac
[ "$os" = "darwin" ] && arch="all"
symfony_releases="https://github.com/symfony-cli/symfony-cli/releases"
if [ "$symfony_tag" = "latest" ]; then
echo "$symfony_releases/latest/download/symfony-cli_${os}_${arch}.tar.gz"
else
echo "$symfony_releases/download/v$symfony_tag/symfony-cli_${os}_${arch}.tar.gz"
fi
}
add_symfony_helper() {
if [ "$(uname -s)" = "Linux" ]; then
url="$(get_symfony_artifact_url)"
if [ -z "$url" ]; then
. "${0%/*}"/tools/brew.sh
configure_brew
add_symfony_with_brew
else
get -s -n "" "$url" | sudo tar -xz -C "${tool_path_dir:?}" 2>/dev/null
sudo chmod a+x /usr/local/bin/symfony
fi
elif [ "$(uname -s)" = "Darwin" ]; then
add_symfony_with_brew
fi
local install_dir=/usr/local/bin
[ "$(uname -s)" = "Darwin" ] && install_dir=${brew_prefix:?}/bin
get -s -n "" "$(get_symfony_artifact_url "$symfony_tag")" | sudo tar -xz -C "$install_dir" 2>/dev/null
sudo chmod a+x "$install_dir"/symfony
}
add_symfony() {
add_symfony_helper >/dev/null 2>&1
symfony_path="$(command -v symfony)"
if [[ -n "$symfony_path" ]]; then
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
tool_version=$(get_tool_version "symfony" "-V")
add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
local symfony_tag="${1/v/}"
if ! [[ "$symfony_tag" =~ ^[0-9]+(\.[0-9]+)*$ || "$symfony_tag" == 'latest' ]]; then
add_log "${cross:?}" "symfony-cli" "Version '$symfony_tag' is not valid for symfony-cli"
else
add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
add_symfony_helper "$symfony_tag" >/dev/null 2>&1
symfony_path="$(command -v symfony)"
if [[ -n "$symfony_path" ]]; then
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
tool_version=$(get_tool_version "symfony" "-V")
add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
else
add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
fi
fi
}

View File

@ -145,7 +145,7 @@ get() {
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
[ "$status_code" = "200" ] && break
done
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
[[ "$execute" = "-e" && -e "$file_path" ]] && sudo chmod a+x "$file_path"
[ "$mode" = "-v" ] && echo "$status_code"
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
fi
@ -244,7 +244,9 @@ configure_php() {
add_php_config
ini_config_dir="${src:?}"/configs/ini
ini_config_files=("$ini_config_dir"/php.ini)
jit_config_files=("$ini_config_dir"/jit.ini)
arch="$(uname -m)"
[[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && jit_ini="$ini_config_dir"/jit_aarch64.ini || jit_ini="$ini_config_dir"/jit.ini
jit_config_files=("$jit_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
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1

View File

@ -1,5 +1,6 @@
import path from 'path';
import fs from 'fs';
import * as cv from 'compare-versions';
import * as fetch from './fetch';
import * as packagist from './packagist';
import * as utils from './utils';
@ -20,6 +21,11 @@ interface IRef {
* @param data
*/
export async function getSemverVersion(data: RS): Promise<string> {
const fixSemver = (t: string): string => {
if (/^\d+\.\d+\.\d+(-|$)/.test(t)) return t;
const m = t.match(/^(\d+\.\d+\.\d+)([A-Za-z]+[0-9A-Za-z.]+)$/);
return m ? `${m[1]}-${m[2]}` : t;
};
const search: string = data['version_prefix'] + data['version'];
const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`;
const github_token: string =
@ -30,10 +36,24 @@ export async function getSemverVersion(data: RS): Promise<string> {
data['error'] = response.error ?? `No version found with prefix ${search}.`;
return data['version'];
} else {
const refs = JSON.parse(response['data']).reverse();
const ref = refs.find((i: IRef) => /.*\d+.\d+.\d+$/.test(i['ref']));
const tag: string = (ref || refs[0])['ref'].split('/').pop();
return tag.replace(/^v(\d)/, '$1');
const refs: IRef[] = JSON.parse(response['data']);
const tags = refs
.map((i: IRef) => (i.ref?.split('/').pop() ?? '').replace(/^v(?=\d)/, ''))
.filter((t: string) => t.length > 0);
const fixedToOriginal = new Map<string, string>();
const fixed = tags.map(t => {
const f = fixSemver(t);
fixedToOriginal.set(f, t);
return f;
});
fixed.sort((a, b) => {
try {
return cv.compareVersions(b, a);
} catch {
return b.localeCompare(a, 'en', {numeric: true, sensitivity: 'base'});
}
});
return fixedToOriginal.get(fixed[0]) ?? fixed[0];
}
}
@ -263,13 +283,15 @@ export async function addComposer(data: RS): Promise<string> {
const github = data['github'];
const getcomposer = data['domain'];
const cds = 'https://dl.cloudsmith.io';
const spc = 'https://artifacts.setup-php.com';
const filename = `composer-${data['php_version']}-${channel}.phar`;
const releases_url = `${github}/shivammathur/composer-cache/releases/latest/download/${filename}`;
const cds_url = `${cds}/public/shivammathur/composer-cache/raw/files/${filename}`;
const spc_url = `${spc}/composer/${filename}`;
const lts_url = `${getcomposer}/download/latest-2.2.x/composer.phar`;
const is_lts = /^5\.[3-6]$|^7\.[0-1]$/.test(data['php_version']);
const version_source_url = `${getcomposer}/composer-${channel}.phar`;
let cache_url = `${releases_url},${cds_url}`;
let cache_url = `${releases_url},${spc_url},${cds_url}`;
let source_url = `${getcomposer}/composer.phar`;
switch (true) {
case /^snapshot$/.test(channel):