Compare commits

...

147 Commits

Author SHA1 Message Date
7aefaa0b54 Merge pull request #967 from jrfnl/feature/readme-fix-broken-link
README: fix broken link
2025-06-25 05:04:51 +05:30
048eb79ef3 README: fix broken link 2025-06-25 01:31:29 +02:00
29247235f0 Merge pull request #966 from OskarStark/patch-1
⚙ Improvement: Update docs
2025-06-24 20:41:11 +05:30
e84efebd6e Update docs
As version 2 is the standard right now, make it clear by setting the v1 manually.
2025-06-24 17:39:04 +03:00
0f7f1d08e3 Upgrade to Jest 30 2025-06-13 02:06:31 +05:30
433bdeeaf0 Bump version to 2.34.1 2025-06-12 03:52:26 +05:30
1c5378302c Update node.js dependencies 2025-06-11 15:17:10 +05:30
c251c791ff Fix pipe in get_sha256 2025-06-11 15:00:38 +05:30
36fada6981 Fix tool-cache directory on self-hosted runners 2025-06-11 14:57:09 +05:30
27853eb8b4 Cleanup up PPA fallback mirror 2025-06-10 15:33:24 +05:30
18b776ee45 Update ppa filename to match apt-add-repository 2025-06-10 04:51:11 +05:30
2ec652d38d Fix locking permissions in get function 2025-06-10 03:20:10 +05:30
8d8f975af3 Pin hiredis version to 1.1 for relay [skip ci] 2025-06-09 20:03:18 +05:30
12b910a04d Add support for COMPOSER_ALLOW_PLUGINS 2025-06-09 17:30:41 +05:30
962fc445e2 Bump version to 2.34.0
Bump Node.js dependencies
2025-06-09 15:52:38 +05:30
6ba658ae8d Merge pull request #957 from cmb69/cmb/phive-0.15.3
Lock Phive version for PHP 7.3/7.4
2025-06-03 18:18:52 +05:30
c954e9c756 Lock Phive version for PHP 7.3/7.4
Latest Phive (0.16.0) claims to require PHP 8.0 or later[1].  While I
have not found any issues running it under PHP 7.4, it might be better
to stick with Phive 0.15.3 for PHP 7.3/7.4.

[1] <https://github.com/phar-io/phive/releases/tag/0.16.0>
2025-06-03 14:35:02 +02:00
b595b415e2 Add fallback for the manifest URL 2025-05-19 08:09:13 +05:30
9c22be2b20 fail fast in source.sh 2025-05-18 05:58:02 +05:30
ac0e29410e Merge pull request #950 from shivammathur/dependabot/npm_and_yarn/npm_and_yarn-87115a91ec
Bump undici from 5.28.5 to 5.29.0 in the npm_and_yarn group across 1 directory
2025-05-16 07:13:42 +05:30
2cae8ac286 Bump undici in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 1 update in the / directory: [undici](https://github.com/nodejs/undici).


Updates `undici` from 5.28.5 to 5.29.0
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.5...v5.29.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 5.29.0
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-15 16:31:38 +00:00
df8d123345 Improve self-hosted detection 2025-05-08 14:38:46 +05:30
d371420c90 Remove copying extension dependencies 2025-05-08 14:30:01 +05:30
287979ae16 Merge pull request #948 from alcaeus/add-pie-support
Add tool support for pie
2025-05-08 14:05:07 +05:30
dd942787eb Add support for pie in tools 2025-05-08 09:46:50 +02:00
d000f49d9a Merge pull request #945 from JMoodyFWD/tools_dir_path-rename
Change TOOLS_DIR to SETUP_PHP_TOOLS_DIR to prevent regression
2025-05-06 23:46:51 +05:30
dc7e73e115 Change TOOLS_DIR to SETUP_PHP_TOOLS_DIR to prevent regression 2025-05-06 11:00:13 -06:00
755f6046e1 Add missing self_hosted_helper in darwin.sh 2025-04-30 15:30:13 +05:30
ec0360b904 Make sure tap directories on macOS exist 2025-04-21 22:13:27 +05:30
373563aabe Update os_releases 2025-04-17 08:59:08 +05:30
cf4cade272 Drop support for ubuntu-20.04 [skip ci] 2025-04-14 07:25:31 +05:30
316da6edfb Fix phalcon and zephir_parser support on Windows 2025-04-14 07:11:13 +05:30
34061fa6b4 Fix relay support on macOS 2025-04-14 07:11:08 +05:30
b7bd9e4655 Bump version to 2.33.0 2025-04-13 00:13:54 +05:30
78e1c95060 feat: set this via an environment variable instead 2025-04-07 12:29:02 +05:30
310e481b83 feat: allow tools path directory to be set
also add a .node-version file
2025-04-07 12:28:57 +05:30
42a9487ddd Fix pdo_oci 2025-03-15 04:43:12 +05:30
f5d98d1683 Improve support for phalcon5 and zephir_parser 2025-03-14 21:26:51 +05:30
1a94db50cb Update dependencies 2025-03-14 20:36:54 +05:30
1489f576c9 Merge pull request #928 from jg-development/main
switch to launchpadcontent #927 close
2025-03-14 18:16:42 +05:30
f25b1cfdcc switch to launchpadcontent #927 close 2025-03-14 13:31:13 +01:00
3209251719 Merge pull request #921 from hms5232/update-ubuntu-latest-to-24
Move `ubuntu-latest` to 24.04
2025-02-25 14:47:34 +05:30
8ad85316fe Move ubuntu-latest to 24.04 2025-02-25 12:57:46 +08:00
297b3cde3c Merge pull request #917 from voodooism/feature/priority-for-openswoole-ext
Change openswoole priority
2025-02-18 20:02:29 +05:30
4eb1919d22 Change openswoole priority 2025-02-18 14:09:04 +01:00
d8af2f43ce Merge pull request #915 from DanielEScherzer/patch-1
README: update list of PHP versions
2025-02-15 15:19:01 +05:30
d3fead0baf README: update list of PHP versions
PHP 8.2 is no longer in active support and only receives security fixes, see
announcement at <https://news-web.php.net/php.internals/126138>.
2025-02-14 21:14:48 -08:00
6cd838e903 Add fallback for launchpad API 2025-02-10 16:57:17 +05:30
3bfebc13bc Add fallback url for phpunit tools 2025-02-07 05:40:29 +05:30
89a5bffb0b Improving locking process in get 2025-02-06 02:33:08 +05:30
260b35cca0 Add support for blackfire on PHP 8.4 2025-02-01 21:27:42 +05:30
f902cc7bd9 Update ioncube support till PHP 8.4 2025-02-01 20:59:07 +05:30
ad03a92562 Use Markdown highlighting in README for notes 2025-02-01 08:55:51 +05:30
a99dd2408e Merge pull request #907 from shivammathur/dependabot/npm_and_yarn/npm_and_yarn-2c579f9325
Bump undici from 5.28.4 to 5.28.5 in the npm_and_yarn group
2025-01-22 07:12:09 +05:30
a7d262f1d8 Bump undici from 5.28.4 to 5.28.5 in the npm_and_yarn group
Bumps the npm_and_yarn group with 1 update: [undici](https://github.com/nodejs/undici).


Updates `undici` from 5.28.4 to 5.28.5
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.4...v5.28.5)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-22 00:45:26 +00:00
c1750d382b Add aarch64 ubuntu runners in OS support [skip ci] 2025-01-22 04:56:05 +05:30
6516e9cb24 Add support for arm64 icu and intl builds 2025-01-22 04:56:05 +05:30
783c77d669 Fix sed for macos in patch script 2025-01-22 04:56:05 +05:30
b0064cd05b Fix arm support for some tools and extensions [skip ci] 2025-01-22 04:56:05 +05:30
fd913ba092 Fix composer normalize version [skip ci] 2025-01-22 04:56:05 +05:30
21e092a3e0 Merge pull request #900 from deguif/update-php-cs-fixer-repository
Update php-cs-fixer repository organisation
2025-01-08 17:53:40 +05:30
64652c947d Update php-cs-fixer repository organisation 2025-01-08 11:13:54 +01:00
9e72090525 Fix composer-dependency-analyser packagist repository 2024-12-30 21:54:47 +05:30
34b79cab10 Improve docs for php-version-file input 2024-12-30 21:47:27 +05:30
e5af5d68b4 Update default version in linux.sh and darwin.sh 2024-12-30 20:17:07 +05:30
ba21a89e0b Pass prefix options to make in source.sh 2024-12-29 09:22:49 +05:30
12b88cf3e2 Fix building pdo_firebird on macOS with clang 15 2024-12-29 09:17:30 +05:30
cffd8ca58a Fix libssl link in couchbase [skip ci] 2024-12-28 18:26:04 +05:30
85ed51cf85 Fix support for zephir_parser 2024-12-28 18:15:07 +05:30
5bb2eed0aa Fix oci extension support on Windows for PHP 8.4 and above 2024-12-28 02:07:42 +05:30
96fb539134 Bump node dependencies 2024-12-26 18:03:23 +05:30
775fa76ea4 Do not upgrade when version is pre-installed on macOS 2024-12-23 16:27:45 +05:30
da729085ef Add support for pre-installed PHP 2024-12-23 16:04:30 +05:30
b6d8115f12 Add support for .tool-versions format in php-version-file 2024-12-23 15:27:22 +05:30
84f76b1fc9 Add support for composer files in sub-directory 2024-12-23 14:36:14 +05:30
cdfde5ebec Fix update on multiple installs in same job 2024-12-23 07:33:26 +05:30
7e98140142 Add windows-2025 to the readme 2024-12-19 22:54:36 +05:30
85a8dfd0c7 Rebuild release file 2024-12-14 03:27:47 +05:30
7ee42db5db Merge pull request #892 from tillkruss/patch-2
Relay: Support PHP 8.4 and 8.5
2024-12-13 21:56:33 +00:00
cdbb89961e support 8.4 and 8.5 for relay 2024-12-13 09:24:59 -08:00
19ba822314 Merge pull request #890 from alexmerlin/fix-github-workflows-docs
Fixed syntax error in `.github/workflows/docs.yml`
2024-12-02 09:20:29 +00:00
fb9c2a9f77 Fixed typo in GitHub workflows docs.yml
Signed-off-by: alexmerlin <alex@dotkernel.com>
2024-12-02 11:04:50 +02:00
e7453ef93f Merge pull request #889 from alexmerlin/fix-readme-typo
Fixed small typo in `README.md`
2024-12-02 08:52:14 +00:00
efd3a13445 Fixed small typo in README.md
Signed-off-by: alexmerlin <alex@dotkernel.com>
2024-12-02 10:18:57 +02:00
981ce2a75a Do not add composer in docs workflow 2024-12-01 07:14:07 +05:30
d97b3754a8 Fix fetching libraries on old PHP on Windows 2024-12-01 06:10:56 +05:30
edf0223f7d Add extension type in docs workflow 2024-12-01 06:00:17 +05:30
516490f3d1 Update versions in manifect and win32.ps1 2024-12-01 04:45:08 +05:30
e77cdb393f Update PHP version in README [skip ci] 2024-11-23 03:49:40 +05:30
944fb41c67 Merge pull request #884 from shivammathur/dependabot/github_actions/develop/codecov/codecov-action-5
Bump codecov/codecov-action from 4 to 5
2024-11-18 15:08:19 +00:00
0830e5d434 Bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 14:43:15 +00:00
ae95648cfc Bump Node.js dependencies 2024-11-18 19:32:14 +05:30
a75ffb672b Fix status code output in get function 2024-11-12 02:20:20 +05:30
80075aeba5 Wait in get till no processes are using the output filepath 2024-11-11 14:32:06 +05:30
449afbcaec Handle race condition in get on a mutli self-hosted runners setup 2024-11-11 12:53:09 +05:30
ce2f681d22 Add macos-15 to the README 2024-11-04 10:07:31 +05:30
cb0fc744e6 Use windows-2022 in php workflow 2024-11-04 09:56:32 +05:30
58a6e6fb4b Add PHP 8.5 to the workflows 2024-11-04 09:55:55 +05:30
bf9d25532d Improve docs workflow 2024-11-04 09:55:00 +05:30
4662a3d03c Add PHP 8.5 to the README 2024-11-04 09:48:51 +05:30
e4fb5432c7 Refactor issue templates to issue forms 2024-11-04 09:43:52 +05:30
7f1cfc01ec Bump version to 2.32.0
Update Node.js dependencies

Migrate eslint config to a mjs file

Fix imports in tests

Bump to Node.js 20.x in workflows
2024-11-04 08:55:26 +05:30
371ee9d086 Fix zts support on self-hosted envs 2024-11-04 08:20:56 +05:30
51383ecefe Fix adding debug package lists 2024-11-04 07:45:52 +05:30
cf36231a82 Remove macos-12 from docs workflow [skip ci] 2024-10-21 06:20:59 +05:30
9f51892bda Drop support for macos-12 2024-09-16 21:50:26 +05:30
53f82379e8 Merge pull request #859 from janedbal/composer-dependency-analyser
Support composer-dependency-analyser tool
2024-07-17 03:25:37 +00:00
24eff50574 Support composer-dependency-analyser 2024-07-15 15:14:10 +02:00
15b611248c Update debian version support in README 2024-07-14 07:04:11 +05:30
6e5c13cd3c Bump version to 2.31.2 2024-07-14 02:49:56 +05:30
e07eecf7a4 Update Node.js dependencies 2024-07-14 02:48:56 +05:30
57a6e91640 Test without HOMEBREW_DEVELOPER=1 2024-07-14 02:21:00 +05:30
c541c155ee Bump version 2.31.1
Update Node.js dependencies
2024-07-08 16:11:28 +05:30
afff805ea3 Fix cache support for ioncube 2024-07-02 18:02:33 +05:30
594bd591ec Fix version regex in Add-Extension 2024-07-01 22:34:55 +05:30
2e947f1f69 Bump version to 2.31.0
Update Node.js dependencies
2024-06-24 03:19:18 +05:30
2a5212466c Add fallback mirror for php PPA when launchpad is down 2024-06-24 02:56:51 +05:30
9c28f9ba58 Fix support for phalcon on PHP 7.4 2024-06-23 18:30:14 +05:30
b9f1db485f Improve support for firebird 2024-06-23 18:12:47 +05:30
588b5da142 Fix support for couchbase on Ubuntu 24.04 2024-06-23 18:12:42 +05:30
a0edbac27b Fix support for blackfire 2024-06-23 08:15:22 +05:30
606ac25b84 Fix oci extension support on Ubuntu 24.04 2024-06-23 07:54:02 +05:30
ea566b68c0 Fix support for relay 2024-06-23 07:41:47 +05:30
4f124b97f7 Merge pull request #853 from shivammathur/dependabot/npm_and_yarn/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3
2024-06-16 21:46:00 +05:30
8fe6ba1e38 Bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-16 13:17:43 +00:00
193510cd90 Link apt-fast to apt-get if missing 2024-06-16 08:07:19 +05:30
b5f04d97d9 Bump version to 2.30.6
Update Node.js dependencies
2024-06-16 07:39:23 +05:30
4b56933e00 Add dkpg option to overwrite conf files 2024-06-16 07:39:18 +05:30
fc14643b0a Fix brew link step
We add --overwrite parameter to brew install and upgrade commands, so that in the linking step it does not fail if another php version is linked
2024-06-02 23:04:56 +05:30
fdb0d9d1a7 Add PHP 8.3 support for zephir parser 2024-06-02 07:32:16 +05:30
622cada40f Bump Node.js dependencies 2024-05-28 12:43:43 +05:30
2a620039e8 Fix priority for ev extension 2024-05-28 12:31:00 +05:30
376a964e21 Implement ioncube support on unix correctly
I think I jumped the shark with this one for this project
2024-05-22 06:54:49 +05:30
d6560b1fbb Document and test support for ubuntu-24.04 2024-05-17 19:19:10 +05:30
868f02c3ff Improve support for deb822 system sources file 2024-04-27 21:04:56 +05:30
18975ec414 Fix ecs config 2024-04-26 02:16:03 +05:30
c49792fb59 Merge pull request #838 from em411/feature/ecs-support
Add support for ecs
2024-04-26 02:03:46 +05:30
806c3cc058 Add support for ecs 2024-04-25 21:59:57 +02:00
c665c7a15b Bump version to 2.30.4 2024-04-24 03:54:07 +05:30
b30e4bc764 Document that only PHP 5.6 and above are supported on arm64 macos runners 2024-04-24 03:52:52 +05:30
436881d084 Set macos version in php workflow to macos-13 2024-04-24 03:38:15 +05:30
14d9660823 Fix support for sqlsrv and pdo_sqlsrv 2024-04-24 03:05:05 +05:30
efffd0e4f2 Bump version to 2.30.3 2024-04-21 18:55:19 +05:30
d802457674 Fix reading extension_dir in PHP 8.4 on macOS 2024-04-21 18:16:08 +05:30
8872c784b0 Bump version to 2.30.2
Update Node.js dependencies
2024-03-31 03:53:16 +05:30
b203b24815 Hotfix: update brew along with core tap 2024-03-31 03:51:38 +05:30
116fe4df69 Add vld for macOS 2024-03-26 17:29:27 +05:30
53 changed files with 7351 additions and 7453 deletions

View File

@ -1,16 +0,0 @@
{
"env": { "node": true, "jest": true },
"parser": "@typescript-eslint/parser",
"parserOptions": { "ecmaVersion": 2021, "sourceType": "module" },
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended",
"prettier"
],
"plugins": ["@typescript-eslint", "jest"]
}

