mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-11-19 20:31:57 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
084302964f |
@@ -14,7 +14,6 @@ This security policy only applies to the latest patch releases of the following
|
|||||||
| 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: |
|
| 8.5 | :white_check_mark: |
|
||||||
| 8.6 | :white_check_mark: |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
|
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # 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@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
|
uses: github/codeql-action/autobuild@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
|
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
env:
|
env:
|
||||||
default-php-version: '8.6'
|
default-php-version: '8.5'
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
name: Run
|
name: Run
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup cache environment
|
- name: Setup cache environment
|
||||||
id: cache-env
|
id: cache-env
|
||||||
uses: shivammathur/cache-extensions@695b1b465eba861efe67cbbc31252c27f5ed253d # v1
|
uses: shivammathur/cache-extensions@d894929efeece5f8d386bd667369b321947064ad # 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 }}
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
|
|||||||
|
|
||||||
On all supported OS/Platforms, the following PHP versions can be set up as per the runner.
|
On all supported OS/Platforms, the following PHP versions can be set up as per the runner.
|
||||||
|
|
||||||
- PHP 5.3 to PHP 8.7 on supported GitHub-hosted runners, including macOS ARM64 runners.
|
- PHP 5.3 to PHP 8.7 on GitHub-hosted runners, except for macOS ARM64 runners.
|
||||||
|
- PHP 5.6 to PHP 8.7 on GitHub-hosted macOS ARM64 runners.
|
||||||
- PHP 5.6 to PHP 8.7 on self-hosted runners.
|
- PHP 5.6 to PHP 8.7 on self-hosted runners.
|
||||||
|
|
||||||
| PHP Version | Stability | Release Support | Runner Support |
|
| PHP Version | Stability | Release Support | Runner Support |
|
||||||
@@ -131,12 +132,12 @@ On all supported OS/Platforms, the following PHP versions can be set up as per t
|
|||||||
| `8.3` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
|
| `8.3` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.5` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
| `8.5` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.6` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
| `8.6` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.7` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
| `8.7` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
||||||
|
|
||||||
|
|
||||||
> [!Note]
|
> [!Note]
|
||||||
> - Specifying `8.6` in the `php-version` input selects the PHP 8.6 stable series. Specifying `8.7`, `nightly`, or `master` installs a nightly build of PHP 8.7 from the master branch of PHP. See [nightly build setup](#nightly-build-setup) for more information.
|
> - Specifying `8.7` or `master` in `php-version` input installs a nightly build of `PHP 8.7.0-dev` from the master branch of PHP. Specifying `8.6` or `nightly` installs a nightly build of `PHP 8.6.0-dev` from the PHP-8.6 branch. See [nightly build setup](#nightly-build-setup) for more information.
|
||||||
> - To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section.
|
> - To use JIT on `PHP 8.0` and above, refer to the [JIT configuration](#jit-configuration) section.
|
||||||
|
|
||||||
## :heavy_plus_sign: PHP Extension Support
|
## :heavy_plus_sign: PHP Extension Support
|
||||||
@@ -432,7 +433,7 @@ Disable coverage for these reasons:
|
|||||||
- Accepts a `string`. For example `'8.5'`.
|
- Accepts a `string`. For example `'8.5'`.
|
||||||
- Accepts `lowest` to set up the lowest supported PHP version.
|
- Accepts `lowest` to set up the lowest supported PHP version.
|
||||||
- Accepts `highest` or `latest` to set up the latest stable PHP version.
|
- Accepts `highest` or `latest` to set up the latest stable PHP version.
|
||||||
- Accepts `nightly` to set up a nightly build of the next PHP release (`8.7`).
|
- Accepts `nightly` to set up a nightly build of the next PHP release (`8.6`).
|
||||||
- Accepts `master` to set up a nightly build from the master branch of PHP (`8.7`).
|
- Accepts `master` to set up a nightly build from the master branch of PHP (`8.7`).
|
||||||
- Accepts `pre-installed` to set up the highest pre-installed PHP version. You can combine this with `update: true` to update the pre-installed PHP version.
|
- Accepts `pre-installed` to set up the highest pre-installed PHP version. You can combine this with `update: true` to update the pre-installed PHP version.
|
||||||
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
|
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
|
||||||
@@ -590,10 +591,10 @@ jobs:
|
|||||||
|
|
||||||
### Nightly Build Setup
|
### Nightly Build Setup
|
||||||
|
|
||||||
> Set up a nightly build of `PHP 8.7`.
|
> Set up a nightly build of `PHP 8.6` or `PHP 8.7`.
|
||||||
|
|
||||||
- PHP 8.7 is in active development and might contain bugs and breaking changes.
|
- These PHP versions are currently in active development and might contain bugs and breaking changes.
|
||||||
- Some extensions might not support PHP 8.7 yet.
|
- Some user space extensions might not support these versions currently.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
@@ -689,7 +690,7 @@ jobs:
|
|||||||
|
|
||||||
> Set up PHP on multiple architectures on Ubuntu GitHub Runners.
|
> Set up PHP on multiple architectures on Ubuntu GitHub Runners.
|
||||||
|
|
||||||
- `PHP 5.6` to `PHP 8.6` are supported by `setup-php` on multiple architectures 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`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -1045,23 +1046,34 @@ Examples of using `setup-php` with various PHP frameworks and packages.
|
|||||||
|
|
||||||
These companies generously provide setup-php their products and services to aid in the development of this project.
|
These companies generously provide setup-php their products and services to aid in the development of this project.
|
||||||
|
|
||||||
<p align="center">
|
<p>
|
||||||
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-light-mode-only"><img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140"></a>
|
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-light-mode-only">
|
||||||
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/jetbrains-white.svg" alt="JetBrains" width="140"></a>
|
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="100">
|
||||||
|
</a>
|
||||||
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only"><img src="https://setup-php.com/sponsors/cloudflare.svg" alt="Cloudflare" width="240"></a>
|
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-dark-mode-only">
|
||||||
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/cloudflare-white.svg" alt="Cloudflare" width="240"></a>
|
<img src="https://setup-php.com/sponsors/jetbrains-white.svg" alt="JetBrains" width="140" height="100">
|
||||||
|
</a>
|
||||||
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-light-mode-only"><img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="200"></a>
|
|
||||||
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200"></a>
|
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only">
|
||||||
</p>
|
<img src="https://setup-php.com/sponsors/cloudflare.svg" alt="Cloudflare" width="240" height="80">
|
||||||
|
</a>
|
||||||
<p align="center">
|
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-dark-mode-only">
|
||||||
<a target="_blank" href="https://namespace.so/#gh-light-mode-only"><img src="https://setup-php.com/sponsors/namespace.svg?v=2" alt="Namespace" width="180" align="middle"></a>
|
<img src="https://setup-php.com/sponsors/cloudflare-white.svg" alt="Cloudflare" width="240" height="80">
|
||||||
<a target="_blank" href="https://namespace.so/#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/namespace-white.svg?v=2" alt="Namespace" width="180" align="middle"></a>
|
</a>
|
||||||
|
|
||||||
<a target="_blank" href="https://www.blacksmith.sh/#gh-light-mode-only"><img src="https://setup-php.com/sponsors/blacksmith.svg?v=2" alt="Blacksmith" width="180" align="middle"></a>
|
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-light-mode-only">
|
||||||
<a target="_blank" href="https://www.blacksmith.sh/#gh-dark-mode-only"><img src="https://setup-php.com/sponsors/blacksmith-white.svg?v=2" alt="Blacksmith" width="180" align="middle"></a>
|
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="200" height="80">
|
||||||
|
</a>
|
||||||
|
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-dark-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200" height="80">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a target="_blank" href="https://m.do.co/c/f1a8ee1277b0#gh-light-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/digitalocean.svg" alt="Digitalocean" width="100" height="100">
|
||||||
|
</a>
|
||||||
|
<a target="_blank" href="https://m.do.co/c/f1a8ee1277b0#gh-dark-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/digitalocean-white.svg" alt="Digitalocean" width="100" height="100">
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Many users and organizations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
|
Many users and organizations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
|
||||||
|
|||||||
@@ -51,10 +51,8 @@ describe('Utils tests', () => {
|
|||||||
'utf8'
|
'utf8'
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
expect(await utils.parseVersion('latest')).toBe('8.6');
|
expect(await utils.parseVersion('latest')).toBe('8.5');
|
||||||
expect(await utils.parseVersion('highest')).toBe('8.6');
|
expect(await utils.parseVersion('nightly')).toBe('8.6');
|
||||||
expect(await utils.parseVersion('8.x')).toBe('8.6');
|
|
||||||
expect(await utils.parseVersion('nightly')).toBe('8.7');
|
|
||||||
expect(await utils.parseVersion('master')).toBe('8.7');
|
expect(await utils.parseVersion('master')).toBe('8.7');
|
||||||
expect(await utils.parseVersion('8.7')).toBe('8.7');
|
expect(await utils.parseVersion('8.7')).toBe('8.7');
|
||||||
expect(await utils.parseVersion('8.7.0')).toBe('8.7');
|
expect(await utils.parseVersion('8.7.0')).toBe('8.7');
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"lowest": "8.1",
|
"lowest": "8.1",
|
||||||
"highest": "8.6",
|
"highest": "8.5",
|
||||||
"latest": "8.6",
|
"latest": "8.5",
|
||||||
"nightly": "8.7",
|
"nightly": "8.6",
|
||||||
"master": "8.7",
|
"master": "8.7",
|
||||||
"5.x": "5.6",
|
"5.x": "5.6",
|
||||||
"7.x": "7.4",
|
"7.x": "7.4",
|
||||||
"8.x": "8.6"
|
"8.x": "8.5"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,111 @@
|
|||||||
|
{
|
||||||
|
"amqp": "php-amqp/php-amqp",
|
||||||
|
"apcu": "apcu/apcu",
|
||||||
|
"apfd": "m6w6/ext-apfd",
|
||||||
|
"arrow": "flow-php/arrow-ext",
|
||||||
|
"ast": "nikic/php-ast",
|
||||||
|
"biscuit_php": "ptondereau/biscuit-php",
|
||||||
|
"bitset": "pecl/bitset",
|
||||||
|
"brotli": "kjdev/brotli",
|
||||||
|
"bsdiff": "bsdiff/bsdiff",
|
||||||
|
"csv": "girgias/csv",
|
||||||
|
"dbus": "pecl/dbus",
|
||||||
|
"decimal": "php-decimal/ext-decimal",
|
||||||
|
"deepclone": "symfony/deepclone",
|
||||||
|
"dio": "pecl/dio",
|
||||||
|
"ds": "php-ds/ext-ds",
|
||||||
|
"ev": "osmanov/pecl-ev",
|
||||||
|
"event": "osmanov/pecl-event",
|
||||||
|
"excel": "iliaal/php-excel",
|
||||||
|
"excimer": "wikimedia/excimer",
|
||||||
|
"fast_uuid": "iliaal/fast_uuid",
|
||||||
|
"fastchart": "iliaal/fastchart",
|
||||||
|
"fastjson": "iliaal/fastjson",
|
||||||
|
"geospatial": "php-geospatial/geospatial",
|
||||||
|
"glfw": "mario-deluna/php-glfw",
|
||||||
|
"grpc": "grpc/grpc-php-ext",
|
||||||
|
"hdr_histogram": "beberlei/hdrhistogram",
|
||||||
|
"hdrhistogram": "beberlei/hdrhistogram",
|
||||||
|
"highlighter": "yiipress/highlighter",
|
||||||
|
"http": "m6w6/ext-http",
|
||||||
|
"igbinary": "igbinary/igbinary",
|
||||||
|
"imagick": "imagick/imagick",
|
||||||
|
"inotify": "arnaud-lb/inotify",
|
||||||
|
"ip2location": "ip2location/ip2location-pie",
|
||||||
|
"ip2proxy": "ip2location/ip2proxy-pie",
|
||||||
|
"json_post": "m6w6/ext-json_post",
|
||||||
|
"jsonpath": "supermetrics/jsonpath",
|
||||||
|
"judy": "orieg/judy",
|
||||||
|
"krb5": "pecl/krb5",
|
||||||
|
"lchash": "iliaal/lchash",
|
||||||
|
"luasandbox": "wikimedia/luasandbox",
|
||||||
|
"lz4": "kjdev/lz4",
|
||||||
|
"lzf": "pecl/lzf",
|
||||||
|
"mailparse": "pecl/mailparse",
|
||||||
|
"maxminddb": "maxmind-db/reader-ext",
|
||||||
|
"mcrypt": "pecl/mcrypt",
|
||||||
|
"mdparser": "iliaal/mdparser",
|
||||||
|
"memcached": "php-memcached/php-memcached",
|
||||||
|
"memprof": "arnaud-lb/memprof",
|
||||||
|
"mjml": "kcs/mjml",
|
||||||
|
"mongodb": "mongodb/mongodb-extension",
|
||||||
|
"msgpack": "msgpack/msgpack-php",
|
||||||
|
"mustache": "jbboehr/php-mustache",
|
||||||
|
"oci8": "oci8/oci8",
|
||||||
|
"openswoole": "openswoole/ext-openswoole",
|
||||||
|
"opentelemetry": "open-telemetry/ext-opentelemetry",
|
||||||
|
"operator": "jblo/operator",
|
||||||
|
"parallel": "pecl/parallel",
|
||||||
|
"pcov": "pecl/pcov",
|
||||||
|
"pdo_duckdb": "thomas-0816/pdo-duckdb-php",
|
||||||
|
"pdo_oci": "pecl/pdo_oci",
|
||||||
|
"pdo_sqlsrv": "microsoft/pdo_sqlsrv",
|
||||||
|
"pecl_http": "m6w6/ext-http",
|
||||||
|
"phalcon": "phalcon/cphalcon",
|
||||||
|
"phonetic": "iliaal/phonetic",
|
||||||
|
"phpser": "iliaal/phpser",
|
||||||
|
"phpstan_turbo": "phpstan/turbo",
|
||||||
|
"pkcs11": "gamringer/pkcs11",
|
||||||
|
"pq": "m6w6/ext-pq",
|
||||||
|
"quickhash": "derickr/quickhash",
|
||||||
|
"raphf": "m6w6/ext-raphf",
|
||||||
|
"rar": "cataphract/rar",
|
||||||
|
"rdkafka": "rdkafka/rdkafka",
|
||||||
|
"redis": "phpredis/phpredis",
|
||||||
|
"relay": "cachewerk/ext-relay",
|
||||||
|
"rpminfo": "remi/rpminfo",
|
||||||
|
"scrypt": "woohoolabs/php-scrypt",
|
||||||
|
"selinux": "pecl/selinux",
|
||||||
|
"snappy": "kjdev/snappy",
|
||||||
|
"solr": "pecl/solr",
|
||||||
|
"spx": "noisebynorthwest/php-spx",
|
||||||
|
"sqlsrv": "microsoft/sqlsrv",
|
||||||
|
"statgrab": "iliaal/statgrab",
|
||||||
|
"swoole": "swoole/swoole",
|
||||||
|
"swow": "swow/swow-extension",
|
||||||
|
"taint": "laruence/taint",
|
||||||
|
"tensor": "rubix/tensor_ext",
|
||||||
|
"timezonedb": "pecl/timezonedb",
|
||||||
|
"translit": "derickr/translit",
|
||||||
|
"uopz": "krakjoe/uopz",
|
||||||
|
"uuid": "pecl/uuid",
|
||||||
|
"uv": "amphp/uv",
|
||||||
|
"valkey_glide": "valkey-io/valkey-glide-php",
|
||||||
|
"vld": "derickr/vld",
|
||||||
|
"wikidiff2": "wikimedia/wikidiff2",
|
||||||
|
"win32service": "win32service/win32service",
|
||||||
|
"xattr": "pecl/xattr",
|
||||||
|
"xdebug": "xdebug/xdebug",
|
||||||
|
"xdiff": "pecl/xdiff",
|
||||||
|
"xlswriter": "viest/xlswriter",
|
||||||
|
"xmldiff": "pecl/xml-xmldiff",
|
||||||
|
"xpass": "remi/xpass",
|
||||||
|
"yac": "laruence/yac",
|
||||||
|
"yaconf": "laruence/yaconf",
|
||||||
|
"yaf": "laruence/yaf",
|
||||||
|
"yaml": "pecl/yaml",
|
||||||
|
"yar": "laruence/yar",
|
||||||
|
"yaz": "indexdata/yaz",
|
||||||
|
"zip": "pecl/zip",
|
||||||
|
"zstd": "kjdev/zstd"
|
||||||
|
}
|
||||||
@@ -333,7 +333,7 @@ setup_php() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
version=${1:-'8.6'}
|
version=${1:-'8.5'}
|
||||||
ini=${2:-'production'}
|
ini=${2:-'production'}
|
||||||
src=${0%/*}/..
|
src=${0%/*}/..
|
||||||
php_formula=shivammathur/php/php@"$version"
|
php_formula=shivammathur/php/php@"$version"
|
||||||
|
|||||||
@@ -85,6 +85,67 @@ Function Add-ExtensionFromGithub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to install a PIE package or mapped version. Windows uses prebuilt DLLs.
|
||||||
|
Function Add-PieExtension {
|
||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[string]
|
||||||
|
$extension,
|
||||||
|
[Parameter(Position = 1, Mandatory = $false)]
|
||||||
|
[string]
|
||||||
|
$package = '',
|
||||||
|
[Parameter(Position = 2, Mandatory = $false)]
|
||||||
|
[Alias('AllowSourceBuild')]
|
||||||
|
[bool]
|
||||||
|
$allow_source = $false
|
||||||
|
)
|
||||||
|
$requested = ($package -split ':', 2)[-1]
|
||||||
|
if ($package -notmatch '/') {
|
||||||
|
$mapping = Get-Content "$src\configs\pie-extensions.json" -Raw | ConvertFrom-Json
|
||||||
|
$package = $mapping.$extension
|
||||||
|
if (-not $package) { throw "No PIE package mapping for $extension" }
|
||||||
|
if ($requested -in @('', 'latest', 'stable')) { $requested = '' } else { $package += ":$requested" }
|
||||||
|
} elseif ($package -notmatch ':') {
|
||||||
|
$requested = ''
|
||||||
|
}
|
||||||
|
& "$php_dir\php.exe" -r 'exit(extension_loaded($argv[1]) && ($argv[2] === "" || phpversion($argv[1]) === $argv[2]) ? 0 : 1);' -- $extension "$requested" >$null 2>&1
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
Add-Log $tick $extension 'Enabled'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$pie_args = @('install', $package, '--no-interaction', '--skip-enable-extension', '--no-build-tools-check', '--no-system-dependencies-check', "--with-php-path=$php_dir\php.exe")
|
||||||
|
if (-not $allow_source) {
|
||||||
|
# Skip CPU detection when compilation is disabled.
|
||||||
|
$pie_args += @('--suppress-download-url-method=composer-default', '--suppress-download-url-method=pre-packaged-source', '--make-parallel-jobs=1')
|
||||||
|
}
|
||||||
|
New-Item -ItemType Directory -Path $composer_home -Force >$null
|
||||||
|
Set-ComposerAuth
|
||||||
|
$pie_log = Join-Path ([System.IO.Path]::GetTempPath()) "pie-$extension.log"
|
||||||
|
$pie_path = Join-Path $bin_dir 'pie'
|
||||||
|
if ([version]$installed.MajorMinorVersion -lt [version]'8.1') {
|
||||||
|
$pie_path = Join-Path $bin_dir 'pie-cli.exe'
|
||||||
|
if (-not (Test-Path $pie_path -PathType Leaf)) {
|
||||||
|
Get-File -Url https://github.com/php/pie/releases/latest/download/pie-Windows-X64.exe -OutFile $pie_path
|
||||||
|
}
|
||||||
|
& $pie_path @pie_args >$pie_log 2>&1
|
||||||
|
} else {
|
||||||
|
if (-not (Test-Path $pie_path -PathType Leaf)) {
|
||||||
|
Add-Tool https://github.com/php/pie/releases/latest/download/pie.phar pie '-V' >$null 2>&1
|
||||||
|
}
|
||||||
|
& "$php_dir\php.exe" $pie_path @pie_args >$pie_log 2>&1
|
||||||
|
}
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Get-Content $pie_log | ForEach-Object { Write-Host $_ }
|
||||||
|
throw "Could not install $package using PIE (exit code $LASTEXITCODE)"
|
||||||
|
}
|
||||||
|
Enable-ExtensionDependencies $extension
|
||||||
|
Enable-PhpExtension -Extension $extension -Path $php_dir
|
||||||
|
& "$php_dir\php.exe" -r 'exit(extension_loaded($argv[1]) ? 0 : 1);' -- $extension >$null 2>&1
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "Could not load $extension after installing $package using PIE" }
|
||||||
|
Add-Log $tick $extension 'Installed and enabled'
|
||||||
|
}
|
||||||
|
|
||||||
# Function to add PHP extensions.
|
# Function to add PHP extensions.
|
||||||
Function Add-Extension {
|
Function Add-Extension {
|
||||||
Param (
|
Param (
|
||||||
|
|||||||
@@ -188,6 +188,54 @@ get_pecl_version() {
|
|||||||
echo "$response" | grep -Eio "$pattern" | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
|
echo "$response" | grep -Eio "$pattern" | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Install a PIE package or mapped version: extension, package, allow_source=false, prefix.
|
||||||
|
pie_install() {
|
||||||
|
local extension=$1 package=${2:-} allow_source=${3:-false}
|
||||||
|
local prefix=${4:-$(get_extension_prefix "$extension")} requested pie_path php_config asset arch
|
||||||
|
requested=${package##*:}
|
||||||
|
if [[ "$package" != */* ]]; then
|
||||||
|
package=$(jq -er --arg extension "$extension" '.[$extension]' "${src:?}/configs/pie-extensions.json") || return 1
|
||||||
|
case "$requested" in ''|latest|stable) requested= ;; *) package="$package:$requested" ;; esac
|
||||||
|
elif [[ "$package" != *:* ]]; then
|
||||||
|
requested=
|
||||||
|
fi
|
||||||
|
if php -d display_errors=0 -r 'exit(extension_loaded($argv[1]) && ($argv[2] === "" || phpversion($argv[1]) === $argv[2]) ? 0 : 1);' -- "$extension" "$requested"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
local pie_args=(install "$package" --no-interaction --skip-enable-extension --no-build-tools-check --no-system-dependencies-check)
|
||||||
|
php_config=$(command -v php-config) || return 1
|
||||||
|
pie_args+=("--with-php-config=$php_config")
|
||||||
|
if [ "$allow_source" != true ]; then
|
||||||
|
# Skip CPU detection when compilation is disabled.
|
||||||
|
pie_args+=(--suppress-download-url-method=composer-default --suppress-download-url-method=pre-packaged-source --make-parallel-jobs=1)
|
||||||
|
fi
|
||||||
|
if php -r 'exit(PHP_VERSION_ID >= 80100 ? 0 : 1);'; then
|
||||||
|
if ! command -v pie >/dev/null 2>&1; then
|
||||||
|
add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie '-V' >/dev/null 2>&1 || return 1
|
||||||
|
fi
|
||||||
|
pie_path=$(command -v pie) || return 1
|
||||||
|
else
|
||||||
|
arch=$(uname -m)
|
||||||
|
case "$arch" in x86_64|amd64) arch=X64 ;; arm64|aarch64) arch=ARM64 ;; *) return 1 ;; esac
|
||||||
|
asset="pie-$(uname -s)-$arch"
|
||||||
|
[ "$(uname -s)" != Darwin ] || asset="pie-macOS-$arch"
|
||||||
|
pie_path="${tool_path_dir:?}/pie-cli"
|
||||||
|
if [ ! -x "$pie_path" ]; then
|
||||||
|
[ "$(get -v -e "$pie_path" "https://github.com/php/pie/releases/latest/download/$asset")" = 200 ] || return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
mkdir -p "${composer_home:?}"
|
||||||
|
set_composer_auth
|
||||||
|
sudo -E "$pie_path" "${pie_args[@]}" >"/tmp/pie-$extension.log" 2>&1 || {
|
||||||
|
local status=$?
|
||||||
|
cat "/tmp/pie-$extension.log" >&2
|
||||||
|
return "$status"
|
||||||
|
}
|
||||||
|
sudo rm -f /tmp/php"${version:?}"_extensions
|
||||||
|
enable_extension "$extension" "$prefix" || return 1
|
||||||
|
check_extension "$extension"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to install PECL extensions and accept default options
|
# Function to install PECL extensions and accept default options
|
||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
|
|||||||
+18
-8
@@ -6,15 +6,20 @@ add_sudo() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to select the package installer.
|
# Function to link apt-fast to apt-get
|
||||||
set_apt_install() {
|
link_apt_fast() {
|
||||||
local apt=apt-get
|
if ! command -v apt-fast >/dev/null; then
|
||||||
command -v apt-fast >/dev/null && apt=apt-fast
|
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
||||||
apt_install="sudo $debconf_fix $apt install -y --no-install-recommends -o Dpkg::Options::=--force-confnew"
|
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup environment for self-hosted runners.
|
# Function to setup environment for self-hosted runners.
|
||||||
self_hosted_helper() {
|
self_hosted_helper() {
|
||||||
|
if ! command -v apt-fast >/dev/null; then
|
||||||
|
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
||||||
|
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
||||||
|
fi
|
||||||
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
|
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
|
||||||
local packages=()
|
local packages=()
|
||||||
mapfile -t packages < <(filter_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg)
|
mapfile -t packages < <(filter_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg)
|
||||||
@@ -25,12 +30,16 @@ self_hosted_helper() {
|
|||||||
|
|
||||||
# Function to fix broken packages.
|
# Function to fix broken packages.
|
||||||
fix_broken_packages() {
|
fix_broken_packages() {
|
||||||
sudo apt --fix-broken install -o Dpkg::Options::=--force-confnew >/dev/null 2>&1
|
sudo apt --fix-broken install >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install a package
|
# Function to install a package
|
||||||
install_packages() {
|
install_packages() {
|
||||||
packages=("$@")
|
packages=("$@")
|
||||||
|
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
|
||||||
|
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew >/dev/null 2>&1
|
||||||
|
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
|
||||||
|
fi
|
||||||
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
|
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,14 +353,15 @@ setup_php() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
version=${1:-'8.6'}
|
version=${1:-'8.5'}
|
||||||
ini=${2:-'production'}
|
ini=${2:-'production'}
|
||||||
src=${0%/*}/..
|
src=${0%/*}/..
|
||||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||||
|
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
|
||||||
scripts="$src"/scripts
|
scripts="$src"/scripts
|
||||||
|
|
||||||
add_sudo >/dev/null 2>&1
|
add_sudo >/dev/null 2>&1
|
||||||
set_apt_install >/dev/null 2>&1
|
link_apt_fast >/dev/null 2>&1
|
||||||
|
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
# shellcheck source=.
|
# shellcheck source=.
|
||||||
|
|||||||
@@ -279,12 +279,8 @@ add_tool() {
|
|||||||
sudo cp -a "$tool_path" "$cache_path"
|
sudo cp -a "$tool_path" "$cache_path"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$status_code" != "200" ]; then
|
if [ "$status_code" != "200" ] && [ -f "$tool_path.bak" ]; then
|
||||||
if [ -f "$tool_path.bak" ]; then
|
|
||||||
sudo mv "$tool_path.bak" "$tool_path"
|
sudo mv "$tool_path.bak" "$tool_path"
|
||||||
else
|
|
||||||
sudo rm -f "$tool_path"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
sudo rm -f "$tool_path.bak"
|
sudo rm -f "$tool_path.bak"
|
||||||
fi
|
fi
|
||||||
|
|||||||
+5
-5
@@ -5,7 +5,7 @@ export curl_opts=(-sL)
|
|||||||
export old_versions="5.[3-5]"
|
export old_versions="5.[3-5]"
|
||||||
export jit_versions="8.[0-9]"
|
export jit_versions="8.[0-9]"
|
||||||
export php_builder_versions="8.[3-9]"
|
export php_builder_versions="8.[3-9]"
|
||||||
export nightly_versions="8.[7-9]"
|
export nightly_versions="8.[6-9]"
|
||||||
export xdebug3_versions="7.[2-4]|8.[0-9]"
|
export xdebug3_versions="7.[2-4]|8.[0-9]"
|
||||||
export latest="releases/latest/download"
|
export latest="releases/latest/download"
|
||||||
export github="https://github.com/shivammathur"
|
export github="https://github.com/shivammathur"
|
||||||
@@ -65,10 +65,10 @@ check_builds_cache_runner() {
|
|||||||
local pid=$PPID executable
|
local pid=$PPID executable
|
||||||
while [[ "$pid" =~ ^[0-9]+$ && "$pid" -gt 1 ]]; do
|
while [[ "$pid" =~ ^[0-9]+$ && "$pid" -gt 1 ]]; do
|
||||||
executable="$(readlink -f "/proc/$pid/exe")" || return 1
|
executable="$(readlink -f "/proc/$pid/exe")" || return 1
|
||||||
if [[ "$executable" = */bin/Runner.Worker || "$executable" = */bin/Runner.Worker.exe ]]; then
|
if [[ "$executable" = */bin/Runner.Worker ]]; then
|
||||||
jq -e --arg name "${RUNNER_NAME:-}" \
|
jq -e --arg name "${RUNNER_NAME:-}" \
|
||||||
'(.AgentName // .agentName) | . == $name and test("^(blacksmith|depot|nsc-runner)-")' \
|
'.AgentName == $name and (.AgentName | test("^(blacksmith|depot)-"))' \
|
||||||
"${executable%/bin/*}/.runner" >/dev/null 2>&1
|
"${executable%/bin/Runner.Worker}/.runner" >/dev/null 2>&1
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
pid="$(awk '$1 == "PPid:" {print $2}' "/proc/$pid/status")" || return 1
|
pid="$(awk '$1 == "PPid:" {print $2}' "/proc/$pid/status")" || return 1
|
||||||
@@ -93,7 +93,7 @@ read_env() {
|
|||||||
if [[ $_runner = "self-hosted" && "${use_builds_cache:-false}" = "true" ]]; then
|
if [[ $_runner = "self-hosted" && "${use_builds_cache:-false}" = "true" ]]; then
|
||||||
runner=github
|
runner=github
|
||||||
if [[ "${ID:-}" = "ubuntu" && -z "$ACT" && -z "$CONTAINER" &&
|
if [[ "${ID:-}" = "ubuntu" && -z "$ACT" && -z "$CONTAINER" &&
|
||||||
( -n "${BLACKSMITH_VM_ID:-}" || "${RUNNER_NAME:-}" =~ ^(blacksmith|depot|nsc-runner)- ) ]] && check_builds_cache_runner; then
|
( -n "${BLACKSMITH_VM_ID:-}" || "${RUNNER_NAME:-}" =~ ^(blacksmith|depot)- ) ]] && check_builds_cache_runner; then
|
||||||
_runner=github
|
_runner=github
|
||||||
builds_cache_warning=true
|
builds_cache_warning=true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ param (
|
|||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
[ValidateLength(1, [int]::MaxValue)]
|
||||||
[string]
|
[string]
|
||||||
$version = '8.6',
|
$version = '8.4',
|
||||||
[Parameter(Position = 1, Mandatory = $true)]
|
[Parameter(Position = 1, Mandatory = $true)]
|
||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
[ValidateLength(1, [int]::MaxValue)]
|
||||||
@@ -343,7 +343,7 @@ $php_manifest = $null
|
|||||||
$current_profile = "$env:TEMP\setup-php.ps1"
|
$current_profile = "$env:TEMP\setup-php.ps1"
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
$jit_versions = '8.[0-9]'
|
$jit_versions = '8.[0-9]'
|
||||||
$nightly_versions = '8.[7-9]'
|
$nightly_versions = '8.[6-9]'
|
||||||
$xdebug3_versions = "7.[2-4]|8.[0-9]"
|
$xdebug3_versions = "7.[2-4]|8.[0-9]"
|
||||||
$enable_extensions = ('openssl', 'curl', 'mbstring')
|
$enable_extensions = ('openssl', 'curl', 'mbstring')
|
||||||
|
|
||||||
@@ -439,7 +439,7 @@ if($version -eq 'pre') {
|
|||||||
}
|
}
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
||||||
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
||||||
Install-PSPackage VcRedist VcRedist-4.1.527\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/v4.1.527.zip" Get-VcList >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ($version -match $nightly_versions) {
|
if ($version -match $nightly_versions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user