Compare commits

...

37 Commits

Author SHA1 Message Date
Shivam Mathur 159772ba0f Use homebrew-extensions for lua on PHP 8.0 and above [skip ci] 2026-08-23 11:36:38 +05:30
dependabot[bot] c9e91c1e82 Bump the github-actions group with 4 updates (#1109)
Bumps the github-actions group with 4 updates: [github/codeql-action/init](https://github.com/github/codeql-action), [github/codeql-action/autobuild](https://github.com/github/codeql-action), [github/codeql-action/analyze](https://github.com/github/codeql-action) and [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions).


Updates `github/codeql-action/init` from 4.37.6 to 4.37.7
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/5595ccaf912efad79be6eef63a5619ff05969be3...ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd)

Updates `github/codeql-action/autobuild` from 4.37.6 to 4.37.7
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/5595ccaf912efad79be6eef63a5619ff05969be3...ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd)

Updates `github/codeql-action/analyze` from 4.37.6 to 4.37.7
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/5595ccaf912efad79be6eef63a5619ff05969be3...ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd)

Updates `shivammathur/cache-extensions` from 1.14.6 to 1.15.0
- [Release notes](https://github.com/shivammathur/cache-extensions/releases)
- [Commits](https://github.com/shivammathur/cache-extensions/compare/9b476298b44f2e4d4268dd103ff4c3e216314e27...50000e7030dd3fa176964a8fbbbd9e4b560fe4d4)

---
updated-dependencies:
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: shivammathur/cache-extensions
  dependency-version: 1.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-22 17:34:40 +05:30
Shivam Mathur 12cc6a507b Fix versioned extension caching 2026-08-19 14:35:13 +05:30
Ibrahim Lawal 33139dbaea Honor a cache-restored build when a versioned extension mismatches (#1108)
* fix: honor a cache-restored build when a versioned extension mismatches

When a PHP package install bundles its own default build of a versioned
extension (e.g. redis ships with its own recent version pre-enabled),
add_pecl_extension correctly detects the version mismatch against the
pinned version and falls back to pecl_install - but it does this even
when a matching build has already been restored from a CI cache into a
separate directory, since shared_extension only checks that *some* file
exists at ext_dir, not which version it is.

This adds an opt-in CACHED_EXTENSIONS_DIR: when set and a mismatch is
detected, look for extension.so there, and if found, copy it into
ext_dir and re-check before falling back to a full pecl_install. When
CACHED_EXTENSIONS_DIR is unset, behavior is unchanged.

Related to shivammathur/cache-extensions#21 and #37, where a cached
build of a versioned PECL extension is silently ignored and
recompiled on every run regardless of caching.

* fix: preserve versioned builds in ext_dir instead of a separate cache dir

Per @shivammathur's review on the PR: drop the opt-in
CACHED_EXTENSIONS_DIR env var. Instead, after installing a versioned
extension, keep a second copy of the built .so in ext_dir itself under
a name with no .so suffix (e.g. redis-5.3.7), so it can't be mistaken
for the active extension and rides along in the same ext_dir that
cache-extensions already caches wholesale - no separate cache
directory, key, or workflow step required. On a version mismatch,
restore that preserved build over the active binary and re-check
before falling back to a full pecl_install.
2026-08-19 13:21:10 +05:30
dependabot[bot] 1adbee900f Bump the github-actions group with 3 updates (#1107)
Bumps the github-actions group with 3 updates: [github/codeql-action/init](https://github.com/github/codeql-action), [github/codeql-action/autobuild](https://github.com/github/codeql-action) and [github/codeql-action/analyze](https://github.com/github/codeql-action).


Updates `github/codeql-action/init` from 4.37.4 to 4.37.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f205ea1c3313d32999d8d6a48b4f6530d4437b38...5595ccaf912efad79be6eef63a5619ff05969be3)

Updates `github/codeql-action/autobuild` from 4.37.4 to 4.37.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f205ea1c3313d32999d8d6a48b4f6530d4437b38...5595ccaf912efad79be6eef63a5619ff05969be3)

Updates `github/codeql-action/analyze` from 4.37.4 to 4.37.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f205ea1c3313d32999d8d6a48b4f6530d4437b38...5595ccaf912efad79be6eef63a5619ff05969be3)

---
updated-dependencies:
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-15 17:52:32 +05:30
damiantw 7d04f5ee7e Add Laravel Cloud CLI Tool (#1106)
* Add Laravel Cloud CLI Tool

* Fix extensions
2026-08-12 21:41:33 +05:30
dependabot[bot] 19bc37cbe5 Bump the github-actions group across 1 directory with 3 updates (#1105)
Bumps the github-actions group with 3 updates in the / directory: [github/codeql-action/init](https://github.com/github/codeql-action), [github/codeql-action/autobuild](https://github.com/github/codeql-action) and [github/codeql-action/analyze](https://github.com/github/codeql-action).


Updates `github/codeql-action/init` from 4.37.3 to 4.37.4
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...f205ea1c3313d32999d8d6a48b4f6530d4437b38)

Updates `github/codeql-action/autobuild` from 4.37.3 to 4.37.4
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...f205ea1c3313d32999d8d6a48b4f6530d4437b38)

Updates `github/codeql-action/analyze` from 4.37.3 to 4.37.4
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...f205ea1c3313d32999d8d6a48b4f6530d4437b38)

---
updated-dependencies:
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-08 16:41:24 +05:30
Shivam Mathur b52e51b078 Fix npm audit for js-yaml [skip ci] 2026-08-08 16:26:45 +05:30
Wendell Adriel a6c520081f Add support for cpx (#1104)
* Add support for cpx

* README: add cpx to tools list
2026-08-05 15:42:46 +05:30
Shivam Mathur ced9161b13 Fix npm audit 2026-08-05 15:38:46 +05:30
dependabot[bot] 858ddd7182 Bump the github-actions group with 3 updates (#1103)
Bumps the github-actions group with 3 updates: [github/codeql-action/init](https://github.com/github/codeql-action), [github/codeql-action/autobuild](https://github.com/github/codeql-action) and [github/codeql-action/analyze](https://github.com/github/codeql-action).


Updates `github/codeql-action/init` from 4.37.1 to 4.37.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/7188fc363630916deb702c7fdcf4e481b751f97a...e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81)

Updates `github/codeql-action/autobuild` from 4.37.1 to 4.37.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/7188fc363630916deb702c7fdcf4e481b751f97a...e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81)

Updates `github/codeql-action/analyze` from 4.37.1 to 4.37.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/7188fc363630916deb702c7fdcf4e481b751f97a...e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81)

---
updated-dependencies:
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-01 19:40:34 +05:30
Shivam Mathur 2608ba9a1a Fix geos patch URLs 2026-07-27 11:36:12 +05:30
Juliette 7d83587834 README: minor documentation fix (#1102)
Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2026-07-26 21:47:51 +05:30
Shivam Mathur a75416c329 Upgrade build to TypeScript 7 2026-07-26 01:22:48 +05:30
dependabot[bot] 0c0c27b4cb Bump the github-actions group across 1 directory with 5 updates (#1100)
Bumps the github-actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `7.0.0` | `7.0.1` |
| [github/codeql-action/init](https://github.com/github/codeql-action) | `4.37.0` | `4.37.1` |
| [github/codeql-action/autobuild](https://github.com/github/codeql-action) | `4.37.0` | `4.37.1` |
| [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.37.0` | `4.37.1` |
| [actions/setup-node](https://github.com/actions/setup-node) | `6.4.0` | `7.0.0` |



Updates `actions/checkout` from 7.0.0 to 7.0.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0...3d3c42e5aac5ba805825da76410c181273ba90b1)

Updates `github/codeql-action/init` from 4.37.0 to 4.37.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/99df26d4f13ea111d4ec1a7dddef6063f76b97e9...7188fc363630916deb702c7fdcf4e481b751f97a)

Updates `github/codeql-action/autobuild` from 4.37.0 to 4.37.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/99df26d4f13ea111d4ec1a7dddef6063f76b97e9...7188fc363630916deb702c7fdcf4e481b751f97a)

Updates `github/codeql-action/analyze` from 4.37.0 to 4.37.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/99df26d4f13ea111d4ec1a7dddef6063f76b97e9...7188fc363630916deb702c7fdcf4e481b751f97a)

Updates `actions/setup-node` from 6.4.0 to 7.0.0
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e...820762786026740c76f36085b0efc47a31fe5020)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: actions/setup-node
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-25 18:53:11 +05:30
Shivam Mathur 5a9d09b8e0 Fix npm audit 2026-07-25 18:32:47 +05:30
Shivam Mathur 8e6e5267e7 Harden tool checksum verification (#1099) 2026-07-23 19:24:32 +05:30
Keisuke Maeda 8ca9579834 Add support for pinning tools to a checksum (#1098)
Tools in the tools input can now be pinned to a checksum using the
tool:version@sha256:<hash> or tool:version@sha512:<hash> syntax.
The downloaded tool is verified against the checksum on all platforms,
including when it is served from the tools cache, and it is removed
along with its cache entry if the verification fails.

Checksum verification is supported for tools downloaded as phar
archives. Specifying a checksum for tools set up using composer
packages or custom package scripts results in an error.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 18:15:59 +05:30
Shivam Mathur b9ef68088b Bump Node.js packages
Add allowScripts for 3 packages
2026-07-21 18:21:48 +05:30
Shivam Mathur fffd6b1db6 Fix support for install krb5 on linux using PECL 2026-07-21 01:50:08 +05:30
dependabot[bot] d64d1a1275 Bump the github-actions group with 3 updates (#1094)
Bumps the github-actions group with 3 updates: [github/codeql-action/init](https://github.com/github/codeql-action), [github/codeql-action/autobuild](https://github.com/github/codeql-action) and [github/codeql-action/analyze](https://github.com/github/codeql-action).


Updates `github/codeql-action/init` from 4.36.3 to 4.37.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/54f647b7e1bb85c95cddabcd46b0c578ec92bc1a...99df26d4f13ea111d4ec1a7dddef6063f76b97e9)

Updates `github/codeql-action/autobuild` from 4.36.3 to 4.37.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/54f647b7e1bb85c95cddabcd46b0c578ec92bc1a...99df26d4f13ea111d4ec1a7dddef6063f76b97e9)

Updates `github/codeql-action/analyze` from 4.36.3 to 4.37.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/54f647b7e1bb85c95cddabcd46b0c578ec92bc1a...99df26d4f13ea111d4ec1a7dddef6063f76b97e9)

---
updated-dependencies:
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-18 19:25:55 +05:30
dependabot[bot] add91f08e1 Bump the github-actions group with 3 updates (#1092)
Bumps the github-actions group with 3 updates: [github/codeql-action/init](https://github.com/github/codeql-action), [github/codeql-action/autobuild](https://github.com/github/codeql-action) and [github/codeql-action/analyze](https://github.com/github/codeql-action).


Updates `github/codeql-action/init` from 4.36.2 to 4.36.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/8aad20d150bbac5944a9f9d289da16a4b0d87c1e...54f647b7e1bb85c95cddabcd46b0c578ec92bc1a)

Updates `github/codeql-action/autobuild` from 4.36.2 to 4.36.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/8aad20d150bbac5944a9f9d289da16a4b0d87c1e...54f647b7e1bb85c95cddabcd46b0c578ec92bc1a)

Updates `github/codeql-action/analyze` from 4.36.2 to 4.36.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/8aad20d150bbac5944a9f9d289da16a4b0d87c1e...54f647b7e1bb85c95cddabcd46b0c578ec92bc1a)

---
updated-dependencies:
- dependency-name: github/codeql-action/init
  dependency-version: 4.36.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.36.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.36.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-11 16:36:32 +05:30
dependabot[bot] 93f351c169 Bump actions/cache from 5.0.5 to 6.1.0 in the github-actions group (#1091)
Bumps the github-actions group with 1 update: [actions/cache](https://github.com/actions/cache).


Updates `actions/cache` from 5.0.5 to 6.1.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/27d5ce7f107fe9357f9df03efb73ab90386fccae...55cc8345863c7cc4c66a329aec7e433d2d1c52a9)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-04 18:52:12 +05:30
dependabot[bot] 529ee057c4 Bump actions/checkout from 6.0.3 to 7.0.0 in the github-actions group (#1090)
Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 6.0.3 to 7.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/df4cb1c069e1874edd31b4311f1884172cec0e10...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-27 16:20:13 +05:30
dependabot[bot] 3fa88f2494 Bump the github-actions group across 1 directory with 2 updates (#1088)
Bumps the github-actions group with 2 updates in the / directory: [shivammathur/setup-php](https://github.com/shivammathur/setup-php) and [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions).


Updates `shivammathur/setup-php` from 2.37.1 to 2.37.2
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc...f3e473d116dcccaddc5834248c87452386958240)

Updates `shivammathur/cache-extensions` from 1.14.5 to 1.14.6
- [Release notes](https://github.com/shivammathur/cache-extensions/releases)
- [Commits](https://github.com/shivammathur/cache-extensions/compare/256729b5fef535345e27904657f78048c0990f81...9b476298b44f2e4d4268dd103ff4c3e216314e27)

---
updated-dependencies:
- dependency-name: shivammathur/cache-extensions
  dependency-version: 1.14.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: shivammathur/setup-php
  dependency-version: 2.37.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-20 19:54:30 +05:30
Shivam Mathur 0c10338998 Update Node.js dependencies 2026-06-20 18:43:15 +05:30
Shivam Mathur 805dfa40c1 Improve README [skip ci] 2026-06-18 10:13:14 +05:30
Shivam Mathur 1b1cce8c66 Add initial support for Ubuntu 26.04 [skip ci] 2026-06-18 04:28:47 +05:30
dependabot[bot] 95edd72557 Bump the github-actions group with 3 updates (#1087)
Bumps the github-actions group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [github/codeql-action](https://github.com/github/codeql-action) and [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `actions/checkout` from 6.0.2 to 6.0.3
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd...df4cb1c069e1874edd31b4311f1884172cec0e10)

Updates `github/codeql-action` from 4.36.0 to 4.36.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/7211b7c8077ea37d8641b6271f6a365a22a5fbfa...8aad20d150bbac5944a9f9d289da16a4b0d87c1e)

Updates `codecov/codecov-action` from 6.0.1 to 7.0.0
- [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/e79a6962e0d4c0c17b229090214935d2e33f8354...fb8b3582c8e4def4969c97caa2f19720cb33a72f)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action
  dependency-version: 4.36.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: codecov/codecov-action
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-13 18:06:26 +05:30
Shivam Mathur f3e473d116 Bump version to 2.37.2
Update Node.js dependencies
2026-06-08 20:54:40 +05:30
Shivam Mathur 8be473cdc3 Trust brew taps 2026-06-08 20:54:32 +05:30
dependabot[bot] 083d5237d9 Bump the github-actions group with 2 updates (#1085)
Bumps the github-actions group with 2 updates: [github/codeql-action](https://github.com/github/codeql-action) and [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `github/codeql-action` from 4.35.5 to 4.36.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/9e0d7b8d25671d64c341c19c0152d693099fb5ba...7211b7c8077ea37d8641b6271f6a365a22a5fbfa)

Updates `codecov/codecov-action` from 6.0.0 to 6.0.1
- [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/57e3a136b779b570ffcdbf80b3bdc90e7fab3de2...e79a6962e0d4c0c17b229090214935d2e33f8354)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-30 16:35:36 +05:30
Shivam Mathur a919ff576a Update FUNDING.yml 2026-05-19 03:02:31 +05:30
Shivam Mathur deb2299a77 Harden GitHub Actions workflows 2026-05-18 00:56:40 +05:30
Shivam Mathur 5825be4b77 Harden environment lookup 2026-05-18 00:56:40 +05:30
Shivam Mathur 8d45593ff3 Add CODEOWNERS 2026-05-15 23:46:09 +05:30
Shivam Mathur ba8d1631c1 Update PHP versions in SECURITY.md 2026-05-15 01:33:20 +05:30
31 changed files with 1195 additions and 411 deletions
+1
View File
@@ -0,0 +1 @@
* @shivammathur
+1
View File
@@ -1,3 +1,4 @@
# These are supported funding model platforms # These are supported funding model platforms
github: shivammathur github: shivammathur
open_collective: setup-php
+1 -1
View File
@@ -10,10 +10,10 @@ This security policy only applies to the latest patch releases of the following
| Version | Supported | | Version | Supported |
|---------|--------------------| |---------|--------------------|
| 8.1 | :white_check_mark: |
| 8.2 | :white_check_mark: | | 8.2 | :white_check_mark: |
| 8.3 | :white_check_mark: | | 8.3 | :white_check_mark: |
| 8.4 | :white_check_mark: | | 8.4 | :white_check_mark: |
| 8.5 | :white_check_mark: |
## Reporting a Vulnerability ## Reporting a Vulnerability
+11 -5
View File
@@ -1,7 +1,13 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: "github-actions" - package-ecosystem: 'github-actions'
directory: "/" directory: '/'
target-branch: "develop" target-branch: 'develop'
schedule: schedule:
interval: "weekly" interval: 'weekly'
groups:
github-actions:
patterns:
- '*'
cooldown:
default-days: 7
+9 -4
View File
@@ -5,9 +5,13 @@ on:
- cron: '0 15 * * 6' - cron: '0 15 * * 6'
permissions: permissions:
contents: read contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
codeql: codeql:
name: CodeQL Analysis
if: github.event.repository.fork == false if: github.event.repository.fork == false
permissions: permissions:
actions: read # for github/codeql-action/init to get workflow details actions: read # for github/codeql-action/init to get workflow details
@@ -16,18 +20,19 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: with:
fetch-depth: 2 fetch-depth: 2
persist-credentials: false
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v4 uses: github/codeql-action/init@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4
with: with:
config-file: ./.github/codeql/codeql-configuration.yml config-file: ./.github/codeql/codeql-configuration.yml
languages: javascript languages: javascript
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v4 uses: github/codeql-action/autobuild@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4 uses: github/codeql-action/analyze@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4
+20 -10
View File
@@ -5,12 +5,15 @@ on:
- cron: '0 15 * * 6' - cron: '0 15 * * 6'
permissions: permissions:
contents: read contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
create: create:
if: github.event.repository.fork == false if: github.event.repository.fork == false
permissions: permissions:
contents: none contents: none # this job only prepares artifacts and uploads them, no repository writes
name: Create name: Create
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:
@@ -20,7 +23,7 @@ jobs:
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6'] php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']
steps: steps:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
tools: none tools: none
@@ -39,7 +42,7 @@ jobs:
run: | run: |
php -m | Out-File -FilePath "$env:file.all" -Append php -m | Out-File -FilePath "$env:file.all" -Append
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: none extensions: none
@@ -72,7 +75,7 @@ jobs:
version: ${{ matrix.php-versions }} version: ${{ matrix.php-versions }}
if: matrix.operating-system == 'windows-2022' if: matrix.operating-system == 'windows-2022'
run: | run: |
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file" Write-Output "## PHP $env:version`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.builtin" -Append php -m | Out-File -FilePath "$env:file.builtin" -Append
Get-Content "$env:file.all" | ForEach-Object { Get-Content "$env:file.all" | ForEach-Object {
@@ -88,7 +91,7 @@ jobs:
Remove-Item "$env:file.all" -Force Remove-Item "$env:file.all" -Force
Remove-Item "$env:file.builtin" -Force Remove-Item "$env:file.builtin" -Force
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with: with:
name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
@@ -101,19 +104,23 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: with:
repository: ${{ github.repository }}.wiki repository: ${{ github.repository }}.wiki
persist-credentials: false
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v8 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with: with:
path: ${{ github.workspace }}/lists path: ${{ github.workspace }}/lists
pattern: lists-* pattern: lists-*
merge-multiple: true merge-multiple: true
- name: Configure Git - name: Configure Git
env:
GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_USER_NAME: github-actions[bot]
run : | run : |
git config --local user.email "${{ secrets.email }}" git config --local user.email "$GIT_USER_EMAIL"
git config --local user.name "${{ github.repository_owner }}" git config --local user.name "$GIT_USER_NAME"
- name: Combine - name: Combine
run: | run: |
for os in ubuntu-24.04 ubuntu-22.04 windows-2025 windows-2022 windows-2019 macos-13 macos-14 macos-15 macos-26; do for os in ubuntu-24.04 ubuntu-22.04 windows-2025 windows-2022 windows-2019 macos-13 macos-14 macos-15 macos-26; do
@@ -130,9 +137,12 @@ jobs:
done done
rm -rf ./lists rm -rf ./lists
- name: Update - name: Update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WIKI_REPOSITORY: ${{ github.repository }}
run: | run: |
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
git add . git add .
git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')" git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')"
git push -f https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git master || true git push -f https://x-access-token:${GITHUB_TOKEN}@github.com/${WIKI_REPOSITORY}.wiki.git master || true
fi fi
+8 -3
View File
@@ -18,10 +18,14 @@ on:
- 'examples/**' - 'examples/**'
permissions: permissions:
contents: read contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
run: run:
name: Run name: Run
environment: codecov
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:
fail-fast: false fail-fast: false
@@ -29,12 +33,13 @@ jobs:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: with:
fetch-depth: 2 fetch-depth: 2
persist-credentials: false
- name: Setup Node.js 24.x - name: Setup Node.js 24.x
uses: actions/setup-node@v6 uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with: with:
node-version: 24.x node-version: 24.x
@@ -54,7 +59,7 @@ jobs:
run: npm audit run: npm audit
- name: Send Coverage - name: Send Coverage
uses: codecov/codecov-action@v6 uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info files: coverage/lcov.info
+15 -6
View File
@@ -19,8 +19,11 @@ on:
- 'examples/**' - 'examples/**'
permissions: permissions:
contents: read contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env: env:
default-php-version: '8.2' default-php-version: '8.5'
jobs: jobs:
run: run:
name: Run name: Run
@@ -39,18 +42,20 @@ jobs:
key: cache-v5 key: cache-v5
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup cache environment - name: Setup cache environment
id: cache-env id: cache-env
uses: shivammathur/cache-extensions@develop uses: shivammathur/cache-extensions@50000e7030dd3fa176964a8fbbbd9e4b560fe4d4 # v1
with: with:
php-version: ${{ matrix.php-versions || env.default-php-version }} php-version: ${{ matrix.php-versions || env.default-php-version }}
extensions: ${{ env.extensions }} extensions: ${{ env.extensions }}
key: ${{ env.key }} key: ${{ env.key }}
- name: Cache extensions - name: Cache extensions
uses: actions/cache@v5 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with: with:
path: ${{ steps.cache-env.outputs.dir }} path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }} key: ${{ steps.cache-env.outputs.key }}
@@ -58,8 +63,10 @@ jobs:
- name: Stage php-version-file - name: Stage php-version-file
if: ${{ matrix.php-version-file == 'php-version-file' }} if: ${{ matrix.php-version-file == 'php-version-file' }}
env:
DEFAULT_PHP_VERSION: ${{ env.default-php-version }}
run: | run: |
echo ${{ env.default-php-version }} > php-version-file echo "$DEFAULT_PHP_VERSION" > php-version-file
- name: Setup PHP with extensions and custom config - name: Setup PHP with extensions and custom config
run: node dist/index.js run: node dist/index.js
@@ -70,9 +77,11 @@ jobs:
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata
- name: Testing PHP version - name: Testing PHP version
env:
EXPECTED_PHP_VERSION: ${{ matrix.php-versions || env.default-php-version }}
run: | run: |
php -v php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-versions || env.default-php-version }}') === false) {throw new Exception('Wrong PHP version Installed');}" php -r '$expected = getenv("EXPECTED_PHP_VERSION"); if(strpos(phpversion(), $expected) === false) {throw new Exception("Wrong PHP version Installed");}'
- name: Testing Composer version - name: Testing Composer version
run: | run: |
+19 -8
View File
@@ -10,29 +10,39 @@ on:
tag: tag:
description: Tag name description: Tag name
required: true required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-latest name: Build and Publish
permissions: permissions:
contents: read contents: read # for actions/checkout
packages: write packages: write # For publishing to GitHub Packages
id-token: write id-token: write # For authentication with npm registry
runs-on: ubuntu-latest
steps: steps:
- name: Checkout release - name: Checkout release
if: github.event_name != 'workflow_dispatch' if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Checkout tag - name: Checkout tag
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: github.event_name == 'workflow_dispatch' if: github.event_name == 'workflow_dispatch'
with: with:
ref: ${{ github.event.inputs.tag }} ref: ${{ github.event.inputs.tag }}
persist-credentials: false
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v6 uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with: with:
node-version: '24.x' node-version: '24.x'
registry-url: https://registry.npmjs.org registry-url: https://registry.npmjs.org
package-manager-cache: false
- name: Install dependencies and add lib - name: Install dependencies and add lib
run: | run: |
@@ -45,9 +55,10 @@ jobs:
run: npm publish --access public run: npm publish --access public
- name: Change to GitHub Packages registry - name: Change to GitHub Packages registry
uses: actions/setup-node@v6 uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with: with:
registry-url: https://npm.pkg.github.com registry-url: https://npm.pkg.github.com
package-manager-cache: false
scope: '@shivammathur' scope: '@shivammathur'
- name: Patch package.json - name: Patch package.json
+46 -28
View File
@@ -18,7 +18,7 @@
<a href="https://status.setup-php.com" title="setup-php status"><img alt="setup-php status" src="https://img.shields.io/badge/status-subscribe-28A745?logo=statuspage&logoColor=28A745&labelColor=555555"></a> <a href="https://status.setup-php.com" title="setup-php status"><img alt="setup-php status" src="https://img.shields.io/badge/status-subscribe-28A745?logo=statuspage&logoColor=28A745&labelColor=555555"></a>
</p> </p>
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross-platform interface to set up the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this. Setup PHP with required extensions, php.ini configuration, code-coverage support, and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross-platform interface to set up the PHP environment you need to test your application. Refer to the [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
## Contents ## Contents
@@ -70,8 +70,10 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
| Virtual environment | Arch | YAML workflow label | Pre-installed PHP | | Virtual environment | Arch | YAML workflow label | Pre-installed PHP |
|---------------------|---------|------------------------------------|-------------------| |---------------------|---------|------------------------------------|-------------------|
| Ubuntu 26.04 | x86_64 | `ubuntu-26.04` | `PHP 8.5` |
| Ubuntu 24.04 | x86_64 | `ubuntu-latest` or `ubuntu-24.04` | `PHP 8.3` | | Ubuntu 24.04 | x86_64 | `ubuntu-latest` or `ubuntu-24.04` | `PHP 8.3` |
| Ubuntu 22.04 | x86_64 | `ubuntu-22.04` | `PHP 8.1` | | Ubuntu 22.04 | x86_64 | `ubuntu-22.04` | `PHP 8.1` |
| Ubuntu 26.04 | aarch64 | `ubuntu-26.04-arm` | `PHP 8.5` |
| Ubuntu 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` | | Ubuntu 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` |
| Ubuntu 22.04 | aarch64 | `ubuntu-22.04-arm` | `PHP 8.1` | | Ubuntu 22.04 | aarch64 | `ubuntu-22.04-arm` | `PHP 8.1` |
| Windows Server 2025 | x64 | `windows-2025` | `PHP 8.5` | | Windows Server 2025 | x64 | `windows-2025` | `PHP 8.5` |
@@ -86,6 +88,7 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
| Host OS/Virtual environment | YAML workflow label | | Host OS/Virtual environment | YAML workflow label |
|----------------------------------|----------------------------| |----------------------------------|----------------------------|
| Ubuntu 26.04 | `self-hosted` or `Linux` |
| Ubuntu 24.04 | `self-hosted` or `Linux` | | Ubuntu 24.04 | `self-hosted` or `Linux` |
| Ubuntu 22.04 | `self-hosted` or `Linux` | | Ubuntu 22.04 | `self-hosted` or `Linux` |
| Debian 13 | `self-hosted` or `Linux` | | Debian 13 | `self-hosted` or `Linux` |
@@ -98,7 +101,7 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
| macOS Sonoma 14.x x86_64/arm64 | `self-hosted` or `macOS` | | macOS Sonoma 14.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 a best effort basis.
- If the requested PHP version is pre-installed, `setup-php` switches to it, otherwise it installs the PHP version. - If the requested PHP version is pre-installed, `setup-php` switches to it, otherwise it installs the PHP version.
## :tada: PHP Support ## :tada: PHP Support
@@ -155,7 +158,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- Extensions installed along with PHP if specified are enabled. - Extensions installed along with PHP if specified are enabled.
- Specific versions of extensions available on `PECL` can be set up by suffixing the extension's name with the version. This is useful for installing old versions of extensions which support end of life PHP versions. - Specific versions of extensions available on `PECL` can be set up by suffixing the extension's name with the version. This is useful for installing old versions of extensions which support end-of-life PHP versions.
```yaml ```yaml
- name: Setup PHP with specific version of PECL extension - name: Setup PHP with specific version of PECL extension
@@ -180,14 +183,14 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
- Shared extensions can be disabled by prefixing them with a `:`. All extensions depending on the specified extension will also be disabled. - Shared extensions can be disabled by prefixing them with a `:`. All extensions depending on the specified extension will also be disabled.
```yaml ```yaml
- name: Setup PHP and disable opcache - name: Setup PHP and disable mbstring
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.5' php-version: '8.5'
extensions: :mbstring extensions: :mbstring
``` ```
- 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 the rest of the extensions in the input will be processed.
This disables all core and third-party shared extensions and thus, can break some tools that 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 that 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.
@@ -216,7 +219,7 @@ This disables all core and third-party shared extensions and thus, can break som
- `event`, `gearman`, `geos` and `relay` on `Ubuntu` and `macOS`. - `event`, `gearman`, `geos` and `relay` on `Ubuntu` and `macOS`.
- `blackfire`, `couchbase`, `ibm_db2`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_ibm`, `pdo_oci`, `pecl_http`, `phalcon3`, `phalcon4`, `phalcon5`, and `zephir_parser` on all supported OS. - `blackfire`, `couchbase`, `ibm_db2`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_ibm`, `pdo_oci`, `pecl_http`, `phalcon3`, `phalcon4`, `phalcon5`, and `zephir_parser` on all supported OS.
- By default, extensions which cannot be added or disabled gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`. - By default, extensions which cannot be added or disabled gracefully leave an error message in the logs. The execution is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
```yaml ```yaml
- name: Setup PHP with fail-fast - name: Setup PHP with fail-fast
@@ -232,7 +235,7 @@ This disables all core and third-party shared extensions and thus, can break som
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.
[`backward-compatibility-check`], [`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`mago`], [`name-collision-detector`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`] [`backward-compatibility-check`], [`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cpx`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`laravel-cloud`] or [`cloud-cli`], [`mago`], [`name-collision-detector`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
```yaml ```yaml
- name: Setup PHP with tools - name: Setup PHP with tools
@@ -242,7 +245,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
tools: php-cs-fixer, phpunit tools: php-cs-fixer, phpunit
``` ```
- In addition to above tools any composer tool or package can also be set up globally by specifying it as `vendor/package` matching the listing on Packagist. This format accepts the same [version constraints](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints "Composer version constraints") as `composer`. - In addition to the above tools, any composer tool or package can also be set up globally by specifying it as `vendor/package` matching the listing on Packagist. This format accepts the same [version constraints](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints "Composer version constraints") as `composer`.
```yaml ```yaml
- name: Setup PHP with tools - name: Setup PHP with tools
@@ -259,7 +262,19 @@ These tools can be set up globally using the `tools` input. It accepts a string
- Major version. For example `tool:1` or `tool:1.x`. - Major version. For example `tool:1` or `tool:1.x`.
- Major and minor version. For example `tool:1.2` or `tool:1.2.x`. - Major and minor version. For example `tool:1.2` or `tool:1.2.x`.
When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup. When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be set up.
- To harden your workflow against supply chain attacks, you can pin a tool to a checksum in the form `tool:version@sha256:<hash>` or `tool:version@sha512:<hash>`. The downloaded tool is verified against the checksum and it is not set up if the verification fails, even if the tool is served from the tools cache.
```yaml
- name: Setup PHP with tools pinned to a checksum
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
tools: composer:2.9.8@sha256:59b2c50e10cafa0d8efc19ede9a326d782f096c674a26baf98cf042ce23de890
```
Checksum verification is supported for tools which are downloaded as phar archives. It is not supported for tools set up using `composer` packages or custom package scripts, specifying a checksum for these tools will result in an error. For checksum pinning to be effective, pin the tool to an exact version, as mutable versions like `latest` or `major.minor` can resolve to a different release with a different checksum.
- The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format. Additionally, for composer `snapshot` and `preview` can also be specified to set up the respective releases. - The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format. Additionally, for composer `snapshot` and `preview` can also be specified to set up the respective releases.
@@ -299,10 +314,10 @@ These tools can be set up globally using the `tools` input. It accepts a string
fail-fast: true fail-fast: true
``` ```
- 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. - 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 allowlist, alternatively if your dependencies have composer plugins, you can allow them by setting `COMPOSER_ALLOW_PLUGINS` that accepts a csv string of plugin names.
```yaml ```yaml
- name: Setup PHP with fail-fast - name: Setup PHP with allow composer plugins
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '8.5' php-version: '8.5'
@@ -342,7 +357,7 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
``` ```
- When you specify `coverage: xdebug`, the latest version of Xdebug compatible with the PHP version is set up by default. - When you specify `coverage: xdebug`, the latest version of Xdebug compatible with the PHP version is set up by default.
- If you need Xdebug 2.x on PHP 7.2, 7.3 or 7.4, you can specify `coverage: xdebug2`. - If you need Xdebug 2.x on PHP 7.2, 7.3, or 7.4, you can specify `coverage: xdebug2`.
```yaml ```yaml
- name: Setup PHP with Xdebug 2.x - name: Setup PHP with Xdebug 2.x
@@ -353,7 +368,7 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
``` ```
> [!NOTE] > [!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. > Xdebug is enabled by default on Ubuntu GitHub Actions images, so if you are not using it in your workflows, 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
@@ -372,7 +387,7 @@ Runs on PHP 7.1 and newer PHP versions.
``` ```
- PHPUnit 8.x and above support PCOV out of the box. - PHPUnit 8.x and above support 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
- name: Setup PCOV - name: Setup PCOV
@@ -390,7 +405,7 @@ Disable coverage for these reasons:
- You are not generating coverage reports while testing. - You are not generating coverage reports while testing.
- You are using `phpdbg` for running your tests. - You are using `phpdbg` for running your tests.
- You are profiling your code using `blackfire`. - You are profiling your code using `blackfire`.
- You are using PHP in JIT mode. Please refer to [JIT configuration](#jit-configuration) section for more details. - You are using PHP in JIT mode. Please refer to the [JIT configuration](#jit-configuration) section for more details.
```yaml ```yaml
- name: Setup PHP with no coverage driver - name: Setup PHP with no coverage driver
@@ -653,7 +668,7 @@ To debug any issues, you can use the `verbose` tag instead of `v2`.
### Multi-Arch Setup ### Multi-Arch Setup
> Set up PHP on multiple architecture on Ubuntu GitHub Runners. > Set up PHP on multiple architectures on Ubuntu GitHub Runners.
- `PHP 5.6` to `PHP 8.5` are supported by `setup-php` on multiple architecture on `Ubuntu` and `Debian`. - `PHP 5.6` to `PHP 8.5` are supported by `setup-php` on multiple architecture on `Ubuntu` and `Debian`.
- For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` and `PHP` installed for `setup-php`. - For this, you can use `shivammathur/node` images as containers. These have compatible `Nodejs` and `PHP` installed for `setup-php`.
@@ -683,7 +698,7 @@ jobs:
> Set up PHP on a self-hosted runner. > Set up PHP on a self-hosted runner.
- To set up a containerised self-hosted runner, refer to the following guides as per your base operating system. - To set up a containerized self-hosted runner, refer to the following guides as per your base operating system.
- [Linux](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Linux) - [Linux](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Linux)
- [Windows](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows) - [Windows](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows)
@@ -710,7 +725,7 @@ jobs:
``` ```
> [!NOTE] > [!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 workflows will conflict with each other.
> - Do not set up self-hosted runners on the side of your development environment or your production server. > - Do not set up self-hosted runners on the side of 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.
@@ -753,7 +768,7 @@ act -P ubuntu-22.04=shivammathur/node:22.04
- By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` (`opcache.jit_buffer_size=128M` on ARM-based environments) are set which can be changed using `ini-values` input. - By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` (`opcache.jit_buffer_size=128M` on ARM-based environments) are set which can be changed using `ini-values` input.
- For detailed information about JIT related directives refer to the [`official PHP documentation`](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit "opcache.jit documentation"). - For 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
@@ -833,7 +848,7 @@ If you use Private Packagist for your private composer dependencies, you can set
### Manual Composer Authentication ### Manual Composer Authentication
In addition to GitHub or Private Packagist, if you want to authenticate private repositories hosted elsewhere, you can set the `COMPOSER_AUTH_JSON` environment variable with the authentication methods and the credentials in json format. In addition to GitHub or Private Packagist, if you want to authenticate private repositories hosted elsewhere, you can set the `COMPOSER_AUTH_JSON` environment variable with the authentication methods and the credentials in JSON format.
Please refer to the authentication section in [`composer documentation`](https://getcomposer.org/doc/articles/authentication-for-private-packages.md "composer documentation") for more details. Please refer to the authentication section in [`composer documentation`](https://getcomposer.org/doc/articles/authentication-for-private-packages.md "composer documentation") for more details.
```yaml ```yaml
@@ -879,7 +894,7 @@ Problem matchers are `json` configurations which identify errors and warnings in
#### PHP #### PHP
Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step. Set up problem matchers for your `PHP` output by adding this step after the `setup-php` step.
```yaml ```yaml
- name: Setup problem matchers for PHP - name: Setup problem matchers for PHP
@@ -888,7 +903,7 @@ Setup problem matchers for your `PHP` output by adding this step after the `setu
#### PHPUnit #### PHPUnit
Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step. Set up problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step.
```yaml ```yaml
- name: Setup problem matchers for PHPUnit - name: Setup problem matchers for PHPUnit
@@ -970,7 +985,7 @@ Examples of using `setup-php` with various PHP frameworks and packages.
| Symfony with `PostgreSQL` | `ubuntu` | [symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL") | | Symfony with `PostgreSQL` | `ubuntu` | [symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL") |
| Symfony without services | `macOS`, `ubuntu` and `windows` | [symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services") | | Symfony without services | `macOS`, `ubuntu` and `windows` | [symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services") |
| WordPress plugin | `ubuntu` | [wordpress.yml](./examples/wordpress.yml "GitHub Action for WordPress plugins") | | WordPress plugin | `ubuntu` | [wordpress.yml](./examples/wordpress.yml "GitHub Action for WordPress plugins") |
| WordPress with Roots/Bedrock | `ubuntu` | [bedrock.yml](./examples/bedrock.yml "GitHub Action for WordPress development using @roots/bedrock") | | WordPress with Roots/Bedrock | `ubuntu` | [bedrock.yml](./examples/bedrock.yml "GitHub Action for WordPress development using @roots/bedrock") |
| WordPress with Roots/Sage | `ubuntu` | [sage.yml](./examples/sage.yml "GitHub Action for WordPress development using @roots/sage") | | WordPress with Roots/Sage | `ubuntu` | [sage.yml](./examples/sage.yml "GitHub Action for WordPress development using @roots/sage") |
| Yii3 web application with `MySQL` | `ubuntu` | [yii3-mysql.yml](./examples/yii3-mysql.yml "GitHub Action for Yii3 web application with MySQL") | | Yii3 web application with `MySQL` | `ubuntu` | [yii3-mysql.yml](./examples/yii3-mysql.yml "GitHub Action for Yii3 web application with MySQL") |
| Yii3 web application with `PostgreSQL` | `ubuntu` | [yii3-postgres.yml](./examples/yii3-postgres.yml "GitHub Action for Yii3 web application with PostgreSQL") | | Yii3 web application with `PostgreSQL` | `ubuntu` | [yii3-postgres.yml](./examples/yii3-postgres.yml "GitHub Action for Yii3 web application with PostgreSQL") |
@@ -978,12 +993,12 @@ Examples of using `setup-php` with various PHP frameworks and packages.
## :bookmark: Versioning ## :bookmark: Versioning
- Use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with the latest minor and patch releases. With `v2` you automatically get the bug fixes, security patches, new features and support for latest PHP releases. - Use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with the latest minor and patch releases. With `v2` you automatically get the bug fixes, security patches, new features, and support for latest PHP releases.
- Semantic release versions can also be used. It is recommended to [use dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot "Setup Dependabot with GitHub Actions") with semantic versioning to keep the actions in your workflows up to date. - Semantic release versions can also be used. It is recommended to [use dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot "Setup Dependabot with GitHub Actions") with semantic versioning to keep the actions in your workflows up to date.
- Commit SHA can also be used, but are not recommended unless you set up tooling to update them with each release of the action. - Commit SHA can also be used, but is not recommended unless you set up tooling to update them with each release of the action.
- A new major version of the action will only be tagged when there are breaking changes in the setup-php API i.e. inputs, outputs, and environment flags. - A new major version of the action will only be tagged when there are breaking changes in the setup-php API i.e. - inputs, outputs, and environment flags.
- For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases. - For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
- It is highly discouraged to use the `main` branch as version, it might break your workflow after major releases as they have breaking changes. - It is highly discouraged to use the `main` branch as the version, it might break your workflow after major releases as they have breaking changes.
- If you are using the `v1` tag or a `1.x.y` version, you should [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` is not supported anymore. - If you are using the `v1` tag or a `1.x.y` version, you should [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` is not supported anymore.
## :scroll: License ## :scroll: License
@@ -1045,7 +1060,7 @@ Many users and organizations support setup-php via [GitHub Sponsors](https://git
<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a> <a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
- If you use setup-php, please consider starring the project and share it. - If you use setup-php, please consider starring the project and sharing it.
- If you blog, please share your experience of using `setup-php`. - If you blog, please share your experience of using `setup-php`.
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php. - Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
@@ -1081,6 +1096,7 @@ Many users and organizations support setup-php via [GitHub Sponsors](https://git
[`box`]: https://github.com/humbug/box [`box`]: https://github.com/humbug/box
[`castor`]: https://github.com/jolicode/castor [`castor`]: https://github.com/jolicode/castor
[`churn`]: https://github.com/bmitch/churn-php [`churn`]: https://github.com/bmitch/churn-php
[`cloud-cli`]: https://cloud.laravel.com/docs/api/cli
[`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-dependency-analyser`]: https://github.com/shipmonk-rnd/composer-dependency-analyser
@@ -1088,12 +1104,14 @@ Many users and organizations support setup-php via [GitHub Sponsors](https://git
[`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
[`cpx`]: https://github.com/laravel/cpx
[`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 [`ecs`]: https://github.com/easy-coding-standard/easy-coding-standard
[`flex`]: https://github.com/symfony/flex [`flex`]: https://github.com/symfony/flex
[`grpc_php_plugin`]: https://grpc.io/ [`grpc_php_plugin`]: https://grpc.io/
[`infection`]: https://infection.github.io/ [`infection`]: https://infection.github.io/
[`laravel-cloud`]: https://cloud.laravel.com/docs/api/cli
[`mago`]: https://github.com/carthage-software/mago [`mago`]: https://github.com/carthage-software/mago
[`name-collision-detector`]: https://github.com/shipmonk/name-collision-detector [`name-collision-detector`]: https://github.com/shipmonk/name-collision-detector
[`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint [`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint
+108 -15
View File
@@ -222,17 +222,50 @@ describe('Tools tests', () => {
}); });
it.each` it.each`
input_list | filtered_list release | expected_release | checksum | error
${'a, b'} | ${'composer, a, b'} ${'tool:1.2.3'} | ${'tool:1.2.3'} | ${undefined} | ${undefined}
${'a, b, composer'} | ${'composer, a, b'} ${'tool:1.2.3@sha256:' + 'a'.repeat(64)} | ${'tool:1.2.3'} | ${'sha256:' + 'a'.repeat(64)} | ${undefined}
${'a, b, composer:1.2.3'} | ${'composer:1.2.3, a, b'} ${'tool:1.2.3@sha256:' + 'A'.repeat(64)} | ${'tool:1.2.3'} | ${'sha256:' + 'a'.repeat(64)} | ${undefined}
${'a, b, composer:v1.2.3'} | ${'composer:1.2.3, a, b'} ${'tool:1.2.3@SHA256:' + 'a'.repeat(64)} | ${'tool:1.2.3'} | ${'sha256:' + 'a'.repeat(64)} | ${undefined}
${'a, b, composer:snapshot'} | ${'composer:snapshot, a, b'} ${'tool:1.2.3@sha512:' + 'b'.repeat(128)} | ${'tool:1.2.3'} | ${'sha512:' + 'b'.repeat(128)} | ${undefined}
${'a, b, composer:preview'} | ${'composer:preview, a, b'} ${'composer:2.9.8@sha256:' + 'c'.repeat(64)} | ${'composer:2.9.8'} | ${'sha256:' + 'c'.repeat(64)} | ${undefined}
${'a, b, composer:1'} | ${'composer:1, a, b'} ${'tool:1.2.3@sha256:xyz'} | ${'tool:1.2.3'} | ${undefined} | ${'Invalid sha256 checksum, expected 64 hexadecimal characters'}
${'a, b, composer:2'} | ${'composer:2, a, b'} ${'tool:1.2.3@sha256:' + 'a'.repeat(63)} | ${'tool:1.2.3'} | ${undefined} | ${'Invalid sha256 checksum, expected 64 hexadecimal characters'}
${'a, b, composer:v1'} | ${'composer:1, a, b'} ${'tool:1.2.3@sha512:' + 'b'.repeat(64)} | ${'tool:1.2.3'} | ${undefined} | ${'Invalid sha512 checksum, expected 128 hexadecimal characters'}
${'a, b, composer:v2'} | ${'composer:2, a, b'} ${'tool:1.2.3@sha384:' + 'b'.repeat(96)} | ${'tool:1.2.3'} | ${undefined} | ${'Unsupported checksum algorithm sha384, expected sha256 or sha512'}
${'tool:1.2.3@md5:' + 'b'.repeat(32)} | ${'tool:1.2.3'} | ${undefined} | ${'Unsupported checksum algorithm md5, expected sha256 or sha512'}
${'tool:1.2.3@sha256' + 'a'.repeat(64)} | ${'tool:1.2.3'} | ${undefined} | ${'Invalid checksum syntax, expected @sha256:<hash> or @sha512:<hash>'}
${'tool:1.0@dev'} | ${'tool:1.0@dev'} | ${undefined} | ${undefined}
`(
'checking extractChecksum: $release',
({release, expected_release, checksum, error}) => {
expect(tools.extractChecksum(release)).toStrictEqual({
release: expected_release,
...(checksum !== undefined && {checksum}),
...(error !== undefined && {error})
});
}
);
it.each`
input_list | filtered_list
${'a, b'} | ${'composer, a, b'}
${'a, b, composer'} | ${'composer, a, b'}
${'a, b, composer:1.2.3'} | ${'composer:1.2.3, a, b'}
${'a, b, composer:v1.2.3'} | ${'composer:1.2.3, a, b'}
${'a, b, composer:snapshot'} | ${'composer:snapshot, a, b'}
${'a, b, composer:preview'} | ${'composer:preview, a, b'}
${'a, b, composer:1'} | ${'composer:1, a, b'}
${'a, b, composer:2'} | ${'composer:2, a, b'}
${'a, b, composer:v1'} | ${'composer:1, a, b'}
${'a, b, composer:v2'} | ${'composer:2, a, b'}
${'a, b, composer:2.7.1@sha256:' + 'a'.repeat(64)} | ${'composer:2.7.1@sha256:' + 'a'.repeat(64) + ', a, b'}
${'a, b, composer:v2.7.1@sha256:' + 'a'.repeat(64)} | ${'composer:2.7.1@sha256:' + 'a'.repeat(64) + ', a, b'}
${'a, b, composer:2.7.1@SHA256:' + 'a'.repeat(64)} | ${'composer:2.7.1@SHA256:' + 'a'.repeat(64) + ', a, b'}
${'a, b, composer:2.7.1@sha384:' + 'a'.repeat(96)} | ${'composer:2.7.1@sha384:' + 'a'.repeat(96) + ', a, b'}
${'a, b, composer:2.7.1@md5:' + 'a'.repeat(32)} | ${'composer:2.7.1@md5:' + 'a'.repeat(32) + ', a, b'}
${'a, b, composer:2.7.1@sha256' + 'a'.repeat(64)} | ${'composer:2.7.1@sha256' + 'a'.repeat(64) + ', a, b'}
${'a, b, composer@sha256:' + 'a'.repeat(64)} | ${'composer@sha256:' + 'a'.repeat(64) + ', a, b'}
`('checking filterList $input_list', async ({input_list, filtered_list}) => { `('checking filterList $input_list', async ({input_list, filtered_list}) => {
expect(await tools.filterList(input_list.split(', '))).toStrictEqual( expect(await tools.filterList(input_list.split(', '))).toStrictEqual(
filtered_list.split(', ') filtered_list.split(', ')
@@ -304,6 +337,23 @@ describe('Tools tests', () => {
expect(await tools.addArchive(data)).toContain(script); expect(await tools.addArchive(data)).toContain(script);
}); });
it.each`
os | script
${'linux'} | ${'add_tool https://example.com/tool.phar tool "-v" sha256:' + 'a'.repeat(64)}
${'darwin'} | ${'add_tool https://example.com/tool.phar tool "-v" sha256:' + 'a'.repeat(64)}
${'win32'} | ${'Add-Tool https://example.com/tool.phar tool "-v" sha256:' + 'a'.repeat(64)}
`('checking addArchive with checksum: $os', async ({os, script}) => {
const data = getData({
tool: 'tool',
version: '1.2.3',
version_parameter: JSON.stringify('-v'),
os: os,
url: 'https://example.com/tool.phar'
});
data.checksum = 'sha256:' + 'a'.repeat(64);
expect(await tools.addArchive(data)).toContain(script);
});
it.each` it.each`
os | release | scope | script os | release | scope | script
${'linux'} | ${'tool:1.2.3'} | ${'global'} | ${'add_composer_tool tool tool:1.2.3 user/ global'} ${'linux'} | ${'tool:1.2.3'} | ${'global'} | ${'add_composer_tool tool tool:1.2.3 user/ global'}
@@ -494,7 +544,7 @@ describe('Tools tests', () => {
); );
} }
})); }));
const isolatedTools = await import('../src/tools'); const isolatedTools = jest.requireActual<typeof tools>('../src/tools');
affected = isolatedTools.skipGitHubAuthForComposerVersion('2.9.7'); affected = isolatedTools.skipGitHubAuthForComposerVersion('2.9.7');
fixed = isolatedTools.skipGitHubAuthForComposerVersion('2.9.8'); fixed = isolatedTools.skipGitHubAuthForComposerVersion('2.9.8');
}); });
@@ -585,13 +635,15 @@ describe('Tools tests', () => {
it.each([ it.each([
[ [
'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, mago, name-collision-detector, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp, pie', 'blackfire, blackfire-player, box, churn, cloud-cli, cpx, cs2pr, flex, grpc_php_plugin, mago, name-collision-detector, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp, pie',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_blackfire', 'add_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/box-project/box/releases/latest/download/box.phar box "--version"', 'add_tool https://github.com/box-project/box/releases/latest/download/box.phar box "--version"',
'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_composer_tool cloud-cli cloud-cli laravel/ scoped',
'add_tool https://github.com/laravel/cpx/releases/latest/download/cpx cpx "--version"',
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"', 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
'add_composer_tool flex flex symfony/ global', 'add_composer_tool flex flex symfony/ global',
'add_grpc_php_plugin latest', 'add_grpc_php_plugin latest',
@@ -630,7 +682,7 @@ describe('Tools tests', () => {
it.each([ it.each([
[ [
'backward-compatibility-check, behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, mago:0.26.1, name-collision-detector, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli, pie', 'backward-compatibility-check, behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cpx:2.0.0, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, laravel-cloud, mago:0.26.1, name-collision-detector, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli, pie',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_composer_tool behat behat behat/ scoped', 'add_composer_tool behat behat behat/ scoped',
@@ -641,10 +693,12 @@ describe('Tools tests', () => {
'add_composer_tool composer-dependency-analyser composer-dependency-analyser shipmonk/ scoped', 'add_composer_tool composer-dependency-analyser composer-dependency-analyser shipmonk/ scoped',
'add_composer_tool composer-require-checker composer-require-checker maglnet/ scoped', 'add_composer_tool composer-require-checker composer-require-checker maglnet/ scoped',
'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused "-V"', 'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused "-V"',
'add_tool https://github.com/laravel/cpx/releases/download/v2.0.0/cpx cpx "--version"',
'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"',
'add_composer_tool flex flex symfony/ global', 'add_composer_tool flex flex symfony/ global',
'add_grpc_php_plugin 1.2.3', 'add_grpc_php_plugin 1.2.3',
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"', 'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
'add_composer_tool cloud-cli cloud-cli laravel/ scoped',
'add_mago 0.26.1', 'add_mago 0.26.1',
'add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped', 'add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped',
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"', 'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
@@ -774,6 +828,45 @@ describe('Tools tests', () => {
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script); expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
}); });
it.each`
tools_csv | os | script
${'phpunit:9.5.0@sha256:' + 'a'.repeat(64)} | ${'linux'} | ${'add_tool https://phar.phpunit.de/phpunit-9.5.0.phar,https://phar.phpunit.de/phpunit-9.phar phpunit "--version" sha256:' + 'a'.repeat(64)}
${'phpunit:9.5.0@sha256:' + 'a'.repeat(64)} | ${'win32'} | ${'Add-Tool https://phar.phpunit.de/phpunit-9.5.0.phar,https://phar.phpunit.de/phpunit-9.phar phpunit "--version" sha256:' + 'a'.repeat(64)}
${'composer:2.9.8@sha256:' + 'b'.repeat(64)} | ${'linux'} | ${'composer 2.9.8 sha256:' + 'b'.repeat(64)}
${'cs2pr:1.2.3@sha256:' + 'd'.repeat(64)} | ${'linux'} | ${'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V" sha256:' + 'd'.repeat(64)}
${'phive:0.15.3@sha512:' + 'c'.repeat(128)} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status" sha512:' + 'c'.repeat(128)}
${'phinx:1.2.3@sha256:' + 'a'.repeat(64)} | ${'linux'} | ${'add_log "$cross" "phinx" "Checksum verification is not supported for phinx"'}
${'pecl@sha256:' + 'a'.repeat(64)} | ${'linux'} | ${'add_log "$cross" "pecl" "Checksum verification is not supported for pecl"'}
${'phpunit:9.5.0@sha256:invalid'} | ${'linux'} | ${'add_log "$cross" "phpunit" "Invalid sha256 checksum, expected 64 hexadecimal characters"'}
${'composer:2.9.8@SHA256:' + 'b'.repeat(64)} | ${'linux'} | ${'composer 2.9.8 sha256:' + 'b'.repeat(64)}
${'composer:2.9.8@sha384:' + 'b'.repeat(96)} | ${'linux'} | ${'add_log "$cross" "composer" "Unsupported checksum algorithm sha384, expected sha256 or sha512"'}
${'composer:2.9.8@md5:' + 'b'.repeat(32)} | ${'linux'} | ${'add_log "$cross" "composer" "Unsupported checksum algorithm md5, expected sha256 or sha512"'}
${'composer:2.9.8@sha256' + 'b'.repeat(64)} | ${'linux'} | ${'add_log "$cross" "composer" "Invalid checksum syntax, expected @sha256:<hash> or @sha512:<hash>"'}
`(
'checking addTools with checksum: $tools_csv, $os',
async ({tools_csv, os, script}) => {
expect(await tools.addTools(tools_csv, '7.4', os)).toContain(script);
}
);
it.each`
type | tool_function | supported
${'phar'} | ${undefined} | ${true}
${'custom-function'} | ${undefined} | ${true}
${'custom-function'} | ${'composer'} | ${true}
${'custom-function'} | ${'pecl'} | ${false}
${'custom-function'} | ${'dev_tools'} | ${false}
${'composer'} | ${undefined} | ${false}
${'custom-package'} | ${undefined} | ${false}
`(
'checking supportsChecksum: $type, $tool_function',
async ({type, tool_function, supported}) => {
const data = getData({tool: 'tool', type: type});
data.function = tool_function;
expect(await tools.supportsChecksum(data)).toBe(supported);
}
);
it.each` it.each`
tools_csv | token | script tools_csv | token | script
${'cs2pr:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "cs2pr" "Invalid token"'} ${'cs2pr:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "cs2pr" "Invalid token"'}
@@ -814,7 +907,7 @@ describe('Tools tests', () => {
); );
} }
})); }));
const isolatedTools = await import('../src/tools'); const isolatedTools = jest.requireActual<typeof tools>('../src/tools');
result = await isolatedTools.addTools('broken-tool', '7.4', 'linux'); result = await isolatedTools.addTools('broken-tool', '7.4', 'linux');
}); });
+6
View File
@@ -11,6 +11,12 @@ describe('Utils tests', () => {
expect(await utils.readEnv('TEST')).toBe('setup-php'); expect(await utils.readEnv('TEST')).toBe('setup-php');
expect(await utils.readEnv('test_hyphen')).toBe('setup-php'); expect(await utils.readEnv('test_hyphen')).toBe('setup-php');
expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php'); expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php');
expect(await utils.readEnv('test invalid')).toBe('');
process.env['conflict_hyphen'] = 'setup-php';
process.env['conflict-hyphen'] = 'wrong';
expect(await utils.readEnv('conflict_hyphen')).toBe('setup-php');
delete process.env['conflict_hyphen'];
delete process.env['conflict-hyphen'];
expect(await utils.readEnv('undefined')).toBe(''); expect(await utils.readEnv('undefined')).toBe('');
}); });
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -5,7 +5,7 @@ module.exports = {
testMatch: ['**/*.test.ts'], testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner', testRunner: 'jest-circus/runner',
transform: { transform: {
'^.+\\.ts$': 'ts-jest' '^.+\\.ts$': ['ts-jest', {tsconfig: 'tsconfig.test.json'}]
}, },
verbose: true, verbose: true,
collectCoverage: true collectCoverage: true
+648 -273
View File
File diff suppressed because it is too large Load Diff
+23 -15
View File
@@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "2.37.1", "version": "2.37.2",
"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",
@@ -41,26 +41,29 @@
"@eslint/compat": "^2.1.0", "@eslint/compat": "^2.1.0",
"@eslint/js": "^10.0.1", "@eslint/js": "^10.0.1",
"@types/jest": "^30.0.0", "@types/jest": "^30.0.0",
"@types/node": "^25.7.0", "@types/node": "^26.1.1",
"@typescript-eslint/eslint-plugin": "^8.59.3", "@typescript-eslint/eslint-plugin": "^8.65.0",
"@typescript-eslint/parser": "^8.59.3", "@typescript-eslint/parser": "^8.65.0",
"@vercel/ncc": "^0.38.4", "@typescript/native": "npm:typescript@^7.0.2",
"eslint": "^10.3.0", "@vercel/ncc": "^0.44.1",
"eslint": "^10.7.0",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4", "eslint-import-resolver-typescript": "^4.4.5",
"eslint-plugin-import-x": "^4.16.2", "eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-jest": "^29.15.2", "eslint-plugin-jest": "^29.15.5",
"eslint-plugin-prettier": "^5.5.5", "eslint-plugin-prettier": "^5.5.6",
"globals": "^17.6.0", "globals": "^17.7.0",
"jest": "^30.4.2", "jest": "^30.4.2",
"jest-circus": "^30.4.2", "jest-circus": "^30.4.2",
"nock": "^14.0.15", "nock": "^14.0.16",
"prettier": "^3.8.3", "prettier": "^3.9.6",
"simple-git-hooks": "^2.13.1", "simple-git-hooks": "^2.13.1",
"ts-jest": "^29.4.9", "ts-jest": "^29.4.11",
"typescript": "^5.9.3" "typescript": "npm:@typescript/typescript6@^6.0.2"
}, },
"overrides": { "overrides": {
"@babel/core": "^7.29.7",
"js-yaml": "^4.2.0",
"test-exclude": "^7.0.1", "test-exclude": "^7.0.1",
"glob": "^13.0.6", "glob": "^13.0.6",
"minimatch": "^10.2.1" "minimatch": "^10.2.1"
@@ -70,5 +73,10 @@
}, },
"simple-git-hooks": { "simple-git-hooks": {
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release" "pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
},
"allowScripts": {
"fsevents@2.3.3": true,
"simple-git-hooks@2.13.1": true,
"unrs-resolver@1.11.1": true
} }
} }
+1
View File
@@ -7,6 +7,7 @@ gmagick=graphicsmagick-libmagick-dev-compat
gnupg=libgpgme-dev gnupg=libgpgme-dev
grpc=libgrpc-dev libprotobuf-dev protobuf-compiler grpc=libgrpc-dev libprotobuf-dev protobuf-compiler
imagick=libmagickwand-dev libmagickcore-dev imagick=libmagickwand-dev libmagickcore-dev
krb5=libkrb5-dev
memcached=libmemcached-dev libevent-dev memcached=libmemcached-dev libevent-dev
protobuf=libprotobuf-dev protobuf-compiler protobuf=libprotobuf-dev protobuf-compiler
rdkafka=librdkafka-dev rdkafka=librdkafka-dev
+14
View File
@@ -42,6 +42,14 @@
"version_prefix": "", "version_prefix": "",
"version_parameter": "diagnose" "version_parameter": "diagnose"
}, },
"cpx": {
"type": "phar",
"repository": "laravel/cpx",
"extension": "",
"domain": "https://github.com",
"version_prefix": "v",
"version_parameter": "--version"
},
"cs2pr": { "cs2pr": {
"type": "phar", "type": "phar",
"repository": "staabm/annotate-pull-request-from-checkstyle", "repository": "staabm/annotate-pull-request-from-checkstyle",
@@ -234,6 +242,12 @@
"repository": "laravel/vapor-cli", "repository": "laravel/vapor-cli",
"scope": "scoped" "scope": "scoped"
}, },
"cloud-cli": {
"type": "composer",
"alias": "laravel-cloud",
"repository": "laravel/cloud-cli",
"scope": "scoped"
},
"rector": { "rector": {
"type": "composer", "type": "composer",
"repository": "rector/rector", "repository": "rector/rector",
+2 -2
View File
@@ -85,11 +85,11 @@ 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|brotli|excimer|expect|gmagick|gnupg|grpc|igbinary|imagick|imap|interbase|mailparse|maxminddb|mcrypt|memcache|memcached|mongodb|mongodb1|msgpack|newrelic|oauth|opentelemetry|pdo_firebird|pinba|protobuf|psr|raphf|rdkafka|redis|scalar_objects|seaslog|snmp|spx|ssh2|swoole|uopz|uploadprogress|uuid|vld|xdebug|xdebug2|xhprof|yaml|zmq|zstd)/.test( case /(?<!5\.[3-5])(amqp|apcu|brotli|excimer|expect|gmagick|gnupg|grpc|igbinary|imagick|imap|interbase|lua|mailparse|maxminddb|mcrypt|memcache|memcached|mongodb|mongodb1|msgpack|newrelic|oauth|opentelemetry|pdo_firebird|pinba|protobuf|psr|raphf|rdkafka|redis|scalar_objects|seaslog|snmp|spx|ssh2|swoole|uopz|uploadprogress|uuid|vld|xdebug|xdebug2|xhprof|yaml|zmq|zstd)/.test(
version_extension version_extension
): ):
case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension): case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
case /(5\.6|7\.[0-4])(propro|lua)/.test(version_extension): case /(5\.6|7\.[0-4])(propro)/.test(version_extension):
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension): case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension): case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
case /^(8\.[0-5])swow$/.test(version_extension): case /^(8\.[0-5])swow$/.test(version_extension):
+10 -2
View File
@@ -105,10 +105,15 @@ Function Add-Extension {
$extension_version = '' $extension_version = ''
) )
try { try {
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
$deps_dir = "$ext_dir\$extension-vc$($installed.VCVersion)-$arch" $deps_dir = "$ext_dir\$extension-vc$($installed.VCVersion)-$arch"
New-Item $deps_dir -Type Directory -Force > $null 2>&1 New-Item $deps_dir -Type Directory -Force > $null 2>&1
if ($null -ne $extension_info) { if($extension_version -ne '' -and (Test-Path "$ext_dir\$extension-$extension_version")) {
Copy-Item "$ext_dir\$extension-$extension_version" "$ext_dir\php_$extension.dll" -Force
Enable-Extension $extension
return
}
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
if ($null -ne $extension_info -and ($extension_version -eq '' -or $extension_info.Version[0] -eq $extension_version)) {
switch ($extension_info.State) { switch ($extension_info.State) {
'Builtin' { 'Builtin' {
Add-Log $tick $extension "Enabled" Add-Log $tick $extension "Enabled"
@@ -145,6 +150,9 @@ Function Add-Extension {
} }
Add-Log $tick $extension "Installed and enabled" Add-Log $tick $extension "Installed and enabled"
} }
if($extension_version -ne '' -and (Test-Path "$ext_dir\php_$extension.dll")) {
Copy-Item "$ext_dir\php_$extension.dll" "$ext_dir\$extension-$extension_version" -Force
}
} 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 )"
} }
+12 -1
View File
@@ -209,17 +209,28 @@ add_pecl_extension() {
local extension=$1 local extension=$1
local pecl_version=$2 local pecl_version=$2
local prefix=$3 local prefix=$3
enable_extension "$extension" "$prefix"
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
pecl_version=$(get_pecl_version "$extension" "$pecl_version") pecl_version=$(get_pecl_version "$extension" "$pecl_version")
fi fi
# Cache versioned extensions using suffixless copies in extension_dir.
if [ -n "$pecl_version" ] && [ -e "${ext_dir:?}/$extension-$pecl_version" ]; then
sudo cp "${ext_dir:?}/$extension-$pecl_version" "${ext_dir:?}/$extension.so"
enable_extension "$extension" "$prefix"
add_log "${tick:?}" "$extension" "Enabled"
return
fi
enable_extension "$extension" "$prefix"
ext_version=$(php -r "echo phpversion('$extension');") ext_version=$(php -r "echo phpversion('$extension');")
if check_extension "$extension" && [[ -z "$pecl_version" || (-n "$pecl_version" && "${ext_version/-/}" == "$pecl_version") ]]; then if check_extension "$extension" && [[ -z "$pecl_version" || (-n "$pecl_version" && "${ext_version/-/}" == "$pecl_version") ]]; then
[ -n "$pecl_version" ] && sudo cp "${ext_dir:?}/$extension.so" "${ext_dir:?}/$extension-$pecl_version" 2>/dev/null || true
add_log "${tick:?}" "$extension" "Enabled" add_log "${tick:?}" "$extension" "Enabled"
else else
[ -n "$pecl_version" ] && pecl_version="-$pecl_version" [ -n "$pecl_version" ] && pecl_version="-$pecl_version"
pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1) pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1)
extension_version="$(php -r "echo phpversion('$extension');")" extension_version="$(php -r "echo phpversion('$extension');")"
if [ -n "$pecl_version" ] && [ "${extension_version/-/}" = "${pecl_version#-}" ]; then
sudo cp "${ext_dir:?}/$extension.so" "${ext_dir:?}/$extension-$extension_version" 2>/dev/null || true
fi
[ -n "$extension_version" ] && extension_version="-$extension_version" [ -n "$extension_version" ] && extension_version="-$extension_version"
add_extension_log "$extension$extension_version" "Installed and enabled" add_extension_log "$extension$extension_version" "Installed and enabled"
fi fi
+2 -2
View File
@@ -2,8 +2,8 @@ patch_geos() {
if [[ $(printf '%s\n%s\n' "${version:?}" "7.0" | sort -V | head -n1) == "7.0" ]]; then if [[ $(printf '%s\n%s\n' "${version:?}" "7.0" | sort -V | head -n1) == "7.0" ]]; then
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
fi fi
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch get -q -n /tmp/php8.patch https://src.fedoraproject.org/rpms/php-geos/raw/2021845a362752948dd0338920f0a0e6b1031b4d/f/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch get -q -n /tmp/toString.patch https://src.fedoraproject.org/rpms/php-geos/raw/2021845a362752948dd0338920f0a0e6b1031b4d/f/0006-fix-__toString-with-8.2.patch
patch -p1 < /tmp/php8.patch 2>/dev/null || true patch -p1 < /tmp/php8.patch 2>/dev/null || true
patch -p1 < /tmp/toString.patch 2>/dev/null || true patch -p1 < /tmp/toString.patch 2>/dev/null || true
} }
+51 -5
View File
@@ -144,6 +144,21 @@ Function Test-MutableToolUrl() {
return ($Url -match $mutableUrlRegex) -or (($Url -match '\.phar([?#].*)?$') -and -not ($Url -match $versionLikeRegex)) return ($Url -match $mutableUrlRegex) -or (($Url -match '\.phar([?#].*)?$') -and -not ($Url -match $versionLikeRegex))
} }
# Function to verify the checksum of a file.
Function Test-ToolChecksum() {
Param(
[Parameter(Position = 0, Mandatory = $true)]
[string]
$Path,
[Parameter(Position = 1, Mandatory = $true)]
[string]
$Checksum
)
$checksum_parts = $Checksum -split ':'
$actual_checksum = (Get-FileHash -Path $Path -Algorithm $checksum_parts[0]).Hash
return $actual_checksum -eq $checksum_parts[1]
}
# Function to extract tool version. # Function to extract tool version.
Function Get-ToolVersion() { Function Get-ToolVersion() {
Param ( Param (
@@ -206,6 +221,9 @@ Function Add-ToolsHelper() {
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter') $extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
} elseif($tool -eq "phpunit-bridge") { } elseif($tool -eq "phpunit-bridge") {
$extensions += @('dom', 'pdo', 'tokenizer', 'xmlwriter') $extensions += @('dom', 'pdo', 'tokenizer', 'xmlwriter')
} elseif($tool -eq "cloud-cli") {
$extensions += @('sockets')
Copy-Item $env:cloud_cli_bin\cloud.bat -Destination $env:cloud_cli_bin\cloud-cli.bat
} elseif($tool -eq "vapor-cli") { } elseif($tool -eq "vapor-cli") {
$extensions += @('fileinfo', 'json', 'mbstring', 'zip', 'simplexml') $extensions += @('fileinfo', 'json', 'mbstring', 'zip', 'simplexml')
Copy-Item $env:vapor_cli_bin\vapor.bat -Destination $env:vapor_cli_bin\vapor-cli.bat Copy-Item $env:vapor_cli_bin\vapor.bat -Destination $env:vapor_cli_bin\vapor-cli.bat
@@ -229,8 +247,18 @@ Function Add-Tool() {
[Parameter(Position = 2, Mandatory = $false)] [Parameter(Position = 2, Mandatory = $false)]
$ver_param, $ver_param,
[Parameter(Position = 3, Mandatory = $false)] [Parameter(Position = 3, Mandatory = $false)]
$skip_composer_github_auth $skip_composer_github_auth,
[Parameter(Position = 4, Mandatory = $false)]
$checksum
) )
$checksum_regex = '^sha(256|512):[0-9a-fA-F]+$'
if("$ver_param" -match $checksum_regex) {
$checksum = $ver_param
$ver_param = $null
} elseif("$skip_composer_github_auth" -match $checksum_regex) {
$checksum = $skip_composer_github_auth
$skip_composer_github_auth = $null
}
if($tool -eq "composer") { if($tool -eq "composer") {
$script:skip_composer_github_auth = $skip_composer_github_auth -eq 'true' $script:skip_composer_github_auth = $skip_composer_github_auth -eq 'true'
} }
@@ -245,7 +273,12 @@ Function Add-Tool() {
$use_cache = -not (Test-MutableToolUrl $urls[0]) $use_cache = -not (Test-MutableToolUrl $urls[0])
$status_code = 200 $status_code = 200
if ($use_cache -and (Test-Path $cache_path -PathType Leaf)) { if ($use_cache -and (Test-Path $cache_path -PathType Leaf)) {
Copy-Item $cache_path -Destination $tool_path -Force if($checksum -and -not(Test-ToolChecksum $cache_path $checksum)) {
Remove-Item $cache_path -Force -ErrorAction SilentlyContinue
$status_code = 'checksum_mismatch'
} else {
Copy-Item $cache_path -Destination $tool_path -Force
}
} else { } else {
$backup_path = "$tool_path.bak" $backup_path = "$tool_path.bak"
if (Test-Path $tool_path) { Copy-Item $tool_path -Destination $backup_path -Force } if (Test-Path $tool_path) { Copy-Item $tool_path -Destination $backup_path -Force }
@@ -265,18 +298,31 @@ Function Add-Tool() {
} }
} }
if($status_code -eq 200 -and (Test-Path $tool_path)) { if($status_code -eq 200 -and (Test-Path $tool_path)) {
if ($use_cache) {
Copy-Item $tool_path -Destination $cache_path -Force
}
break break
} }
} }
if($status_code -eq 200 -and (Test-Path $tool_path)) {
if($checksum -and -not(Test-ToolChecksum $tool_path $checksum)) {
Remove-Item @($tool_path, $cache_path) -Force -ErrorAction SilentlyContinue
$status_code = 'checksum_mismatch'
} elseif($use_cache) {
Copy-Item $tool_path -Destination $cache_path -Force
}
}
if ($status_code -ne 200 -and (Test-Path $backup_path)) { if ($status_code -ne 200 -and (Test-Path $backup_path)) {
Copy-Item $backup_path -Destination $tool_path -Force Copy-Item $backup_path -Destination $tool_path -Force
} }
Remove-Item $backup_path -Force -ErrorAction SilentlyContinue Remove-Item $backup_path -Force -ErrorAction SilentlyContinue
} }
if($status_code -eq 'checksum_mismatch') {
if($tool -eq "composer") {
$env:fail_fast = 'true'
}
Add-Log $cross $tool "Checksum verification failed for $tool"
return
}
$escaped_tool = [regex]::Escape($tool) $escaped_tool = [regex]::Escape($tool)
if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$escaped_tool(\.exe|\.phar)?$").Count -gt 0)) { if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$escaped_tool(\.exe|\.phar)?$").Count -gt 0)) {
$bat_content = @() $bat_content = @()
+27 -4
View File
@@ -185,6 +185,9 @@ add_tools_helper() {
if [ -e "$tool_path_dir"/phpunit ] && [ -d "$composer_bin" ]; then if [ -e "$tool_path_dir"/phpunit ] && [ -d "$composer_bin" ]; then
sudo cp "$tool_path_dir"/phpunit "$composer_bin" sudo cp "$tool_path_dir"/phpunit "$composer_bin"
fi fi
elif [ "$tool" = "cloud-cli" ]; then
extensions+=(dom iconv sockets tokenizer)
sudo ln -s "$scoped_dir"/vendor/bin/cloud "$scoped_dir"/vendor/bin/cloud-cli 2>/dev/null || true
elif [ "$tool" = "vapor-cli" ]; then elif [ "$tool" = "vapor-cli" ]; then
extensions+=(fileinfo json mbstring zip simplexml) extensions+=(fileinfo json mbstring zip simplexml)
sudo ln -s "$scoped_dir"/vendor/bin/vapor "$scoped_dir"/vendor/bin/vapor-cli 2>/dev/null || true sudo ln -s "$scoped_dir"/vendor/bin/vapor "$scoped_dir"/vendor/bin/vapor-cli 2>/dev/null || true
@@ -201,8 +204,15 @@ add_tool() {
url=$1 url=$1
tool=$2 tool=$2
ver_param=$3 ver_param=$3
checksum=
local arg
for arg in "$@"; do
[[ "$arg" =~ ^sha(256|512):[0-9a-fA-F]+$ ]] && checksum="$arg"
done
[[ "$ver_param" =~ ^sha(256|512): ]] && ver_param=
if [ "$tool" = "composer" ]; then if [ "$tool" = "composer" ]; then
skip_composer_github_auth="${4:-false}" skip_composer_github_auth="${4:-false}"
[[ "$skip_composer_github_auth" =~ ^sha(256|512): ]] && skip_composer_github_auth=false
fi fi
tool_path="$tool_path_dir/$tool" tool_path="$tool_path_dir/$tool"
if ! [ -d "$tool_path_dir" ]; then if ! [ -d "$tool_path_dir" ]; then
@@ -220,7 +230,12 @@ add_tool() {
is_mutable_tool_url "${url[0]}" && use_cache=false is_mutable_tool_url "${url[0]}" && use_cache=false
status_code="200" status_code="200"
if [ "$use_cache" = "true" ] && [ -f "$cache_path" ]; then if [ "$use_cache" = "true" ] && [ -f "$cache_path" ]; then
sudo cp -a "$cache_path" "$tool_path" if [ -n "$checksum" ] && ! verify_checksum "$cache_path" "$checksum"; then
sudo rm -f "$cache_path"
status_code="checksum_mismatch"
else
sudo cp -a "$cache_path" "$tool_path"
fi
else else
[ -f "$tool_path" ] && sudo cp -a "$tool_path" "$tool_path.bak" [ -f "$tool_path" ] && sudo cp -a "$tool_path" "$tool_path.bak"
status_code=$(get -v -e "$tool_path" "${url[@]}") status_code=$(get -v -e "$tool_path" "${url[@]}")
@@ -229,8 +244,14 @@ add_tool() {
status_code=$(get -v -e "$tool_path" "${url[0]}") status_code=$(get -v -e "$tool_path" "${url[0]}")
fi fi
if [ "$status_code" = "200" ]; then if [ "$status_code" = "200" ]; then
[ "$use_cache" = "true" ] && sudo cp -a "$tool_path" "$cache_path" if [ -n "$checksum" ] && ! verify_checksum "$tool_path" "$checksum"; then
elif [ -f "$tool_path.bak" ]; then sudo rm -f "$tool_path" "$cache_path"
status_code="checksum_mismatch"
elif [ "$use_cache" = "true" ]; then
sudo cp -a "$tool_path" "$cache_path"
fi
fi
if [ "$status_code" != "200" ] && [ -f "$tool_path.bak" ]; then
sudo mv "$tool_path.bak" "$tool_path" sudo mv "$tool_path.bak" "$tool_path"
fi fi
sudo rm -f "$tool_path.bak" sudo rm -f "$tool_path.bak"
@@ -244,7 +265,9 @@ add_tool() {
if [ "$tool" = "composer" ]; then if [ "$tool" = "composer" ]; then
export fail_fast=true export fail_fast=true
fi fi
if [ "$status_code" = "404" ]; then if [ "$status_code" = "checksum_mismatch" ]; then
add_log "$cross" "$tool" "Checksum verification failed for $tool"
elif [ "$status_code" = "404" ]; then
add_log "$cross" "$tool" "Failed to download $tool from ${url[*]}" add_log "$cross" "$tool" "Failed to download $tool from ${url[*]}"
else else
add_log "$cross" "$tool" "Could not setup $tool" add_log "$cross" "$tool" "Could not setup $tool"
+1
View File
@@ -22,6 +22,7 @@ add_brew_tap() {
fi fi
fi fi
fi fi
brew trust "$tap" >/dev/null 2>&1
} }
# Function to get brew prefix. # Function to get brew prefix.
+18 -9
View File
@@ -343,23 +343,32 @@ add_ppa_sp_mirror() {
add_list sp/"$ppa_name" "$ppa_sp/$ppa/ubuntu" "$ppa_sp/$ppa/ubuntu/key.gpg" add_list sp/"$ppa_name" "$ppa_sp/$ppa/ubuntu" "$ppa_sp/$ppa/ubuntu/key.gpg"
} }
add_sury_list() {
ppa=${1:-ondrej/php}
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.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
if is_ubuntu_ppa_up "$ppa" ; then if [ "$VERSION_ID" = "26.04" ]; then
[ "${runner:?}" = "self-hosted" ] && find "$list_dir" -type f -name 'sp*' -exec grep -qF "${sp/https:\/\/}" {} \; -delete add_sury_list
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lpc_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
add_list "$ppa"
elif [ "$ppa" = "ondrej/php" ]; then
add_ppa_sp_mirror "$ppa"
else else
add_log "${cross:?}" "$ppa" "PPA $ppa is not available" if is_ubuntu_ppa_up "$ppa" ; then
[ "${runner:?}" = "self-hosted" ] && find "$list_dir" -type f -name 'sp*' -exec grep -qF "${sp/https:\/\/}" {} \; -delete
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lpc_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
add_list "$ppa"
elif [ "$ppa" = "ondrej/php" ]; then
add_ppa_sp_mirror "$ppa"
else
add_log "${cross:?}" "$ppa" "PPA $ppa is not available"
fi
fi 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" add_sury_list
add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg
else else
add_list "$ppa" add_list "$ppa"
fi fi
+19
View File
@@ -122,6 +122,25 @@ get_sha256() {
fi fi
} }
# Function to verify the checksum of a file.
# checksum format: sha256:<hash> or sha512:<hash>
verify_checksum() {
local file_path=$1
local checksum=$2
local algo="${checksum%%:*}"
local expected="${checksum#*:}"
local actual=
local hash_command=
if hash_command="$(command -v "${algo}sum")"; then
actual="$(sudo "$hash_command" "$file_path" | cut -d' ' -f1)"
elif hash_command="$(command -v shasum)"; then
actual="$(sudo "$hash_command" -a "${algo#sha}" "$file_path" | cut -d' ' -f1)"
elif hash_command="$(command -v openssl)"; then
actual="$(sudo "$hash_command" dgst -"$algo" "$file_path" | awk '{print $NF}')"
fi
[ -n "$actual" ] && [ "$(echo "$actual" | tr '[:upper:]' '[:lower:]')" = "$(echo "$expected" | tr '[:upper:]' '[:lower:]')" ]
}
# Function to download a file using cURL. # Function to download a file using cURL.
# mode: -s pipe to stdout, -v save file and return status code # mode: -s pipe to stdout, -v save file and return status code
# execute: -e save file as executable # execute: -e save file as executable
+87 -3
View File
@@ -27,6 +27,7 @@ type ToolFunction =
export interface ToolData { export interface ToolData {
tool: string; tool: string;
version: string; version: string;
checksum?: string;
os: string; os: string;
php_version: string; php_version: string;
github: string; github: string;
@@ -73,6 +74,53 @@ interface ToolConfig {
packagist?: string; packagist?: string;
} }
/**
* Regex to match a checksum suffix in a tool release - tool:version@sha256:<hash>
*/
const checksum_suffix_regex = /@([a-z][a-z0-9-]*):([^@]*)$/i;
const checksum_like_suffix_regex = /@sha[^@]*$/i;
/**
* Function to parse the checksum suffix in the tool release
*
* @param release
*/
export function extractChecksum(release: string): {
release: string;
checksum?: string;
error?: string;
} {
const matches = release.match(checksum_suffix_regex);
if (!matches) {
const checksum_like_matches = release.match(checksum_like_suffix_regex);
if (checksum_like_matches) {
return {
release: release.slice(0, -checksum_like_matches[0].length),
error:
'Invalid checksum syntax, expected @sha256:<hash> or @sha512:<hash>'
};
}
return {release};
}
release = release.slice(0, -matches[0].length);
const algo = matches[1].toLowerCase();
if (!['sha256', 'sha512'].includes(algo)) {
return {
release,
error: `Unsupported checksum algorithm ${algo}, expected sha256 or sha512`
};
}
const hash = matches[2].toLowerCase();
const hash_length = algo === 'sha256' ? 64 : 128;
if (!new RegExp(`^[a-f0-9]{${hash_length}}$`).test(hash)) {
return {
release,
error: `Invalid ${algo} checksum, expected ${hash_length} hexadecimal characters`
};
}
return {release, checksum: `${algo}:${hash}`};
}
/** /**
* GitHub reference object from API response * GitHub reference object from API response
*/ */
@@ -260,9 +308,13 @@ export async function filterList(tools_list: string[]): Promise<string[]> {
const regex_any = /^composer($|:.*)/; const regex_any = /^composer($|:.*)/;
const regex_valid = const regex_valid =
/^composer:?($|preview$|snapshot$|v?\d+(\.\d+)?$|v?\d+\.\d+\.\d+[\w-]*$)/; /^composer:?($|preview$|snapshot$|v?\d+(\.\d+)?$|v?\d+\.\d+\.\d+[\w-]*$)/;
const matches: string[] = tools_list.filter(tool => regex_valid.test(tool)); const matches: string[] = tools_list.filter(tool =>
regex_valid.test(extractChecksum(tool).release)
);
let composer = 'composer'; let composer = 'composer';
tools_list = tools_list.filter(tool => !regex_any.test(tool)); tools_list = tools_list.filter(
tool => !regex_any.test(extractChecksum(tool).release)
);
switch (true) { switch (true) {
case matches[0] == undefined: case matches[0] == undefined:
break; break;
@@ -335,7 +387,8 @@ export async function getPharUrl(data: ToolData): Promise<string> {
export async function addArchive(data: ToolData): Promise<string> { export async function addArchive(data: ToolData): Promise<string> {
return ( return (
(await utils.getCommand(data.os, 'tool')) + (await utils.getCommand(data.os, 'tool')) +
(await utils.joins(data.url, data.tool, data.version_parameter)) (await utils.joins(data.url, data.tool, data.version_parameter)) +
(data.checksum ? ' ' + data.checksum : '')
); );
} }
@@ -612,6 +665,8 @@ export async function getData(
const json_file: string = fs.readFileSync(json_file_path, 'utf8'); const json_file: string = fs.readFileSync(json_file_path, 'utf8');
const json_objects: Record<string, ToolConfig> = JSON.parse(json_file); const json_objects: Record<string, ToolConfig> = JSON.parse(json_file);
release = release.replace(/\s+/g, ''); release = release.replace(/\s+/g, '');
const checksum_data = extractChecksum(release);
release = checksum_data.release;
const parts: string[] = release.split(':'); const parts: string[] = release.split(':');
const tool = parts[0]; const tool = parts[0];
const version = parts[1]; const version = parts[1];
@@ -663,6 +718,8 @@ export async function getData(
function: config.function, function: config.function,
alias: config.alias alias: config.alias
}; };
data.checksum = checksum_data.checksum;
data.error = checksum_data.error;
data.release = await getRelease(release, data); data.release = await getRelease(release, data);
data.version = version data.version = version
? await getVersion(version, data) ? await getVersion(version, data)
@@ -688,6 +745,25 @@ export const functionRecord: Record<
wp_cli: addWPCLI wp_cli: addWPCLI
}; };
/**
* Function to check if a tool supports checksum verification
*
* Only tools downloaded as archives via add_tool support it, so composer
* packages and tools set up using custom package scripts do not.
*
* @param data
*/
export async function supportsChecksum(data: ToolData): Promise<boolean> {
switch (data.type) {
case 'phar':
return true;
case 'custom-function':
return !['pecl', 'dev_tools'].includes(data.function ?? '');
default:
return false;
}
}
/** /**
* Setup tools * Setup tools
* *
@@ -714,6 +790,14 @@ export async function addTools(
case data.error !== undefined: case data.error !== undefined:
script += await utils.addLog('$cross', data.tool, data.error, data.os); script += await utils.addLog('$cross', data.tool, data.error, data.os);
break; break;
case data.checksum !== undefined && !(await supportsChecksum(data)):
script += await utils.addLog(
'$cross',
data.tool,
'Checksum verification is not supported for ' + data.tool,
data.os
);
break;
case 'phar' === data.type: case 'phar' === data.type:
script += await addArchive(data); script += await addArchive(data);
break; break;
+11 -8
View File
@@ -9,16 +9,19 @@ import * as fetch from './fetch';
* @param property * @param property
*/ */
export async function readEnv(property: string): Promise<string> { export async function readEnv(property: string): Promise<string> {
if (!/^[A-Za-z0-9_-]+$/.test(property)) {
return '';
}
const property_lc: string = property.toLowerCase(); const property_lc: string = property.toLowerCase();
const property_uc: string = property.toUpperCase(); const property_uc: string = property.toUpperCase();
return ( const candidates = [
process.env[property] || property,
process.env[property_lc] || property_lc,
process.env[property_uc] || property_uc,
process.env[property_lc.replace('_', '-')] || property_lc.replace('_', '-'),
process.env[property_uc.replace('_', '-')] || property_uc.replace('_', '-')
'' ].filter((value, index, array) => array.indexOf(value) === index);
); return candidates.map(name => process.env[name] || '').find(Boolean) || '';
} }
/** /**
+8 -5
View File
@@ -3,17 +3,20 @@
"declaration": true, "declaration": true,
"esModuleInterop": true, "esModuleInterop": true,
"lib": [ "lib": [
"ES2024" "ES2025"
], ],
"module": "commonjs", "module": "Node20",
"moduleResolution": "node", "moduleResolution": "Node16",
"noImplicitAny": true, "noImplicitAny": true,
"outDir": "./lib", "outDir": "./lib",
"removeComments": true, "removeComments": true,
"rootDir": "./src", "rootDir": "./src",
"sourceMap": true, "sourceMap": true,
"strict": true, "strict": true,
"target": "ES2024" "target": "ES2025",
"types": [
"node"
]
}, },
"exclude": ["__tests__", "lib", "node_modules"] "exclude": ["__tests__", "lib", "node_modules"]
} }
+14
View File
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"isolatedModules": true,
"noEmit": true,
"rootDir": ".",
"types": [
"jest",
"node"
]
},
"exclude": ["lib", "node_modules"],
"include": ["__tests__/**/*.ts", "src/**/*.ts"]
}