View File

@ -1,42 +0,0 @@
---
name: Bug report
about: Nice, you found a bug!
title: ''
labels: 'bug'
assignees: 'shivammathur'
---
**Describe the bug**
<!-- Please describe the bug concisely. -->
**Version**
- [ ] I have checked releases, and the bug exists in the latest patch version of `v1` or `v2`.
- [ ] `v2`
- [ ] `v1`
**Runners**
<!-- Please mark the GitHub Action runner your workflow uses. -->
- [ ] GitHub Hosted
- [ ] Self Hosted
**Operating systems**
<!-- Please mention the operating systems your workflow uses. -->
**PHP versions**
<!-- Please mention the PHP versions your workflow uses. -->
**To Reproduce**
<!-- Please provide the relevant steps of your workflow `.yml` file. -->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Screenshots/Logs**
<!-- If applicable, add screenshots or logs to help explain your problem. -->
**Additional context**
<!-- Add any other context about the problem here. -->
**Are you willing to submit a PR?**
<!-- We accept pull requests targeting the develop branch. -->

94
.github/ISSUE_TEMPLATE/bug.yml vendored Normal file
View File

@ -0,0 +1,94 @@
name: Bug report
description: Nice, you found a bug!
title: "Bug: "
labels: ["bug"]
assignees: ["shivammathur"]
body:
- type: markdown
attributes:
value: "Please fill out the sections below to help us address your issue."
- type: textarea
id: bug-description
attributes:
label: "Describe the bug"
placeholder: "Please describe the bug concisely."
validations:
required: true
- type: checkboxes
id: version
attributes:
label: "Version"
description: "I have checked releases, and the bug exists in the latest patch version of `v1` or `v2`."
options:
- label: "v2"
- label: "v1"
validations:
required: true
- type: dropdown
id: runners
attributes:
label: "Runners"
description: "Please choose the GitHub Action runner your workflow uses."
options:
- "GitHub Hosted"
- "Self Hosted"
validations:
required: true
- type: textarea
id: operating-systems
attributes:
label: "Operating systems"
placeholder: "e.g., Ubuntu 22.04, Windows Server 2022, etc."
validations:
required: true
- type: textarea
id: php-versions
attributes:
label: "PHP versions"
placeholder: "e.g., PHP 7.4, PHP 8.0, etc."
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: "To Reproduce"
placeholder: "Please provide the relevant steps of your workflow `.yml` file."
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: "Expected behavior"
placeholder: "A clear and concise description of what you expected to happen."
validations:
required: true
- type: textarea
id: screenshots-logs
attributes:
label: "Screenshots/Logs"
placeholder: "Drag and drop images or paste logs here..."
- type: textarea
id: additional-context
attributes:
label: "Additional context"
placeholder: "Add any other context about the problem here."
- type: dropdown
id: willing-to-submit-pr
attributes:
label: "Are you willing to submit a PR?"
description: "We accept pull requests targeting the develop branch."
options:
- "Yes"
- "No"
validations:
required: true

View File

@ -1,26 +0,0 @@
---
name: Feature request
about: Suggest a new feature
title: ''
labels: 'enhancement'
assignees: 'shivammathur'
---
**Describe the feature**
<!-- Please describe concisely the feature you want to add. -->
**Version**
- [ ] I have checked releases, and the feature is missing in the latest patch version of `v2`.
**Underlying issue**
<!-- Please describe the issue this would solve. -->
**Describe alternatives**
<!-- Please mention any alternative solutions you've considered. -->
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
**Are you willing to submit a PR?**
<!-- We accept pull requests targeting the develop branch. -->

58
.github/ISSUE_TEMPLATE/feature.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Feature request
description: Suggest a new feature
title: "Feature: "
labels: ["enhancement"]
assignees: ["shivammathur"]
body:
- type: markdown
attributes:
value: "Please fill out the sections below to help us understand your new feature proposal."
- type: textarea
id: feature-description
attributes:
label: "Describe the feature"
placeholder: "A clear and concise description of what you want and why."
validations:
required: true
- type: checkboxes
id: version-check
attributes:
label: "Please check the latest release"
options:
- label: "I have checked releases, and the feature is missing in the latest patch version of `v2`."
required: true
- type: textarea
id: underlying-issue
attributes:
label: "Underlying issue"
placeholder: "Please describe the issue this would solve."
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: "Describe alternatives"
placeholder: "Please mention any alternative solutions you've considered."
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: "Additional context"
placeholder: "Drag and drop images or paste any additional information here..."
- type: dropdown
id: willing-to-submit-pr
attributes:
label: "Are you willing to submit a PR?"
description: "We accept pull requests targeting the develop branch."
options:
- "Yes"
- "No"
validations:
required: true

View File

@ -15,14 +15,35 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2022, macos-12] 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'] 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
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
- name: Create for Linux and macOS tools: none
- name: Create file with all extensions for Linux and macOS
env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }}
if: matrix.operating-system != 'windows-2022'
run: |
php -m >> "$file.all"
- name: Create file with all extensions for Windows
env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }}
if: matrix.operating-system == 'windows-2022'
run: |
php -m | Out-File -FilePath "$env:file.all" -Append
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: none
tools: none
- name: Create final file for Linux and macOS
env: env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }} version: ${{ matrix.php-versions }}
@ -31,10 +52,20 @@ jobs:
echo "## PHP $version" >> "$file" echo "## PHP $version" >> "$file"
printf "\n" >> "$file" printf "\n" >> "$file"
echo "\`\`\`" >> "$file" echo "\`\`\`" >> "$file"
php -m >> "$file" php -m >> "$file.builtin"
while IFS= read -r line; do
if [[ $line == [* || -z "${line// }" ]]; then
echo "$line" >> "$file"
elif grep -q "^$line" "$file.builtin"; then
echo "$line (builtin)" >> "$file"
else
echo "$line (shared)" >> "$file"
fi
done < "$file.all"
echo "\`\`\`" >> "$file" echo "\`\`\`" >> "$file"
printf "\n" >> "$file" printf "\n" >> "$file"
- name: Create for Windows rm "$file.all" "$file.builtin"
- name: Create final file for Windows
env: env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }} version: ${{ matrix.php-versions }}
@ -42,8 +73,19 @@ jobs:
run: | run: |
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file" Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
Write-Output "``````" | Out-File -FilePath "$env:file" -Append Write-Output "``````" | Out-File -FilePath "$env:file" -Append
php -m | Out-File -FilePath "$env:file" -Append php -m | Out-File -FilePath "$env:file.builtin" -Append
Get-Content "$env:file.all" | ForEach-Object {
if ($_.startsWith('[') -or -not $_.trim()) {
Write-Output "$_" | Out-File -FilePath "$env:file" -Append
} elseif ($_ -in (Get-Content "$env:file.builtin")) {
Write-Output "$_ (builtin)" | Out-File -FilePath "$env:file" -Append
} else {
Write-Output "$_ (shared)" | Out-File -FilePath "$env:file" -Append
}
}
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
Remove-Item "$env:file.all" -Force
Remove-Item "$env:file.builtin" -Force
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -72,12 +114,12 @@ 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-22.04 ubuntu-20.04 windows-2022 windows-2019 macos-11 macos-12 macos-13; 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; 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-11" || "$os" = "macos-13" ]]; then if [[ "${os%-*}" = "macos" ]]; then
cat lists/php"$version"-macos-12.md >> Php-extensions-loaded-on-"$os".md cat lists/php"$version"-macos-13.md >> Php-extensions-loaded-on-"$os".md
elif [ "$os" = "windows-2019" ]; then elif [ "${os%-*}" = "windows" ]; then
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
else else
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md

View File

@ -33,10 +33,10 @@ jobs:
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Setup Node.js 16.x - name: Setup Node.js 20.x
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 16.x node-version: 20.x
- name: Install dependencies - name: Install dependencies
run: npm install run: npm install
@ -54,7 +54,7 @@ jobs:
run: npm audit run: npm audit
- name: Send Coverage - name: Send Coverage
uses: codecov/codecov-action@v4 uses: codecov/codecov-action@v5
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info files: coverage/lcov.info

View File

@ -28,10 +28,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-22.04, ubuntu-20.04, windows-2019, macos-latest] 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'] 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-22.04 - operating-system: ubuntu-24.04
php-versions: '' php-versions: ''
php-version-file: 'php-version-file' php-version-file: 'php-version-file'
env: env:

View File

@ -30,7 +30,7 @@ jobs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '16.x' node-version: '20.x'
registry-url: https://registry.npmjs.org registry-url: https://registry.npmjs.org
- name: Install dependencies and add lib - name: Install dependencies and add lib

1
.node-version Normal file
View File

@ -0,0 +1 @@
20

226
README.md
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://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://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="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.4-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.5-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
</p> </p>
<p align="center"> <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> <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,29 +68,32 @@ 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 22.04 | `ubuntu-latest` or `ubuntu-22.04` | `PHP 8.1` | | Ubuntu 24.04 | x86_64 | `ubuntu-latest` or `ubuntu-24.04` | `PHP 8.3` |
| Ubuntu 20.04 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.3` | | Ubuntu 22.04 | x86_64 | `ubuntu-22.04` | `PHP 8.1` |
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.3` | | Ubuntu 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` |
| Windows Server 2019 | `windows-2019` | `PHP 8.3` | | Ubuntu 22.04 | aarch64 | `ubuntu-22.04-arm` | `PHP 8.1` |
| macOS Sonoma 14.x | `macos-14` | - | | Windows Server 2025 | x64 | `windows-2025` | `PHP 8.3` |
| macOS Ventura 13.x | `macos-13` | `PHP 8.3` | | Windows Server 2022 | x64 | `windows-latest` or `windows-2022` | `PHP 8.3` |
| macOS Monterey 12.x | `macos-latest` or `macos-12` | `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` |
### Self-Hosted Runners ### Self-Hosted Runners
| Host OS/Virtual environment | YAML workflow label | | Host OS/Virtual environment | YAML workflow label |
|----------------------------------|----------------------------| |----------------------------------|----------------------------|
| 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 11 | `self-hosted` or `Linux` | | Debian 11 | `self-hosted` or `Linux` |
| Debian 10 | `self-hosted` or `Linux` |
| Windows 7 and newer | `self-hosted` or `Windows` | | Windows 7 and newer | `self-hosted` or `Windows` |
| Windows Server 2012 R2 and newer | `self-hosted` or `Windows` | | Windows Server 2012 R2 and newer | `self-hosted` or `Windows` |
| macOS Sequoia 15.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Sonoma 14.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` | | macOS Ventura 13.x x86_64/arm64 | `self-hosted` or `macOS` |
| macOS Monterey 12.x x86_64/arm64 | `self-hosted` or `macOS` |
- Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners. - Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
- Operating systems based on the above Ubuntu and Debian versions are also supported on best effort basis. - Operating systems based on the above Ubuntu and Debian versions are also supported on best effort basis.
@ -100,8 +103,9 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
On all supported OS/Platforms the following PHP versions can be set up as per the runner. On all supported OS/Platforms the following PHP versions can be set up as per the runner.
- PHP 5.3 to PHP 8.4 on GitHub-hosted runners. - PHP 5.3 to PHP 8.5 on GitHub-hosted runners, except for macOS ARM64 runners (macos-14).
- PHP 5.6 to PHP 8.4 on self-hosted runners. - 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 Version | Stability | Release Support | Runner Support | | PHP Version | Stability | Release Support | Runner Support |
|-------------|-----------|-----------------------|--------------------------------| |-------------|-----------|-----------------------|--------------------------------|
@ -116,13 +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` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` | | `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
| `8.5` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
**Notes:**
- Specifying `8.4` in `php-version` input installs a nightly build of `PHP 8.4.0-dev`. See [nightly build setup](#nightly-build-setup) for more information. > [!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
@ -134,7 +140,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with PECL extension - name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
extensions: imagick, swoole extensions: imagick, swoole
``` ```
@ -162,7 +168,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with pre-release PECL extension - name: Setup PHP with pre-release PECL extension
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
extensions: xdebug-beta extensions: xdebug-beta
``` ```
@ -174,19 +180,19 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP and disable opcache - name: Setup PHP and disable opcache
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
extensions: :opcache extensions: :opcache
``` ```
- 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
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
extensions: none, mbstring extensions: none, mbstring
``` ```
@ -196,7 +202,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with intl - name: Setup PHP with intl
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
extensions: intl-70.1 extensions: intl-70.1
``` ```
@ -213,7 +219,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- name: Setup PHP with fail-fast - name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
extensions: oci8 extensions: oci8
env: env:
fail-fast: true fail-fast: true
@ -223,13 +229,13 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
These tools can be set up globally using the `tools` input. It accepts a string in csv-format. 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-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`] [`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
```yaml ```yaml
- name: Setup PHP with tools - name: Setup PHP with tools
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
tools: php-cs-fixer, phpunit tools: php-cs-fixer, phpunit
``` ```
@ -239,28 +245,28 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with tools - name: Setup PHP with tools
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
tools: vimeo/psalm tools: vimeo/psalm
``` ```
- 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:
- Semver. For example `tool:1.2.3` or `tool:1.2.3-beta1`.
- Major version. For example `tool:1` or `tool:1.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.
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"). Version can be in the following format:
- Semver. For example `tool:1.2.3` or `tool:1.2.3-beta1`.
- Major version. For example `tool:1` or `tool:1.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.
With the exception of major versions of `composer`, if you specify only the `major` version or the version in `major.minor` format for a tool you can get rate limited by GitHub's API. To avoid this, it is recommended to provide a [`GitHub` OAuth token](https://github.com/shivammathur/setup-php#github-composer-authentication "Composer GitHub OAuth").
You can do that by setting `GITHUB_TOKEN` environment variable. The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version. You can do that by setting `GITHUB_TOKEN` environment variable. The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
```yaml ```yaml
- name: Setup PHP with tools - name: Setup PHP with tools
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
tools: php-cs-fixer:3.39, phpunit:10.4 tools: php-cs-fixer:3.64, phpunit:11.4
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
``` ```
@ -271,8 +277,8 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with composer v2 - name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' 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.
@ -281,7 +287,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP without composer - name: Setup PHP without composer
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
tools: none tools: none
``` ```
@ -297,24 +303,35 @@ These tools can be set up globally using the `tools` input. It accepts a string
- name: Setup PHP with fail-fast - name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
tools: deployer tools: deployer
env: env:
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
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
env: env:
COMPOSER_PROCESS_TIMEOUT: 300 COMPOSER_PROCESS_TIMEOUT: 300
``` ```
@ -330,7 +347,7 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
- name: Setup PHP with Xdebug - name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
coverage: xdebug coverage: xdebug
``` ```
@ -345,25 +362,26 @@ 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
Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`. Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`.
Runs on PHP 7.1 and newer PHP versions. Runs on PHP 7.1 and newer PHP versions.
- If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input. - If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
```yaml ```yaml
- name: Setup PHP with PCOV - name: Setup PHP with PCOV
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
ini-values: pcov.directory=api #optional, see above for usage. ini-values: pcov.directory=api #optional, see above for usage.
coverage: pcov coverage: pcov
``` ```
- PHPUnit 8.x and above supports PCOV out of the box. - PHPUnit 8.x and above supports PCOV out of the box.
- If you are using PHPUnit 5.x, 6.x or 7.x, you need to set up `pcov/clobber` before executing your tests. - If you are using PHPUnit 5.x, 6.x or 7.x, you need to set up `pcov/clobber` before executing your tests.
```yaml ```yaml
@ -388,7 +406,7 @@ Disable coverage for these reasons:
- name: Setup PHP with no coverage driver - name: Setup PHP with no coverage driver
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
coverage: none coverage: none
``` ```
@ -401,16 +419,18 @@ Disable coverage for these reasons:
#### `php-version` (optional) #### `php-version` (optional)
- Specify the PHP version you want to set up. - Specify the PHP version you want to set up.
- Accepts a `string`. For example `'8.3'`. - Accepts a `string`. For example `'8.4'`.
- Accepts `lowest` to set up the lowest supported PHP version. - Accepts `lowest` to set up the lowest supported PHP version.
- Accepts `highest` or `latest` to set up the latest stable PHP version. - Accepts `highest` or `latest` to set up the latest stable PHP version.
- Accepts `nightly` to set up a nightly build from the master branch of PHP. - Accepts `nightly` to set up a nightly build from the master branch of PHP.
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`. - Accepts `pre-installed` to set up the highest pre-installed PHP version. You can combine this with `update: true` to update the pre-installed PHP version.
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
- See [PHP support](#tada-php-support) for the supported PHP versions. - See [PHP support](#tada-php-support) for the supported PHP versions.
- If not specified, it looks for the following in order: - If not specified, it looks for the following in order:
- 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.
#### `php-version-file` (optional) #### `php-version-file` (optional)
@ -418,6 +438,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.
- 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)
@ -436,9 +457,9 @@ Disable coverage for these reasons:
#### `ini-values` (optional) #### `ini-values` (optional)
- Specify the values you want to add to `php.ini`. - Specify the values you want to add to `php.ini`.
- Accepts a `string` in csv-format. For example `post_max_size=256M, max_execution_time=180`. - Accepts a `string` in csv-format. For example `post_max_size=256M, max_execution_time=180`.
- Accepts ini values with commas if wrapped in quotes. For example `xdebug.mode="develop,coverage"`. - Accepts ini values with commas if wrapped in quotes. For example `xdebug.mode="develop,coverage"`.
#### `coverage` (optional) #### `coverage` (optional)
@ -465,7 +486,7 @@ On GitHub Actions you can assign the `setup-php` step an `id`, you can use the s
id: setup-php id: setup-php
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
- name: Print PHP version - name: Print PHP version
run: echo ${{ steps.setup-php.outputs.php-version }} run: echo ${{ steps.setup-php.outputs.php-version }}
@ -507,7 +528,7 @@ steps:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
extensions: mbstring, intl extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180 ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug coverage: xdebug
@ -525,12 +546,12 @@ jobs:
strategy: strategy:
matrix: matrix:
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest'] operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
php-versions: ['8.1', '8.2', '8.3'] php-versions: ['8.2', '8.3', '8.4']
phpunit-versions: ['latest'] phpunit-versions: ['latest']
include: include:
- operating-system: 'ubuntu-latest' - operating-system: 'ubuntu-latest'
php-versions: '8.0' php-versions: '8.1'
phpunit-versions: 9 phpunit-versions: 10
steps: steps:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
@ -546,7 +567,7 @@ jobs:
### Nightly Build Setup ### Nightly Build Setup
> Set up a nightly build of `PHP 8.4`. > Set up a nightly build of `PHP 8.5`.
- These PHP versions are currently in active development and might contain bugs and breaking changes. - 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 this version currently.
@ -556,7 +577,7 @@ steps:
- name: Setup nightly PHP - name: Setup nightly PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.4' php-version: '8.5'
extensions: mbstring extensions: mbstring
ini-values: post_max_size=256M, max_execution_time=180 ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug coverage: xdebug
@ -570,17 +591,17 @@ 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:
- name: Setup PHP with debugging symbols - name: Setup PHP with debugging symbols
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
env: env:
debug: true # specify true or false debug: true # specify true or false
``` ```
@ -600,7 +621,7 @@ jobs:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
env: env:
phpts: ts # specify ts or nts phpts: ts # specify ts or nts
``` ```
@ -617,7 +638,7 @@ jobs:
- name: Setup PHP with latest versions - name: Setup PHP with latest versions
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
env: env:
update: true # specify true or false update: true # specify true or false
``` ```
@ -632,14 +653,14 @@ To debug any issues, you can use the `verbose` tag instead of `v2`.
- name: Setup PHP with logs - name: Setup PHP with logs
uses: shivammathur/setup-php@verbose uses: shivammathur/setup-php@verbose
with: with:
php-version: '8.3' php-version: '8.4'
``` ```
### Multi-Arch Setup ### Multi-Arch Setup
> Set up PHP on multiple architecture on Ubuntu GitHub Runners. > Set up PHP on multiple architecture on Ubuntu GitHub Runners.
- `PHP 5.6` to `PHP 8.3` are supported by `setup-php` on multiple architecture on `Ubuntu`. - `PHP 5.6` to `PHP 8.4` are supported by `setup-php` on multiple architecture on `Ubuntu`.
- For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` installed for `setup-php`. - For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` installed for `setup-php`.
- Currently, for `ARM` based setup, you will need [self-hosted runners](#self-hosted-setup). - Currently, for `ARM` based setup, you will need [self-hosted runners](#self-hosted-setup).
@ -655,7 +676,7 @@ jobs:
- name: Install PHP - name: Install PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
``` ```
### Self Hosted Setup ### Self Hosted Setup
@ -677,7 +698,7 @@ jobs:
runs-on: self-hosted runs-on: self-hosted
strategy: strategy:
matrix: matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
name: PHP ${{ matrix.php-versions }} name: PHP ${{ matrix.php-versions }}
steps: steps:
- name: Setup PHP - name: Setup PHP
@ -688,10 +709,10 @@ jobs:
runner: self-hosted runner: self-hosted
``` ```
**Notes** > [!NOTE]
- Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other. > - Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
- Do not set up self-hosted runners on the side on your development environment or your production server. > - Do not set up self-hosted runners on the side on your development environment or your production server.
- Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners. > - Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
### Local Testing Setup ### Local Testing Setup
@ -705,22 +726,22 @@ jobs:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
``` ```
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
act -P ubuntu-latest=shivammathur/node:latest act -P ubuntu-latest=shivammathur/node:latest
# For runs-on: ubuntu-24.04
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
@ -732,13 +753,13 @@ act -P ubuntu-20.04=shivammathur/node:2004
- 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` 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 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`. For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
```yaml ```yaml
- name: Setup PHP with JIT in tracing mode - name: Setup PHP with JIT in tracing mode
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
coverage: none coverage: none
ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
``` ```
@ -768,9 +789,9 @@ If your project uses composer, you can persist the composer's internal cache dir
run: composer install --prefer-dist run: composer install --prefer-dist
``` ```
**Notes** > [!NOTE]
- Please do not cache `vendor` directory using `action/cache` as that will have side effects. > - Please do not cache `vendor` directory using `action/cache` as that will have side effects.
- If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache. > - If you do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
```yaml ```yaml
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
``` ```
@ -791,7 +812,7 @@ The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHU
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
``` ```
@ -804,7 +825,7 @@ If you use Private Packagist for your private composer dependencies, you can set
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
env: env:
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }} PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
``` ```
@ -818,7 +839,7 @@ Please refer to the authentication section in [`composer documentation`](https:/
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
env: env:
COMPOSER_AUTH_JSON: | COMPOSER_AUTH_JSON: |
{ {
@ -841,7 +862,7 @@ Put the code in the run property of a step and specify the shell as `php {0}`.
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
- name: Run PHP code - name: Run PHP code
shell: php {0} shell: php {0}
@ -881,7 +902,7 @@ PHPStan supports error reporting in GitHub Actions, so it does not require probl
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
tools: phpstan tools: phpstan
- name: Run PHPStan - name: Run PHPStan
@ -896,7 +917,7 @@ Psalm supports error reporting in GitHub Actions with an output format `github`.
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
tools: psalm tools: psalm
- name: Run Psalm - name: Run Psalm
@ -914,7 +935,7 @@ For examples refer to the [cs2pr documentation](https://github.com/staabm/annota
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.3' php-version: '8.4'
tools: cs2pr, phpcs tools: cs2pr, phpcs
- name: Run phpcs - name: Run phpcs
@ -963,7 +984,7 @@ Examples of using `setup-php` with various PHP frameworks and packages.
## :scroll: License ## :scroll: License
- The scripts and documentation in this project are under the [MIT License](LICENSE "License for shivammathur/setup-php"). - The scripts and documentation in this project are under the [MIT License](LICENSE "License for shivammathur/setup-php").
- This project has multiple [dependencies](#package-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories. - This project has multiple [dependencies](#package-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
- The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License"). - The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License").
@ -1043,12 +1064,14 @@ These companies generously provide setup-php their products and services to aid
[`churn`]: https://github.com/bmitch/churn-php [`churn`]: https://github.com/bmitch/churn-php
[`codeception`]: https://codeception.com/ [`codeception`]: https://codeception.com/
[`composer`]: https://getcomposer.org/ [`composer`]: https://getcomposer.org/
[`composer-dependency-analyser`]: https://github.com/shipmonk-rnd/composer-dependency-analyser
[`composer-normalize`]: https://github.com/ergebnis/composer-normalize [`composer-normalize`]: https://github.com/ergebnis/composer-normalize
[`composer-prefetcher`]: https://github.com/narrowspark/automatic-composer-prefetcher [`composer-prefetcher`]: https://github.com/narrowspark/automatic-composer-prefetcher
[`composer-require-checker`]: https://github.com/maglnet/ComposerRequireChecker [`composer-require-checker`]: https://github.com/maglnet/ComposerRequireChecker
[`composer-unused`]: https://github.com/composer-unused/composer-unused [`composer-unused`]: https://github.com/composer-unused/composer-unused
[`cs2pr`]: https://github.com/staabm/annotate-pull-request-from-checkstyle [`cs2pr`]: https://github.com/staabm/annotate-pull-request-from-checkstyle
[`deployer`]: https://deployer.org/ [`deployer`]: https://deployer.org/
[`ecs`]: https://github.com/easy-coding-standard/easy-coding-standard
[`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/
@ -1074,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/

View File

@ -1,5 +1,5 @@
import * as fetch from '../src/fetch'; import * as fetch from '../src/fetch';
import nock = require('nock'); import nock from 'nock';
it('checking fetch', async () => { it('checking fetch', async () => {
const host_url = 'https://example.com'; const host_url = 'https://example.com';

View File

@ -1,5 +1,5 @@
import * as packagist from '../src/packagist'; import * as packagist from '../src/packagist';
import nock = require('nock'); import nock from 'nock';
describe('search function', () => { describe('search function', () => {
const mockResponse = { const mockResponse = {

View File

@ -1,4 +1,4 @@
import fs = require('fs'); import * as fs from 'fs';
import * as tools from '../src/tools'; import * as tools from '../src/tools';
interface IData { interface IData {
@ -258,8 +258,9 @@ describe('Tools tests', () => {
it.each` it.each`
version | php_version | os | script version | php_version | os | script
${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'} ${'latest'} | ${'8.0'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'}
${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'} ${'1.2.3'} | ${'8.0'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
${'1.2.3'} | ${'7.4'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive'}
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'} ${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'} ${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'} ${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
@ -392,7 +393,7 @@ describe('Tools tests', () => {
it.each([ it.each([
[ [
'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp', 'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp, pie',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_blackfire', 'add_blackfire',
@ -403,17 +404,17 @@ describe('Tools tests', () => {
'add_composer_tool flex flex symfony/ global', 'add_composer_tool flex flex symfony/ global',
'add_grpc_php_plugin latest', 'add_grpc_php_plugin latest',
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"', 'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"', 'add_tool https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
'add_tool https://github.com/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"', 'add_tool https://github.com/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"',
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"', 'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
'add_composer_tool phplint phplint overtrue/', 'add_composer_tool phplint phplint overtrue/',
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"', 'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"', 'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"',
'add_pecl', 'add_pecl',
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"', 'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
'add_composer_tool phinx phinx robmorgan/ scoped', 'add_composer_tool phinx phinx robmorgan/ scoped',
'add_composer_tool phinx phinx:1.2.3 robmorgan/ scoped', 'add_composer_tool phinx phinx:1.2.3 robmorgan/ scoped',
'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive "status"', 'add_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status"',
'add_composer_tool phpunit-bridge phpunit-bridge symfony/ global', 'add_composer_tool phpunit-bridge phpunit-bridge symfony/ global',
'add_composer_tool phpunit-polyfills phpunit-polyfills yoast/ global', 'add_composer_tool phpunit-polyfills phpunit-polyfills yoast/ global',
'add_tool https://github.com/laravel/pint/releases/latest/download/pint.phar pint "-V"', 'add_tool https://github.com/laravel/pint/releases/latest/download/pint.phar pint "-V"',
@ -422,7 +423,8 @@ describe('Tools tests', () => {
'add_protoc latest', 'add_protoc latest',
'add_symfony latest', 'add_symfony latest',
'add_composer_tool vapor-cli vapor-cli laravel/ scoped', 'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"' 'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
'add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
] ]
] ]
])('checking addTools on linux', async (tools_csv, scripts) => { ])('checking addTools on linux', async (tools_csv, scripts) => {
@ -434,14 +436,15 @@ describe('Tools tests', () => {
it.each([ it.each([
[ [
'behat, blackfire, blackfire-player, churn, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli', 'behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli, pie',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_composer_tool behat behat behat/ scoped', 'add_composer_tool behat behat behat/ scoped',
'add_blackfire', 'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"', 'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"', 'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"', 'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "diagnose"',
'add_composer_tool composer-dependency-analyser composer-dependency-analyser shipmonk/ scoped',
'add_composer_tool composer-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"',
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"', 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"',
@ -452,7 +455,7 @@ describe('Tools tests', () => {
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"', 'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
'add_tool https://www.phing.info/get/phing-1.2.3.phar,https://github.com/phingofficial/phing/releases/download/1.2.3/phing-1.2.3.phar phing "-v"', 'add_tool https://www.phing.info/get/phing-1.2.3.phar,https://github.com/phingofficial/phing/releases/download/1.2.3/phing-1.2.3.phar phing "-v"',
'add_composer_tool phinx phinx robmorgan/ scoped', 'add_composer_tool phinx phinx robmorgan/ scoped',
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive', 'add_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive',
'add_devtools php-config', 'add_devtools php-config',
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"', 'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"', 'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
@ -468,7 +471,9 @@ describe('Tools tests', () => {
'add_composer_tool rector rector rector/ scoped', 'add_composer_tool rector rector rector/ 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_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) => {
@ -480,7 +485,7 @@ describe('Tools tests', () => {
it.each([ it.each([
[ [
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp', 'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp, pie',
[ [
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'Add-Blackfire', 'Add-Blackfire',
@ -491,13 +496,14 @@ describe('Tools tests', () => {
'Tool does_not_exist is not supported', 'Tool does_not_exist is not supported',
'Add-ComposerTool flex flex symfony/ global', 'Add-ComposerTool flex flex symfony/ global',
'Add-ComposerTool phinx phinx robmorgan/ scoped', 'Add-ComposerTool phinx phinx robmorgan/ scoped',
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive "status"', 'Add-Tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status"',
'php-config is not a windows tool', 'php-config is not a windows tool',
'phpize is not a windows tool', 'phpize is not a windows tool',
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"', 'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
'Add-ComposerTool phpunit-bridge phpunit-bridge symfony/ global', 'Add-ComposerTool phpunit-bridge phpunit-bridge symfony/ global',
'Add-Symfony', 'Add-Symfony',
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"' 'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
'Add-Tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
] ]
] ]
])('checking addTools on Windows', async (tools_csv, scripts) => { ])('checking addTools on Windows', async (tools_csv, scripts) => {
@ -560,7 +566,7 @@ describe('Tools tests', () => {
it.each` it.each`
tools_csv | script tools_csv | script
${'none'} | ${''} ${'none'} | ${''}
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"'} ${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"'}
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'} ${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'} ${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'} ${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}

View File

@ -1,6 +1,7 @@
import fs = require('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 () => {
@ -285,6 +289,14 @@ describe('Utils tests', () => {
delete process.env['php-version-file']; delete process.env['php-version-file'];
delete process.env['php-version']; delete process.env['php-version'];
existsSync.mockReturnValue(true);
readFileSync.mockReturnValue('ruby 1.2.3\nphp 8.4.2\nnode 20.1.2');
expect(await utils.readPHPVersion()).toBe('8.4.2');
existsSync.mockReturnValue(true);
readFileSync.mockReturnValue('setup-php');
expect(await utils.readPHPVersion()).toBe('setup-php');
existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true);
readFileSync.mockReturnValue( readFileSync.mockReturnValue(
'{ "platform-overrides": { "php": "7.3.25" } }' '{ "platform-overrides": { "php": "7.3.25" } }'

4
dist/index.js vendored

File diff suppressed because one or more lines are too long

51
eslint.config.mjs Normal file
View File

@ -0,0 +1,51 @@
import {fixupConfigRules, fixupPluginRules} from '@eslint/compat';
// eslint-disable-next-line import/no-unresolved
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import jest from 'eslint-plugin-jest';
import globals from 'globals';
// eslint-disable-next-line import/no-unresolved
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import js from '@eslint/js';
import {FlatCompat} from '@eslint/eslintrc';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
'prettier'
)
),
{
plugins: {
'@typescript-eslint': fixupPluginRules(typescriptEslint),
jest
},
languageOptions: {
globals: {
...globals.node,
...globals.jest
},
parser: tsParser,
ecmaVersion: 2021,
sourceType: 'module'
}
}
];

13470
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "2.30.1", "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",
@ -34,29 +34,32 @@
"author": "shivammathur", "author": "shivammathur",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3", "@actions/io": "^1.1.3",
"compare-versions": "^6.1.0" "compare-versions": "^6.1.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@eslint/compat": "^1.3.0",
"@types/node": "^20.11.30", "@eslint/js": "9.28.0",
"@typescript-eslint/eslint-plugin": "^7.3.1", "@types/jest": "^29.5.14",
"@typescript-eslint/parser": "^7.3.1", "@types/node": "^24.0.1",
"@vercel/ncc": "^0.38.1", "@typescript-eslint/eslint-plugin": "^8.34.0",
"eslint": "^8.57.0", "@typescript-eslint/parser": "^8.34.0",
"eslint-config-prettier": "^9.1.0", "@vercel/ncc": "^0.38.3",
"eslint-plugin-import": "^2.29.1", "eslint": "9.28.0",
"eslint-plugin-jest": "^27.9.0", "eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-import": "^2.31.0",
"jest": "^29.7.0", "eslint-plugin-jest": "^28.13.3",
"jest-circus": "^29.7.0", "eslint-plugin-prettier": "^5.4.1",
"nock": "^13.5.4", "globals": "^16.2.0",
"prettier": "^3.2.5", "jest": "^30.0.0",
"simple-git-hooks": "^2.11.0", "jest-circus": "^30.0.0",
"ts-jest": "^29.1.2", "nock": "^14.0.5",
"typescript": "^5.4.3" "prettier": "^3.5.3",
"simple-git-hooks": "^2.13.0",
"ts-jest": "^29.4.0",
"typescript": "^5.8.3"
}, },
"bugs": { "bugs": {
"url": "https://github.com/shivammathur/setup-php/issues" "url": "https://github.com/shivammathur/setup-php/issues"

View File

@ -37,6 +37,7 @@ swoole=swoole
uuid=uuid uuid=uuid
v8js=v8js v8js=v8js
vips=vips vips=vips
vld=vld
xdebug=xdebug xdebug=xdebug
xdebug2=xdebug xdebug2=xdebug
xlswriter=xlswriter xlswriter=xlswriter

View File

@ -6,11 +6,11 @@ couchbase=30
decimal=30 decimal=30
ds=30 ds=30
event=30 event=30
ev=30
grpc=30 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
@ -19,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

View File

@ -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 8 jessie
20 23.04 lunar
21 23.10 mantic
22 24.04 noble
23 24.10 oracular
24 25.10 plucky

View File

@ -1,9 +1,9 @@
{ {
"lowest": "8.1", "lowest": "8.1",
"highest": "8.3", "highest": "8.4",
"latest": "8.3", "latest": "8.4",
"nightly": "8.4", "nightly": "8.5",
"5.x": "5.6", "5.x": "5.6",
"7.x": "7.4", "7.x": "7.4",
"8.x": "8.3" "8.x": "8.4"
} }

View File

@ -16,6 +16,11 @@
"version_prefix": "", "version_prefix": "",
"version_parameter": "-V" "version_parameter": "-V"
}, },
"composer-dependency-analyser": {
"type": "composer",
"repository": "shipmonk/composer-dependency-analyser",
"scope": "scoped"
},
"composer-unused": { "composer-unused": {
"type": "phar", "type": "phar",
"repository": "composer-unused/composer-unused", "repository": "composer-unused/composer-unused",
@ -30,7 +35,7 @@
"extension": ".phar", "extension": ".phar",
"domain": "https://github.com", "domain": "https://github.com",
"version_prefix": "", "version_prefix": "",
"version_parameter": "-V" "version_parameter": "diagnose"
}, },
"cs2pr": { "cs2pr": {
"type": "phar", "type": "phar",
@ -66,7 +71,7 @@
}, },
"php-cs-fixer": { "php-cs-fixer": {
"type": "phar", "type": "phar",
"repository": "FriendsOfPHP/PHP-CS-Fixer", "repository": "PHP-CS-Fixer/PHP-CS-Fixer",
"extension": ".phar", "extension": ".phar",
"domain": "https://github.com", "domain": "https://github.com",
"fetch_latest": "true", "fetch_latest": "true",
@ -131,6 +136,14 @@
"version_prefix": "", "version_prefix": "",
"version_parameter": "-V" "version_parameter": "-V"
}, },
"pie": {
"type": "phar",
"repository": "php/pie",
"extension": ".phar",
"domain": "https://github.com",
"version_prefix": "",
"version_parameter": "-V"
},
"pint": { "pint": {
"type": "phar", "type": "phar",
"repository": "laravel/pint", "repository": "laravel/pint",
@ -318,5 +331,11 @@
"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"
} }
} }

View File

@ -31,26 +31,26 @@ export async function addExtensionDarwin(
case /.+-.+\/.+@.+/.test(extension): case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.parseExtensionSource(extension, ext_prefix); add_script += await utils.parseExtensionSource(extension, ext_prefix);
return; return;
// match 7.4relay...8.3relay // 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...7.4ioncube // 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.2zephir_parser // match 7.0zephir_parser...8.4zephir_parser
case /^(7\.4|8\.[0-3])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])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-2])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(
@ -83,7 +83,7 @@ export async function addExtensionDarwin(
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin'); add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
return; return;
// match brew extensions // match brew extensions
case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|snmp|ssh2|swoole|uuid|xdebug|xdebug2|yaml|zmq)/.test( case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|snmp|ssh2|swoole|uuid|vld|xdebug|xdebug2|yaml|zmq)/.test(
version_extension version_extension
): ):
case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension): case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
@ -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...7.4ioncube // 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.2zephir_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])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-2])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(
@ -263,16 +263,16 @@ export async function addExtensionLinux(
case /.+-.+\/.+@.+/.test(extension): case /.+-.+\/.+@.+/.test(extension):
add_script += await utils.parseExtensionSource(extension, ext_prefix); add_script += await utils.parseExtensionSource(extension, ext_prefix);
return; return;
// match 7.4relay...8.3relay // 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...7.4ioncube // 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.2zephir_parser // match 7.0zephir_parser...8.4zephir_parser
case /^(7\.4|8\.[0-3])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])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-2])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(

View File

@ -69,7 +69,6 @@ add_brew_extension() {
else else
add_brew_tap "$php_tap" add_brew_tap "$php_tap"
add_brew_tap "$ext_tap" add_brew_tap "$ext_tap"
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "${core_repo:?}/Formula/" 2>/dev/null || true
update_dependencies >/dev/null 2>&1 update_dependencies >/dev/null 2>&1
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1 handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1 (brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
@ -135,7 +134,11 @@ patch_brew() {
update_dependencies() { update_dependencies() {
patch_brew patch_brew
if ! [ -e /tmp/update_dependencies ]; then if ! [ -e /tmp/update_dependencies ]; then
git_retry -C "$core_repo" fetch origin master && git -C "$core_repo" reset --hard origin/master 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
fi
done
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1 echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
fi fi
} }
@ -162,10 +165,11 @@ add_php() {
suffix="$(get_php_formula_suffix)" suffix="$(get_php_formula_suffix)"
php_formula="shivammathur/php/php@$version$suffix" php_formula="shivammathur/php/php@$version$suffix"
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula" ([ "$action" = "upgrade" ] && brew upgrade -f --overwrite "$php_formula") || brew unlink "$php_formula"
else else
brew install -f "$php_formula" brew install -f --overwrite "$php_formula"
fi fi
sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix"
brew link --force --overwrite "$php_formula" brew link --force --overwrite "$php_formula"
} }
@ -206,10 +210,17 @@ get_scan_dir() {
fi fi
} }
# Function to handle self-hosted runner setup.
self_hosted_helper() {
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
}
# Function to Setup PHP. # Function to Setup PHP.
setup_php() { setup_php() {
step_log "Setup PHP" step_log "Setup PHP"
php_config="$(command -v php-config 2>/dev/null)" php_config="$(command -v php-config 2>/dev/null)"
update=true
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/./}" >/dev/null 2>&1
@ -217,15 +228,16 @@ setup_php() {
elif [ "$existing_version" != "$version" ]; then elif [ "$existing_version" != "$version" ]; then
add_php "install" "$existing_version" >/dev/null 2>&1 add_php "install" "$existing_version" >/dev/null 2>&1
status="Installed" status="Installed"
elif [ "$existing_version" = "$version" ] && [ "${update:?}" = "true" ]; then elif [ "$existing_version" = "$version" ]; then
add_php "upgrade" "$existing_version" >/dev/null 2>&1 if [ "${update:?}" = "true" ]; then
status="Updated to" add_php "upgrade" "$existing_version" >/dev/null 2>&1
else status="Updated to"
add_php "upgrade" "$existing_version" >/dev/null 2>&1 else
status="Updated to" status="Found"
fi
fi fi
php_config="$(command -v php-config)" php_config="$(command -v php-config)"
ext_dir="$(grep 'extension_dir=' "$php_config" | cut -d "'" -f 2)" ext_dir="$(sed -n "s/.*extension_dir=['\"]\(.*\)['\"].*/\1/p" "$php_config")"
ini_dir="$(php_ini_path)" ini_dir="$(php_ini_path)"
scan_dir="$(get_scan_dir)" scan_dir="$(get_scan_dir)"
ini_file="$ini_dir"/php.ini ini_file="$ini_dir"/php.ini
@ -246,7 +258,7 @@ setup_php() {
} }
# Variables # Variables
version=${1:-'8.3'} version=${1:-'8.4'}
ini=${2:-'production'} ini=${2:-'production'}
src=${0%/*}/.. src=${0%/*}/..
php_formula=shivammathur/php/php@"$version" php_formula=shivammathur/php/php@"$version"
@ -254,7 +266,6 @@ scripts="$src"/scripts
ext_tap=shivammathur/homebrew-extensions ext_tap=shivammathur/homebrew-extensions
php_tap=shivammathur/homebrew-php php_tap=shivammathur/homebrew-php
export HOMEBREW_CHANGE_ARCH_TO_ARM=1 export HOMEBREW_CHANGE_ARCH_TO_ARM=1
export HOMEBREW_DEVELOPER=1
export HOMEBREW_NO_AUTO_UPDATE=1 export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1 export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1 export HOMEBREW_NO_INSTALL_CLEANUP=1

View File

@ -66,7 +66,7 @@ Function Enable-Extension() {
} }
# Function to add custom built PHP extension for nightly builds. # Function to add custom built PHP extension for nightly builds.
Function Add-NightlyExtension { Function Add-ExtensionFromGithub {
Param ( Param (
[Parameter(Position = 0, Mandatory = $true)] [Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()] [ValidateNotNull()]
@ -100,7 +100,7 @@ Function Add-Extension {
$stability = 'stable', $stability = 'stable',
[Parameter(Position = 2, Mandatory = $false)] [Parameter(Position = 2, Mandatory = $false)]
[ValidateNotNull()] [ValidateNotNull()]
[ValidatePattern('^\d+(\.\d+){0,2}$')] [ValidatePattern('^\d+(\.\d+){0,3}$')]
[string] [string]
$extension_version = '' $extension_version = ''
) )
@ -123,7 +123,7 @@ Function Add-Extension {
} }
else { else {
if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) { if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) {
Add-NightlyExtension $extension Add-ExtensionFromGithub $extension
} else { } else {
# Patch till DLLs for PHP 8.1 and above are released as stable. # Patch till DLLs for PHP 8.1 and above are released as stable.
$minimumStability = $stability $minimumStability = $stability
@ -136,6 +136,10 @@ Function Add-Extension {
{ {
$params["Version"] = $extension_version $params["Version"] = $extension_version
} }
# If extension for a different version exists
if(Test-Path $ext_dir\php_$extension.dll) {
Move-Item $ext_dir\php_$extension.dll $ext_dir\php_$extension.bak.dll -Force
}
Install-PhpExtension @params Install-PhpExtension @params
Set-ExtensionPrerequisites $extension Set-ExtensionPrerequisites $extension
} }
@ -257,4 +261,4 @@ Function Disable-AllShared() {
# Function to handle request to add PECL. # Function to handle request to add PECL.
Function Add-Pecl() { Function Add-Pecl() {
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows" Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
} }

View File

@ -8,6 +8,10 @@ add_blackfire() {
status='Enabled' status='Enabled'
if ! shared_extension blackfire; then if ! shared_extension blackfire; then
status='Installed and enabled' status='Installed and enabled'
arch="$(uname -m)"
arch_name="amd64"
[[ "$arch" = "aarch64" || "$arch" = "arm64" ]] && arch_name="arm64"
[ "${ts:?}" = 'zts' ] && no_dot_version="${no_dot_version}-zts"
if [ "$extension_version" = "blackfire" ]; then if [ "$extension_version" = "blackfire" ]; then
if [[ ${version:?} =~ 5.[3-6] ]]; then if [[ ${version:?} =~ 5.[3-6] ]]; then
extension_version='1.50.0' extension_version='1.50.0'
@ -15,10 +19,14 @@ 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"_amd64-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 >/dev/null 2>&1
fi
if [ -e "${ext_dir:?}/blackfire.so" ]; then
disable_extension xdebug >/dev/null 2>&1
disable_extension pcov >/dev/null 2>&1
enable_extension blackfire extension
add_extension_log blackfire "$status"
else
add_extension_log blackfire "Could not install blackfire on PHP ${semver:?}"
fi fi
disable_extension xdebug >/dev/null 2>&1
disable_extension pcov >/dev/null 2>&1
enable_extension blackfire extension
add_extension_log blackfire "$status"
} }

View File

@ -7,15 +7,27 @@ add_couchbase_clibs() {
else else
release=$(get -s -n "" "$trunk"/latest | grep -Eo -m 1 "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) release=$(get -s -n "" "$trunk"/latest | grep -Eo -m 1 "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
fi fi
[ "$VERSION_ID" = "22.04" ] && vid=20.04 || vid="$VERSION_ID" [ "$VERSION_ID" = "24.04" ] && vid=22.04 || vid="$VERSION_ID"
[ "$VERSION_CODENAME" = "jammy" ] && vcn=focal || vcn="$VERSION_CODENAME" [ "$VERSION_CODENAME" = "noble" ] && vcn=jammy || vcn="$VERSION_CODENAME"
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${vid/./}_${vcn}_amd64.tar" deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${vid/./}_${vcn}_amd64.tar"
get -q -n /tmp/libcouchbase.tar "$deb_url" get -q -n /tmp/libcouchbase.tar "$deb_url"
if ! [ -e /tmp/libcouchbase.tar ] || ! file /tmp/libcouchbase.tar | grep -q 'tar archive'; then
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu2004_focal_amd64.tar"
get -q -n /tmp/libcouchbase.tar "$deb_url"
add_old_libssl
fi
sudo tar -xf /tmp/libcouchbase.tar -C /tmp sudo tar -xf /tmp/libcouchbase.tar -C /tmp
install_packages libev4 libevent-dev install_packages libev4 libevent-dev
sudo dpkg -i /tmp/libcouchbase-*/*.deb sudo dpkg -i /tmp/libcouchbase-*/*.deb
} }
add_old_libssl() {
if [[ "$VERSION_ID" = "24.04" ]]; then
get -q -n /tmp/libssl.deb http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
[ -e /tmp/libssl.deb ] && sudo dpkg -i /tmp/libssl.deb || add_extension_log "couchbase" "Could not install libssl1.1"
fi
}
add_couchbase_cxxlibs() { add_couchbase_cxxlibs() {
if [ "${runner:?}" = "self-hosted" ]; then if [ "${runner:?}" = "self-hosted" ]; then
add_list cmake https://apt.kitware.com/ubuntu/ https://apt.kitware.com/keys/kitware-archive-latest.asc "$VERSION_CODENAME" main add_list cmake https://apt.kitware.com/ubuntu/ https://apt.kitware.com/keys/kitware-archive-latest.asc "$VERSION_CODENAME" main
@ -33,7 +45,7 @@ get_couchbase_version() {
elif [ "${version:?}" = '7.3' ]; then elif [ "${version:?}" = '7.3' ]; then
echo couchbase-3.2.2 echo couchbase-3.2.2
elif [ "${version:?}" = '7.4' ]; then elif [ "${version:?}" = '7.4' ]; then
echo couchbase-4.1.0 echo couchbase-4.1.1
else else
echo couchbase echo couchbase
fi fi

View File

@ -1,17 +1,21 @@
add_firebird_client_darwin() { add_firebird_client_darwin() {
firebird_tag='R3_0_7' firebird_tag='v5.0.0'
pkg_name=$(get -s -n "" https://api.github.com/repos/FirebirdSQL/firebird/releases/tags/"$firebird_tag" | grep -Eo "Firebird-.*.pkg" | head -n 1) arch_name='x64'
[ -z "$pkg_name" ] && pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/expanded_assets/"$firebird_tag" | grep -Eo "Firebird-.*.pkg" | head -n 1) arch="$(uname -m)"
[[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && arch_name='arm64'
pkg_name=$(get -s -n "" https://api.github.com/repos/FirebirdSQL/firebird/releases/tags/"$firebird_tag" | grep -Eo "Firebird-.*.-$arch_name.pkg" | head -n 1)
[ -z "$pkg_name" ] && pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/expanded_assets/"$firebird_tag" | grep -Eo "Firebird-.*.-$arch_name.pkg" | head -n 1)
get -q -e "/tmp/firebird.pkg" https://github.com/FirebirdSQL/firebird/releases/download/"$firebird_tag"/"$pkg_name" get -q -e "/tmp/firebird.pkg" https://github.com/FirebirdSQL/firebird/releases/download/"$firebird_tag"/"$pkg_name"
sudo installer -pkg /tmp/firebird.pkg -target / sudo installer -pkg /tmp/firebird.pkg -target /
sudo mkdir -p /opt/firebird/include /opt/firebird/lib sudo mkdir -p /opt/firebird/include /opt/firebird/lib
sudo find /Library/Frameworks/Firebird.framework -name '*.h' -exec cp "{}" /opt/firebird/include \; sudo cp -a /Library/Frameworks/Firebird.framework/Headers/* /opt/firebird/include/
sudo find /Library/Frameworks/Firebird.framework -name '*.dylib' -exec cp "{}" /opt/firebird/lib \; sudo find /Library/Frameworks/Firebird.framework -name '*.dylib' -exec cp "{}" /opt/firebird/lib \;
} }
add_firebird_helper() { add_firebird_helper() {
firebird_dir=$1 firebird_dir=$1
tag="$(php_src_tag)" tag="$(php_src_tag)"
export PDO_FIREBIRD_CONFIGURE_PREFIX_OPTS="CFLAGS=-Wno-incompatible-function-pointer-types EXTRA_CFLAGS=-Wno-int-conversion"
export PDO_FIREBIRD_CONFIGURE_OPTS="--with-pdo-firebird=$firebird_dir" export PDO_FIREBIRD_CONFIGURE_OPTS="--with-pdo-firebird=$firebird_dir"
export PDO_FIREBIRD_LINUX_LIBS="firebird-dev" export PDO_FIREBIRD_LINUX_LIBS="firebird-dev"
export PDO_FIREBIRD_PATH="ext/pdo_firebird" export PDO_FIREBIRD_PATH="ext/pdo_firebird"

View File

@ -2,9 +2,9 @@
install_icu() { install_icu() {
icu=$1 icu=$1
if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu.tar.zst" get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu$arch_suffix.tar.zst"
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/ sudo cp -r /usr/local/icu/lib/* /usr/lib/"$(uname -m)"-linux-gnu/
fi fi
} }
@ -17,8 +17,11 @@ add_intl() {
else else
[ "${ts:?}" = 'zts' ] && suffix='-zts' [ "${ts:?}" = 'zts' ] && suffix='-zts'
install_icu "$icu" >/dev/null 2>&1 install_icu "$icu" >/dev/null 2>&1
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix.so" get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix$arch_suffix.so"
enable_extension intl extension enable_extension intl extension
add_extension_log intl "Installed and enabled with ICU $icu" add_extension_log intl "Installed and enabled with ICU $icu"
fi fi
} }
arch="$(uname -m)"
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch_suffix='-arm64' || arch_suffix=''

View File

@ -10,12 +10,25 @@ add_ioncube() {
status='Enabled' status='Enabled'
if ! shared_extension ioncube; then if ! shared_extension ioncube; then
status='Installed and enabled' status='Installed and enabled'
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac' arch="$(uname -m)"
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp if [ "$(uname -s)" = "Darwin" ]; then
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "${ext_dir:?}/ioncube.so" [ "$arch" = "arm64" ] && os_suffix="dar_arm64" || os_suffix="mac_x86-64"
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt else
[[ "$arch" = "i386" || "$arch" = "i686" ]] && arch=x86
[[ "$arch" = "x86_64" ]] && arch=x86-64
os_suffix="lin_$arch"
fi
ts_part="" && [ "${ts:?}" = "zts" ] && ts_part="_ts"
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_suffix".tar.gz | tar -xzf - -C /tmp
loader_file=/tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so
if [ -e "$loader_file" ]; then
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
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
fi
else
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
fi fi
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
add_extension_log "ioncube" "$status" add_extension_log "ioncube" "$status"
check_extension "ioncube" && add_license_log check_extension "ioncube" && add_license_log
} }

View File

@ -48,6 +48,7 @@ Function Get-Oci8DLL() {
return $_ return $_
} }
} }
return $null
} }
# Function to install oci8 and pdo_oci. # Function to install oci8 and pdo_oci.
@ -62,22 +63,17 @@ Function Add-Oci() {
try { try {
$status = 'Enabled' $status = 'Enabled'
Add-InstantClient Add-InstantClient
if ($extension -eq "pdo_oci") { if($version -lt '8.4') {
Enable-PhpExtension pdo_oci -Path $php_dir if($version -lt '5.6' -and $extension -eq 'oci8') {
} else { Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
if(-not(Test-Path $ext_dir\php_oci8.dll)) { } else {
$oci8DLL = Get-Oci8DLL Enable-PhpExtension $extension -Path $php_dir
if($oci8DLL) {
Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll
} else {
$status = 'Installed and enabled'
Get-File -Url (Get-Oci8Url) -OutFile $php_dir\oci8.zip
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
}
} }
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini } else {
$status = 'Installed and enabled'
Add-Extension $extension >$null 2>&1
} }
Add-Log $tick $extension $status Add-ExtensionLog $extension $status
Add-LicenseLog Add-LicenseLog
} catch { } catch {
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )" Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"

View File

@ -11,25 +11,37 @@ 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
[ -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
fi
fi fi
} }

View File

@ -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

View 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
} }
} }

View File

@ -1,7 +1,11 @@
# Helper function to get phalcon version # Helper function to get phalcon version
get_phalcon_version() { get_phalcon_version() {
if [ "$extension" = "phalcon5" ]; then if [ "$extension" = "phalcon5" ]; then
get_pecl_version phalcon stable 5 if [ "${version:?}" = "7.4" ]; then
echo '5.4.0'
else
get_pecl_version phalcon stable 5
fi
elif [ "$extension" = "phalcon4" ]; then elif [ "$extension" = "phalcon4" ]; then
echo '4.1.2' echo '4.1.2'
elif [ "$extension" = "phalcon3" ]; then elif [ "$extension" = "phalcon3" ]; then
@ -69,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)

View File

@ -2,7 +2,11 @@
get_relay_version() { get_relay_version() {
local ext=$1 local ext=$1
if [[ "$ext" =~ ^relay$ ]]; then if [[ "$ext" =~ ^relay$ ]]; then
get -s -n "" "${relay_releases:?}"/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2 if [ "${version:?}" = "7.4" ]; then
echo 'v0.7.0'
else
get -s -n "" "${relay_releases:?}"/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2
fi
else else
relay_version="${ext##*-}" relay_version="${ext##*-}"
echo "v${relay_version/v//}" echo "v${relay_version/v//}"
@ -40,9 +44,23 @@ change_library_paths() {
install_name_tool -change "$(echo "${dylibs}" | grep -E "liblz4.*dylib" | xargs)" "$brew_prefix"/opt/lz4/lib/liblz4.dylib "$ext_dir"/relay.so install_name_tool -change "$(echo "${dylibs}" | grep -E "liblz4.*dylib" | xargs)" "$brew_prefix"/opt/lz4/lib/liblz4.dylib "$ext_dir"/relay.so
install_name_tool -change "$(echo "${dylibs}" | grep -E "libssl.*dylib" | xargs)" "$brew_prefix"/opt/openssl@"$openssl_version"/lib/libssl.dylib "$ext_dir"/relay.so install_name_tool -change "$(echo "${dylibs}" | grep -E "libssl.*dylib" | xargs)" "$brew_prefix"/opt/openssl@"$openssl_version"/lib/libssl.dylib "$ext_dir"/relay.so
install_name_tool -change "$(echo "${dylibs}" | grep -E "libcrypto.*dylib" | xargs)" "$brew_prefix"/opt/openssl@"$openssl_version"/lib/libcrypto.dylib "$ext_dir"/relay.so install_name_tool -change "$(echo "${dylibs}" | grep -E "libcrypto.*dylib" | xargs)" "$brew_prefix"/opt/openssl@"$openssl_version"/lib/libcrypto.dylib "$ext_dir"/relay.so
install_name_tool -change "$(echo "${dylibs}" | grep -E "libck.*dylib" | xargs)" "$brew_prefix"/opt/concurrencykit/lib/libck.dylib "$ext_dir"/relay.so
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
@ -51,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 brew install lz4 zstd concurrencykit
add_hiredis
fi fi
} }
@ -92,8 +111,7 @@ enable_relay() {
# Patch binary id in relay extension # Patch binary id in relay extension
init_relay_binary_id() { init_relay_binary_id() {
if [ -e "${ext_dir:?}"/relay.so ]; then if [ -e "${ext_dir:?}"/relay.so ]; then
grep -aq 00000000 "${ext_dir:?}"/relay.so && \ sudo LC_ALL=C sed -i.bak "s/00000000-0000-0000-0000-000000000000/$(uuidgen)/" "$ext_dir"/relay.so || true
sudo LC_ALL=C sed -i.bak "s/00000000-0000-0000-0000-000000000000/$(uuidgen)/" "$ext_dir"/relay.so
fi fi
} }

View File

@ -83,8 +83,10 @@ run_group() {
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1 echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
echo "$GROUP$log" echo "$GROUP$log"
. ./run_group.sh . ./run_group.sh
local status=$?
rm ./run_group.sh rm ./run_group.sh
echo "$END_GROUP" echo "$END_GROUP"
return $status
} }
patch_extension() { patch_extension() {
@ -150,10 +152,10 @@ add_extension_from_source() {
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries" [[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug" [ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
patch_extension "$extension" >/dev/null 2>&1 patch_extension "$extension" >/dev/null 2>&1
run_group "phpize" "phpize" run_group "phpize" "phpize" && \
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure" run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure" && \
run_group "sudo 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
) )

View File

@ -29,7 +29,7 @@ Function Get-SqlsrvReleaseUrl()
} }
# Function to add sqlsrv extension from GitHub. # Function to add sqlsrv extension from GitHub.
Function Add-SqlsrvFromGithub() Function Add-SqlsrvFromMSGithub()
{ {
Param ( Param (
[Parameter(Position = 0, Mandatory = $true)] [Parameter(Position = 0, Mandatory = $true)]
@ -37,16 +37,18 @@ Function Add-SqlsrvFromGithub()
[string] [string]
$extension $extension
) )
$zipUrl = SqlsrvReleaseUrl try {
if($zipUrl) { $zipUrl = SqlsrvReleaseUrl
$nts = if (!$installed.ThreadSafe) { "nts" } else { "ts" } if($zipUrl) {
$noDotVersion = $version.replace('.', '') $nts = if (!$installed.ThreadSafe) { "nts" } else { "ts" }
$extensionFilePath = "Windows-$version\$arch\php_${extension}_${noDotVersion}_${nts}.dll" $noDotVersion = $version.replace('.', '')
Get-File -Url $zipUrl -OutFile $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip > $null 2>&1 $extensionFilePath = "Windows-$version\$arch\php_${extension}_${noDotVersion}_${nts}.dll"
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\sqlsrv -Force > $null 2>&1 Get-File -Url $zipUrl -OutFile $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip > $null 2>&1
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\sqlsrv\$extensionFilePath" -Destination "$ext_dir\php_$extension.dll" Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\sqlsrv -Force > $null 2>&1
Enable-PhpExtension -Extension $extension -Path $php_dir Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\sqlsrv\$extensionFilePath" -Destination "$ext_dir\php_$extension.dll"
} Enable-PhpExtension -Extension $extension -Path $php_dir
}
} catch { }
} }
# Function to add sqlsrv extension. # Function to add sqlsrv extension.
@ -61,7 +63,12 @@ Function Add-Sqlsrv() {
if (Test-Path $ext_dir\php_$extension.dll) { if (Test-Path $ext_dir\php_$extension.dll) {
Enable-PhpExtension -Extension $extension -Path $php_dir Enable-PhpExtension -Extension $extension -Path $php_dir
} else { } else {
Add-SqlsrvFromGithub $extension >$null 2>&1 try {
Add-ExtensionFromGithub $extension > $null 2>&1
} catch {}
if (-not(Test-Extension $extension)) {
Add-SqlsrvFromMSGithub $extension >$null 2>&1
}
if (-not(Test-Extension $extension)) { if (-not(Test-Extension $extension)) {
Add-Extension $extension >$null 2>&1 Add-Extension $extension >$null 2>&1
} }

View File

@ -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')
@ -71,10 +74,14 @@ Function Add-ZephirParser() {
Enable-PhpExtension -Extension zephir_parser -Path $php_dir Enable-PhpExtension -Extension zephir_parser -Path $php_dir
} else { } else {
$status = 'Installed and enabled' $status = 'Installed and enabled'
Add-ZephirParserFromGitHub $extension try {
Add-ZephirParserFromGitHub $extension
} catch {
Add-Extension $extension >$null 2>&1
}
} }
Add-ExtensionLog zephir_parser $status Add-ExtensionLog zephir_parser $status
} catch { } catch {
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)" Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
} }
} }

View File

@ -17,9 +17,13 @@ add_zephir_parser_helper() {
[ "$(uname -s)" = "Linux" ] && os_suffix=ubuntu || os_suffix=macos [ "$(uname -s)" = "Linux" ] && os_suffix=ubuntu || os_suffix=macos
build_name=$(get -s -n "" https://api.github.com/repos/"$repo"/releases/tags/"$ext_version" | grep -Eo "zephir_parser-php-${version:?}-$nts-$os_suffix-.*.zip" | head -n 1) build_name=$(get -s -n "" https://api.github.com/repos/"$repo"/releases/tags/"$ext_version" | grep -Eo "zephir_parser-php-${version:?}-$nts-$os_suffix-.*.zip" | head -n 1)
[ -z "$build_name" ] && build_name=$(get -s -n "" "$zp_releases"/expanded_assets/"$ext_version" | grep -Eo "zephir_parser-php-${version:?}-$nts-$os_suffix-.*.zip" | head -n 1) [ -z "$build_name" ] && build_name=$(get -s -n "" "$zp_releases"/expanded_assets/"$ext_version" | grep -Eo "zephir_parser-php-${version:?}-$nts-$os_suffix-.*.zip" | head -n 1)
get -q -e "/tmp/zp.zip" "$zp_releases"/download/"$ext_version"/"$build_name" if [ -n "$build_name" ]; then
sudo unzip -o "/tmp/zp.zip" -d "${ext_dir:?}" get -q -e "/tmp/zp.zip" "$zp_releases"/download/"$ext_version"/"$build_name"
enable_extension zephir_parser extension sudo unzip -o "/tmp/zp.zip" -d "${ext_dir:?}"
enable_extension zephir_parser extension
else
pecl_install zephir_parser
fi
} }
# Add zephir_parser # Add zephir_parser

View File

@ -6,12 +6,21 @@ add_sudo() {
fi fi
} }
# Function to link apt-fast to apt-get
link_apt_fast() {
if ! command -v apt-fast >/dev/null; then
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
fi
}
# Function to setup environment for self-hosted runners. # Function to setup environment for self-hosted runners.
self_hosted_helper() { self_hosted_helper() {
if ! command -v apt-fast >/dev/null; then if ! command -v apt-fast >/dev/null; then
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
fi fi
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
} }
@ -23,6 +32,10 @@ fix_broken_packages() {
# 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
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew >/dev/null 2>&1
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
fi
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1) $apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
} }
@ -99,8 +112,8 @@ add_devtools() {
add_log "${tick:?}" "$tool" "Added $tool $semver" add_log "${tick:?}" "$tool" "Added $tool $semver"
} }
# Function to setup the nightly build from shivammathur/php-builder # Function to setup PHP from the shivammathur/php-builder builds.
setup_nightly() { setup_php_builder() {
run_script "php-builder" "${runner:?}" "$version" "${debug:?}" "${ts:?}" run_script "php-builder" "${runner:?}" "$version" "${debug:?}" "${ts:?}"
} }
@ -174,8 +187,8 @@ update_php() {
# Function to install PHP. # Function to install PHP.
add_php() { add_php() {
if [ "${runner:?}" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then if [ "${runner:?}" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
if [[ "$version" =~ ${nightly_versions:?} ]]; then if [[ "$version" =~ ${nightly_versions:?} || "$ts" = "zts" ]]; then
setup_nightly setup_php_builder
else else
add_packaged_php add_packaged_php
switch_version >/dev/null 2>&1 switch_version >/dev/null 2>&1
@ -234,6 +247,7 @@ setup_php() {
step_log "Setup PHP" step_log "Setup PHP"
sudo mkdir -m 777 -p /var/run /run/php sudo mkdir -m 777 -p /var/run /run/php
php_config="$(command -v php-config)" php_config="$(command -v php-config)"
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 >/dev/null 2>&1
@ -277,7 +291,7 @@ setup_php() {
} }
# Variables # Variables
version=${1:-'8.3'} version=${1:-'8.4'}
ini=${2:-'production'} ini=${2:-'production'}
src=${0%/*}/.. src=${0%/*}/..
debconf_fix="DEBIAN_FRONTEND=noninteractive" debconf_fix="DEBIAN_FRONTEND=noninteractive"
@ -285,6 +299,7 @@ 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 >/dev/null 2>&1
link_apt_fast >/dev/null 2>&1
. /etc/os-release . /etc/os-release
# shellcheck source=. # shellcheck source=.

View File

@ -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.

View File

@ -1,5 +1,4 @@
# Variables # Variables
export tool_path_dir="/usr/local/bin"
export composer_home="$HOME/.composer" export composer_home="$HOME/.composer"
export composer_bin="$composer_home/vendor/bin" export composer_bin="$composer_home/vendor/bin"
export composer_json="$composer_home/composer.json" export composer_json="$composer_home/composer.json"
@ -76,6 +75,11 @@ set_composer_env() {
sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env" sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env"
fi fi
add_env_path "$composer_env" add_env_path "$composer_env"
if [ -n "$COMPOSER_ALLOW_PLUGINS" ]; then
echo "$COMPOSER_ALLOW_PLUGINS" | tr ',' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | grep -v '^$' | while IFS= read -r plugin; do
composer global config --no-plugins "allow-plugins.$plugin" true >/dev/null 2>&1
done
fi
} }
# Helper function to configure tools. # Helper function to configure tools.

View File

@ -70,7 +70,6 @@ configure_brew() {
core_repo="$tap_dir"/homebrew/homebrew-core core_repo="$tap_dir"/homebrew/homebrew-core
export HOMEBREW_CHANGE_ARCH_TO_ARM=1 export HOMEBREW_CHANGE_ARCH_TO_ARM=1
export HOMEBREW_DEVELOPER=1
export HOMEBREW_NO_AUTO_UPDATE=1 export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1 export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1 export HOMEBREW_NO_INSTALL_CLEANUP=1

View File

@ -9,7 +9,13 @@ Function Add-Msys2() {
Function Add-GrpcPhpPlugin() { Function Add-GrpcPhpPlugin() {
$msys_location = Add-Msys2 $msys_location = Add-Msys2
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1 $arch = arch
if($arch -eq 'arm64' -or $arch -eq 'aarch64') {
$grpc_package = 'mingw-w64-clang-aarch64-grpc'
} else {
$grpc_package = 'mingw-w64-x86_64-grpc'
}
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package" >$null 2>&1
$grpc_version = Get-ToolVersion 'Write-Output' "$logs" $grpc_version = Get-ToolVersion 'Write-Output' "$logs"
Add-Path $msys_location\mingw64\bin Add-Path $msys_location\mingw64\bin
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe" Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"

View File

@ -54,8 +54,8 @@ update_lists() {
status_file=/tmp/os_lists status_file=/tmp/os_lists
if [[ -n "$ppa" && -n "$ppa_search" ]]; then if [[ -n "$ppa" && -n "$ppa_search" ]]; then
list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")" list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
status_file=/tmp/"${ppa/\//_}" status_file=/tmp/"$(echo -n "$ppa_search" | shasum -a 256 | cut -d ' ' -f 1)"
elif [ -e "$list_file" ] && grep -Eq '^deb ' "$list_file"; then elif [ -e "$list_file" ] && grep -Eq '^deb |^Types deb' "$list_file"; then
list="$list_file" list="$list_file"
fi fi
if [ ! -e "$status_file" ]; then if [ ! -e "$status_file" ]; then
@ -67,7 +67,7 @@ update_lists() {
# Function to get fingerprint from an Ubuntu PPA. # Function to get fingerprint from an Ubuntu PPA.
ubuntu_fingerprint() { ubuntu_fingerprint() {
ppa=$1 ppa=$1
get -s -n "" "$lp_api"/~"${ppa%/*}"/+archive/"${ppa##*/}" | jq -r '.signing_key_fingerprint' get -s -n "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
} }
# Function to get fingerprint from a Debian PPA. # Function to get fingerprint from a Debian PPA.
@ -88,7 +88,7 @@ add_key() {
key_source=$4 key_source=$4
key_file=$5 key_file=$5
key_urls=("$key_source") key_urls=("$key_source")
if [[ "$key_source" =~ launchpad.net|debian.org|setup-php.com ]]; then if [[ "$key_source" =~ launchpadcontent.net|debian.org ]]; then
fingerprint="$("${ID}"_fingerprint "$ppa" "$ppa_url" "$package_dist")" fingerprint="$("${ID}"_fingerprint "$ppa" "$ppa_url" "$package_dist")"
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint" sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}") key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
@ -117,11 +117,11 @@ 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}
ppa_search="deb .*$ppa_url $package_dist .*$branches" ppa_search="deb .*$ppa_url $package_dist .*$branches$"
if check_lists "$ppa" "$ppa_search"; then if check_lists "$ppa" "$ppa_search"; then
echo "Repository $ppa already exists"; echo "Repository $ppa already exists";
return 1; return 1;
@ -129,7 +129,8 @@ add_list() {
arch=$(dpkg --print-architecture) arch=$(dpkg --print-architecture)
[ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg [ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file" add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
echo "deb [arch=$arch signed-by=$key_file] $ppa_url $package_dist $branches" | sudo tee -a "$list_dir"/"${ppa/\//-}".list >/dev/null 2>&1 sudo rm -rf "$list_dir"/"${ppa/\//-}".list || true
echo "deb [arch=$arch signed-by=$key_file] $ppa_url $package_dist $branches" | sudo tee -a "$list_dir"/"${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$package_dist".list >/dev/null 2>&1
update_lists "$ppa" "$ppa_search" update_lists "$ppa" "$ppa_search"
. /etc/os-release . /etc/os-release
fi fi
@ -139,10 +140,10 @@ 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$"
if check_lists "$ppa" "$ppa_search"; then if check_lists "$ppa" "$ppa_search"; then
return 0; return 0;
else else
@ -153,18 +154,40 @@ check_ppa() {
# Function to remove a PPA. # Function to remove a PPA.
remove_list() { remove_list() {
ppa=${1-ondrej/php} ppa=${1-ondrej/php}
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"} [ -n "$2" ] && ppa_urls=("$2") || ppa_urls=("$lp_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu")
grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f for ppa_url in "${ppa_urls[@]}"; do
grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
done
sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring || true sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring || true
} }
# Function to check if ubuntu ppa is up
is_ubuntu_ppa_up() {
ppa=${1:-ondrej/php}
curl -s --connect-timeout 5 --max-time 5 --head --fail "$lpc_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
}
# Function to add the PPA mirror.
add_ppa_sp_mirror() {
ppa=$1
ppa_name="$(basename "$ppa")"
remove_list "$ppa" || true
[ "${debug:?}" = "debug" ] && add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg" "$VERSION_CODENAME" "main/debug"
add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg"
}
# Function to add a PPA. # Function to add a PPA.
add_ppa() { add_ppa() {
set_base_version set_base_version
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
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lp_ppa/$ppa/ubuntu" "$lp_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug" if is_ubuntu_ppa_up "$ppa" ; then
add_list "$ppa" [ "${runner:?}" = "self-hosted" ] && find "$list_dir" -type f -name 'sp*' -exec grep -qF "$sp" {} \; -delete
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lpc_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
add_list "$ppa"
else
add_ppa_sp_mirror "$ppa"
fi
elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug" [ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg
@ -180,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"
@ -189,14 +212,20 @@ update_ppa() {
} }
# Variables # Variables
list_file='/etc/apt/sources.list' list_dir='/etc/apt/sources.list.d'
list_dir="$list_file.d" list_file="/etc/apt/sources.list.d/$ID.sources"
[ -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'
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'
sp='https://setup-php.com'
sks=( sks=(
'https://keyserver.ubuntu.com' 'https://keyserver.ubuntu.com'
'https://pgp.mit.edu' 'https://pgp.mit.edu'

View File

@ -17,7 +17,9 @@ add_protoc() {
( (
platform='linux' platform='linux'
[ "$(uname -s)" = "Darwin" ] && platform='osx' [ "$(uname -s)" = "Darwin" ] && platform='osx'
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-x86_64.zip" arch="$(uname -m)"
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch='aarch_64'
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-$arch.zip"
sudo unzip /tmp/protobuf.zip -d /usr/local/ sudo unzip /tmp/protobuf.zip -d /usr/local/
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
) >/dev/null 2>&1 ) >/dev/null 2>&1

View File

@ -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
@ -63,13 +66,57 @@ read_env() {
# Set Update to true if the ubuntu github image does not have PHP PPA. # Set Update to true if the ubuntu github image does not have PHP PPA.
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
check_ppa ondrej/php || update=true if ! check_ppa ondrej/php; then
update=true
echo '' | sudo tee /tmp/sp_update >/dev/null 2>&1
elif [ -e /tmp/sp_update ]; then
update=true
fi
fi fi
export fail_fast export fail_fast
export runner export runner
export update export update
export ts export ts
export tool_path_dir
}
# Function to create a lock.
acquire_lock() {
lock_path="$1"
while true; do
if sudo mkdir "$lock_path" 2>/dev/null; then
echo $$ | sudo tee "$lock_path/pid" >/dev/null
return 0
else
if sudo test -f "$lock_path/pid"; then
lock_pid=$(sudo cat "$lock_path/pid")
if ! ps -p "$lock_pid" >/dev/null 2>&1; then
sudo rm -rf "$lock_path"
continue
fi
fi
sleep 1
fi
done
}
# Function to release the lock.
release_lock() {
lock_path="$1"
sudo rm -rf "$lock_path"
}
# Function to get the SHA256 hash of a string.
get_sha256() {
local input=$1
if command -v sha256sum >/dev/null; then
printf '%s' "$input" | sha256sum | cut -d' ' -f1
elif command -v shasum >/dev/null; then
printf '%s' "$input" | shasum -a 256 | cut -d' ' -f1
elif command -v openssl >/dev/null; then
printf '%s' "$input" | openssl dgst -sha256 | cut -d' ' -f2
fi
} }
# Function to download a file using cURL. # Function to download a file using cURL.
@ -84,12 +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
if [ "$runner" = "self-hosted" ]; then
lock_path="/tmp/sp-lck-$(get_sha256 "$file_path")"
acquire_lock "$lock_path"
if [ "$execute" = "-e" ]; then
until [ -z "$(fuser "$file_path" 2>/dev/null)" ]; do
sleep 1
done
fi
trap 'release_lock "$lock_path"' EXIT SIGINT SIGTERM
fi
for link in "${links[@]}"; do for link in "${links[@]}"; do
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link") status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
[ "$status_code" = "200" ] && break [ "$status_code" = "200" ] && break
done done
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path" [ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
[ "$mode" = "-v" ] && echo "$status_code" [ "$mode" = "-v" ] && echo "$status_code"
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
fi fi
} }
@ -163,7 +221,20 @@ self_hosted_setup() {
exit 1 exit 1
else else
self_hosted_helper >/dev/null 2>&1 self_hosted_helper >/dev/null 2>&1
add_env RUNNER_TOOL_CACHE /tmp add_env RUNNER_TOOL_CACHE /opt/hostedtoolcache
fi
fi
}
# Function to check pre-installed PHP
check_pre_installed() {
if [ "$version" = "pre" ]; then
if [ -n "$php_config" ]; then
version="$(php_semver | cut -c 1-3)"
update=false
else
fail_fast=true
add_log "$cross" "PHP" "No pre-installed PHP version found"
fi fi
fi fi
} }

View File

@ -3,7 +3,7 @@ param (
[ValidateNotNull()] [ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)] [ValidateLength(1, [int]::MaxValue)]
[string] [string]
$version = '8.2', $version = '8.4',
[Parameter(Position = 1, Mandatory = $true)] [Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()] [ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)] [ValidateLength(1, [int]::MaxValue)]
@ -401,6 +401,15 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
} }
$status = "Installed" $status = "Installed"
$extra_version = "" $extra_version = ""
if($version -eq 'pre') {
if($null -ne $installed) {
$version = $installed.MajorMinorVersion
$env:update = 'false'
} else {
Add-Log $cross "PHP" "No pre-installed PHP version found"
Write-Error "No pre-installed PHP version found" -ErrorAction Stop
}
}
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 >$null 2>&1
@ -434,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 { Get-File -Url "$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\$_ >$null 2>&1 }
} else { } else {
$enable_extensions += ('opcache') $enable_extensions += ('opcache')
} }

View File

@ -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);
} }

View File

@ -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:
@ -436,14 +443,20 @@ export async function readPHPVersion(): Promise<string> {
const versionFile = const versionFile =
(await getInput('php-version-file', false)) || '.php-version'; (await getInput('php-version-file', false)) || '.php-version';
if (fs.existsSync(versionFile)) { if (fs.existsSync(versionFile)) {
return fs.readFileSync(versionFile, 'utf8').replace(/[\r\n]/g, ''); const contents: string = fs.readFileSync(versionFile, 'utf8');
const match: RegExpMatchArray | null = contents.match(
/^(?:php\s)?(\d+\.\d+\.\d+)$/m
);
return match ? match[1] : contents.trim();
} else if (versionFile !== '.php-version') { } else if (versionFile !== '.php-version') {
throw new Error(`Could not find '${versionFile}' file.`); throw new Error(`Could not find '${versionFile}' file.`);
} }
const composerLock = 'composer.lock'; const composerProjectDir = await readEnv('COMPOSER_PROJECT_DIR');
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']
@ -452,11 +465,12 @@ export async function readPHPVersion(): Promise<string> {
} }
} }
const composerJson = 'composer.json'; const composerJson = path.join(composerProjectDir, 'composer.json');
if (fs.existsSync(composerJson)) { if (fs.existsSync(composerJson)) {
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'] &&