mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-11-26 09:06:44 +07:00
Compare commits
145 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f024c2c609 | |||
| 9b213db010 | |||
| a909b43232 | |||
| be556f8879 | |||
| 91d37511e3 | |||
| 3961404d06 | |||
| 43e4e008cc | |||
| b010fa7c8f | |||
| cc78f4c7f9 | |||
| 7662a9b5f4 | |||
| 865d4645a1 | |||
| 248e3ca37a | |||
| 2c40db3599 | |||
| 4eb1b49da1 | |||
| 5eda055652 | |||
| 04e773ea40 | |||
| 53bf167847 | |||
| 355aade280 | |||
| 74d4e20179 | |||
| ae0a50642d | |||
| 5187d97121 | |||
| eddb855af9 | |||
| eec99716ef | |||
| 788275d42c | |||
| be38e7a127 | |||
| 47ac2e221b | |||
| 36338985e2 | |||
| 185b391822 | |||
| f210bb3904 | |||
| 6f153798c8 | |||
| f7b7badb27 | |||
| 8473b2327f | |||
| 3efd894d72 | |||
| 1e8cc75dad | |||
| 2e18086d64 | |||
| 9cf252c302 | |||
| aa0de4323f | |||
| 00242b5fc2 | |||
| 319ac00da8 | |||
| 38e8065d61 | |||
| 91a018aa46 | |||
| bdaf698d5d | |||
| ab68d9f583 | |||
| d65cf8f3f2 | |||
| 6beaa7dc34 | |||
| 79ab6fe269 | |||
| 4cbbb6d82c | |||
| 4cba65b8c5 | |||
| 7fea117d1c | |||
| bf6b4fbd49 | |||
| 8f8196743c | |||
| 06512d94ed | |||
| 1c302aed34 | |||
| dcffe28928 | |||
| 6ffdb3d118 | |||
| c97dacbacf | |||
| 34f574e7aa | |||
| 317a051dea | |||
| dfcda83968 | |||
| 96d7cf331d | |||
| baed2d33b8 | |||
| 1398cb4c9f | |||
| 462e7103e4 | |||
| 8582cb12d5 | |||
| ec406be512 | |||
| 36a27b0262 | |||
| ea2f858afe | |||
| 507ff06e8d | |||
| 629475b7b3 | |||
| 521f2e5b93 | |||
| 259d177178 | |||
| 20529878ed | |||
| 68634e7bca | |||
| 0ac4874a14 | |||
| c9735bcc02 | |||
| 89b2566bb0 | |||
| dcec1cf0b4 | |||
| ccf2c627fe | |||
| 2a597f617d | |||
| 2282b6a082 | |||
| 11373c6dce | |||
| 50ad25710d | |||
| c1c6c51867 | |||
| 34a5396826 | |||
| a0d5abedf1 | |||
| 102ffdc294 | |||
| 97cf0581e3 | |||
| bac87fed32 | |||
| b9341130b4 | |||
| e1dc734412 | |||
| 20169f80b7 | |||
| ec1e2c6601 | |||
| 5581e61575 | |||
| de4f59c442 | |||
| 26dc9b4fed | |||
| 8d11cf02d2 | |||
| 8aee7c58b7 | |||
| 725b40730f | |||
| b8f4bf011c | |||
| f9fbb516a6 | |||
| 987ba5bfe9 | |||
| 9dffd40113 | |||
| 2dfe351907 | |||
| 1897d72bb4 | |||
| 879090af77 | |||
| a3845d84ae | |||
| 24d382d1f8 | |||
| 7a5da9d8dc | |||
| 011ab6e363 | |||
| 545bc26d45 | |||
| 55463ffe4f | |||
| 2a3befd7ab | |||
| 7cc4441283 | |||
| 4a4c5a48bb | |||
| 3514a658eb | |||
| 7aefaa0b54 | |||
| 048eb79ef3 | |||
| 29247235f0 | |||
| e84efebd6e | |||
| 0f7f1d08e3 | |||
| 433bdeeaf0 | |||
| 1c5378302c | |||
| c251c791ff | |||
| 36fada6981 | |||
| 27853eb8b4 | |||
| 18b776ee45 | |||
| 2ec652d38d | |||
| 8d8f975af3 | |||
| 12b910a04d | |||
| 962fc445e2 | |||
| 6ba658ae8d | |||
| c954e9c756 | |||
| b595b415e2 | |||
| 9c22be2b20 | |||
| ac0e29410e | |||
| 2cae8ac286 | |||
| df8d123345 | |||
| d371420c90 | |||
| 287979ae16 | |||
| dd942787eb | |||
| d000f49d9a | |||
| dc7e73e115 | |||
| 755f6046e1 | |||
| ec0360b904 | |||
| 373563aabe |
11
.github/SECURITY.md
vendored
11
.github/SECURITY.md
vendored
@ -2,23 +2,20 @@
|
|||||||
|
|
||||||
## Supported Versions
|
## Supported Versions
|
||||||
|
|
||||||
The latest patch versions of `v1` and `v2` releases of this project are supported for security updates.
|
The latest patch version of `v2` release of this project is supported for security updates.
|
||||||
|
|
||||||
## Supported PHP Versions
|
## Supported PHP Versions
|
||||||
|
|
||||||
This security policy only applies to the latest patches of the following PHP versions.
|
This security policy only applies to the latest patch releases of the following PHP versions.
|
||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
|---------|--------------------|
|
|---------|--------------------|
|
||||||
| 8.1 | :white_check_mark: |
|
| 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: |
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
If you have found any issues that might have security implications in the versions supported, please send a report privately to [contact@shivammathur.com](mailto:contact@shivammathur.com).
|
If you have found any issues that might have security implications in the versions supported, please send a report privately to [contact@setup-php.com](mailto:contact@setup-php.com).
|
||||||
Do not report security reports publicly.
|
Do not report security reports publicly.
|
||||||
|
|
||||||
## Tidelift
|
|
||||||
|
|
||||||
If you use this GitHub Action through a Tidelift subscription, please refer to [https://tidelift.com/security](https://tidelift.com/security).
|
|
||||||
9
.github/workflows/codeql.yml
vendored
9
.github/workflows/codeql.yml
vendored
@ -8,6 +8,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
codeql:
|
codeql:
|
||||||
|
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
|
||||||
contents: read # for actions/checkout to fetch code
|
contents: read # for actions/checkout to fetch code
|
||||||
@ -15,18 +16,18 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v3
|
uses: github/codeql-action/init@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@v3
|
uses: github/codeql-action/autobuild@v4
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v3
|
uses: github/codeql-action/analyze@v4
|
||||||
|
|||||||
18
.github/workflows/docs.yml
vendored
18
.github/workflows/docs.yml
vendored
@ -8,6 +8,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create:
|
create:
|
||||||
|
if: github.event.repository.fork == false
|
||||||
permissions:
|
permissions:
|
||||||
contents: none
|
contents: none
|
||||||
name: Create
|
name: Create
|
||||||
@ -15,8 +16,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-13]
|
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-15-intel]
|
||||||
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
|
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@v2
|
||||||
@ -87,11 +88,12 @@ 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@v4
|
uses: actions/upload-artifact@v5
|
||||||
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
|
||||||
update:
|
update:
|
||||||
|
if: github.event.repository.fork == false
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # for Git to git push
|
contents: write # for Git to git push
|
||||||
name: Update
|
name: Update
|
||||||
@ -99,11 +101,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
repository: ${{ github.repository }}.wiki
|
repository: ${{ github.repository }}.wiki
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v6
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/lists
|
path: ${{ github.workspace }}/lists
|
||||||
pattern: lists-*
|
pattern: lists-*
|
||||||
@ -114,11 +116,11 @@ jobs:
|
|||||||
git config --local user.name "${{ github.repository_owner }}"
|
git config --local user.name "${{ github.repository_owner }}"
|
||||||
- name: Combine
|
- name: Combine
|
||||||
run: |
|
run: |
|
||||||
for os in ubuntu-24.04 ubuntu-22.04 windows-2022 windows-2019 macos-13 macos-14 macos-15; do
|
for os in ubuntu-24.04 ubuntu-22.04 windows-2025 windows-2022 windows-2019 macos-13 macos-14 macos-15 macos-26; do
|
||||||
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
|
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
|
||||||
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5; do
|
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5 8.6; do
|
||||||
if [[ "${os%-*}" = "macos" ]]; then
|
if [[ "${os%-*}" = "macos" ]]; then
|
||||||
cat lists/php"$version"-macos-13.md >> Php-extensions-loaded-on-"$os".md
|
cat lists/php"$version"-macos-15-intel.md >> Php-extensions-loaded-on-"$os".md
|
||||||
elif [ "${os%-*}" = "windows" ]; then
|
elif [ "${os%-*}" = "windows" ]; then
|
||||||
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
|
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
|
||||||
else
|
else
|
||||||
|
|||||||
8
.github/workflows/node.yml
vendored
8
.github/workflows/node.yml
vendored
@ -2,7 +2,7 @@ name: Node workflow
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -10,7 +10,7 @@ on:
|
|||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -29,12 +29,12 @@ 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@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Setup Node.js 20.x
|
- name: Setup Node.js 20.x
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
|
|
||||||
|
|||||||
10
.github/workflows/php.yml
vendored
10
.github/workflows/php.yml
vendored
@ -3,7 +3,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -11,7 +11,7 @@ on:
|
|||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -28,8 +28,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-13]
|
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-15-intel]
|
||||||
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
|
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']
|
||||||
include:
|
include:
|
||||||
- operating-system: ubuntu-24.04
|
- operating-system: ubuntu-24.04
|
||||||
php-versions: ''
|
php-versions: ''
|
||||||
@ -39,7 +39,7 @@ jobs:
|
|||||||
key: cache-v5
|
key: cache-v5
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Setup cache environment
|
- name: Setup cache environment
|
||||||
id: cache-env
|
id: cache-env
|
||||||
|
|||||||
8
.github/workflows/publish.yml
vendored
8
.github/workflows/publish.yml
vendored
@ -19,16 +19,16 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout release
|
- name: Checkout release
|
||||||
if: github.event_name != 'workflow_dispatch'
|
if: github.event_name != 'workflow_dispatch'
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Checkout tag
|
- name: Checkout tag
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
if: github.event_name == 'workflow_dispatch'
|
if: github.event_name == 'workflow_dispatch'
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.inputs.tag }}
|
ref: ${{ github.event.inputs.tag }}
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '20.x'
|
node-version: '20.x'
|
||||||
registry-url: https://registry.npmjs.org
|
registry-url: https://registry.npmjs.org
|
||||||
@ -46,7 +46,7 @@ jobs:
|
|||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
- name: Change to GitHub Packages registry
|
- name: Change to GitHub Packages registry
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
registry-url: https://npm.pkg.github.com
|
registry-url: https://npm.pkg.github.com
|
||||||
scope: '@shivammathur'
|
scope: '@shivammathur'
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@ node_modules/
|
|||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
lib/
|
lib/
|
||||||
|
|
||||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/main/Node.gitignore
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
|
|||||||
136
README.md
136
README.md
@ -10,7 +10,7 @@
|
|||||||
<a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
|
<a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
|
||||||
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://img.shields.io/codecov/c/github/shivammathur/setup-php?logo=codecov"></a>
|
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://img.shields.io/codecov/c/github/shivammathur/setup-php?logo=codecov"></a>
|
||||||
<a href="https://github.com/shivammathur/setup-php/blob/main/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
|
<a href="https://github.com/shivammathur/setup-php/blob/main/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
|
||||||
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.5-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
|
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.6-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit&logoColor=FF5700&labelColor=555555"></a>
|
<a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit&logoColor=FF5700&labelColor=555555"></a>
|
||||||
@ -69,7 +69,7 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
|
|||||||
### GitHub-Hosted Runners
|
### GitHub-Hosted Runners
|
||||||
|
|
||||||
| Virtual environment | Arch | YAML workflow label | Pre-installed PHP |
|
| Virtual environment | Arch | YAML workflow label | Pre-installed PHP |
|
||||||
|---------------------|---------|------------------------------------|------------------------|
|
|---------------------|---------|------------------------------------|-------------------|
|
||||||
| 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 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` |
|
| Ubuntu 24.04 | aarch64 | `ubuntu-24.04-arm` | `PHP 8.3` |
|
||||||
@ -77,8 +77,10 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
|
|||||||
| Windows Server 2025 | x64 | `windows-2025` | `PHP 8.3` |
|
| Windows Server 2025 | x64 | `windows-2025` | `PHP 8.3` |
|
||||||
| Windows Server 2022 | x64 | `windows-latest` or `windows-2022` | `PHP 8.3` |
|
| Windows Server 2022 | x64 | `windows-latest` or `windows-2022` | `PHP 8.3` |
|
||||||
| Windows Server 2019 | x64 | `windows-2019` | `PHP 8.3` |
|
| Windows Server 2019 | x64 | `windows-2019` | `PHP 8.3` |
|
||||||
| macOS Sequoia 15.x | arm64 | `macos-15` | - |
|
| macOS Tahoe 26.x | arm64 | `macos-26` | - |
|
||||||
| macOS Sonoma 14.x | arm64 | `macos-latest` or `macos-14` | - |
|
| macOS Sequoia 15.x | arm64 | `macos-latest` or `macos-15` | - |
|
||||||
|
| macOS Sonoma 14.x | arm64 | `macos-14` | - |
|
||||||
|
| macOS Sequoia 15.x | x86_64 | `macos-15-intel` | `PHP 8.3` |
|
||||||
| macOS Ventura 13.x | x86_64 | `macos-13` | `PHP 8.3` |
|
| macOS Ventura 13.x | x86_64 | `macos-13` | `PHP 8.3` |
|
||||||
|
|
||||||
### Self-Hosted Runners
|
### Self-Hosted Runners
|
||||||
@ -91,6 +93,7 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
|
|||||||
| Debian 11 | `self-hosted` or `Linux` |
|
| Debian 11 | `self-hosted` or `Linux` |
|
||||||
| Windows 7 and newer | `self-hosted` or `Windows` |
|
| Windows 7 and newer | `self-hosted` or `Windows` |
|
||||||
| Windows Server 2012 R2 and newer | `self-hosted` or `Windows` |
|
| Windows Server 2012 R2 and newer | `self-hosted` or `Windows` |
|
||||||
|
| macOS Tahoe 26.x x86_64/arm64 | `self-hosted` or `macOS` |
|
||||||
| macOS Sequoia 15.x x86_64/arm64 | `self-hosted` or `macOS` |
|
| macOS Sequoia 15.x x86_64/arm64 | `self-hosted` or `macOS` |
|
||||||
| macOS Sonoma 14.x x86_64/arm64 | `self-hosted` or `macOS` |
|
| macOS Sonoma 14.x x86_64/arm64 | `self-hosted` or `macOS` |
|
||||||
| macOS Ventura 13.x x86_64/arm64 | `self-hosted` or `macOS` |
|
| macOS Ventura 13.x x86_64/arm64 | `self-hosted` or `macOS` |
|
||||||
@ -101,11 +104,11 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
|
|||||||
|
|
||||||
## :tada: PHP Support
|
## :tada: PHP Support
|
||||||
|
|
||||||
On all supported OS/Platforms the following PHP versions can be set up as per the runner.
|
On all supported OS/Platforms, the following PHP versions can be set up as per the runner.
|
||||||
|
|
||||||
- PHP 5.3 to PHP 8.5 on GitHub-hosted runners, except for macOS ARM64 runners (macos-14).
|
- PHP 5.3 to PHP 8.6 on GitHub-hosted runners, except for macOS ARM64 runners (macos-14).
|
||||||
- PHP 5.6 to PHP 8.5 on GitHub-hosted macOS ARM64 runners (macos-14).
|
- PHP 5.6 to PHP 8.6 on GitHub-hosted macOS ARM64 runners (macos-14).
|
||||||
- PHP 5.6 to PHP 8.5 on self-hosted runners.
|
- PHP 5.6 to PHP 8.6 on self-hosted runners.
|
||||||
|
|
||||||
| PHP Version | Stability | Release Support | Runner Support |
|
| PHP Version | Stability | Release Support | Runner Support |
|
||||||
|-------------|-----------|-----------------------|--------------------------------|
|
|-------------|-----------|-----------------------|--------------------------------|
|
||||||
@ -123,11 +126,12 @@ On all supported OS/Platforms the following PHP versions can be set up as per th
|
|||||||
| `8.2` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
|
| `8.2` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
| `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
| `8.4` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||||
| `8.5` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
| `8.5` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
|
||||||
|
| `8.6` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
|
||||||
|
|
||||||
|
|
||||||
> [!Note]
|
> [!Note]
|
||||||
> - Specifying `8.5` in `php-version` input installs a nightly build of `PHP 8.5.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
|
> - Specifying `8.6` in `php-version` input installs a nightly build of `PHP 8.6.0-dev` from the master branch of PHP. 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
|
||||||
@ -211,7 +215,7 @@ This disables all core and third-party shared extensions and thus, can break som
|
|||||||
- These extensions have custom support:
|
- These extensions have custom support:
|
||||||
- `cubrid` and `pdo_cubrid` on `Ubuntu`.
|
- `cubrid` and `pdo_cubrid` on `Ubuntu`.
|
||||||
- `event`, `gearman`, `geos` and `relay` on `Ubuntu` and `macOS`.
|
- `event`, `gearman`, `geos` and `relay` on `Ubuntu` and `macOS`.
|
||||||
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_firebird`, `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`.
|
||||||
|
|
||||||
@ -229,7 +233,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.
|
||||||
|
|
||||||
[`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
|
[`backward-compatibility-check`], [`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`mago`], [`name-collision-detector`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with tools
|
- name: Setup PHP with tools
|
||||||
@ -258,19 +262,6 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
|||||||
|
|
||||||
When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
|
When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
|
||||||
|
|
||||||
With the exception of major versions of `composer`, if you specify only the `major` version or the version in `major.minor` format for a tool you can get rate limited by GitHub's API. To avoid this, it is recommended to provide a [`GitHub` OAuth token](https://github.com/shivammathur/setup-php#composer-github-oauth "Composer GitHub OAuth").
|
|
||||||
You can do that by setting `GITHUB_TOKEN` environment variable. The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Setup PHP with tools
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '8.4'
|
|
||||||
tools: php-cs-fixer:3.64, phpunit:11.4
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
|
||||||
|
|
||||||
- The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format. Additionally, for composer `snapshot` and `preview` can also be specified to set up the respective releases.
|
- The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format. Additionally, for composer `snapshot` and `preview` can also be specified to set up the respective releases.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -278,7 +269,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.4'
|
php-version: '8.4'
|
||||||
tools: composer:v2
|
tools: composer:v1
|
||||||
```
|
```
|
||||||
|
|
||||||
- If you do not use composer in your workflow, you can specify `tools: none` to skip it.
|
- If you do not use composer in your workflow, you can specify `tools: none` to skip it.
|
||||||
@ -309,6 +300,17 @@ 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.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PHP with fail-fast
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.4'
|
||||||
|
env:
|
||||||
|
COMPOSER_ALLOW_PLUGINS: composer/installers, composer/satis
|
||||||
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> - Input `tools` is useful to set up tools which are only used in CI workflows, thus keeping your `composer.json` tidy.
|
> - Input `tools` is useful to set up tools which are only used in CI workflows, thus keeping your `composer.json` tidy.
|
||||||
> - If you do not want to use all your dev-dependencies in workflow, you can run composer with `--no-dev` and install required tools using `tools` input to speed up your workflow.
|
> - If you do not want to use all your dev-dependencies in workflow, you can run composer with `--no-dev` and install required tools using `tools` input to speed up your workflow.
|
||||||
@ -419,7 +421,7 @@ Disable coverage for these reasons:
|
|||||||
- The `php-version-file` input if it exists
|
- The `php-version-file` input if it exists
|
||||||
- A `composer.lock` file and the `platform-overrides.php` value
|
- A `composer.lock` file and the `platform-overrides.php` value
|
||||||
- A `composer.json` file and the `config.platform.php` value
|
- A `composer.json` file and the `config.platform.php` value
|
||||||
- If the `composer.lock` or `composer.json` file is in a sub-directory in your repository, please specify the subdirectory path in `COMPOSER_PROJECT_DIR` env.
|
- If the `composer.lock` or `composer.json` file is in a subdirectory in your repository, please specify the subdirectory path in `COMPOSER_PROJECT_DIR` env.
|
||||||
|
|
||||||
#### `php-version-file` (optional)
|
#### `php-version-file` (optional)
|
||||||
|
|
||||||
@ -427,7 +429,7 @@ Disable coverage for these reasons:
|
|||||||
- Accepts a `string`. For example `'.phpenv-version'`.
|
- Accepts a `string`. For example `'.phpenv-version'`.
|
||||||
- See [PHP support](#tada-php-support) for the supported PHP versions.
|
- See [PHP support](#tada-php-support) for the supported PHP versions.
|
||||||
- By default, `.php-version` file is used.
|
- By default, `.php-version` file is used.
|
||||||
- The file either have the PHP version as its content, or follow the asdf `.tool-versions` format.
|
- The file needs to either have the PHP version as its content or follows the asdf `.tool-versions` format.
|
||||||
- If not specified and the default `.php-version` file is not found, the latest stable PHP version is set up.
|
- If not specified and the default `.php-version` file is not found, the latest stable PHP version is set up.
|
||||||
|
|
||||||
#### `extensions` (optional)
|
#### `extensions` (optional)
|
||||||
@ -462,6 +464,13 @@ Disable coverage for these reasons:
|
|||||||
- Accepts a `string` in csv-format. For example: `phpunit, phpcs`
|
- Accepts a `string` in csv-format. For example: `phpunit, phpcs`
|
||||||
- See [tools support](#wrench-tools-support) for tools supported.
|
- See [tools support](#wrench-tools-support) for tools supported.
|
||||||
|
|
||||||
|
#### `github-token` (optional)
|
||||||
|
|
||||||
|
- Specify the GitHub token to use for authentication.
|
||||||
|
- Accepts a `string`.
|
||||||
|
- By default, `GITHUB_TOKEN` secret provided by GitHub Actions is used.
|
||||||
|
- For GitHub Enterprise users, it is recommended to use a Personal Access Token (PAT).
|
||||||
|
|
||||||
### Outputs
|
### Outputs
|
||||||
|
|
||||||
#### `php-version`
|
#### `php-version`
|
||||||
@ -550,23 +559,21 @@ jobs:
|
|||||||
ini-values: post_max_size=256M, max_execution_time=180
|
ini-values: post_max_size=256M, max_execution_time=180
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
|
tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Nightly Build Setup
|
### Nightly Build Setup
|
||||||
|
|
||||||
> Set up a nightly build of `PHP 8.5`.
|
> Set up a nightly build of `PHP 8.6`.
|
||||||
|
|
||||||
- These PHP versions are currently in active development and might contain bugs and breaking changes.
|
- These PHP versions are currently in active development and might contain bugs and breaking changes.
|
||||||
- Some user space extensions might not support this version currently.
|
- Some user space extensions might not support these versions currently.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- name: Setup nightly PHP
|
- name: Setup nightly PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.5'
|
php-version: '8.6'
|
||||||
extensions: mbstring
|
extensions: mbstring
|
||||||
ini-values: post_max_size=256M, max_execution_time=180
|
ini-values: post_max_size=256M, max_execution_time=180
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
@ -739,7 +746,7 @@ act -P ubuntu-22.04=shivammathur/node:2204
|
|||||||
|
|
||||||
- To enable JIT, enable `opcache` in cli mode by setting `opcache.enable_cli=1`.
|
- To enable JIT, enable `opcache` in cli mode by setting `opcache.enable_cli=1`.
|
||||||
- JIT conflicts with `Xdebug`, `PCOV`, and other extensions which override `zend_execute_ex` function, so set `coverage: none` and disable any such extension if added.
|
- JIT conflicts with `Xdebug`, `PCOV`, and other extensions which override `zend_execute_ex` function, so set `coverage: none` and disable any such extension if added.
|
||||||
- By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` are set which can be changed using `ini-values` input.
|
- By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` (`opcache.jit_buffer_size=128M` on ARM-based environments) are set which can be changed using `ini-values` input.
|
||||||
- For detailed information about JIT related directives refer to the [`official PHP documentation`](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit "opcache.jit documentation").
|
- For 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`.
|
||||||
@ -793,19 +800,20 @@ restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-
|
|||||||
|
|
||||||
### GitHub Composer Authentication
|
### GitHub Composer Authentication
|
||||||
|
|
||||||
If you have a number of workflows which set up multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. Also, if you specify only the major version or the version in `major.minor` format, you can hit the rate limit. To avoid this you can specify an `OAuth` token by setting `GITHUB_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
|
By default, setup-php uses the `GITHUB_TOKEN` secret that is generated for each workflow run. In case you want to use a Personal Access Token (PAT) instead, you can set the `github-token` input.
|
||||||
|
|
||||||
The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.4'
|
php-version: '8.4'
|
||||||
env:
|
github-token: ${{ secrets.YOUR_PAT_TOKEN }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `COMPOSER_TOKEN` and `GITHUB_TOKEN` environment variables have been deprecated in favor of the `github-token` input and will be removed in the next major version.
|
||||||
|
|
||||||
|
For GitHub Enterprise users, the `github-token` input does not default to the `GITHUB_TOKEN` secret. Therefore, it's recommended to set the `github-token` input to a Personal Access Token (PAT).
|
||||||
|
|
||||||
### Private Packagist Authentication
|
### Private Packagist Authentication
|
||||||
|
|
||||||
If you use Private Packagist for your private composer dependencies, you can set the `PACKAGIST_TOKEN` environment variable to authenticate.
|
If you use Private Packagist for your private composer dependencies, you can set the `PACKAGIST_TOKEN` environment variable to authenticate.
|
||||||
@ -994,32 +1002,46 @@ Examples of using `setup-php` with various PHP frameworks and packages.
|
|||||||
|
|
||||||
## :sparkling_heart: Support This Project
|
## :sparkling_heart: Support This Project
|
||||||
|
|
||||||
- Please star the project and share it. If you blog, please share your experience of using `setup-php`.
|
|
||||||
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
|
|
||||||
|
|
||||||
Many users and organisations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
|
|
||||||
|
|
||||||
<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
|
|
||||||
|
|
||||||
These companies generously provide setup-php their products and services to aid in the development of this project.
|
These companies generously provide setup-php their products and services to aid in the development of this project.
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="https://www.jetbrains.com/?from=setup-php">
|
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-light-mode-only">
|
||||||
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="212" height="120">
|
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="100">
|
||||||
|
</a>
|
||||||
|
<a target="_blank" href="https://www.jetbrains.com/?from=setup-php#gh-dark-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/jetbrains-white.svg" alt="JetBrains" width="140" height="100">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://www.macstadium.com/opensource/members#gh-light-mode-only">
|
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only">
|
||||||
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="296" height="120">
|
<img src="https://setup-php.com/sponsors/cloudflare.svg" alt="Cloudflare" width="240" height="80">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only">
|
<a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-dark-mode-only">
|
||||||
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="296" height="120">
|
<img src="https://setup-php.com/sponsors/cloudflare-white.svg" alt="Cloudflare" width="240" height="80">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-light-mode-only">
|
||||||
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="140" height="120">
|
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="200" height="80">
|
||||||
|
</a>
|
||||||
|
<a target="_blank" href="https://www.macstadium.com/company/opensource#gh-dark-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200" height="80">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a target="_blank" href="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>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
Many users and organizations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
|
||||||
|
|
||||||
|
<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
|
||||||
|
|
||||||
|
- If you use setup-php, please consider starring the project and share it.
|
||||||
|
- If you blog, please share your experience of using `setup-php`.
|
||||||
|
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
|
||||||
|
|
||||||
## :package: Dependencies
|
## :package: Dependencies
|
||||||
|
|
||||||
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
|
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
|
||||||
@ -1045,6 +1067,7 @@ These companies generously provide setup-php their products and services to aid
|
|||||||
|
|
||||||
|
|
||||||
<!-- Links to tools -->
|
<!-- Links to tools -->
|
||||||
|
[`backward-compatibility-check`]: https://github.com/Roave/BackwardCompatibilityCheck
|
||||||
[`behat`]: https://docs.behat.org/en/latest/
|
[`behat`]: https://docs.behat.org/en/latest/
|
||||||
[`blackfire`]: https://blackfire.io/docs/php/index
|
[`blackfire`]: https://blackfire.io/docs/php/index
|
||||||
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
|
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
|
||||||
@ -1061,9 +1084,11 @@ These companies generously provide setup-php their products and services to aid
|
|||||||
[`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://flex.symfony.com/
|
[`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/
|
||||||
|
[`mago`]: https://github.com/carthage-software/mago
|
||||||
|
[`name-collision-detector`]: https://github.com/shipmonk/name-collision-detector
|
||||||
[`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint
|
[`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint
|
||||||
[`pecl`]: https://pecl.php.net/
|
[`pecl`]: https://pecl.php.net/
|
||||||
[`phan`]: https://github.com/phan/phan/wiki
|
[`phan`]: https://github.com/phan/phan/wiki
|
||||||
@ -1086,6 +1111,7 @@ These companies generously provide setup-php their products and services to aid
|
|||||||
[`phpunit`]: https://phpunit.de/
|
[`phpunit`]: https://phpunit.de/
|
||||||
[`phpunit-bridge`]: https://symfony.com/doc/current/components/phpunit_bridge.html
|
[`phpunit-bridge`]: https://symfony.com/doc/current/components/phpunit_bridge.html
|
||||||
[`phpunit-polyfills`]: https://github.com/Yoast/PHPUnit-Polyfills
|
[`phpunit-polyfills`]: https://github.com/Yoast/PHPUnit-Polyfills
|
||||||
|
[`pie`]: https://github.com/php/pie
|
||||||
[`pint`]: https://github.com/laravel/pint
|
[`pint`]: https://github.com/laravel/pint
|
||||||
[`prestissimo`]: https://github.com/hirak/prestissimo
|
[`prestissimo`]: https://github.com/hirak/prestissimo
|
||||||
[`protoc`]: https://developers.google.com/protocol-buffers/
|
[`protoc`]: https://developers.google.com/protocol-buffers/
|
||||||
|
|||||||
@ -18,6 +18,8 @@ describe('Extension tests', () => {
|
|||||||
${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
|
${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
|
||||||
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
||||||
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
|
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
|
||||||
|
${'ibm_db2'} | ${'7.4'} | ${'Add-Ibm ibm_db2'}
|
||||||
|
${'pdo_ibm'} | ${'7.4'} | ${'Add-Ibm pdo_ibm'}
|
||||||
${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
|
${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
|
||||||
${'pdo_sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv pdo_sqlsrv'}
|
${'pdo_sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv pdo_sqlsrv'}
|
||||||
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
|
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
|
||||||
@ -56,11 +58,13 @@ describe('Extension tests', () => {
|
|||||||
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
||||||
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
||||||
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
|
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
|
||||||
|
${'ibm_db2'} | ${'7.3'} | ${'add_ibm ibm_db2'}
|
||||||
${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
|
${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
|
||||||
${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
|
${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
|
||||||
${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
|
${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
|
||||||
${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
|
${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
|
||||||
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
||||||
|
${'pdo_ibm'} | ${'7.3'} | ${'add_ibm pdo_ibm'}
|
||||||
${'pdo_sqlsrv'} | ${'7.4'} | ${'add_sqlsrv pdo_sqlsrv'}
|
${'pdo_sqlsrv'} | ${'7.4'} | ${'add_sqlsrv pdo_sqlsrv'}
|
||||||
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
||||||
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
|
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
|
||||||
|
|||||||
@ -61,7 +61,23 @@ jest.mock('../src/fetch', () => ({
|
|||||||
} else if (!token || token === 'valid_token') {
|
} else if (!token || token === 'valid_token') {
|
||||||
return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
|
return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
|
||||||
} else if (token === 'beta_token') {
|
} else if (token === 'beta_token') {
|
||||||
return {data: `[{"ref": "refs/tags/1.2.3-beta1", "url": "${url}"}]`};
|
return {data: `[{"ref": "refs/tags/1.2.3beta1", "url": "${url}"}]`};
|
||||||
|
} else if (token === 'rc_token') {
|
||||||
|
return {
|
||||||
|
data: `[{"ref":"refs/tags/3.0.0RC1"},{"ref":"refs/tags/3.0.0RC2"}]`
|
||||||
|
};
|
||||||
|
} else if (token === 'non_semver_tags') {
|
||||||
|
return {
|
||||||
|
data: `[{"ref":"refs/tags/release-2025-09-18"},{"ref":"refs/tags/release-2025-09-17"}]`
|
||||||
|
};
|
||||||
|
} else if (token === 'undefined_ref') {
|
||||||
|
return {
|
||||||
|
data: `[{"url":"${url}"},{"ref":"refs/tags/v1.2.4","url":"${url}"}]`
|
||||||
|
};
|
||||||
|
} else if (token === 'multi_refs') {
|
||||||
|
return {
|
||||||
|
data: `[{"ref":"refs/tags/v1.2.3","url":"${url}"},{"ref":"refs/tags/1.2.4","url":"${url}"}]`
|
||||||
|
};
|
||||||
} else if (token === 'no_data') {
|
} else if (token === 'no_data') {
|
||||||
return {data: '[]'};
|
return {data: '[]'};
|
||||||
} else {
|
} else {
|
||||||
@ -92,7 +108,10 @@ describe('Tools tests', () => {
|
|||||||
token | version
|
token | version
|
||||||
${'invalid_token'} | ${'1.2'}
|
${'invalid_token'} | ${'1.2'}
|
||||||
${'valid_token'} | ${'1.2.3'}
|
${'valid_token'} | ${'1.2.3'}
|
||||||
${'beta_token'} | ${'1.2.3-beta1'}
|
${'beta_token'} | ${'1.2.3beta1'}
|
||||||
|
${'undefined_ref'} | ${'1.2.4'}
|
||||||
|
${'multi_refs'} | ${'1.2.4'}
|
||||||
|
${'non_semver_tags'} | ${'release-2025-09-18'}
|
||||||
${''} | ${'1.2.3'}
|
${''} | ${'1.2.3'}
|
||||||
`('checking getSemverVersion: $token', async ({token, version}) => {
|
`('checking getSemverVersion: $token', async ({token, version}) => {
|
||||||
process.env['GITHUB_TOKEN'] = token;
|
process.env['GITHUB_TOKEN'] = token;
|
||||||
@ -101,6 +120,26 @@ describe('Tools tests', () => {
|
|||||||
).toBe(version);
|
).toBe(version);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking getSemverVersion triggers ?? fallback via Map#get mock', async () => {
|
||||||
|
process.env['GITHUB_TOKEN'] = 'rc_token';
|
||||||
|
const spy = jest
|
||||||
|
.spyOn(Map.prototype as Map<string, string>, 'get')
|
||||||
|
.mockImplementation(function (
|
||||||
|
this: Map<string, string>,
|
||||||
|
key: string
|
||||||
|
): string | undefined {
|
||||||
|
if (key === '3.0.0-RC2') {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return Map.prototype.get.call(this, key);
|
||||||
|
});
|
||||||
|
const result = await tools.getSemverVersion(
|
||||||
|
getData({tool: 'tool', version: '3.0.0'})
|
||||||
|
);
|
||||||
|
expect(result).toBe('3.0.0-RC2');
|
||||||
|
spy.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
tool | fetch_latest | version
|
tool | fetch_latest | version
|
||||||
${'tool'} | ${'true'} | ${'3.2.1'}
|
${'tool'} | ${'true'} | ${'3.2.1'}
|
||||||
@ -205,6 +244,19 @@ describe('Tools tests', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it('checking getUrl handles undefined version without double slash', async () => {
|
||||||
|
const data = getData({
|
||||||
|
tool: 'cs2pr',
|
||||||
|
repository: 'staabm/annotate-pull-request-from-checkstyle',
|
||||||
|
domain: 'https://github.com'
|
||||||
|
});
|
||||||
|
data['extension'] = '';
|
||||||
|
delete data['version'];
|
||||||
|
expect(await tools.getUrl(data)).toBe(
|
||||||
|
'https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/cs2pr'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | version_prefix | url
|
version | version_prefix | url
|
||||||
${'latest'} | ${''} | ${'https://example.com/tool.phar'}
|
${'latest'} | ${''} | ${'https://example.com/tool.phar'}
|
||||||
@ -258,8 +310,9 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | php_version | os | script
|
version | php_version | os | script
|
||||||
${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'}
|
${'latest'} | ${'8.0'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'}
|
||||||
${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
|
${'1.2.3'} | ${'8.0'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
|
||||||
|
${'1.2.3'} | ${'7.4'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive'}
|
||||||
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
|
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
|
||||||
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
|
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
|
||||||
${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
|
${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
|
||||||
@ -331,14 +384,20 @@ describe('Tools tests', () => {
|
|||||||
${'preview'} | ${'7.4'} | ${'true'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
|
${'preview'} | ${'7.4'} | ${'true'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
|
||||||
${'1'} | ${'7.4'} | ${'false'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
${'1'} | ${'7.4'} | ${'false'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
||||||
${'2'} | ${'7.4'} | ${'false'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
|
${'2'} | ${'7.4'} | ${'false'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
|
||||||
|
${'latest'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
||||||
|
${'stable'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
||||||
|
${'snapshot'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
|
||||||
|
${'preview'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
|
||||||
|
${'1'} | ${'7.4'} | ${'false'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
||||||
|
${'2'} | ${'7.4'} | ${'false'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
|
||||||
${'latest'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
${'latest'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
||||||
${'stable'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
${'stable'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
||||||
${'snapshot'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-snapshot.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
${'snapshot'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-snapshot.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
||||||
${'preview'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-preview.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
${'preview'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-preview.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
||||||
${'1'} | ${'7.1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
${'1'} | ${'7.1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
||||||
${'2'} | ${'7.1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-2.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
${'2'} | ${'7.1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-2.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
||||||
${'1.2.3'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'}
|
${'1.2.3'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/download/1.2.3/composer.phar'}
|
||||||
${'1.2.3-RC1'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'}
|
${'1.2.3-RC1'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/download/1.2.3-RC1/composer.phar'}
|
||||||
`(
|
`(
|
||||||
'checking addComposer: $version, $php_version, $no_tool_cache',
|
'checking addComposer: $version, $php_version, $no_tool_cache',
|
||||||
async ({version, php_version, no_tool_cache, cache_url, source_url}) => {
|
async ({version, php_version, no_tool_cache, cache_url, source_url}) => {
|
||||||
@ -392,9 +451,9 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp',
|
'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, mago, name-collision-detector, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp, pie',
|
||||||
[
|
[
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://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"',
|
||||||
@ -402,6 +461,8 @@ describe('Tools tests', () => {
|
|||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
|
||||||
'add_composer_tool flex flex symfony/ global',
|
'add_composer_tool flex flex symfony/ global',
|
||||||
'add_grpc_php_plugin latest',
|
'add_grpc_php_plugin latest',
|
||||||
|
'add_mago',
|
||||||
|
'add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped',
|
||||||
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
|
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
|
||||||
'add_tool https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
|
'add_tool https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
|
||||||
'add_tool https://github.com/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"',
|
'add_tool https://github.com/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"',
|
||||||
@ -413,7 +474,7 @@ describe('Tools tests', () => {
|
|||||||
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
|
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
|
||||||
'add_composer_tool phinx phinx robmorgan/ scoped',
|
'add_composer_tool phinx phinx robmorgan/ scoped',
|
||||||
'add_composer_tool phinx phinx:1.2.3 robmorgan/ scoped',
|
'add_composer_tool phinx phinx:1.2.3 robmorgan/ scoped',
|
||||||
'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive "status"',
|
'add_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status"',
|
||||||
'add_composer_tool phpunit-bridge phpunit-bridge symfony/ global',
|
'add_composer_tool phpunit-bridge phpunit-bridge symfony/ global',
|
||||||
'add_composer_tool phpunit-polyfills phpunit-polyfills yoast/ global',
|
'add_composer_tool phpunit-polyfills phpunit-polyfills yoast/ global',
|
||||||
'add_tool https://github.com/laravel/pint/releases/latest/download/pint.phar pint "-V"',
|
'add_tool https://github.com/laravel/pint/releases/latest/download/pint.phar pint "-V"',
|
||||||
@ -422,7 +483,8 @@ describe('Tools tests', () => {
|
|||||||
'add_protoc latest',
|
'add_protoc latest',
|
||||||
'add_symfony latest',
|
'add_symfony latest',
|
||||||
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
|
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
|
||||||
|
'add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on linux', async (tools_csv, scripts) => {
|
])('checking addTools on linux', async (tools_csv, scripts) => {
|
||||||
@ -434,9 +496,9 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli',
|
'backward-compatibility-check, behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, mago:0.26.1, name-collision-detector, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli, pie',
|
||||||
[
|
[
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://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',
|
||||||
'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"',
|
||||||
@ -449,11 +511,13 @@ describe('Tools tests', () => {
|
|||||||
'add_composer_tool flex flex symfony/ global',
|
'add_composer_tool flex flex symfony/ global',
|
||||||
'add_grpc_php_plugin 1.2.3',
|
'add_grpc_php_plugin 1.2.3',
|
||||||
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
|
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
|
||||||
|
'add_mago 0.26.1',
|
||||||
|
'add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped',
|
||||||
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
|
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
|
||||||
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
||||||
'add_tool https://www.phing.info/get/phing-1.2.3.phar,https://github.com/phingofficial/phing/releases/download/1.2.3/phing-1.2.3.phar phing "-v"',
|
'add_tool https://www.phing.info/get/phing-1.2.3.phar,https://github.com/phingofficial/phing/releases/download/1.2.3/phing-1.2.3.phar phing "-v"',
|
||||||
'add_composer_tool phinx phinx robmorgan/ scoped',
|
'add_composer_tool phinx phinx robmorgan/ scoped',
|
||||||
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive',
|
'add_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive',
|
||||||
'add_devtools php-config',
|
'add_devtools php-config',
|
||||||
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
|
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
|
||||||
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
|
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
|
||||||
@ -467,10 +531,12 @@ describe('Tools tests', () => {
|
|||||||
'add_protoc 1.2.3',
|
'add_protoc 1.2.3',
|
||||||
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
||||||
'add_composer_tool rector rector rector/ scoped',
|
'add_composer_tool rector rector rector/ scoped',
|
||||||
|
'add_composer_tool backward-compatibility-check backward-compatibility-check roave/ scoped',
|
||||||
'add_symfony latest',
|
'add_symfony latest',
|
||||||
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
|
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
|
||||||
'add_composer_tool easy-coding-standard easy-coding-standard symplify/ scoped'
|
'add_composer_tool easy-coding-standard easy-coding-standard symplify/ scoped',
|
||||||
|
'add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on darwin', async (tools_csv, scripts) => {
|
])('checking addTools on darwin', async (tools_csv, scripts) => {
|
||||||
@ -482,9 +548,9 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp',
|
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, mago, name-collision-detector, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp, pie',
|
||||||
[
|
[
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://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',
|
||||||
'blackfire-player is not a windows tool',
|
'blackfire-player is not a windows tool',
|
||||||
'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"',
|
||||||
@ -492,14 +558,17 @@ describe('Tools tests', () => {
|
|||||||
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
|
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
|
||||||
'Tool does_not_exist is not supported',
|
'Tool does_not_exist is not supported',
|
||||||
'Add-ComposerTool flex flex symfony/ global',
|
'Add-ComposerTool flex flex symfony/ global',
|
||||||
|
'Add-Mago',
|
||||||
|
'Add-ComposerTool name-collision-detector name-collision-detector shipmonk/ scoped',
|
||||||
'Add-ComposerTool phinx phinx robmorgan/ scoped',
|
'Add-ComposerTool phinx phinx robmorgan/ scoped',
|
||||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive "status"',
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status"',
|
||||||
'php-config is not a windows tool',
|
'php-config is not a windows tool',
|
||||||
'phpize is not a windows tool',
|
'phpize is not a windows tool',
|
||||||
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
||||||
'Add-ComposerTool phpunit-bridge phpunit-bridge symfony/ global',
|
'Add-ComposerTool phpunit-bridge phpunit-bridge symfony/ global',
|
||||||
'Add-Symfony',
|
'Add-Symfony',
|
||||||
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
|
||||||
|
'Add-Tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on Windows', async (tools_csv, scripts) => {
|
])('checking addTools on Windows', async (tools_csv, scripts) => {
|
||||||
@ -513,7 +582,7 @@ describe('Tools tests', () => {
|
|||||||
[
|
[
|
||||||
'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2',
|
'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2',
|
||||||
[
|
[
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer',
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://artifacts.setup-php.com/composer/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer',
|
||||||
'Add-ComposerTool codeception codeception codeception/ global',
|
'Add-ComposerTool codeception codeception codeception/ global',
|
||||||
'Add-ComposerTool prestissimo prestissimo hirak/ global',
|
'Add-ComposerTool prestissimo prestissimo hirak/ global',
|
||||||
'Add-ComposerTool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/ global',
|
'Add-ComposerTool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/ global',
|
||||||
@ -562,10 +631,10 @@ describe('Tools tests', () => {
|
|||||||
it.each`
|
it.each`
|
||||||
tools_csv | script
|
tools_csv | script
|
||||||
${'none'} | ${''}
|
${'none'} | ${''}
|
||||||
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"'}
|
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"'}
|
||||||
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
|
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://artifacts.setup-php.com/composer/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
|
||||||
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
|
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://artifacts.setup-php.com/composer/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
|
||||||
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
|
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://artifacts.setup-php.com/composer/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
|
||||||
`('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
|
`('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
|
||||||
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as utils from '../src/utils';
|
import * as utils from '../src/utils';
|
||||||
|
import * as fetchModule from '../src/fetch';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock @actions/core
|
* Mock @actions/core
|
||||||
@ -12,15 +13,6 @@ jest.mock('@actions/core', () => ({
|
|||||||
info: jest.fn()
|
info: jest.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
|
||||||
* Mock fetch.ts
|
|
||||||
*/
|
|
||||||
jest.mock('../src/fetch', () => ({
|
|
||||||
fetch: jest.fn().mockImplementation(() => {
|
|
||||||
return {data: '{ "latest": "8.1", "5.x": "5.6" }'};
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('Utils tests', () => {
|
describe('Utils tests', () => {
|
||||||
it('checking readEnv', async () => {
|
it('checking readEnv', async () => {
|
||||||
process.env['test'] = 'setup-php';
|
process.env['test'] = 'setup-php';
|
||||||
@ -43,15 +35,27 @@ describe('Utils tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking getManifestURL', async () => {
|
it('checking getManifestURL', async () => {
|
||||||
expect(await utils.getManifestURL()).toContain('php-versions.json');
|
for (const url of await utils.getManifestURLS()) {
|
||||||
|
expect(url).toContain('php-versions.json');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking parseVersion', async () => {
|
it('checking parseVersion', async () => {
|
||||||
|
const fetchSpy = jest
|
||||||
|
.spyOn(fetchModule, 'fetch')
|
||||||
|
.mockResolvedValue({data: '{ "latest": "8.1", "5.x": "5.6" }'});
|
||||||
expect(await utils.parseVersion('latest')).toBe('8.1');
|
expect(await utils.parseVersion('latest')).toBe('8.1');
|
||||||
expect(await utils.parseVersion('7')).toBe('7.0');
|
expect(await utils.parseVersion('7')).toBe('7.0');
|
||||||
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
||||||
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
||||||
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
||||||
|
|
||||||
|
fetchSpy.mockReset();
|
||||||
|
fetchSpy.mockResolvedValueOnce({}).mockResolvedValueOnce({});
|
||||||
|
await expect(utils.parseVersion('latest')).rejects.toThrow(
|
||||||
|
'Could not fetch the PHP version manifest.'
|
||||||
|
);
|
||||||
|
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking parseIniFile', async () => {
|
it('checking parseIniFile', async () => {
|
||||||
@ -177,9 +181,9 @@ describe('Utils tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking suppressOutput', async () => {
|
it('checking suppressOutput', async () => {
|
||||||
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
expect(await utils.suppressOutput('win32')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('linux')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('darwin')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('openbsd')).toContain(
|
expect(await utils.suppressOutput('openbsd')).toContain(
|
||||||
'Platform openbsd is not supported'
|
'Platform openbsd is not supported'
|
||||||
);
|
);
|
||||||
|
|||||||
@ -27,6 +27,9 @@ inputs:
|
|||||||
tools:
|
tools:
|
||||||
description: 'Setup popular tools globally.'
|
description: 'Setup popular tools globally.'
|
||||||
required: false
|
required: false
|
||||||
|
github-token:
|
||||||
|
description: 'GitHub token to use for authentication.'
|
||||||
|
default: ${{ github.token }}
|
||||||
outputs:
|
outputs:
|
||||||
php-version:
|
php-version:
|
||||||
description: 'PHP version in semver format'
|
description: 'PHP version in semver format'
|
||||||
|
|||||||
4
dist/index.js
vendored
4
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -11,7 +11,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -19,7 +19,7 @@ jobs:
|
|||||||
# blackfire-player supports PHP >= 5.5
|
# blackfire-player supports PHP >= 5.5
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -19,7 +19,7 @@ jobs:
|
|||||||
# Blackfire supports PHP >= 5.3 on Ubuntu and macOS, and PHP >= 5.4 on Windows
|
# Blackfire supports PHP >= 5.3 on Ubuntu and macOS, and PHP >= 5.4 on Windows
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -28,7 +28,7 @@ jobs:
|
|||||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@ -75,7 +75,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@ -108,7 +108,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -28,7 +28,7 @@ jobs:
|
|||||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@ -75,7 +75,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@ -108,7 +108,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -11,7 +11,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@ -47,7 +47,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@ -79,7 +79,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -37,7 +37,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -39,7 +39,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -12,7 +12,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -37,7 +37,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -39,7 +39,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -12,7 +12,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -36,7 +36,7 @@ jobs:
|
|||||||
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -37,7 +37,7 @@ jobs:
|
|||||||
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -12,10 +12,10 @@ jobs:
|
|||||||
node-versions: ['16']
|
node-versions: ['16']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-versions }}
|
node-version: ${{ matrix.node-versions }}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -23,7 +23,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -23,7 +23,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -12,7 +12,7 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|||||||
@ -29,10 +29,10 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0']
|
php-versions: ['7.4', '8.0']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Set Node.js 10.x
|
- name: Set Node.js 10.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 10.x
|
||||||
|
|
||||||
|
|||||||
@ -29,10 +29,10 @@ jobs:
|
|||||||
php-versions: ['7.4', '8.0']
|
php-versions: ['7.4', '8.0']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Set Node.js 10.x
|
- name: Set Node.js 10.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 10.x
|
||||||
|
|
||||||
|
|||||||
4677
package-lock.json
generated
4677
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
48
package.json
48
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.33.0",
|
"version": "2.35.5",
|
||||||
"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",
|
||||||
@ -36,30 +36,34 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.3",
|
"@actions/io": "^2.0.0",
|
||||||
"compare-versions": "^6.1.1"
|
"compare-versions": "^6.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/compat": "^1.2.8",
|
"@eslint/compat": "^2.0.0",
|
||||||
"@eslint/js": "9.24.0",
|
"@eslint/js": "9.39.1",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^22.14.1",
|
"@types/node": "^24.10.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
||||||
"@typescript-eslint/parser": "^8.29.1",
|
"@typescript-eslint/parser": "^8.47.0",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.4",
|
||||||
"eslint": "9.24.0",
|
"eslint": "9.39.1",
|
||||||
"eslint-config-prettier": "^10.1.2",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.32.0",
|
||||||
"eslint-plugin-jest": "^28.11.0",
|
"eslint-plugin-jest": "^29.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.6",
|
"eslint-plugin-prettier": "^5.5.4",
|
||||||
"globals": "^16.0.0",
|
"globals": "^16.5.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^30.2.0",
|
||||||
"jest-circus": "^29.7.0",
|
"jest-circus": "^30.2.0",
|
||||||
"nock": "^14.0.3",
|
"nock": "^14.0.10",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.6.2",
|
||||||
"simple-git-hooks": "^2.12.1",
|
"simple-git-hooks": "^2.13.1",
|
||||||
"ts-jest": "^29.3.1",
|
"ts-jest": "^29.4.5",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.9.3"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"test-exclude": "^7.0.1",
|
||||||
|
"glob": "^11.1.0"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/shivammathur/setup-php/issues"
|
"url": "https://github.com/shivammathur/setup-php/issues"
|
||||||
|
|||||||
@ -17,7 +17,7 @@ export async function addINIValuesUnix(
|
|||||||
return (
|
return (
|
||||||
'echo "' +
|
'echo "' +
|
||||||
ini_values.join('\n') +
|
ini_values.join('\n') +
|
||||||
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
|
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" ' +
|
||||||
script
|
script
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@ protobuf=protobuf
|
|||||||
psr=psr
|
psr=psr
|
||||||
raphf=raphf
|
raphf=raphf
|
||||||
rdkafka=rdkafka
|
rdkafka=rdkafka
|
||||||
|
phpredis=redis
|
||||||
redis=redis
|
redis=redis
|
||||||
snmp=snmp
|
snmp=snmp
|
||||||
sqlsrv=sqlsrv
|
sqlsrv=sqlsrv
|
||||||
|
|||||||
22
src/configs/darwin_libs
Normal file
22
src/configs/darwin_libs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
amqp=rabbitmq-c
|
||||||
|
decimal=mpdecimal
|
||||||
|
ev=libev
|
||||||
|
event=libevent
|
||||||
|
geoip=geoip
|
||||||
|
gmagick=graphicsmagick
|
||||||
|
gnupg=gpgme
|
||||||
|
grpc=grpc protobuf
|
||||||
|
imagick=imagemagick
|
||||||
|
memcached=libmemcached libevent
|
||||||
|
protobuf=protobuf
|
||||||
|
rdkafka=librdkafka
|
||||||
|
snappy=snappy
|
||||||
|
sodium=libsodium
|
||||||
|
ssh2=libssh2
|
||||||
|
uv=libuv
|
||||||
|
uuid=util-linux
|
||||||
|
vips=vips
|
||||||
|
yaz=yaz
|
||||||
|
yaml=libyaml
|
||||||
|
zstd=zstd
|
||||||
|
zmq=zeromq
|
||||||
3
src/configs/ini/jit_aarch64.ini
Normal file
3
src/configs/ini/jit_aarch64.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
opcache.enable=1
|
||||||
|
opcache.jit_buffer_size=128M
|
||||||
|
opcache.jit=1235
|
||||||
22
src/configs/linux_libs
Normal file
22
src/configs/linux_libs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
amqp=librabbitmq-dev
|
||||||
|
decimal=libmpdec-dev
|
||||||
|
ev=libev-dev
|
||||||
|
event=libevent-dev
|
||||||
|
geoip=libgeoip-dev
|
||||||
|
gmagick=graphicsmagick-libmagick-dev-compat
|
||||||
|
gnupg=libgpgme-dev
|
||||||
|
grpc=libgrpc-dev libprotobuf-dev protobuf-compiler
|
||||||
|
imagick=libmagickwand-dev libmagickcore-dev
|
||||||
|
memcached=libmemcached-dev libevent-dev
|
||||||
|
protobuf=libprotobuf-dev protobuf-compiler
|
||||||
|
rdkafka=librdkafka-dev
|
||||||
|
snappy=libsnappy-dev
|
||||||
|
sodium=libsodium-dev
|
||||||
|
ssh2=libssh2-1-dev
|
||||||
|
uv=libuv1-dev
|
||||||
|
uuid=uuid-dev
|
||||||
|
vips=libvips-dev
|
||||||
|
yaz=libyaz-dev
|
||||||
|
yaml=libyaml-dev
|
||||||
|
zstd=libzstd-dev
|
||||||
|
zmq=libzmq3-dev
|
||||||
@ -20,3 +20,5 @@
|
|||||||
23.04,lunar
|
23.04,lunar
|
||||||
23.10,mantic
|
23.10,mantic
|
||||||
24.04,noble
|
24.04,noble
|
||||||
|
24.10,oracular
|
||||||
|
25.10,plucky
|
||||||
|
|||||||
|
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"lowest": "8.1",
|
"lowest": "8.1",
|
||||||
"highest": "8.4",
|
"highest": "8.5",
|
||||||
"latest": "8.4",
|
"latest": "8.5",
|
||||||
"nightly": "8.5",
|
"nightly": "8.6",
|
||||||
|
"master": "8.6",
|
||||||
"5.x": "5.6",
|
"5.x": "5.6",
|
||||||
"7.x": "7.4",
|
"7.x": "7.4",
|
||||||
"8.x": "8.4"
|
"8.x": "8.5"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"backward-compatibility-check": {
|
||||||
|
"type": "composer",
|
||||||
|
"repository": "roave/backward-compatibility-check",
|
||||||
|
"scope": "scoped"
|
||||||
|
},
|
||||||
"box": {
|
"box": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "box-project/box",
|
"repository": "box-project/box",
|
||||||
@ -45,6 +50,12 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
|
"easy-coding-standard": {
|
||||||
|
"type": "composer",
|
||||||
|
"alias": "ecs",
|
||||||
|
"repository": "symplify/easy-coding-standard",
|
||||||
|
"scope": "scoped"
|
||||||
|
},
|
||||||
"infection": {
|
"infection": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "infection/infection",
|
"repository": "infection/infection",
|
||||||
@ -53,6 +64,11 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
|
"name-collision-detector": {
|
||||||
|
"type": "composer",
|
||||||
|
"repository": "shipmonk/name-collision-detector",
|
||||||
|
"scope": "scoped"
|
||||||
|
},
|
||||||
"phan": {
|
"phan": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "phan/phan",
|
"repository": "phan/phan",
|
||||||
@ -136,6 +152,14 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
|
"pie": {
|
||||||
|
"type": "phar",
|
||||||
|
"repository": "php/pie",
|
||||||
|
"extension": ".phar",
|
||||||
|
"domain": "https://github.com",
|
||||||
|
"version_prefix": "",
|
||||||
|
"version_parameter": "-V"
|
||||||
|
},
|
||||||
"pint": {
|
"pint": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "laravel/pint",
|
"repository": "laravel/pint",
|
||||||
@ -225,6 +249,12 @@
|
|||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "v"
|
"version_prefix": "v"
|
||||||
},
|
},
|
||||||
|
"mago": {
|
||||||
|
"type": "custom-package",
|
||||||
|
"repository": "carthage-software/mago",
|
||||||
|
"domain": "https://github.com",
|
||||||
|
"version_prefix": ""
|
||||||
|
},
|
||||||
"protoc": {
|
"protoc": {
|
||||||
"type": "custom-package",
|
"type": "custom-package",
|
||||||
"repository": "protocolbuffers/protobuf",
|
"repository": "protocolbuffers/protobuf",
|
||||||
@ -236,7 +266,8 @@
|
|||||||
"type": "custom-package",
|
"type": "custom-package",
|
||||||
"repository": "symfony-cli/symfony-cli",
|
"repository": "symfony-cli/symfony-cli",
|
||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "-V"
|
"version_prefix": "v",
|
||||||
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
"blackfire-player": {
|
"blackfire-player": {
|
||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
@ -323,11 +354,5 @@
|
|||||||
"extension": ".phar",
|
"extension": ".phar",
|
||||||
"version_parameter": "--version",
|
"version_parameter": "--version",
|
||||||
"version_prefix": "v"
|
"version_prefix": "v"
|
||||||
},
|
|
||||||
"easy-coding-standard": {
|
|
||||||
"type": "composer",
|
|
||||||
"alias": "ecs",
|
|
||||||
"repository": "symplify/easy-coding-standard",
|
|
||||||
"scope": "scoped"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,17 +32,19 @@ export async function addExtensionDarwin(
|
|||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 7.4relay...8.5relay
|
// match 7.4relay...8.5relay
|
||||||
// match 5.3blackfire...8.4blackfire
|
// match 5.3blackfire...8.5blackfire
|
||||||
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.5blackfire-(semver)
|
||||||
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
|
// match couchbase, event, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...8.4ioncube
|
// match 5.3ioncube...8.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
|
||||||
// match 7.0zephir_parser...8.4zephir_parser
|
// match 7.0zephir_parser...8.4zephir_parser
|
||||||
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
|
version_extension
|
||||||
|
):
|
||||||
|
case /^couchbase|^event|^gearman$|^geos$|^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
||||||
@ -134,17 +136,19 @@ export async function addExtensionWindows(
|
|||||||
case /^none$/.test(ext_name):
|
case /^none$/.test(ext_name):
|
||||||
add_script += '\nDisable-AllShared';
|
add_script += '\nDisable-AllShared';
|
||||||
break;
|
break;
|
||||||
// match 5.3blackfire...8.4blackfire
|
// match 5.3blackfire...8.5blackfire
|
||||||
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.5blackfire-(semver)
|
||||||
// match pdo_oci and oci8
|
// match ibm_db2, pdo_ibm, pdo_oci and oci8
|
||||||
// match 5.3ioncube...8.4ioncube
|
// match 5.3ioncube...8.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
|
||||||
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
|
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
|
||||||
// match 7.0zephir_parser...8.4zephir_parser
|
// match 7.0zephir_parser...8.4zephir_parser
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
case /^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^pdo_firebird$/.test(
|
||||||
|
extension
|
||||||
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
@ -264,21 +268,23 @@ export async function addExtensionLinux(
|
|||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 7.4relay...8.5relay
|
// match 7.4relay...8.5relay
|
||||||
// match 5.3blackfire...8.4blackfire
|
// match 5.3blackfire...8.5blackfire
|
||||||
// match 5.3blackfire-(semver)...8.4blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.5blackfire-(semver)
|
||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
// match couchbase, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...8.4ioncube
|
// match 5.3ioncube...8.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
|
||||||
// match 7.0zephir_parser...8.4zephir_parser
|
// match 7.0zephir_parser...8.4zephir_parser
|
||||||
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
version_extension
|
||||||
|
):
|
||||||
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
case /^couchbase|^event|^gearman$|^geos$|^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
|
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
|
||||||
|
|||||||
@ -18,7 +18,6 @@ export async function getScript(os: string): Promise<string> {
|
|||||||
const filename = os + (await utils.scriptExtension(os));
|
const filename = os + (await utils.scriptExtension(os));
|
||||||
const script_path = path.join(__dirname, '../src/scripts', filename);
|
const script_path = path.join(__dirname, '../src/scripts', filename);
|
||||||
const run_path = script_path.replace(os, 'run');
|
const run_path = script_path.replace(os, 'run');
|
||||||
process.env['fail_fast'] = await utils.getInput('fail-fast', false);
|
|
||||||
const extension_csv: string = await utils.getInput('extensions', false);
|
const extension_csv: string = await utils.getInput('extensions', false);
|
||||||
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
||||||
const coverage_driver: string = await utils.getInput('coverage', false);
|
const coverage_driver: string = await utils.getInput('coverage', false);
|
||||||
@ -48,10 +47,19 @@ export async function getScript(os: string): Promise<string> {
|
|||||||
return run_path;
|
return run_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to set environment variables based on inputs.
|
||||||
|
*/
|
||||||
|
export async function setEnv(): Promise<void> {
|
||||||
|
process.env['fail_fast'] = await utils.getInput('fail-fast', false);
|
||||||
|
process.env['GITHUB_TOKEN'] ??= await utils.getInput('github-token', false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the script
|
* Run the script
|
||||||
*/
|
*/
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
|
await setEnv();
|
||||||
const os: string = process.platform;
|
const os: string = process.platform;
|
||||||
const tool = await utils.scriptTool(os);
|
const tool = await utils.scriptTool(os);
|
||||||
const run_path = await getScript(os);
|
const run_path = await getScript(os);
|
||||||
|
|||||||
@ -13,9 +13,9 @@ handle_dependency_extensions() {
|
|||||||
suffix="$(get_php_formula_suffix)"
|
suffix="$(get_php_formula_suffix)"
|
||||||
if [[ -n "$suffix" ]]; then
|
if [[ -n "$suffix" ]]; then
|
||||||
brew_opts=(-sf)
|
brew_opts=(-sf)
|
||||||
patch_abstract_file >/dev/null 2>&1
|
patch_abstract_file
|
||||||
for dependency_extension in "${dependency_extensions[@]}"; do
|
for dependency_extension in "${dependency_extensions[@]}"; do
|
||||||
brew install "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 && copy_brew_extensions "$dependency_extension"
|
brew install "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" && copy_brew_extensions "$dependency_extension"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ disable_extension_helper() {
|
|||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
|
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
|
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get extension name from brew formula.
|
# Function to get extension name from brew formula.
|
||||||
@ -39,10 +39,21 @@ get_extension_from_formula() {
|
|||||||
local formula=$1
|
local formula=$1
|
||||||
local extension
|
local extension
|
||||||
extension=$(grep -E "^$formula=" "$src"/configs/brew_extensions | cut -d '=' -f 2)
|
extension=$(grep -E "^$formula=" "$src"/configs/brew_extensions | cut -d '=' -f 2)
|
||||||
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")"
|
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|php|[0-9]//g")"
|
||||||
echo "$extension"
|
echo "$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to get renamed formula.
|
||||||
|
get_renamed_formula() {
|
||||||
|
local formula=$1
|
||||||
|
formula_renames_json="$tap_dir/$ext_tap/formula_renames.json"
|
||||||
|
if [ -e "$formula_renames_json" ] && grep -q "$formula@$version\":" "$formula_renames_json"; then
|
||||||
|
grep "$formula@$version\":" "$formula_renames_json" | cut -d ':' -f 2 | tr -d ' ",' | cut -d '@' -f 1
|
||||||
|
else
|
||||||
|
echo $formula
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to copy extension binaries to the extension directory.
|
# Function to copy extension binaries to the extension directory.
|
||||||
copy_brew_extensions() {
|
copy_brew_extensions() {
|
||||||
local formula=$1
|
local formula=$1
|
||||||
@ -69,10 +80,10 @@ add_brew_extension() {
|
|||||||
else
|
else
|
||||||
add_brew_tap "$php_tap"
|
add_brew_tap "$php_tap"
|
||||||
add_brew_tap "$ext_tap"
|
add_brew_tap "$ext_tap"
|
||||||
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "${core_repo:?}/Formula/" 2>/dev/null || true
|
formula="$(get_renamed_formula "$formula")"
|
||||||
update_dependencies >/dev/null 2>&1
|
update_dependencies
|
||||||
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
|
handle_dependency_extensions "$formula" "$extension"
|
||||||
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
|
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" && copy_brew_extensions "$formula") || pecl_install "$extension"
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -81,7 +92,7 @@ add_brew_extension() {
|
|||||||
patch_abstract_file() {
|
patch_abstract_file() {
|
||||||
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
|
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
|
||||||
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
|
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
|
||||||
echo '' | sudo tee /tmp/abstract_patch >/dev/null 2>&1
|
echo '' | sudo tee /tmp/abstract_patch
|
||||||
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
|
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -91,9 +102,9 @@ add_extension_helper() {
|
|||||||
local extension=$1
|
local extension=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
|
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
|
||||||
run_script "php5-darwin" "${version/./}" "$extension" >/dev/null 2>&1
|
run_script "php5-darwin" "${version/./}" "$extension"
|
||||||
else
|
else
|
||||||
pecl_install "$extension" >/dev/null 2>&1 &&
|
pecl_install "$extension" &&
|
||||||
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
||||||
fi
|
fi
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
@ -107,8 +118,8 @@ add_devtools() {
|
|||||||
|
|
||||||
# Function to handle request to add PECL.
|
# Function to handle request to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
enable_extension xml extension >/dev/null 2>&1
|
enable_extension xml extension
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl
|
||||||
pear_version=$(get_tool_version "pecl" "version")
|
pear_version=$(get_tool_version "pecl" "version")
|
||||||
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
|
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
|
||||||
}
|
}
|
||||||
@ -135,10 +146,12 @@ patch_brew() {
|
|||||||
update_dependencies() {
|
update_dependencies() {
|
||||||
patch_brew
|
patch_brew
|
||||||
if ! [ -e /tmp/update_dependencies ]; then
|
if ! [ -e /tmp/update_dependencies ]; then
|
||||||
for repo in "$brew_repo" "$core_repo"; do
|
for repo in "$brew_repo" "${core_repo:?}"; do
|
||||||
git_retry -C "$repo" fetch origin master && git -C "$repo" reset --hard origin/master
|
if [ -e "$repo" ]; then
|
||||||
|
git_retry -C "$repo" fetch origin main && git -C "$repo" reset --hard origin/main
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
echo '' | sudo tee /tmp/update_dependencies
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,9 +160,9 @@ get_brewed_php() {
|
|||||||
cellar="$brew_prefix"/Cellar
|
cellar="$brew_prefix"/Cellar
|
||||||
php_cellar="$cellar"/php
|
php_cellar="$cellar"/php
|
||||||
if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
||||||
php_semver | cut -c 1-3
|
php_semver
|
||||||
elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
||||||
php_semver | cut -c 1-3
|
php_semver
|
||||||
else
|
else
|
||||||
echo 'false';
|
echo 'false';
|
||||||
fi
|
fi
|
||||||
@ -159,17 +172,25 @@ get_brewed_php() {
|
|||||||
add_php() {
|
add_php() {
|
||||||
action=$1
|
action=$1
|
||||||
existing_version=$2
|
existing_version=$2
|
||||||
add_brew_tap "$php_tap"
|
|
||||||
update_dependencies
|
|
||||||
suffix="$(get_php_formula_suffix)"
|
suffix="$(get_php_formula_suffix)"
|
||||||
php_formula="shivammathur/php/php@$version$suffix"
|
php_keg="php@$version$suffix"
|
||||||
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
|
php_formula="shivammathur/php/$php_keg"
|
||||||
([ "$action" = "upgrade" ] && brew upgrade -f --overwrite "$php_formula") || brew unlink "$php_formula"
|
if [[ "$existing_version" = "false" || -n "$suffix" || "$action" = "upgrade" ]]; then
|
||||||
else
|
update_dependencies
|
||||||
brew install -f --overwrite "$php_formula"
|
add_brew_tap "$php_tap"
|
||||||
fi
|
fi
|
||||||
sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix"
|
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
|
||||||
brew link --force --overwrite "$php_formula"
|
if [ "$action" = "upgrade" ]; then
|
||||||
|
brew install --only-dependencies "$php_formula"
|
||||||
|
brew upgrade -f --overwrite "$php_formula"
|
||||||
|
else
|
||||||
|
brew unlink "$php_keg"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
brew install --only-dependencies "$php_formula"
|
||||||
|
brew install -f --overwrite "$php_formula" || brew upgrade -f --overwrite "$php_formula"
|
||||||
|
fi
|
||||||
|
brew link --force --overwrite "$php_keg"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get formula suffix
|
# Function to get formula suffix
|
||||||
@ -196,7 +217,7 @@ add_php_config() {
|
|||||||
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
|
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
|
||||||
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
|
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
|
||||||
elif [ "$ini" = "none" ]; then
|
elif [ "$ini" = "none" ]; then
|
||||||
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
|
echo '' | sudo tee "${ini_file[@]}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +230,11 @@ get_scan_dir() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to handle self-hosted runner setup.
|
||||||
|
self_hosted_helper() {
|
||||||
|
sudo mkdir -p /opt/hostedtoolcache || true
|
||||||
|
}
|
||||||
|
|
||||||
# Function to Setup PHP.
|
# Function to Setup PHP.
|
||||||
setup_php() {
|
setup_php() {
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
@ -216,18 +242,18 @@ setup_php() {
|
|||||||
update=true
|
update=true
|
||||||
check_pre_installed
|
check_pre_installed
|
||||||
existing_version=$(get_brewed_php)
|
existing_version=$(get_brewed_php)
|
||||||
if [[ "$version" =~ ${old_versions:?} ]]; then
|
|
||||||
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
|
|
||||||
status="Installed"
|
|
||||||
elif [ "$existing_version" != "$version" ]; then
|
|
||||||
add_php "install" "$existing_version" >/dev/null 2>&1
|
|
||||||
status="Installed"
|
|
||||||
elif [ "$existing_version" = "$version" ]; then
|
|
||||||
if [ "${update:?}" = "true" ]; then
|
|
||||||
add_php "upgrade" "$existing_version" >/dev/null 2>&1
|
|
||||||
status="Updated to"
|
|
||||||
else
|
|
||||||
status="Found"
|
status="Found"
|
||||||
|
if [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
|
run_script "php5-darwin" "${version/./}"
|
||||||
|
status="Installed"
|
||||||
|
elif [ "${existing_version:0:3}" != "$version" ]; then
|
||||||
|
add_php "install" "$existing_version"
|
||||||
|
status="Installed"
|
||||||
|
elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then
|
||||||
|
brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')"
|
||||||
|
if [ "$brew_php_version" != "$existing_version" ]; then
|
||||||
|
add_php "upgrade" "$existing_version"
|
||||||
|
status="Upgraded"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
php_config="$(command -v php-config)"
|
php_config="$(command -v php-config)"
|
||||||
@ -252,7 +278,7 @@ setup_php() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
version=${1:-'8.4'}
|
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"
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
# Function to log result of installing extension.
|
# Function to log result of installing extension.
|
||||||
add_extension_log() {
|
add_extension_log() {
|
||||||
(
|
if check_extension ${1%%-*}; then
|
||||||
check_extension "$(echo "$1" | cut -d '-' -f 1)" && add_log "${tick:?}" "$1" "$2"
|
add_log "${tick:?}" "$1" "$2"
|
||||||
) || add_log "${cross:?}" "$1" "Could not install $1 on PHP ${semver:?}"
|
else
|
||||||
|
add_log "${cross:?}" "$1" "${3:-Could not install $1 on PHP ${semver:?}}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to test if extension is loaded.
|
# Function to test if extension is loaded.
|
||||||
@ -48,7 +50,7 @@ enable_extension() {
|
|||||||
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
||||||
enable_extension_dependencies "$1" "$2"
|
enable_extension_dependencies "$1" "$2"
|
||||||
enable_cache_extension_dependencies "$1" "$2"
|
enable_cache_extension_dependencies "$1" "$2"
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod >/dev/null 2>&1; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod ; then
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
|
||||||
mod="${ini_dir:?}"/../mods-available/"$1".ini
|
mod="${ini_dir:?}"/../mods-available/"$1".ini
|
||||||
if ! [ -e "$mod" ]; then
|
if ! [ -e "$mod" ]; then
|
||||||
@ -57,7 +59,7 @@ enable_extension() {
|
|||||||
[ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2)
|
[ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2)
|
||||||
(echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null
|
(echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null
|
||||||
fi
|
fi
|
||||||
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
|
sudo phpenmod -v "$version" "$1"
|
||||||
else
|
else
|
||||||
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
||||||
fi
|
fi
|
||||||
@ -69,7 +71,7 @@ enable_extensions() {
|
|||||||
local extensions=("$@")
|
local extensions=("$@")
|
||||||
to_wait=()
|
to_wait=()
|
||||||
for ext in "${extensions[@]}"; do
|
for ext in "${extensions[@]}"; do
|
||||||
enable_extension "$ext" extension >/dev/null 2>&1 &
|
enable_extension "$ext" extension &
|
||||||
to_wait+=($!)
|
to_wait+=($!)
|
||||||
done
|
done
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
@ -77,7 +79,7 @@ enable_extensions() {
|
|||||||
|
|
||||||
# Function to get a map of extensions and their dependent shared extensions.
|
# Function to get a map of extensions and their dependent shared extensions.
|
||||||
get_extension_map() {
|
get_extension_map() {
|
||||||
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig >/dev/null 2>&1
|
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to enable extension dependencies which are also extensions.
|
# Function to enable extension dependencies which are also extensions.
|
||||||
@ -123,7 +125,7 @@ disable_extension() {
|
|||||||
disable_all_shared() {
|
disable_all_shared() {
|
||||||
get_extension_map
|
get_extension_map
|
||||||
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
|
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
|
||||||
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
|
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
sudo rm -f /tmp/php"$version"_extensions
|
sudo rm -f /tmp/php"$version"_extensions
|
||||||
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -I{} touch /tmp/extdisabled/"$version"/{}
|
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -I{} touch /tmp/extdisabled/"$version"/{}
|
||||||
@ -137,7 +139,7 @@ configure_pecl() {
|
|||||||
for script in pear pecl; do
|
for script in pear pecl; do
|
||||||
sudo "$script" channel-update "$script".php.net
|
sudo "$script" channel-update "$script".php.net
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
echo '' | sudo tee /tmp/pecl_config
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,8 +177,8 @@ get_pecl_version() {
|
|||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
local prefix=${2:-extension}
|
local prefix=${2:-extension}
|
||||||
add_pecl >/dev/null 2>&1
|
add_pecl
|
||||||
disable_extension_helper "${extension%-*}" >/dev/null 2>&1
|
disable_extension_helper "${extension%-*}"
|
||||||
# Compare version with 8.3 so it runs only on 8.4 and above
|
# Compare version with 8.3 so it runs only on 8.4 and above
|
||||||
# Install using the source interface as it allows for patching.
|
# Install using the source interface as it allows for patching.
|
||||||
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
||||||
@ -189,11 +191,11 @@ pecl_install() {
|
|||||||
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
|
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
|
||||||
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
||||||
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
||||||
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
|
(( ${#libraries[@]} )) && add_libs "${libraries[@]}"
|
||||||
if [ "$version" = "5.3" ]; then
|
if [ "$version" = "5.3" ]; then
|
||||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
|
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension"
|
||||||
else
|
else
|
||||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
|
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension"
|
||||||
fi
|
fi
|
||||||
local exit_code=$?
|
local exit_code=$?
|
||||||
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
|
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
|
||||||
@ -216,7 +218,7 @@ add_pecl_extension() {
|
|||||||
add_log "${tick:?}" "$extension" "Enabled"
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
|
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
|
||||||
pecl_install "$extension$pecl_version" || add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1
|
pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" )
|
||||||
extension_version="$(php -r "echo phpversion('$extension');")"
|
extension_version="$(php -r "echo phpversion('$extension');")"
|
||||||
[ -n "$extension_version" ] && extension_version="-$extension_version"
|
[ -n "$extension_version" ] && extension_version="-$extension_version"
|
||||||
add_extension_log "$extension$extension_version" "Installed and enabled"
|
add_extension_log "$extension$extension_version" "Installed and enabled"
|
||||||
|
|||||||
@ -19,11 +19,11 @@ add_blackfire() {
|
|||||||
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so >/dev/null 2>&1
|
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so
|
||||||
fi
|
fi
|
||||||
if [ -e "${ext_dir:?}/blackfire.so" ]; then
|
if [ -e "${ext_dir:?}/blackfire.so" ]; then
|
||||||
disable_extension xdebug >/dev/null 2>&1
|
disable_extension xdebug
|
||||||
disable_extension pcov >/dev/null 2>&1
|
disable_extension pcov
|
||||||
enable_extension blackfire extension
|
enable_extension blackfire extension
|
||||||
add_extension_log blackfire "$status"
|
add_extension_log blackfire "$status"
|
||||||
else
|
else
|
||||||
|
|||||||
@ -59,9 +59,9 @@ add_couchbase() {
|
|||||||
ext=$(get_couchbase_version)
|
ext=$(get_couchbase_version)
|
||||||
fi
|
fi
|
||||||
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
|
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
|
||||||
add_couchbase_clibs "$ext" >/dev/null 2>&1
|
add_couchbase_clibs "$ext"
|
||||||
else
|
else
|
||||||
add_couchbase_cxxlibs >/dev/null 2>&1
|
add_couchbase_cxxlibs
|
||||||
fi
|
fi
|
||||||
enable_extension "couchbase" "extension"
|
enable_extension "couchbase" "extension"
|
||||||
if check_extension "couchbase"; then
|
if check_extension "couchbase"; then
|
||||||
@ -72,9 +72,9 @@ add_couchbase() {
|
|||||||
n_proc="$(nproc)"
|
n_proc="$(nproc)"
|
||||||
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
|
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
|
||||||
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
|
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
|
||||||
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
|
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl
|
||||||
else
|
else
|
||||||
pecl_install "${ext}" >/dev/null 2>&1
|
pecl_install "${ext}"
|
||||||
fi
|
fi
|
||||||
add_extension_log "couchbase" "Installed and enabled"
|
add_extension_log "couchbase" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -7,15 +7,6 @@ add_license_log() {
|
|||||||
echo "$END_GROUP"
|
echo "$END_GROUP"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup gcc-7 and g++-7
|
|
||||||
setup_compiler() {
|
|
||||||
if ! command -v gcc-7 >/dev/null || ! command -v g++-7 >/dev/null; then
|
|
||||||
add_ppa ubuntu-toolchain-r/test
|
|
||||||
add_packages gcc-7 g++-7 -y
|
|
||||||
fi
|
|
||||||
printf "gcc g++" | xargs -d ' ' -I {} sudo update-alternatives --install /usr/bin/{} {} /usr/bin/{}-7 7
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to set cubrid repo for the extension.
|
# Function to set cubrid repo for the extension.
|
||||||
set_cubrid_repo() {
|
set_cubrid_repo() {
|
||||||
case "${ext:?}" in
|
case "${ext:?}" in
|
||||||
@ -51,7 +42,7 @@ add_cubrid_helper() {
|
|||||||
add_cubrid() {
|
add_cubrid() {
|
||||||
ext=$1
|
ext=$1
|
||||||
status='Enabled'
|
status='Enabled'
|
||||||
add_cubrid_helper "$ext" >/dev/null 2>&1
|
add_cubrid_helper "$ext"
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,9 +39,9 @@ add_event() {
|
|||||||
add_log "${tick:?}" "event" "Enabled"
|
add_log "${tick:?}" "event" "Enabled"
|
||||||
else
|
else
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
|
||||||
add_brew_extension event extension >/dev/null 2>&1
|
add_brew_extension event extension
|
||||||
else
|
else
|
||||||
add_event_helper "$ext" >/dev/null 2>&1
|
add_event_helper "$ext"
|
||||||
fi
|
fi
|
||||||
add_extension_log "event" "Installed and enabled"
|
add_extension_log "event" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -24,7 +24,7 @@ add_firebird_helper() {
|
|||||||
|
|
||||||
add_firebird() {
|
add_firebird() {
|
||||||
if [ "$(uname -s )" = "Darwin" ]; then
|
if [ "$(uname -s )" = "Darwin" ]; then
|
||||||
add_firebird_client_darwin >/dev/null 2>&1
|
add_firebird_client_darwin
|
||||||
fi
|
fi
|
||||||
enable_extension pdo_firebird extension
|
enable_extension pdo_firebird extension
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
@ -32,12 +32,12 @@ add_firebird() {
|
|||||||
status="Installed and enabled"
|
status="Installed and enabled"
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
|
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
|
||||||
add_firebird_helper /usr >/dev/null 2>&1
|
add_firebird_helper /usr
|
||||||
else
|
else
|
||||||
add_pdo_extension firebird >/dev/null 2>&1
|
add_pdo_extension firebird
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
add_firebird_helper /opt/firebird >/dev/null 2>&1
|
add_firebird_helper /opt/firebird
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
add_extension_log pdo_firebird "$status"
|
add_extension_log pdo_firebird "$status"
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
# Helper function to add gearman extension.
|
# Helper function to add gearman extension.
|
||||||
add_gearman_helper() {
|
add_gearman_helper() {
|
||||||
add_ppa ondrej/pkg-gearman
|
|
||||||
install_packages libgearman-dev
|
install_packages libgearman-dev
|
||||||
enable_extension gearman extension
|
enable_extension gearman extension
|
||||||
if ! check_extension gearman; then
|
if ! check_extension gearman; then
|
||||||
status="Installed and enabled"
|
status="Installed and enabled"
|
||||||
if [[ "${version:?}" =~ 5.[3-5] ]]; then
|
if [[ "${version:?}" =~ 5.[3-6] ]]; then
|
||||||
pecl_install gearman-1.1.2
|
pecl_install gearman-1.1.2
|
||||||
|
elif [[ "${version:?}" =~ 7.0 ]]; then
|
||||||
|
pecl_install gearman-2.1.3
|
||||||
else
|
else
|
||||||
install_packages php"${version:?}"-gearman || pecl_install gearman
|
install_packages php"${version:?}"-gearman || pecl_install gearman
|
||||||
fi
|
fi
|
||||||
@ -18,7 +19,7 @@ add_gearman_helper() {
|
|||||||
add_gearman() {
|
add_gearman() {
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
if [ "$(uname -s)" = 'Linux' ]; then
|
if [ "$(uname -s)" = 'Linux' ]; then
|
||||||
add_gearman_helper >/dev/null 2>&1
|
add_gearman_helper
|
||||||
add_extension_log "gearman" "$status"
|
add_extension_log "gearman" "$status"
|
||||||
else
|
else
|
||||||
add_brew_extension gearman extension
|
add_brew_extension gearman extension
|
||||||
|
|||||||
@ -11,7 +11,7 @@ add_geos() {
|
|||||||
if check_extension "geos"; then
|
if check_extension "geos"; then
|
||||||
add_log "${tick:?}" "geos" "Enabled"
|
add_log "${tick:?}" "geos" "Enabled"
|
||||||
else
|
else
|
||||||
add_geos_helper >/dev/null 2>&1
|
add_geos_helper
|
||||||
add_extension_log "geos" "Installed and enabled"
|
add_extension_log "geos" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,12 +40,12 @@ Function Repair-ICU() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Http() {
|
Function Add-Http() {
|
||||||
Add-Extension iconv >$null 2>&1
|
Add-Extension iconv
|
||||||
Add-Extension raphf >$null 2>&1
|
Add-Extension raphf
|
||||||
if($version -lt '8.0') {
|
if($version -lt '8.0') {
|
||||||
Add-Extension propro >$null 2>&1
|
Add-Extension propro
|
||||||
}
|
}
|
||||||
Add-Extension pecl_http >$null 2>&1
|
Add-Extension pecl_http
|
||||||
Repair-ICU
|
Repair-ICU
|
||||||
Add-ExtensionLog http "Installed and enabled"
|
Add-ExtensionLog http "Installed and enabled"
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ add_http_latest() {
|
|||||||
if [ "$os" = "Linux" ]; then
|
if [ "$os" = "Linux" ]; then
|
||||||
add_http_dependencies
|
add_http_dependencies
|
||||||
package="php$version-http"
|
package="php$version-http"
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
|
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
|
||||||
else
|
else
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
||||||
@ -103,9 +103,9 @@ add_http() {
|
|||||||
ext=$1
|
ext=$1
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
||||||
add_http_latest >/dev/null 2>&1
|
add_http_latest
|
||||||
else
|
else
|
||||||
add_http_version "$ext" >/dev/null 2>&1
|
add_http_version "$ext"
|
||||||
fi
|
fi
|
||||||
add_extension_log "http" "$status"
|
add_extension_log "http" "$status"
|
||||||
}
|
}
|
||||||
|
|||||||
56
src/scripts/extensions/ibm.ps1
Normal file
56
src/scripts/extensions/ibm.ps1
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# Function to log license information for ibm extensions.
|
||||||
|
Function Add-LicenseLog() {
|
||||||
|
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
|
||||||
|
printf "IBM Db2 ODBC and CLI Driver is required for %s extension.\n" $extension
|
||||||
|
printf "It is provided under the IBM International Program License Agreement.\n"
|
||||||
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.ibm.com/support/pages/db2-odbc-cli-driver-download-and-installation-information"
|
||||||
|
$licensePath = "$php_dir\clidriver\license\odbc_notices.rtf"
|
||||||
|
if (Test-Path $licensePath) {
|
||||||
|
Add-Type -AssemblyName System.Windows.Forms
|
||||||
|
$rtBox = New-Object System.Windows.Forms.RichTextBox
|
||||||
|
$rtBox.Rtf = [System.IO.File]::ReadAllText($licensePath);
|
||||||
|
Write-Host $rtBox.Text;
|
||||||
|
}
|
||||||
|
Write-Output "$env:END_GROUP"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install IBM Db2 CLI driver.
|
||||||
|
Function Add-IbmCli() {
|
||||||
|
$cliPath = "$php_dir\clidriver"
|
||||||
|
if (-not (Test-Path "$cliPath\bin")) {
|
||||||
|
$suffix = if ($arch -eq 'x86') { 'nt32' } else { 'ntx64' }
|
||||||
|
$archive = "$suffix`_odbc_cli.zip"
|
||||||
|
$destination = "$ENV:RUNNER_TOOL_CACHE\ibm_cli.zip"
|
||||||
|
Get-File -Url "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/$archive" -OutFile $destination > $null 2>&1
|
||||||
|
Expand-Archive -Path $destination -DestinationPath $php_dir -Force > $null 2>&1
|
||||||
|
}
|
||||||
|
$env:IBM_DB_HOME = $cliPath
|
||||||
|
$env:LD_LIBRARY_PATH = "$cliPath\bin;$cliPath\lib;$env:LD_LIBRARY_PATH"
|
||||||
|
Add-Path "$cliPath\bin"
|
||||||
|
$env:PATH = "$cliPath\bin;$env:PATH"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install ibm_db2 and pdo_ibm.
|
||||||
|
Function Add-Ibm() {
|
||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[ValidateSet('ibm_db2', 'pdo_ibm')]
|
||||||
|
[string]
|
||||||
|
$extension
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
$status = 'Enabled'
|
||||||
|
Add-IbmCli
|
||||||
|
if (Test-Path "$ext_dir\php_$extension.dll") {
|
||||||
|
Enable-PhpExtension -Extension $extension -Path $php_dir
|
||||||
|
} else {
|
||||||
|
Add-Extension $extension
|
||||||
|
$status = 'Installed and enabled'
|
||||||
|
}
|
||||||
|
Add-ExtensionLog $extension $status
|
||||||
|
Add-LicenseLog
|
||||||
|
} catch {
|
||||||
|
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
|
||||||
|
}
|
||||||
|
}
|
||||||
106
src/scripts/extensions/ibm.sh
Normal file
106
src/scripts/extensions/ibm.sh
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
# Function to log license details for ibm extensions.
|
||||||
|
add_license_log() {
|
||||||
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
||||||
|
printf "IBM Db2 ODBC and CLI Driver is required for %s extension.\n" "$ext"
|
||||||
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.ibm.com/support/pages/db2-odbc-cli-driver-download-and-installation-information"
|
||||||
|
local license_file="$ibm_cli/license/odbc_notices.txt"
|
||||||
|
if [ -f "$license_file" ]; then
|
||||||
|
cat "$license_file"
|
||||||
|
fi
|
||||||
|
echo "$END_GROUP"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to determine the driver archive for the current platform.
|
||||||
|
get_cli_archive() {
|
||||||
|
local os=$1
|
||||||
|
local arch=$2
|
||||||
|
case $os in
|
||||||
|
Linux)
|
||||||
|
case $arch in
|
||||||
|
x86_64|amd64) echo "linuxx64_odbc_cli.tar.gz";;
|
||||||
|
i?86) echo "linuxia32_odbc_cli.tar.gz";;
|
||||||
|
*) return 1;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
Darwin)
|
||||||
|
case $arch in
|
||||||
|
x86_64) echo "macos64_odbc_cli.tar.gz";;
|
||||||
|
arm64|aarch64) echo "macarm64_odbc_cli.tar.gz";;
|
||||||
|
*) return 1;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install IBM Db2 CLI driver.
|
||||||
|
add_cli_driver() {
|
||||||
|
local os arch archive url tmp libs
|
||||||
|
if [ -d "$ibm_cli" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
os=$(uname -s)
|
||||||
|
arch=$(uname -m)
|
||||||
|
archive=$(get_cli_archive "$os" "$arch") || return 1
|
||||||
|
url="https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/$archive"
|
||||||
|
tmp=/tmp/$archive
|
||||||
|
get -q -n "$tmp" "$url"
|
||||||
|
sudo mkdir -p "$ibm_home"
|
||||||
|
sudo tar -xzf "$tmp" -C "$ibm_home"
|
||||||
|
sudo rm -f "$tmp"
|
||||||
|
if [ ! -d "$ibm_cli" ]; then
|
||||||
|
local extracted
|
||||||
|
extracted=$(find "$ibm_home" -maxdepth 1 -type d -name 'clidriver*' | head -n 1)
|
||||||
|
[ -n "$extracted" ] && sudo mv "$extracted" "$ibm_cli"
|
||||||
|
fi
|
||||||
|
if [ "$os" = "Linux" ]; then
|
||||||
|
echo "$ibm_cli/lib" | sudo tee /etc/ld.so.conf.d/ibm_db2.conf >/dev/null
|
||||||
|
sudo ldconfig
|
||||||
|
else
|
||||||
|
libs='/usr/local/lib'
|
||||||
|
sudo mkdir -p "$libs"
|
||||||
|
sudo ln -sf "$ibm_cli"/lib/*.dylib "$libs" || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install ibm_db2 and pdo_ibm.
|
||||||
|
add_ibm_helper() {
|
||||||
|
if ! shared_extension "$ext"; then
|
||||||
|
status='Installed and enabled'
|
||||||
|
export IBM_DB_HOME="$ibm_cli"
|
||||||
|
export LD_LIBRARY_PATH="$IBM_DB_HOME/lib"
|
||||||
|
add_env DYLD_LIBRARY_PATH "$IBM_DB_HOME/lib"
|
||||||
|
local configure_flag
|
||||||
|
if [ "$ext" = 'ibm_db2' ]; then
|
||||||
|
configure_flag="--with-IBM_DB2=$IBM_DB_HOME"
|
||||||
|
else
|
||||||
|
configure_flag="--with-pdo-ibm=$IBM_DB_HOME"
|
||||||
|
fi
|
||||||
|
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) $configure_flag"
|
||||||
|
patch_phpize
|
||||||
|
add_extension_from_source "$ext" https://github.com php "pecl-database-$ext" master extension get
|
||||||
|
restore_phpize
|
||||||
|
else
|
||||||
|
enable_extension "$ext" extension
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to add ibm_db2 and pdo_ibm.
|
||||||
|
add_ibm() {
|
||||||
|
ext=$1
|
||||||
|
status='Enabled'
|
||||||
|
ibm_home='/opt/ibm'
|
||||||
|
ibm_cli=$ibm_home/clidriver
|
||||||
|
if ! add_cli_driver ; then
|
||||||
|
add_log "${cross:?}" "$ext" "IBM Db2 CLI driver is not available on $(uname -s)/$(uname -m)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
add_ibm_helper
|
||||||
|
add_extension_log "$ext" "$status"
|
||||||
|
check_extension "$ext" && add_license_log
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck source=.
|
||||||
|
. "${scripts:?}"/extensions/patches/phpize.sh
|
||||||
@ -11,13 +11,14 @@ install_icu() {
|
|||||||
# Function to add ext-intl with the given version of ICU
|
# Function to add ext-intl with the given version of ICU
|
||||||
add_intl() {
|
add_intl() {
|
||||||
icu=$(echo "$1" | cut -d'-' -f 2)
|
icu=$(echo "$1" | cut -d'-' -f 2)
|
||||||
supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases | grep -Po "${icu//./\\.}" | head -n 1)
|
supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases/tags/intl-"$icu" | grep -Po "php${version?}-intl-$icu" | head -n 1)
|
||||||
if [ "$icu" != "$supported_version" ]; then
|
[ -z "$supported_version" ] && supported_version=$(get -s -n "" https://github.com/shivammathur/icu-intl/releases/expanded_assets/intl-"$icu" | grep -Po "php$version-intl-$icu" | head -n 1)
|
||||||
add_log "${cross:?}" "intl" "ICU $icu is not supported"
|
if [ "php$version-intl-$icu" != "$supported_version" ]; then
|
||||||
|
add_log "${cross:?}" "intl" "ICU $icu is not supported for PHP $version"
|
||||||
else
|
else
|
||||||
[ "${ts:?}" = 'zts' ] && suffix='-zts'
|
[ "${ts:?}" = 'zts' ] && suffix='-zts'
|
||||||
install_icu "$icu" >/dev/null 2>&1
|
install_icu "$icu"
|
||||||
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix$arch_suffix.so"
|
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl-$icu/php${version:?}-intl-$icu$suffix$arch_suffix.so"
|
||||||
enable_extension intl extension
|
enable_extension intl extension
|
||||||
add_extension_log intl "Installed and enabled with ICU $icu"
|
add_extension_log intl "Installed and enabled with ICU $icu"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -24,10 +24,10 @@ add_ioncube() {
|
|||||||
if [ -e "$loader_file" ]; then
|
if [ -e "$loader_file" ]; then
|
||||||
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
|
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
|
||||||
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
|
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
|
||||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
|
||||||
fi
|
fi
|
||||||
add_extension_log "ioncube" "$status"
|
add_extension_log "ioncube" "$status"
|
||||||
check_extension "ioncube" && add_license_log
|
check_extension "ioncube" && add_license_log
|
||||||
|
|||||||
@ -71,7 +71,7 @@ Function Add-Oci() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
Add-ExtensionLog $extension $status
|
Add-ExtensionLog $extension $status
|
||||||
Add-LicenseLog
|
Add-LicenseLog
|
||||||
|
|||||||
@ -71,8 +71,8 @@ add_oci() {
|
|||||||
oracle_home='/opt/oracle'
|
oracle_home='/opt/oracle'
|
||||||
oracle_client=$oracle_home/instantclient
|
oracle_client=$oracle_home/instantclient
|
||||||
os=$(uname -s)
|
os=$(uname -s)
|
||||||
add_client >/dev/null 2>&1
|
add_client
|
||||||
add_oci_helper >/dev/null 2>&1
|
add_oci_helper
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
|||||||
5
src/scripts/extensions/patches/amqp.sh
Normal file
5
src/scripts/extensions/patches/amqp.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
patch_amqp() {
|
||||||
|
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
|
||||||
|
get -q -n amqp_connection_resource.c https://raw.githubusercontent.com/remicollet/php-amqp/977449987412a3d5c59a036dbab8b6d67764bb3e/amqp_connection_resource.c
|
||||||
|
fi
|
||||||
|
}
|
||||||
@ -1,12 +1,35 @@
|
|||||||
process_file() {
|
patch_84() {
|
||||||
local file=$1
|
sed -i.bak \
|
||||||
sed -i'' -e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//\#include <ext\/random\/php_random.h>/' "$file"
|
-e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//#include <ext\/random\/php_random.h>/' \
|
||||||
sed -i'' -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' "$file"
|
-e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' \
|
||||||
|
"$1" && rm -rf *.bak
|
||||||
}
|
}
|
||||||
|
|
||||||
export -f process_file
|
patch_85() {
|
||||||
|
sed -i.bak \
|
||||||
|
-e 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#g' \
|
||||||
|
-e 's#ext/standard/php_smart_string_public.h#Zend/zend_smart_string.h#g' \
|
||||||
|
-e 's#zend_exception_get_default(TSRMLS_C)#zend_ce_exception#g' \
|
||||||
|
-e 's#zend_exception_get_default()#zend_ce_exception#g' \
|
||||||
|
"$1" && rm -rf *.bak
|
||||||
|
}
|
||||||
|
|
||||||
# Compare with 8.3 so it runs only on 8.4 and above
|
version_ge() {
|
||||||
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
ver=$1
|
||||||
find . -type f \( -name "*.c" -o -name "*.h" \) -exec bash -c 'process_file "$0"' {} \;
|
min=$2
|
||||||
|
[[ $(printf '%s\n%s\n' "$ver" "$min" | sort -V | head -n1) == "$min" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
if version_ge "${version:?}" "8.4"; then
|
||||||
|
while IFS= read -r file; do
|
||||||
|
patch_84 "$file"
|
||||||
|
done < <(grep -rlE 'php_lcg\.h|php_mt_rand\.h|php_rand\.h|standard/php_random\.h' \
|
||||||
|
--include='*.c' --include='*.h' . || true)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if version_ge "${version:?}" "8.5"; then
|
||||||
|
while IFS= read -r file; do
|
||||||
|
patch_85 "$file"
|
||||||
|
done < <(grep -rlE 'ext/standard/php_smart_string(_public)?\.h|zend_exception_get_default' \
|
||||||
|
--include='*.c' --include='*.h' . || true)
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
patch_geos() {
|
patch_geos() {
|
||||||
if [ "$(php -r "echo PHP_VERSION_ID;")" -ge 70000 ]; 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://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
patch_pdo_oci() {
|
patch_pdo_oci() {
|
||||||
get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
|
get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
|
||||||
|
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
|
||||||
|
get -q -n pdo_oci.c https://raw.githubusercontent.com/shivammathur/pecl-database-pdo_oci/a9cf2c53b6de46f9e5f523bcd11fd344e3beeb85/pdo_oci.c
|
||||||
|
fi
|
||||||
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
||||||
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
||||||
fi
|
fi
|
||||||
|
|||||||
5
src/scripts/extensions/patches/pdo_sqlsrv.sh
Normal file
5
src/scripts/extensions/patches/pdo_sqlsrv.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
|
||||||
|
sed -i.bak -e 's/zval_ptr_dtor( &dbh->query_stmt_zval );/OBJ_RELEASE(dbh->query_stmt_obj);dbh->query_stmt_obj = NULL;/' php_pdo_sqlsrv_int.h
|
||||||
|
sed -i.bak -e 's/pdo_error_mode prev_err_mode/uint8_t prev_err_mode/g' pdo_dbh.cpp
|
||||||
|
rm -rf *.bak
|
||||||
|
fi
|
||||||
@ -3,7 +3,8 @@ get_phpize() {
|
|||||||
if [[ "${version:?}" =~ 5.[3-5] ]]; then
|
if [[ "${version:?}" =~ 5.[3-5] ]]; then
|
||||||
echo '/opt/local/bin/phpize'
|
echo '/opt/local/bin/phpize'
|
||||||
else
|
else
|
||||||
echo "/usr/local/bin/$(readlink /usr/local/bin/phpize)"
|
[ -n "$brew_prefix" ] && phpize_dir="$brew_prefix" || phpize_dir="/usr/local/bin"
|
||||||
|
echo "${phpize_dir}/bin/$(readlink ${phpize_dir}/bin/phpize)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ add_phalcon_helper() {
|
|||||||
add_brew_extension "$extension" extension
|
add_brew_extension "$extension" extension
|
||||||
else
|
else
|
||||||
package="php${version:?}-$extension"
|
package="php${version:?}-$extension"
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
[[ "$extension" =~ phalcon[4|5] ]] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
[[ "$extension" =~ phalcon[4|5] ]] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
||||||
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
|
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
|
||||||
fi
|
fi
|
||||||
@ -94,7 +94,7 @@ add_phalcon() {
|
|||||||
[ "$extension" = "phalcon" ] && extension=phalcon5
|
[ "$extension" = "phalcon" ] && extension=phalcon5
|
||||||
extension_major_version=${extension: -1}
|
extension_major_version=${extension: -1}
|
||||||
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
||||||
add_phalcon"$extension_major_version" >/dev/null 2>&1
|
add_phalcon"$extension_major_version"
|
||||||
fi
|
fi
|
||||||
add_extension_log "phalcon" "$status"
|
add_extension_log "phalcon" "$status"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,9 @@
|
|||||||
get_relay_version() {
|
get_relay_version() {
|
||||||
local ext=$1
|
local ext=$1
|
||||||
if [[ "$ext" =~ ^relay$ ]]; then
|
if [[ "$ext" =~ ^relay$ ]]; then
|
||||||
if [ "${version:?}" = "7.4" ]; then
|
get -s -n "" "${relay_release:?}"
|
||||||
echo 'v0.7.0'
|
elif [[ $ext =~ ^relay-nightly$ ]]; then
|
||||||
else
|
echo "dev"
|
||||||
get -s -n "" "${relay_releases:?}"/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
relay_version="${ext##*-}"
|
relay_version="${ext##*-}"
|
||||||
echo "v${relay_version/v//}"
|
echo "v${relay_version/v//}"
|
||||||
@ -48,14 +46,6 @@ change_library_paths() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Link hiredis library
|
|
||||||
link_hiredis() {
|
|
||||||
lib_dir="${brew_prefix:?}"/opt/hiredis/lib
|
|
||||||
if [ -e "$lib_dir"/libhiredis_ssl.1.1.0.dylib ]; then
|
|
||||||
sudo ln -sf "$lib_dir"/libhiredis_ssl.1.1.0.dylib "$lib_dir"/libhiredis_ssl.dylib.1.1.0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add relay dependencies
|
# Add relay dependencies
|
||||||
add_relay_dependencies() {
|
add_relay_dependencies() {
|
||||||
add_extension json
|
add_extension json
|
||||||
@ -64,8 +54,7 @@ add_relay_dependencies() {
|
|||||||
if [ "$os" = "Darwin" ]; then
|
if [ "$os" = "Darwin" ]; then
|
||||||
. "${0%/*}"/tools/brew.sh
|
. "${0%/*}"/tools/brew.sh
|
||||||
configure_brew
|
configure_brew
|
||||||
brew install hiredis lz4 zstd concurrencykit
|
brew install lz4 hiredis zstd concurrencykit
|
||||||
link_hiredis
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +108,7 @@ configure_relay() {
|
|||||||
|
|
||||||
# Helper function to add relay extension
|
# Helper function to add relay extension
|
||||||
add_relay_helper() {
|
add_relay_helper() {
|
||||||
arch="$(uname -m | sed 's/_/-/')"
|
local arch=$1
|
||||||
os_suffix="$(get_os_suffix)"
|
os_suffix="$(get_os_suffix)"
|
||||||
openssl_suffix="$(get_openssl_suffix)"
|
openssl_suffix="$(get_openssl_suffix)"
|
||||||
artifact_file_name="relay-$relay_version-php${version:?}-$os_suffix-$arch$openssl_suffix.tar.gz"
|
artifact_file_name="relay-$relay_version-php${version:?}-$os_suffix-$arch$openssl_suffix.tar.gz"
|
||||||
@ -143,17 +132,24 @@ add_relay() {
|
|||||||
local ext=$1
|
local ext=$1
|
||||||
local arch
|
local arch
|
||||||
local url
|
local url
|
||||||
|
local message
|
||||||
|
local error
|
||||||
os=$(uname -s)
|
os=$(uname -s)
|
||||||
relay_releases=https://github.com/cachewerk/relay/releases
|
arch="$(uname -m | sed 's/_/-/')"
|
||||||
|
relay_release=https://builds.r2.relay.so/meta/latest
|
||||||
relay_trunk=https://builds.r2.relay.so
|
relay_trunk=https://builds.r2.relay.so
|
||||||
|
if [[ "$arch" = "x86-64" && "$os" = "Darwin" ]]; then
|
||||||
|
error="Relay extension is not available for macOS x86_64 architecture"
|
||||||
|
else
|
||||||
relay_version=$(get_relay_version "$ext")
|
relay_version=$(get_relay_version "$ext")
|
||||||
add_relay_dependencies >/dev/null 2>&1
|
add_relay_dependencies
|
||||||
if shared_extension relay; then
|
if shared_extension relay; then
|
||||||
message="Enabled"
|
message="Enabled"
|
||||||
else
|
else
|
||||||
add_relay_helper >/dev/null 2>&1
|
add_relay_helper "$arch"
|
||||||
message="Installed and enabled"
|
message="Installed and enabled ${relay_version}"
|
||||||
fi
|
fi
|
||||||
configure_relay >/dev/null 2>&1
|
configure_relay
|
||||||
add_extension_log relay "$message"
|
fi
|
||||||
|
add_extension_log relay "$message" "$error"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
os="$(uname -s)"
|
||||||
|
os_lower=$(echo "$os" | tr '[:upper:]' '[:lower:]')
|
||||||
|
os_capital=$(echo "$os" | tr '[:lower:]' '[:upper:]')
|
||||||
|
|
||||||
# Function to parse extension environment variables
|
# Function to parse extension environment variables
|
||||||
parse_args() {
|
parse_args() {
|
||||||
local extension=${1%-*}
|
local extension=${1%-*}
|
||||||
@ -36,7 +40,7 @@ add_lib_log() {
|
|||||||
# Function to check if a library is installed
|
# Function to check if a library is installed
|
||||||
check_lib() {
|
check_lib() {
|
||||||
local lib=$1
|
local lib=$1
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$os" = "Linux" ]; then
|
||||||
[ "x$(dpkg -s "$lib" 2>/dev/null | grep Status)" != "x" ]
|
[ "x$(dpkg -s "$lib" 2>/dev/null | grep Status)" != "x" ]
|
||||||
else
|
else
|
||||||
[ "x$(find "${brew_prefix:?}"/Cellar -maxdepth 1 -name "$lib")" != "x" ]
|
[ "x$(find "${brew_prefix:?}"/Cellar -maxdepth 1 -name "$lib")" != "x" ]
|
||||||
@ -47,7 +51,7 @@ check_lib() {
|
|||||||
add_linux_libs() {
|
add_linux_libs() {
|
||||||
local lib=$1
|
local lib=$1
|
||||||
if ! check_lib "$lib"; then
|
if ! check_lib "$lib"; then
|
||||||
install_packages "$lib" >/dev/null 2>&1 || true
|
install_packages "$lib" || true
|
||||||
fi
|
fi
|
||||||
add_lib_log "$lib"
|
add_lib_log "$lib"
|
||||||
}
|
}
|
||||||
@ -56,9 +60,9 @@ add_linux_libs() {
|
|||||||
add_darwin_libs() {
|
add_darwin_libs() {
|
||||||
local lib=$1
|
local lib=$1
|
||||||
if ! check_lib "$lib"; then
|
if ! check_lib "$lib"; then
|
||||||
brew install "$lib" >/dev/null 2>&1 || true
|
brew install "$lib" || true
|
||||||
if [[ "$lib" = *@* ]]; then
|
if [[ "$lib" = *@* ]]; then
|
||||||
brew link --overwrite --force "$lib" >/dev/null 2>&1 || true
|
brew link --overwrite --force "$lib" || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
add_lib_log "$lib"
|
add_lib_log "$lib"
|
||||||
@ -68,7 +72,7 @@ add_darwin_libs() {
|
|||||||
add_libs() {
|
add_libs() {
|
||||||
local all_libs=("$@")
|
local all_libs=("$@")
|
||||||
for lib in "${all_libs[@]}"; do
|
for lib in "${all_libs[@]}"; do
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$os" = "Linux" ]; then
|
||||||
add_linux_libs "$lib"
|
add_linux_libs "$lib"
|
||||||
else
|
else
|
||||||
add_darwin_libs "$lib"
|
add_darwin_libs "$lib"
|
||||||
@ -76,15 +80,30 @@ add_libs() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to get required libraries for an extension
|
||||||
|
get_libraries() {
|
||||||
|
local extension=$1
|
||||||
|
{
|
||||||
|
parse_args "$extension" LIBS
|
||||||
|
parse_args "$extension" "$os_capital"_LIBS
|
||||||
|
[ -r "${src:?}/configs/${os_lower}_libs" ] && \
|
||||||
|
grep -E "^[[:space:]]*${extension}[[:space:]]*=" "${src:?}/configs/${os_lower}_libs" | \
|
||||||
|
head -n1 | \
|
||||||
|
sed -E "s/^[[:space:]]*${extension}[[:space:]]*=[[:space:]]*//"
|
||||||
|
} | xargs -n 1 2>/dev/null | sort -u | xargs 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
# Function to run command in a group
|
# Function to run command in a group
|
||||||
run_group() {
|
run_group() {
|
||||||
local command=$1
|
local command=$1
|
||||||
local log=$2
|
local log=$2
|
||||||
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
|
echo "$command" | sudo tee ./run_group.sh
|
||||||
echo "$GROUP$log"
|
echo "$GROUP$log"
|
||||||
. ./run_group.sh
|
. ./run_group.sh
|
||||||
|
local status=$?
|
||||||
rm ./run_group.sh
|
rm ./run_group.sh
|
||||||
echo "$END_GROUP"
|
echo "$END_GROUP"
|
||||||
|
return $status
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_extension() {
|
patch_extension() {
|
||||||
@ -117,9 +136,10 @@ fetch_extension() {
|
|||||||
elif [ "$fetch" = "pecl" ]; then
|
elif [ "$fetch" = "pecl" ]; then
|
||||||
source="pecl"
|
source="pecl"
|
||||||
pecl_name=${extension/http/pecl_http}
|
pecl_name=${extension/http/pecl_http}
|
||||||
get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz
|
capital_pecl_name=$(echo "$pecl_name" | tr '[:lower:]' '[:upper:]')
|
||||||
|
get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz https://pecl.php.net/get/"$capital_pecl_name"-"$release".tgz
|
||||||
tar -xzf /tmp/"$pecl_name".tgz -C /tmp
|
tar -xzf /tmp/"$pecl_name".tgz -C /tmp
|
||||||
cd /tmp/"$pecl_name"-"$release" || exit
|
cd /tmp/"$pecl_name"-"$release" 2>/dev/null || cd /tmp/"$capital_pecl_name"-"$release" 2>/dev/null || exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,14 +154,14 @@ add_extension_from_source() {
|
|||||||
local fetch=${7:-clone}
|
local fetch=${7:-clone}
|
||||||
slug="$extension-$release"
|
slug="$extension-$release"
|
||||||
source="$url/$org/$repo"
|
source="$url/$org/$repo"
|
||||||
libraries="$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
libraries="$(get_libraries "$extension")"
|
||||||
opts="$(parse_args "$extension" CONFIGURE_OPTS)"
|
opts="$(parse_args "$extension" CONFIGURE_OPTS)"
|
||||||
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
|
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
|
||||||
suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
||||||
sub_dir="$(parse_args "$extension" PATH)"
|
sub_dir="$(parse_args "$extension" PATH)"
|
||||||
step_log "Setup $slug"
|
step_log "Setup $slug"
|
||||||
(
|
(
|
||||||
add_devtools phpize >/dev/null 2>&1
|
add_devtools phpize
|
||||||
disable_extension_helper "$extension"
|
disable_extension_helper "$extension"
|
||||||
fetch_extension "$extension" "$fetch"
|
fetch_extension "$extension" "$fetch"
|
||||||
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
|
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
|
||||||
@ -149,11 +169,11 @@ add_extension_from_source() {
|
|||||||
else
|
else
|
||||||
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
||||||
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
||||||
patch_extension "$extension" >/dev/null 2>&1
|
patch_extension "$extension"
|
||||||
run_group "phpize" "phpize"
|
run_group "phpize" "phpize" && \
|
||||||
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
|
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure" && \
|
||||||
run_group "sudo $prefix_opts make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make"
|
run_group "sudo $prefix_opts make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make" && \
|
||||||
run_group "sudo make install" "make install"
|
run_group "sudo make install" "make install" && \
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|||||||
@ -67,10 +67,10 @@ Function Add-Sqlsrv() {
|
|||||||
Add-ExtensionFromGithub $extension > $null 2>&1
|
Add-ExtensionFromGithub $extension > $null 2>&1
|
||||||
} catch {}
|
} catch {}
|
||||||
if (-not(Test-Extension $extension)) {
|
if (-not(Test-Extension $extension)) {
|
||||||
Add-SqlsrvFromMSGithub $extension >$null 2>&1
|
Add-SqlsrvFromMSGithub $extension
|
||||||
}
|
}
|
||||||
if (-not(Test-Extension $extension)) {
|
if (-not(Test-Extension $extension)) {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,7 +77,7 @@ Function Add-ZephirParser() {
|
|||||||
try {
|
try {
|
||||||
Add-ZephirParserFromGitHub $extension
|
Add-ZephirParserFromGitHub $extension
|
||||||
} catch {
|
} catch {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Add-ExtensionLog zephir_parser $status
|
Add-ExtensionLog zephir_parser $status
|
||||||
|
|||||||
@ -33,7 +33,7 @@ add_zephir_parser() {
|
|||||||
zp_releases=https://github.com/"$repo"/releases
|
zp_releases=https://github.com/"$repo"/releases
|
||||||
if ! shared_extension zephir_parser; then
|
if ! shared_extension zephir_parser; then
|
||||||
message='Installed and enabled'
|
message='Installed and enabled'
|
||||||
add_zephir_parser_helper "$ext" >/dev/null 2>&1
|
add_zephir_parser_helper "$ext"
|
||||||
else
|
else
|
||||||
message='Enabled'
|
message='Enabled'
|
||||||
enable_extension zephir_parser extension
|
enable_extension zephir_parser extension
|
||||||
|
|||||||
@ -20,22 +20,23 @@ self_hosted_helper() {
|
|||||||
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
||||||
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
||||||
fi
|
fi
|
||||||
|
sudo mkdir -p /opt/hostedtoolcache || true
|
||||||
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
|
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to fix broken packages.
|
# Function to fix broken packages.
|
||||||
fix_broken_packages() {
|
fix_broken_packages() {
|
||||||
sudo apt --fix-broken install >/dev/null 2>&1
|
sudo apt --fix-broken install
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install a package
|
# Function to install a package
|
||||||
install_packages() {
|
install_packages() {
|
||||||
packages=("$@")
|
packages=("$@")
|
||||||
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
|
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
|
||||||
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew >/dev/null 2>&1
|
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew
|
||||||
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
|
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
|
||||||
fi
|
fi
|
||||||
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
|
$apt_install "${packages[@]}" || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" )
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to disable an extension.
|
# Function to disable an extension.
|
||||||
@ -47,10 +48,10 @@ disable_extension_helper() {
|
|||||||
disable_extension_dependents "$extension"
|
disable_extension_dependents "$extension"
|
||||||
fi
|
fi
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "${ini_file[@]}" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "${ini_file[@]}" "$pecl_file"
|
||||||
sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
|
sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
|
||||||
sudo rm -f /tmp/php"$version"_extensions
|
sudo rm -f /tmp/php"$version"_extensions
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
|
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add PDO extension.
|
# Function to add PDO extension.
|
||||||
@ -63,7 +64,7 @@ add_pdo_extension() {
|
|||||||
ext_name=$1
|
ext_name=$1
|
||||||
if shared_extension pdo; then
|
if shared_extension pdo; then
|
||||||
disable_extension_helper pdo
|
disable_extension_helper pdo
|
||||||
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}"
|
||||||
fi
|
fi
|
||||||
if [ "$ext" = "mysql" ]; then
|
if [ "$ext" = "mysql" ]; then
|
||||||
enable_extension "mysqlnd" "extension"
|
enable_extension "mysqlnd" "extension"
|
||||||
@ -71,15 +72,15 @@ add_pdo_extension() {
|
|||||||
elif [ "$ext" = "dblib" ]; then
|
elif [ "$ext" = "dblib" ]; then
|
||||||
ext_name="sybase"
|
ext_name="sybase"
|
||||||
elif [ "$ext" = "firebird" ]; then
|
elif [ "$ext" = "firebird" ]; then
|
||||||
install_packages libfbclient2 >/dev/null 2>&1
|
install_packages libfbclient2
|
||||||
enable_extension "pdo_firebird" "extension"
|
enable_extension "pdo_firebird" "extension"
|
||||||
ext_name="interbase"
|
ext_name="interbase"
|
||||||
elif [ "$ext" = "sqlite" ]; then
|
elif [ "$ext" = "sqlite" ]; then
|
||||||
ext="sqlite3"
|
ext="sqlite3"
|
||||||
ext_name="sqlite3"
|
ext_name="sqlite3"
|
||||||
fi
|
fi
|
||||||
add_extension "$ext_name" "extension" >/dev/null 2>&1
|
add_extension "$ext_name" "extension"
|
||||||
add_extension "$pdo_ext" "extension" >/dev/null 2>&1
|
add_extension "$pdo_ext" "extension"
|
||||||
add_extension_log "$pdo_ext" "Enabled"
|
add_extension_log "$pdo_ext" "Enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -93,7 +94,7 @@ check_package() {
|
|||||||
add_extension_helper() {
|
add_extension_helper() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
packages=(php"$version"-"$extension")
|
packages=(php"$version"-"$extension")
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
||||||
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
|
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
@ -107,7 +108,7 @@ add_devtools() {
|
|||||||
install_packages "php$version-dev"
|
install_packages "php$version-dev"
|
||||||
fi
|
fi
|
||||||
switch_version "phpize" "php-config"
|
switch_version "phpize" "php-config"
|
||||||
add_extension xml extension >/dev/null 2>&1
|
add_extension xml extension
|
||||||
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,11 +129,11 @@ setup_cached_versions() {
|
|||||||
|
|
||||||
# Function to add PECL.
|
# Function to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
add_devtools phpize >/dev/null 2>&1
|
add_devtools phpize
|
||||||
if ! command -v pecl >/dev/null; then
|
if ! command -v pecl >/dev/null; then
|
||||||
install_packages php-pear
|
install_packages php-pear
|
||||||
fi
|
fi
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl
|
||||||
pear_version=$(get_tool_version "pecl" "version")
|
pear_version=$(get_tool_version "pecl" "version")
|
||||||
add_log "${tick:?}" "PECL" "Added PECL $pear_version"
|
add_log "${tick:?}" "PECL" "Added PECL $pear_version"
|
||||||
}
|
}
|
||||||
@ -166,7 +167,7 @@ get_php_packages() {
|
|||||||
|
|
||||||
# Function to install packaged PHP
|
# Function to install packaged PHP
|
||||||
add_packaged_php() {
|
add_packaged_php() {
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
||||||
install_packages "${packages[@]}"
|
install_packages "${packages[@]}"
|
||||||
}
|
}
|
||||||
@ -190,7 +191,7 @@ add_php() {
|
|||||||
setup_php_builder
|
setup_php_builder
|
||||||
else
|
else
|
||||||
add_packaged_php
|
add_packaged_php
|
||||||
switch_version >/dev/null 2>&1
|
switch_version
|
||||||
add_pecl
|
add_pecl
|
||||||
fi
|
fi
|
||||||
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
@ -203,7 +204,7 @@ add_php() {
|
|||||||
|
|
||||||
# Function to ini file for pear and link it to each SAPI.
|
# Function to ini file for pear and link it to each SAPI.
|
||||||
link_pecl_file() {
|
link_pecl_file() {
|
||||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
echo '' | sudo tee "$pecl_file"
|
||||||
for file in "${ini_file[@]}"; do
|
for file in "${ini_file[@]}"; do
|
||||||
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
|
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
|
||||||
if [ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ]; then
|
if [ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ]; then
|
||||||
@ -236,9 +237,9 @@ add_php_config() {
|
|||||||
elif [ "$ini" = "development" ]; then
|
elif [ "$ini" = "development" ]; then
|
||||||
echo "${ini_file[@]}" | xargs -n 1 -P 6 sudo cp "$php_lib_dir"/php.ini-development
|
echo "${ini_file[@]}" | xargs -n 1 -P 6 sudo cp "$php_lib_dir"/php.ini-development
|
||||||
elif [ "$ini" = "none" ]; then
|
elif [ "$ini" = "none" ]; then
|
||||||
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
|
echo '' | sudo tee "${ini_file[@]}"
|
||||||
fi
|
fi
|
||||||
echo "$ini" | sudo tee "$current_ini" >/dev/null 2>&1
|
echo "$ini" | sudo tee "$current_ini"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to Setup PHP
|
# Function to Setup PHP
|
||||||
@ -249,13 +250,13 @@ setup_php() {
|
|||||||
check_pre_installed
|
check_pre_installed
|
||||||
if [[ -z "$php_config" ]] || [ "$(php_semver | cut -c 1-3)" != "$version" ]; then
|
if [[ -z "$php_config" ]] || [ "$(php_semver | cut -c 1-3)" != "$version" ]; then
|
||||||
if [ ! -e "/usr/bin/php$version" ] || [ ! -e "/usr/bin/php-config$version" ]; then
|
if [ ! -e "/usr/bin/php$version" ] || [ ! -e "/usr/bin/php-config$version" ]; then
|
||||||
add_php >/dev/null 2>&1
|
add_php
|
||||||
else
|
else
|
||||||
if ! [[ "$version" =~ ${old_versions:?} ]]; then
|
if ! [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
switch_version >/dev/null 2>&1
|
switch_version
|
||||||
fi
|
fi
|
||||||
if [ "${update:?}" = "true" ]; then
|
if [ "${update:?}" = "true" ]; then
|
||||||
update_php >/dev/null 2>&1
|
update_php
|
||||||
else
|
else
|
||||||
status="Switched to"
|
status="Switched to"
|
||||||
fi
|
fi
|
||||||
@ -263,7 +264,7 @@ setup_php() {
|
|||||||
php_config="$(command -v php-config)"
|
php_config="$(command -v php-config)"
|
||||||
else
|
else
|
||||||
if [ "$update" = "true" ]; then
|
if [ "$update" = "true" ]; then
|
||||||
update_php >/dev/null 2>&1
|
update_php
|
||||||
else
|
else
|
||||||
status="Found"
|
status="Found"
|
||||||
fi
|
fi
|
||||||
@ -283,22 +284,22 @@ setup_php() {
|
|||||||
link_pecl_file
|
link_pecl_file
|
||||||
configure_php
|
configure_php
|
||||||
set_output "php-version" "$semver"
|
set_output "php-version" "$semver"
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit
|
||||||
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
||||||
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
version=${1:-'8.4'}
|
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"
|
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
|
||||||
scripts="$src"/scripts
|
scripts="$src"/scripts
|
||||||
|
|
||||||
add_sudo >/dev/null 2>&1
|
add_sudo
|
||||||
link_apt_fast >/dev/null 2>&1
|
link_apt_fast
|
||||||
|
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
# shellcheck source=.
|
# shellcheck source=.
|
||||||
|
|||||||
@ -28,6 +28,52 @@ Function Edit-ComposerConfig() {
|
|||||||
Set-ComposerAuth
|
Set-ComposerAuth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to update auth.json.
|
||||||
|
Function Update-AuthJson {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory)][string[]] $ComposerAuth
|
||||||
|
)
|
||||||
|
if (Test-Path $composer_home\auth.json) {
|
||||||
|
try {
|
||||||
|
$existing = Get-Content $composer_home\auth.json -Raw | ConvertFrom-Json
|
||||||
|
} catch {
|
||||||
|
$existing = [PSCustomObject]@{}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$existing = [PSCustomObject]@{}
|
||||||
|
}
|
||||||
|
foreach ($fragment in $ComposerAuth) {
|
||||||
|
$piece = ('{' + $fragment + '}') | ConvertFrom-Json
|
||||||
|
foreach ($prop in $piece.PSObject.Properties) {
|
||||||
|
if ($prop.Name -eq 'http-basic') {
|
||||||
|
if (-not $existing.'http-basic') {
|
||||||
|
$existing | Add-Member -MemberType NoteProperty -Name 'http-basic' -Value ([PSCustomObject]@{}) -Force
|
||||||
|
}
|
||||||
|
foreach ($domainProp in $prop.Value.PSObject.Properties) {
|
||||||
|
$existing.'http-basic' | Add-Member -MemberType NoteProperty -Name $domainProp.Name -Value $domainProp.Value -Force
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$existing | Add-Member -MemberType NoteProperty -Name $prop.Name -Value $prop.Value -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Set-Content -Path $composer_home\auth.json -Value ($existing | ConvertTo-Json -Depth 5)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Test-GitHubPublicAccess {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$Token
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
Invoke-RestMethod -Uri 'https://api.github.com/' -Headers @{ Authorization = "token $Token" } -ErrorAction Stop | Out-Null
|
||||||
|
return $true
|
||||||
|
} catch {
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup authentication in composer.
|
# Function to setup authentication in composer.
|
||||||
Function Set-ComposerAuth() {
|
Function Set-ComposerAuth() {
|
||||||
if(Test-Path env:COMPOSER_AUTH_JSON) {
|
if(Test-Path env:COMPOSER_AUTH_JSON) {
|
||||||
@ -41,14 +87,18 @@ Function Set-ComposerAuth() {
|
|||||||
if(Test-Path env:PACKAGIST_TOKEN) {
|
if(Test-Path env:PACKAGIST_TOKEN) {
|
||||||
$composer_auth += '"http-basic": {"repo.packagist.com": { "username": "token", "password": "' + $env:PACKAGIST_TOKEN + '"}}'
|
$composer_auth += '"http-basic": {"repo.packagist.com": { "username": "token", "password": "' + $env:PACKAGIST_TOKEN + '"}}'
|
||||||
}
|
}
|
||||||
if(-not(Test-Path env:GITHUB_TOKEN) -and (Test-Path env:COMPOSER_TOKEN)) {
|
$write_token = $true
|
||||||
$env:GITHUB_TOKEN = $env:COMPOSER_TOKEN
|
$token = if ($env:COMPOSER_TOKEN) { $env:COMPOSER_TOKEN } else { $env:GITHUB_TOKEN }
|
||||||
|
if ($token) {
|
||||||
|
if ($env:GITHUB_SERVER_URL -ne "https://github.com" -and -not(Test-GitHubPublicAccess $token)) {
|
||||||
|
$write_token = $false
|
||||||
|
}
|
||||||
|
if($write_token) {
|
||||||
|
$composer_auth += '"github-oauth": {"github.com": "' + $token + '"}'
|
||||||
}
|
}
|
||||||
if (Test-Path env:GITHUB_TOKEN) {
|
|
||||||
$composer_auth += '"github-oauth": {"github.com": "' + $env:GITHUB_TOKEN + '"}'
|
|
||||||
}
|
}
|
||||||
if($composer_auth.length) {
|
if($composer_auth.length) {
|
||||||
Add-Env COMPOSER_AUTH ('{' + ($composer_auth -join ',') + '}')
|
Update-AuthJson $composer_auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +108,11 @@ Function Set-ComposerEnv() {
|
|||||||
(Get-Content $src\configs\composer.env -Raw) -replace '(?m)^COMPOSER_PROCESS_TIMEOUT=.*$', "COMPOSER_PROCESS_TIMEOUT=$env:COMPOSER_PROCESS_TIMEOUT" | Set-Content $src\configs\composer.env
|
(Get-Content $src\configs\composer.env -Raw) -replace '(?m)^COMPOSER_PROCESS_TIMEOUT=.*$', "COMPOSER_PROCESS_TIMEOUT=$env:COMPOSER_PROCESS_TIMEOUT" | Set-Content $src\configs\composer.env
|
||||||
}
|
}
|
||||||
Add-EnvPATH $src\configs\composer.env
|
Add-EnvPATH $src\configs\composer.env
|
||||||
|
if($env:COMPOSER_ALLOW_PLUGINS) {
|
||||||
|
$env:COMPOSER_ALLOW_PLUGINS -split '\s*,\s*' | Where-Object { $_ } | ForEach-Object {
|
||||||
|
& composer global config --no-plugins "allow-plugins.$_" true > $null 2>&1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to extract tool version.
|
# Function to extract tool version.
|
||||||
@ -121,7 +176,7 @@ Function Add-ToolsHelper() {
|
|||||||
$extensions += @('json', 'tokenizer')
|
$extensions += @('json', 'tokenizer')
|
||||||
} elseif($tool -eq "phpDocumentor") {
|
} elseif($tool -eq "phpDocumentor") {
|
||||||
$extensions+=('ctype', 'hash', 'json', 'fileinfo', 'iconv', 'mbstring', 'simplexml', 'xml')
|
$extensions+=('ctype', 'hash', 'json', 'fileinfo', 'iconv', 'mbstring', 'simplexml', 'xml')
|
||||||
Add-Extension fileinfo >$null 2>&1
|
Add-Extension fileinfo
|
||||||
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
||||||
} elseif($tool -eq "phpunit") {
|
} elseif($tool -eq "phpunit") {
|
||||||
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
|
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
|
||||||
@ -134,7 +189,7 @@ Function Add-ToolsHelper() {
|
|||||||
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
||||||
}
|
}
|
||||||
foreach($extension in $extensions) {
|
foreach($extension in $extensions) {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +236,7 @@ Function Add-Tool() {
|
|||||||
$bat_content += "php %BIN_TARGET% %*"
|
$bat_content += "php %BIN_TARGET% %*"
|
||||||
Set-Content -Path $bin_dir\$tool.bat -Value $bat_content
|
Set-Content -Path $bin_dir\$tool.bat -Value $bat_content
|
||||||
Add-ToolsHelper $tool
|
Add-ToolsHelper $tool
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat" >$null 2>&1
|
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat"
|
||||||
$tool_version = Get-ToolVersion $tool $ver_param
|
$tool_version = Get-ToolVersion $tool $ver_param
|
||||||
Add-Log $tick $tool "Added $tool $tool_version"
|
Add-Log $tick $tool "Added $tool $tool_version"
|
||||||
} else {
|
} else {
|
||||||
@ -221,9 +276,9 @@ Function Add-ComposerToolHelper() {
|
|||||||
Remove-Item -Path $composer_lock -Force
|
Remove-Item -Path $composer_lock -Force
|
||||||
}
|
}
|
||||||
if((composer global show $prefix$tool $tool_version -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
if((composer global show $prefix$tool $tool_version -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
||||||
composer global config --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
|
composer global config --no-plugins allow-plugins."$prefix$tool" true
|
||||||
}
|
}
|
||||||
composer global require $prefix$release $composer_args >$null 2>&1
|
composer global require $prefix$release $composer_args
|
||||||
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
||||||
} else {
|
} else {
|
||||||
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
||||||
@ -234,9 +289,9 @@ Function Add-ComposerToolHelper() {
|
|||||||
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
|
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
|
||||||
Set-Content -Path $scoped_dir\composer.json -Value "{}"
|
Set-Content -Path $scoped_dir\composer.json -Value "{}"
|
||||||
if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
||||||
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
|
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true
|
||||||
}
|
}
|
||||||
composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1
|
composer require $prefix$release -d $unix_scoped_dir $composer_args
|
||||||
}
|
}
|
||||||
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")
|
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")
|
||||||
Add-Path $scoped_dir\vendor\bin
|
Add-Path $scoped_dir\vendor\bin
|
||||||
|
|||||||
@ -11,7 +11,7 @@ get_tool_version() {
|
|||||||
alp="[a-zA-Z0-9\.]"
|
alp="[a-zA-Z0-9\.]"
|
||||||
version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
|
version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
|
composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "${tool_path_dir:?}/composer" | grep -Eo "$version_regex")"
|
||||||
if [[ -n "$composer_alias_version" ]]; then
|
if [[ -n "$composer_alias_version" ]]; then
|
||||||
composer_version="$composer_alias_version+$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$alp+" | tail -n 1)"
|
composer_version="$composer_alias_version+$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$alp+" | tail -n 1)"
|
||||||
else
|
else
|
||||||
@ -46,6 +46,30 @@ configure_composer() {
|
|||||||
set_composer_auth
|
set_composer_auth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to merge auth.json fragments.
|
||||||
|
update_auth_json() {
|
||||||
|
local auth_file="$composer_home/auth.json"
|
||||||
|
local merged
|
||||||
|
[[ -f "$auth_file" ]] && merged=$(<"$auth_file") || merged='{}'
|
||||||
|
for frag in "$@"; do
|
||||||
|
local obj="{$frag}"
|
||||||
|
merged=$(jq -n --argjson b "$merged" --argjson n "$obj" '
|
||||||
|
if $n|has("http-basic") then
|
||||||
|
(($b["http-basic"]//{}) + $n["http-basic"]) as $hb
|
||||||
|
| ($b + $n) | .["http-basic"] = $hb
|
||||||
|
else
|
||||||
|
$b + $n
|
||||||
|
end
|
||||||
|
')
|
||||||
|
done
|
||||||
|
printf '%s' "$merged" > "$composer_home/auth.json"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check if public GitHub token authentication is possible.
|
||||||
|
can_access_public_github() {
|
||||||
|
curl --fail -s -H "Authorization: token $1" 'https://api.github.com/'
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup authentication in composer.
|
# Function to setup authentication in composer.
|
||||||
set_composer_auth() {
|
set_composer_auth() {
|
||||||
if [ -n "$COMPOSER_AUTH_JSON" ]; then
|
if [ -n "$COMPOSER_AUTH_JSON" ]; then
|
||||||
@ -59,11 +83,18 @@ set_composer_auth() {
|
|||||||
if [ -n "$PACKAGIST_TOKEN" ]; then
|
if [ -n "$PACKAGIST_TOKEN" ]; then
|
||||||
composer_auth+=( '"http-basic": {"repo.packagist.com": { "username": "token", "password": "'"$PACKAGIST_TOKEN"'"}}' )
|
composer_auth+=( '"http-basic": {"repo.packagist.com": { "username": "token", "password": "'"$PACKAGIST_TOKEN"'"}}' )
|
||||||
fi
|
fi
|
||||||
if [ -n "${GITHUB_TOKEN:-$COMPOSER_TOKEN}" ]; then
|
token="${COMPOSER_TOKEN:-$GITHUB_TOKEN}"
|
||||||
composer_auth+=( '"github-oauth": {"github.com": "'"${GITHUB_TOKEN:-$COMPOSER_TOKEN}"'"}' )
|
if [ -n "$token" ]; then
|
||||||
|
write_token=true
|
||||||
|
if [ "$GITHUB_SERVER_URL" != "https://github.com" ]; then
|
||||||
|
can_access_public_github "$token" || write_token=false
|
||||||
|
fi
|
||||||
|
if [ "$write_token" = 'true' ]; then
|
||||||
|
composer_auth+=( '"github-oauth": {"github.com": "'"$token"'"}' )
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if ((${#composer_auth[@]})); then
|
if ((${#composer_auth[@]})); then
|
||||||
add_env COMPOSER_AUTH "{$(IFS=$','; echo "${composer_auth[*]}")}"
|
update_auth_json "${composer_auth[@]}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +106,11 @@ set_composer_env() {
|
|||||||
sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env"
|
sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env"
|
||||||
fi
|
fi
|
||||||
add_env_path "$composer_env"
|
add_env_path "$composer_env"
|
||||||
|
if [ -n "$COMPOSER_ALLOW_PLUGINS" ]; then
|
||||||
|
echo "$COMPOSER_ALLOW_PLUGINS" | tr ',' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | grep -v '^$' | while IFS= read -r plugin; do
|
||||||
|
composer global config --no-plugins "allow-plugins.$plugin" true
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper function to configure tools.
|
# Helper function to configure tools.
|
||||||
@ -131,7 +167,7 @@ add_tools_helper() {
|
|||||||
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}"
|
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}"
|
||||||
fi
|
fi
|
||||||
for extension in "${extensions[@]}"; do
|
for extension in "${extensions[@]}"; do
|
||||||
add_extension "$extension" extension >/dev/null 2>&1
|
add_extension "$extension" extension
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,8 +200,12 @@ add_tool() {
|
|||||||
elif [ -e /tmp/"$tool" ]; then
|
elif [ -e /tmp/"$tool" ]; then
|
||||||
sudo cp -a /tmp/"$tool" "$tool_path"
|
sudo cp -a /tmp/"$tool" "$tool_path"
|
||||||
fi
|
fi
|
||||||
|
if [ "$status_code" = "404" ]; then
|
||||||
|
add_log "$cross" "$tool" "Failed to download $tool from ${url[*]}"
|
||||||
|
else
|
||||||
add_log "$cross" "$tool" "Could not setup $tool"
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup a tool using composer in a different scope.
|
# Function to setup a tool using composer in a different scope.
|
||||||
@ -178,22 +218,22 @@ add_composer_tool_helper() {
|
|||||||
enable_extensions curl mbstring openssl
|
enable_extensions curl mbstring openssl
|
||||||
tool_version=${release##*:}; [ "$tool_version" = "$tool" ] && tool_version="*"
|
tool_version=${release##*:}; [ "$tool_version" = "$tool" ] && tool_version="*"
|
||||||
if [ "$scope" = "global" ]; then
|
if [ "$scope" = "global" ]; then
|
||||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
sudo rm -f "$composer_lock" || true
|
||||||
if composer global show "$prefix$tool" "$tool_version" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
if composer global show "$prefix$tool" "$tool_version" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
||||||
composer global config --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
|
composer global config --no-plugins allow-plugins."$prefix$tool" true
|
||||||
fi
|
fi
|
||||||
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
|
composer global require "$prefix$release" "$composer_args"
|
||||||
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log
|
||||||
else
|
else
|
||||||
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
||||||
if ! [ -d "$scoped_dir" ]; then
|
if ! [ -d "$scoped_dir" ]; then
|
||||||
mkdir -p "$scoped_dir"
|
mkdir -p "$scoped_dir"
|
||||||
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
|
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
|
||||||
if composer show "$prefix$tool" "$tool_version" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
if composer show "$prefix$tool" "$tool_version" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
||||||
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
|
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true
|
||||||
fi
|
fi
|
||||||
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
|
composer require "$prefix$release" -d "$scoped_dir" "$composer_args"
|
||||||
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log
|
||||||
fi
|
fi
|
||||||
add_path "$scoped_dir"/vendor/bin
|
add_path "$scoped_dir"/vendor/bin
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -6,14 +6,14 @@ Function Add-Blackfire() {
|
|||||||
}
|
}
|
||||||
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
||||||
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
||||||
Get-File -Url $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\blackfire.zip
|
||||||
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force
|
||||||
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
||||||
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
||||||
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1
|
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN
|
||||||
}
|
}
|
||||||
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
||||||
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
|
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem
|
||||||
}
|
}
|
||||||
Add-Log $tick "blackfire" "Added blackfire $cli_version"
|
Add-Log $tick "blackfire" "Added blackfire $cli_version"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,9 +32,9 @@ blackfire_config() {
|
|||||||
# Function to add blackfire cli.
|
# Function to add blackfire cli.
|
||||||
add_blackfire() {
|
add_blackfire() {
|
||||||
os="$(uname -s)"
|
os="$(uname -s)"
|
||||||
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
[ "$os" = "Linux" ] && add_blackfire_linux
|
||||||
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
|
[ "$os" = "Darwin" ] && add_blackfire_darwin
|
||||||
blackfire_config >/dev/null 2>&1
|
blackfire_config
|
||||||
tool_version=$(get_tool_version "blackfire" "version")
|
tool_version=$(get_tool_version "blackfire" "version")
|
||||||
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,11 +14,11 @@ add_brew_tap() {
|
|||||||
tap=$1
|
tap=$1
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
if [ "${runner:?}" = "self-hosted" ]; then
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
brew tap "$tap" >/dev/null 2>&1
|
brew tap "$tap"
|
||||||
else
|
else
|
||||||
fetch_brew_tap "$tap" >/dev/null 2>&1
|
fetch_brew_tap "$tap"
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
brew tap "$tap" >/dev/null 2>&1
|
brew tap "$tap"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -49,7 +49,7 @@ add_brew() {
|
|||||||
brew_prefix="$(get_brew_prefix)"
|
brew_prefix="$(get_brew_prefix)"
|
||||||
if ! [ -d "$brew_prefix"/bin ]; then
|
if ! [ -d "$brew_prefix"/bin ]; then
|
||||||
step_log "Setup Brew"
|
step_log "Setup Brew"
|
||||||
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/master/install.sh" | bash -s >/dev/null 2>&1
|
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/main/install.sh" | bash -s
|
||||||
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
||||||
fi
|
fi
|
||||||
add_brew_bins_to_path "$brew_prefix"
|
add_brew_bins_to_path "$brew_prefix"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
Function Add-Msys2() {
|
Function Add-Msys2() {
|
||||||
$msys_location = 'C:\msys64'
|
$msys_location = 'C:\msys64'
|
||||||
if (-not(Test-Path $msys_location)) {
|
if (-not(Test-Path $msys_location)) {
|
||||||
choco install msys2 -y >$null 2>&1
|
choco install msys2 -y
|
||||||
$msys_location = 'C:\tools\msys64'
|
$msys_location = 'C:\tools\msys64'
|
||||||
}
|
}
|
||||||
return $msys_location
|
return $msys_location
|
||||||
@ -15,7 +15,7 @@ Function Add-GrpcPhpPlugin() {
|
|||||||
} else {
|
} else {
|
||||||
$grpc_package = 'mingw-w64-x86_64-grpc'
|
$grpc_package = 'mingw-w64-x86_64-grpc'
|
||||||
}
|
}
|
||||||
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package" >$null 2>&1
|
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package"
|
||||||
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
||||||
Add-Path $msys_location\mingw64\bin
|
Add-Path $msys_location\mingw64\bin
|
||||||
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
|
|||||||
@ -26,7 +26,7 @@ add_grpc_php_plugin_brew() {
|
|||||||
configure_brew
|
configure_brew
|
||||||
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
|
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
|
||||||
brew install grpc
|
brew install grpc
|
||||||
brew link --force --overwrite grpc >/dev/null 2>&1
|
brew link --force --overwrite grpc
|
||||||
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
|
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
|
||||||
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
||||||
license_path="$(brew --prefix grpc)/LICENSE"
|
license_path="$(brew --prefix grpc)/LICENSE"
|
||||||
@ -50,9 +50,9 @@ add_grpc_php_plugin() {
|
|||||||
grpc_tag=$1
|
grpc_tag=$1
|
||||||
license_path=""
|
license_path=""
|
||||||
if [ "$grpc_tag" = "latest" ]; then
|
if [ "$grpc_tag" = "latest" ]; then
|
||||||
add_grpc_php_plugin_brew >/dev/null 2>&1
|
add_grpc_php_plugin_brew
|
||||||
else
|
else
|
||||||
add_grpc_php_plugin_compile >/dev/null 2>&1
|
add_grpc_php_plugin_compile
|
||||||
fi
|
fi
|
||||||
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
||||||
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
||||||
|
|||||||
36
src/scripts/tools/mago.ps1
Normal file
36
src/scripts/tools/mago.ps1
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Function Get-MagoTag() {
|
||||||
|
$releases = 'https://github.com/carthage-software/mago/releases'
|
||||||
|
if("$mago_tag" -eq "latest") {
|
||||||
|
$mago_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
[net.httpWebRequest] $request = [net.webRequest]::create("$releases/tag/$mago_tag")
|
||||||
|
$request.Method = "HEAD"
|
||||||
|
[net.httpWebResponse] $response = $request.getResponse()
|
||||||
|
$response.Close()
|
||||||
|
$mago_tag = "$mago_tag"
|
||||||
|
} catch {
|
||||||
|
$mago_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $mago_tag
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Add-Mago() {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true, Position = 0, HelpMessage = 'The mago version to be installed')]
|
||||||
|
[ValidatePattern('^latest$|^\d+\.\d+\.\d+$')]
|
||||||
|
[string] $mago_tag
|
||||||
|
)
|
||||||
|
$mago_tag = Get-MagoTag
|
||||||
|
$arch_name = 'x86_64'
|
||||||
|
if(-not([Environment]::Is64BitOperatingSystem)) {
|
||||||
|
$arch_name = 'i686'
|
||||||
|
}
|
||||||
|
$url = "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch_name-pc-windows-msvc.zip"
|
||||||
|
Get-File -Url $url -OutFile $bin_dir\mago.zip
|
||||||
|
Expand-Archive -Path $bin_dir\mago.zip -DestinationPath $bin_dir\mago -Force
|
||||||
|
Move-Item -Path $bin_dir\mago\mago-$mago_tag-$arch_name-pc-windows-msvc\mago.exe -Destination $bin_dir\mago.exe -Force
|
||||||
|
Add-ToProfile $current_profile 'mago' "New-Alias mago $bin_dir\mago.exe"
|
||||||
|
Add-Log $tick "mago" "Added mago $mago_tag"
|
||||||
|
}
|
||||||
29
src/scripts/tools/mago.sh
Normal file
29
src/scripts/tools/mago.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
get_mago_tag() {
|
||||||
|
if [ "$mago_tag" = "latest" ]; then
|
||||||
|
mago_tag=$(get -s -n "" https://github.com/carthage-software/mago/releases/latest 2<&1 | grep -m 1 -Eo "tag/([0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
|
||||||
|
else
|
||||||
|
status_code=$(get -v -n /tmp/mago.tmp "https://github.com/carthage-software/mago/releases/tag/$mago_tag")
|
||||||
|
if [ "$status_code" = "200" ]; then
|
||||||
|
mago_tag="$mago_tag"
|
||||||
|
else
|
||||||
|
mago_tag=$(get -s -n "" https://github.com/carthage-software/mago/releases/latest 2<&1 | grep -m 1 -Eo "tag/([0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_mago() {
|
||||||
|
mago_tag=$1
|
||||||
|
get_mago_tag
|
||||||
|
(
|
||||||
|
platform='unknown-linux-gnu'
|
||||||
|
[ "$(uname -s)" = "Darwin" ] && platform='apple-darwin'
|
||||||
|
arch="$(uname -m)"
|
||||||
|
[[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch='aarch64'
|
||||||
|
[[ "$arch" = 'x86_64' || "$arch" = 'amd64' ]] && arch='x86_64'
|
||||||
|
get -q -n /tmp/mago.tar.gz "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch-$platform.tar.gz"
|
||||||
|
sudo tar -xzf /tmp/mago.tar.gz -C /tmp/
|
||||||
|
sudo mv /tmp/mago-$mago_tag-$arch-$platform/mago /usr/local/bin/mago
|
||||||
|
sudo chmod +x /usr/local/bin/mago
|
||||||
|
)
|
||||||
|
add_log "${tick:?}" "mago" "Added mago $mago_tag"
|
||||||
|
}
|
||||||
@ -31,7 +31,7 @@ set_base_version() {
|
|||||||
else
|
else
|
||||||
set_base_version_codename
|
set_base_version_codename
|
||||||
set_base_version_id
|
set_base_version_id
|
||||||
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release >/dev/null 2>&1
|
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,26 +50,116 @@ update_lists_helper() {
|
|||||||
update_lists() {
|
update_lists() {
|
||||||
local ppa=${1:-}
|
local ppa=${1:-}
|
||||||
local ppa_search=${2:-}
|
local ppa_search=${2:-}
|
||||||
|
local status_token=${3:-$ppa_search}
|
||||||
local list=
|
local list=
|
||||||
status_file=/tmp/os_lists
|
local status_file=/tmp/os_lists
|
||||||
|
local hash_cmd
|
||||||
if [[ -n "$ppa" && -n "$ppa_search" ]]; then
|
if [[ -n "$ppa" && -n "$ppa_search" ]]; then
|
||||||
list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
|
if [ -f "$ppa_search" ]; then
|
||||||
status_file=/tmp/"$(echo -n "$ppa_search" | shasum -a 256 | cut -d ' ' -f 1)"
|
list="$ppa_search"
|
||||||
elif [ -e "$list_file" ] && grep -Eq '^deb |^Types deb' "$list_file"; then
|
else
|
||||||
|
list="$(grep -Elr "$ppa_search" "$list_dir" 2>/dev/null | head -n 1)"
|
||||||
|
fi
|
||||||
|
hash_cmd="$(command -v sha256sum || command -v shasum)"
|
||||||
|
if [ -n "$status_token" ] && [ -n "$hash_cmd" ]; then
|
||||||
|
status_file=/tmp/os_lists_"$(echo -n "$status_token" | $hash_cmd | awk '{print $1}')"
|
||||||
|
elif [ -n "$status_token" ]; then
|
||||||
|
status_file=/tmp/os_lists_$(date +%s)
|
||||||
|
fi
|
||||||
|
elif [ -e "$list_file" ] && grep -Eq '^deb |^Types: *deb' "$list_file"; then
|
||||||
list="$list_file"
|
list="$list_file"
|
||||||
fi
|
fi
|
||||||
if [ ! -e "$status_file" ]; then
|
if [ ! -e "$status_file" ]; then
|
||||||
update_lists_helper "$list" >/dev/null 2>&1
|
update_lists_helper "$list"
|
||||||
echo '' | tee "$status_file" >/dev/null 2>&1
|
echo '' | tee "$status_file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Determine whether deb822 sources are the default on this system.
|
||||||
|
get_sources_format() {
|
||||||
|
if [ -n "$sources_format" ]; then
|
||||||
|
echo "$sources_format"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
sources_format=deb
|
||||||
|
if [ -e "$list_dir"/ubuntu.sources ] || [ -e "$list_dir"/debian.sources ]; then
|
||||||
|
sources_format="deb822"
|
||||||
|
elif ! [[ "$ID" =~ ubuntu|debian ]]; then
|
||||||
|
find "$list_dir" -type f -name '*.sources' | grep -q . && sources_format="deb822"
|
||||||
|
fi
|
||||||
|
echo "$sources_format"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get sources file extension.
|
||||||
|
get_sources_extension() {
|
||||||
|
[ "$1" = "deb822" ] && echo "sources" || echo "list"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to escape regex special characters.
|
||||||
|
escape_regex() {
|
||||||
|
printf '%s' "$1" | sed -e 's/[][\.^$*+?{}()|\/]/\\&/g'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to merge two components strings.
|
||||||
|
merge_components() {
|
||||||
|
local out=() t
|
||||||
|
for t in $1 $2; do [[ $t && " ${out[*]} " != *" $t "* ]] && out+=("$t"); done
|
||||||
|
printf '%s\n' "${out[*]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to merge components from a file.
|
||||||
|
merge_components_from_file() {
|
||||||
|
local path=$1
|
||||||
|
local incoming=$2
|
||||||
|
local current=
|
||||||
|
if [ -n "$path" ] && [ -e "$path" ]; then
|
||||||
|
if grep -Eq '^Components:' "$path"; then
|
||||||
|
current="$(grep -E '^Components:' "$path" | head -n 1 | cut -d ':' -f 2 | xargs)"
|
||||||
|
else
|
||||||
|
current="$(sed -E -n 's/^deb[[:space:]]+(\[[^]]*\][[:space:]]+)?[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+//p' "$path" | head -n 1 | xargs)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
local merged
|
||||||
|
merged="$(merge_components "$current" "$incoming")"
|
||||||
|
if [ -z "$merged" ] || [ "$merged" = "$current" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
printf '%s\n' "$merged"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get repo patterns based on format.
|
||||||
|
get_repo_patterns() {
|
||||||
|
local list_format=$1
|
||||||
|
local ppa_url=$2
|
||||||
|
local package_dist=$3
|
||||||
|
local branches=$4
|
||||||
|
local escaped_url
|
||||||
|
local escaped_dist
|
||||||
|
local escaped_branches
|
||||||
|
escaped_url="$(escape_regex "$ppa_url")"
|
||||||
|
escaped_dist="$(escape_regex "$package_dist")"
|
||||||
|
escaped_branches="$(escape_regex "$branches")"
|
||||||
|
local deb_primary="^deb[[:space:]]+(\\[[^]]*\\][[:space:]]+)?${escaped_url}[[:space:]]+${escaped_dist}[[:space:]]"
|
||||||
|
local deb_secondary="^deb[[:space:]]+(\\[[^]]*\\][[:space:]]+)?${escaped_url}[[:space:]]+${escaped_dist}[[:space:]]+.*${escaped_branches}([[:space:]]|$)"
|
||||||
|
local deb822_primary="^URIs: ${escaped_url}$"
|
||||||
|
local deb822_secondary="^Suites: ${escaped_dist}$"
|
||||||
|
if [ "$list_format" = "deb822" ]; then
|
||||||
|
printf '%s|%s\n' "$deb822_primary" "$deb822_secondary"
|
||||||
|
else
|
||||||
|
printf '%s|%s\n' "$deb_primary" "$deb_secondary"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get fingerprint from an Ubuntu PPA.
|
# Function to get fingerprint from an Ubuntu PPA.
|
||||||
ubuntu_fingerprint() {
|
ubuntu_fingerprint() {
|
||||||
ppa=$1
|
ppa="$1"
|
||||||
get -s -n "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
|
ppa_uri="~${ppa%/*}/+archive/ubuntu/${ppa##*/}"
|
||||||
|
get -s -n "" "${lp_api[0]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
|
||||||
|
|| get -s -n "" "${lp_api[1]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
|
||||||
|
|| get -s -n "" "$ppa_sp/keys/$ppa.fingerprint"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to get fingerprint from a Debian PPA.
|
# Function to get fingerprint from a Debian PPA.
|
||||||
debian_fingerprint() {
|
debian_fingerprint() {
|
||||||
ppa=$1
|
ppa=$1
|
||||||
@ -93,25 +183,81 @@ add_key() {
|
|||||||
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
|
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
|
||||||
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
|
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
|
||||||
fi
|
fi
|
||||||
|
key_urls+=("$ppa_sp/keys/$ppa.gpg")
|
||||||
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
||||||
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
||||||
sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"
|
sudo gpg --batch --yes --dearmor "$key_file" && sudo mv "$key_file".gpg "$key_file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to handle existing list files.
|
||||||
|
handle_existing_list() {
|
||||||
|
local ppa=$1
|
||||||
|
local list_format=$2
|
||||||
|
local branches=$3
|
||||||
|
local merged_components
|
||||||
|
if [ -z "$check_lists_file" ]; then
|
||||||
|
echo "Repository $ppa ($branches) already exists" && return 1
|
||||||
|
fi
|
||||||
|
if merged_components="$(merge_components_from_file "$check_lists_file" "$branches")"; then
|
||||||
|
sudo rm -f "$check_lists_file" && printf '%s\n' "$merged_components" && return 0
|
||||||
|
fi
|
||||||
|
if [[ "$list_format" = "deb822" && "$check_lists_file" = *.list ]]; then
|
||||||
|
sudo rm -f "$check_lists_file" && printf '%s\n' "$branches" && return 0
|
||||||
|
fi
|
||||||
|
echo "Repository $ppa ($branches) already exists" && return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to write a list file.
|
||||||
|
write_list() {
|
||||||
|
local type=$1
|
||||||
|
local ppa=$2
|
||||||
|
local url=$3
|
||||||
|
local suite=$4
|
||||||
|
local components=$5
|
||||||
|
local key_file=$6
|
||||||
|
local list_basename="${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$suite"
|
||||||
|
local arch
|
||||||
|
arch="$(dpkg --print-architecture)"
|
||||||
|
sudo rm -f "$list_dir"/"${ppa/\//-}".list "$list_dir"/"${ppa/\//-}".sources "$list_dir"/"$list_basename".list "$list_dir"/"$list_basename".sources || true
|
||||||
|
if [ "$type" = "deb822" ]; then
|
||||||
|
cat <<EOF | sudo tee "$list_dir"/"$list_basename".sources >/dev/null
|
||||||
|
Types: deb
|
||||||
|
URIs: $url
|
||||||
|
Suites: $suite
|
||||||
|
Components: $components
|
||||||
|
Architectures: $arch
|
||||||
|
Signed-By: $key_file
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
echo "deb [arch=$arch signed-by=$key_file] $url $suite $components" | sudo tee "$list_dir"/"$list_basename".list
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to check if a PPA and its lists exist
|
# Function to check if a PPA and its lists exist
|
||||||
check_lists() {
|
check_lists() {
|
||||||
ppa=$1
|
local ppa=$1
|
||||||
ppa_search=$2
|
local primary=${2:-}
|
||||||
if grep -Eqr "$ppa_search" "$list_dir"; then
|
local secondary=${3:-}
|
||||||
|
local status_token=${4:-$primary}
|
||||||
|
local match_file=
|
||||||
|
check_lists_file=
|
||||||
|
if [ -n "$primary" ]; then
|
||||||
|
match_file=$(grep -Elr "$primary" "$list_dir" 2>/dev/null | head -n 1)
|
||||||
|
fi
|
||||||
|
if [ -z "$match_file" ] && [ -n "$secondary" ]; then
|
||||||
|
match_file=$(grep -Elr "$secondary" "$list_dir" 2>/dev/null | head -n 1)
|
||||||
|
fi
|
||||||
|
if [ -n "$match_file" ]; then
|
||||||
|
local list_count
|
||||||
list_count="$(sudo find /var/lib/apt/lists -type f -name "*${ppa/\//_}*" | wc -l)"
|
list_count="$(sudo find /var/lib/apt/lists -type f -name "*${ppa/\//_}*" | wc -l)"
|
||||||
if [ "$list_count" = "0" ]; then
|
if [ "$list_count" = "0" ]; then
|
||||||
update_lists "$ppa" "$ppa_search"
|
update_lists "$ppa" "$match_file" "$status_token"
|
||||||
fi
|
fi
|
||||||
return 0;
|
check_lists_file="$match_file"
|
||||||
else
|
return 0
|
||||||
return 1;
|
|
||||||
fi
|
fi
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add a sources list.
|
# Function to add a sources list.
|
||||||
@ -121,18 +267,32 @@ add_list() {
|
|||||||
key_source=${3:-"$ppa_url"}
|
key_source=${3:-"$ppa_url"}
|
||||||
package_dist=${4:-"$VERSION_CODENAME"}
|
package_dist=${4:-"$VERSION_CODENAME"}
|
||||||
branches=${5:-main}
|
branches=${5:-main}
|
||||||
ppa_search="deb .*$ppa_url $package_dist .*$branches$"
|
local list_format
|
||||||
if check_lists "$ppa" "$ppa_search"; then
|
local list_extension
|
||||||
echo "Repository $ppa already exists";
|
local status_token
|
||||||
return 1;
|
local resolved_branches
|
||||||
|
local list_path=
|
||||||
|
list_format="$(get_sources_format)"
|
||||||
|
list_extension="$(get_sources_extension "$list_format")"
|
||||||
|
status_token="${ppa_url}|${package_dist}|${branches}"
|
||||||
|
IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
|
||||||
|
if check_lists "$ppa" "$primary_pattern" "$secondary_pattern" "$status_token"; then
|
||||||
|
list_path="$check_lists_file"
|
||||||
|
if resolved_branches="$(handle_existing_list "$ppa" "$list_format" "$branches")"; then
|
||||||
|
branches="$resolved_branches"
|
||||||
else
|
else
|
||||||
arch=$(dpkg --print-architecture)
|
[ -n "$resolved_branches" ] && echo "$resolved_branches" && return 1
|
||||||
|
fi
|
||||||
|
check_lists_file=
|
||||||
|
IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
|
||||||
|
status_token="${ppa_url}|${package_dist}|${branches}"
|
||||||
|
fi
|
||||||
[ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
|
[ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
|
||||||
add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
|
add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
|
||||||
echo "deb [arch=$arch signed-by=$key_file] $ppa_url $package_dist $branches" | sudo tee -a "$list_dir"/"${ppa/\//-}".list >/dev/null 2>&1
|
write_list "$list_format" "$ppa" "$ppa_url" "$package_dist" "$branches" "$key_file"
|
||||||
update_lists "$ppa" "$ppa_search"
|
list_path="$list_dir"/"${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$package_dist"."$list_extension"
|
||||||
|
update_lists "$ppa" "$list_path" "$status_token"
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
fi
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,8 +302,12 @@ check_ppa() {
|
|||||||
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
|
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
|
||||||
package_dist=${3:-"$VERSION_CODENAME"}
|
package_dist=${3:-"$VERSION_CODENAME"}
|
||||||
branches=${4:-main}
|
branches=${4:-main}
|
||||||
ppa_search="deb .*$ppa_url $package_dist .*$branches$"
|
local list_format
|
||||||
if check_lists "$ppa" "$ppa_search"; then
|
list_format="$(get_sources_format)"
|
||||||
|
IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
|
||||||
|
local status_token
|
||||||
|
status_token="${ppa_url}|${package_dist}|${branches}"
|
||||||
|
if check_lists "$ppa" "$primary_pattern" "$secondary_pattern" "$status_token"; then
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
@ -157,13 +321,13 @@ remove_list() {
|
|||||||
for ppa_url in "${ppa_urls[@]}"; do
|
for ppa_url in "${ppa_urls[@]}"; do
|
||||||
grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
|
grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
|
||||||
done
|
done
|
||||||
sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring || true
|
sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring /tmp/os_lists* || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to check if ubuntu ppa is up
|
# Function to check if ubuntu ppa is up
|
||||||
is_ubuntu_ppa_up() {
|
is_ubuntu_ppa_up() {
|
||||||
ppa=${1:-ondrej/php}
|
ppa=${1:-ondrej/php}
|
||||||
curl -s --connect-timeout 5 --max-time 5 --head --fail "$lpc_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
|
curl -s --connect-timeout 10 --max-time 10 --head --fail "$lpc_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add the PPA mirror.
|
# Function to add the PPA mirror.
|
||||||
@ -171,8 +335,8 @@ add_ppa_sp_mirror() {
|
|||||||
ppa=$1
|
ppa=$1
|
||||||
ppa_name="$(basename "$ppa")"
|
ppa_name="$(basename "$ppa")"
|
||||||
remove_list "$ppa" || true
|
remove_list "$ppa" || true
|
||||||
[ "${debug:?}" = "debug" ] && add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg" "$VERSION_CODENAME" "main/debug"
|
[ "${debug:?}" = "debug" ] && add_list sp/"$ppa_name" "$ppa_sp/$ppa/ubuntu" "$ppa_sp/$ppa/ubuntu/key.gpg" "$VERSION_CODENAME" "main/debug"
|
||||||
add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg"
|
add_list sp/"$ppa_name" "$ppa_sp/$ppa/ubuntu" "$ppa_sp/$ppa/ubuntu/key.gpg"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add a PPA.
|
# Function to add a PPA.
|
||||||
@ -181,10 +345,13 @@ add_ppa() {
|
|||||||
ppa=${1:-ondrej/php}
|
ppa=${1:-ondrej/php}
|
||||||
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
||||||
if is_ubuntu_ppa_up "$ppa" ; then
|
if is_ubuntu_ppa_up "$ppa" ; then
|
||||||
|
[ "${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"
|
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lpc_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
|
||||||
add_list "$ppa"
|
add_list "$ppa"
|
||||||
else
|
elif [ "$ppa" = "ondrej/php" ]; then
|
||||||
add_ppa_sp_mirror "$ppa"
|
add_ppa_sp_mirror "$ppa"
|
||||||
|
else
|
||||||
|
add_log "${cross:?}" "$ppa" "PPA $ppa is not available"
|
||||||
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"
|
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
|
||||||
@ -204,12 +371,23 @@ update_ppa() {
|
|||||||
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
|
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
|
||||||
package_dist=${4:-"$VERSION_CODENAME"}
|
package_dist=${4:-"$VERSION_CODENAME"}
|
||||||
branches=${5:-main}
|
branches=${5:-main}
|
||||||
ppa_search="deb .*$ppa_url $package_dist .*$branches"
|
local list_format
|
||||||
update_lists "$ppa" "$ppa_search"
|
list_format="$(get_sources_format)"
|
||||||
|
IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
|
||||||
|
local list_path
|
||||||
|
list_path="$(grep -Elr "$primary_pattern" "$list_dir" 2>/dev/null | head -n 1)"
|
||||||
|
if [ -z "$list_path" ] && [ -n "$secondary_pattern" ]; then
|
||||||
|
list_path="$(grep -Elr "$secondary_pattern" "$list_dir" 2>/dev/null | head -n 1)"
|
||||||
|
fi
|
||||||
|
local status_token
|
||||||
|
status_token="${ppa_url}|${package_dist}|${branches}"
|
||||||
|
update_lists "$ppa" "${list_path:-$primary_pattern}" "$status_token"
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
|
sources_format=
|
||||||
|
check_lists_file=
|
||||||
list_dir='/etc/apt/sources.list.d'
|
list_dir='/etc/apt/sources.list.d'
|
||||||
list_file="/etc/apt/sources.list.d/$ID.sources"
|
list_file="/etc/apt/sources.list.d/$ID.sources"
|
||||||
[ -e "$list_file" ] || list_file='/etc/apt/sources.list'
|
[ -e "$list_file" ] || list_file='/etc/apt/sources.list'
|
||||||
@ -223,6 +401,7 @@ lpc_ppa='https://ppa.launchpadcontent.net'
|
|||||||
key_dir='/usr/share/keyrings'
|
key_dir='/usr/share/keyrings'
|
||||||
dist_info_dir='/usr/share/distro-info'
|
dist_info_dir='/usr/share/distro-info'
|
||||||
sury='https://packages.sury.org'
|
sury='https://packages.sury.org'
|
||||||
|
ppa_sp='https://ppa.setup-php.com'
|
||||||
sp='https://setup-php.com'
|
sp='https://setup-php.com'
|
||||||
sks=(
|
sks=(
|
||||||
'https://keyserver.ubuntu.com'
|
'https://keyserver.ubuntu.com'
|
||||||
|
|||||||
@ -29,12 +29,12 @@ Function Add-Protoc() {
|
|||||||
$arch_num = '32'
|
$arch_num = '32'
|
||||||
}
|
}
|
||||||
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
||||||
Get-File -Url $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\protoc.zip
|
||||||
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force
|
||||||
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
||||||
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
||||||
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
||||||
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/main/LICENSE).Content
|
||||||
Write-Output "$env:END_GROUP"
|
Write-Output "$env:END_GROUP"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,9 @@ add_protoc() {
|
|||||||
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-$arch.zip"
|
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-$arch.zip"
|
||||||
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
||||||
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
||||||
) >/dev/null 2>&1
|
)
|
||||||
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
||||||
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/main/LICENSE
|
||||||
echo "$END_GROUP"
|
echo "$END_GROUP"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,25 @@
|
|||||||
Function Add-Symfony() {
|
Function Add-Symfony() {
|
||||||
$arch_name ='amd64'
|
param(
|
||||||
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
[Parameter(Mandatory = $true, Position = 0, HelpMessage = 'Symfony version to be installed')]
|
||||||
|
[string] $protobuf_tag
|
||||||
|
)
|
||||||
|
$protobuf_tag = $protobuf_tag.replace('v', '')
|
||||||
|
if($protobuf_tag -ne 'latest' -and $protobuf_tag -notmatch '^\d+(\.\d+)*$') {
|
||||||
|
Add-Log $cross "symfony-cli" "Invalid symfony version: $protobuf_tag"
|
||||||
|
} else {
|
||||||
|
$arch_name = 'amd64'
|
||||||
|
if (-not ([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||||
$arch_name = '386'
|
$arch_name = '386'
|
||||||
}
|
}
|
||||||
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
$symfony_releases = "https://github.com/symfony-cli/symfony-cli/releases"
|
||||||
Get-File -Url $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
if ($protobuf_tag -eq 'latest') {
|
||||||
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
$url = "$symfony_releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
||||||
if(Test-Path $bin_dir\symfony.exe) {
|
} else {
|
||||||
|
$url = "$symfony_releases/download/v$protobuf_tag/symfony-cli_windows_${arch_name}.zip"
|
||||||
|
}
|
||||||
|
Get-File -Url $url -OutFile $bin_dir\symfony.zip > $null 2>&1
|
||||||
|
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force > $null 2>&1
|
||||||
|
if (Test-Path $bin_dir\symfony.exe) {
|
||||||
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
||||||
Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
|
Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
|
||||||
Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
|
Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
|
||||||
@ -15,4 +28,5 @@ Function Add-Symfony() {
|
|||||||
} else {
|
} else {
|
||||||
Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
|
Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,35 +1,37 @@
|
|||||||
add_symfony_with_brew() {
|
|
||||||
add_brew_tap symfony-cli/homebrew-tap
|
|
||||||
brew install symfony-cli/tap/symfony-cli
|
|
||||||
}
|
|
||||||
|
|
||||||
get_symfony_artifact_url() {
|
get_symfony_artifact_url() {
|
||||||
arch=$(dpkg --print-architecture)
|
local symfony_tag=$1
|
||||||
url=$(get -s -n "" https://raw.githubusercontent.com/symfony-cli/homebrew-tap/main/Formula/symfony-cli.rb 2<&1 | grep -m 1 "url.*linux.*${arch}" | cut -d\" -f 2)
|
local os
|
||||||
if [ -z "$url" ]; then
|
local arch
|
||||||
url=$(get -s -n "" https://api.github.com/repos/symfony-cli/symfony-cli/releases 2<&1 | grep -m 1 "url.*linux.*${arch}.*gz\"" | cut -d\" -f 4)
|
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||||
|
arch="$(uname -m)"
|
||||||
|
case "$arch" in
|
||||||
|
arm|armv6*|armv7*) arch="armv6" ;;
|
||||||
|
aarch64*|armv8*|arm64) arch="arm64" ;;
|
||||||
|
i[36]86) arch="386" ;;
|
||||||
|
x86_64|amd64) arch="amd64" ;;
|
||||||
|
esac
|
||||||
|
[ "$os" = "darwin" ] && arch="all"
|
||||||
|
symfony_releases="https://github.com/symfony-cli/symfony-cli/releases"
|
||||||
|
if [ "$symfony_tag" = "latest" ]; then
|
||||||
|
echo "$symfony_releases/latest/download/symfony-cli_${os}_${arch}.tar.gz"
|
||||||
|
else
|
||||||
|
echo "$symfony_releases/download/v$symfony_tag/symfony-cli_${os}_${arch}.tar.gz"
|
||||||
fi
|
fi
|
||||||
echo "$url"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_symfony_helper() {
|
add_symfony_helper() {
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
local install_dir=/usr/local/bin
|
||||||
url="$(get_symfony_artifact_url)"
|
[ "$(uname -s)" = "Darwin" ] && install_dir=${brew_prefix:?}/bin
|
||||||
if [ -z "$url" ]; then
|
get -s -n "" "$(get_symfony_artifact_url "$symfony_tag")" | sudo tar -xz -C "$install_dir" 2>/dev/null
|
||||||
. "${0%/*}"/tools/brew.sh
|
sudo chmod a+x "$install_dir"/symfony
|
||||||
configure_brew
|
|
||||||
add_symfony_with_brew
|
|
||||||
else
|
|
||||||
get -s -n "" "$url" | sudo tar -xz -C "${tool_path_dir:?}" 2>/dev/null
|
|
||||||
sudo chmod a+x /usr/local/bin/symfony
|
|
||||||
fi
|
|
||||||
elif [ "$(uname -s)" = "Darwin" ]; then
|
|
||||||
add_symfony_with_brew
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_symfony() {
|
add_symfony() {
|
||||||
add_symfony_helper >/dev/null 2>&1
|
local symfony_tag="${1/v/}"
|
||||||
|
if ! [[ "$symfony_tag" =~ ^[0-9]+(\.[0-9]+)*$ || "$symfony_tag" == 'latest' ]]; then
|
||||||
|
add_log "${cross:?}" "symfony-cli" "Version '$symfony_tag' is not valid for symfony-cli"
|
||||||
|
else
|
||||||
|
add_symfony_helper "$symfony_tag"
|
||||||
symfony_path="$(command -v symfony)"
|
symfony_path="$(command -v symfony)"
|
||||||
if [[ -n "$symfony_path" ]]; then
|
if [[ -n "$symfony_path" ]]; then
|
||||||
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
|
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
|
||||||
@ -38,4 +40,5 @@ add_symfony() {
|
|||||||
else
|
else
|
||||||
add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
|
add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ export cross="✗"
|
|||||||
export curl_opts=(-sL)
|
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 nightly_versions="8.[3-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"
|
||||||
@ -43,7 +43,7 @@ set_output() {
|
|||||||
name=$1
|
name=$1
|
||||||
value=$2
|
value=$2
|
||||||
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
||||||
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT" >/dev/null 2>&1
|
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,9 +53,11 @@ read_env() {
|
|||||||
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
|
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
|
||||||
[[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
|
[[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
|
||||||
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
||||||
[[ -z "${ImageOS}" && -z "${ImageVersion}" || -n ${ACT} ]] && _runner=self-hosted || _runner=github
|
[[ ( -z "$ImageOS" && -z "$ImageVersion" ) ||
|
||||||
|
( -n "$RUNNER_ENVIRONMENT" && "$RUNNER_ENVIRONMENT" = "self-hosted" ) ||
|
||||||
|
-n "$ACT" || -n "$CONTAINER" ]] && _runner=self-hosted || _runner=github
|
||||||
runner="${runner:-${RUNNER:-$_runner}}"
|
runner="${runner:-${RUNNER:-$_runner}}"
|
||||||
tool_path_dir="${tools_dir:-${TOOLS_DIR:-/usr/local/bin}}"
|
tool_path_dir="${setup_php_tools_dir:-${SETUP_PHP_TOOLS_DIR:-/usr/local/bin}}"
|
||||||
|
|
||||||
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then
|
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then
|
||||||
fail_fast=true
|
fail_fast=true
|
||||||
@ -66,7 +68,7 @@ read_env() {
|
|||||||
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
|
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
|
||||||
if ! check_ppa ondrej/php; then
|
if ! check_ppa ondrej/php; then
|
||||||
update=true
|
update=true
|
||||||
echo '' | sudo tee /tmp/sp_update >/dev/null 2>&1
|
echo '' | sudo tee /tmp/sp_update
|
||||||
elif [ -e /tmp/sp_update ]; then
|
elif [ -e /tmp/sp_update ]; then
|
||||||
update=true
|
update=true
|
||||||
fi
|
fi
|
||||||
@ -76,7 +78,7 @@ read_env() {
|
|||||||
export runner
|
export runner
|
||||||
export update
|
export update
|
||||||
export ts
|
export ts
|
||||||
export tools_dir_path
|
export tool_path_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to create a lock.
|
# Function to create a lock.
|
||||||
@ -89,7 +91,7 @@ acquire_lock() {
|
|||||||
else
|
else
|
||||||
if sudo test -f "$lock_path/pid"; then
|
if sudo test -f "$lock_path/pid"; then
|
||||||
lock_pid=$(sudo cat "$lock_path/pid")
|
lock_pid=$(sudo cat "$lock_path/pid")
|
||||||
if ! ps -p "$lock_pid" >/dev/null 2>&1; then
|
if ! ps -p "$lock_pid" ; then
|
||||||
sudo rm -rf "$lock_path"
|
sudo rm -rf "$lock_path"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -105,6 +107,18 @@ release_lock() {
|
|||||||
sudo rm -rf "$lock_path"
|
sudo rm -rf "$lock_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to get the SHA256 hash of a string.
|
||||||
|
get_sha256() {
|
||||||
|
local input=$1
|
||||||
|
if command -v sha256sum >/dev/null; then
|
||||||
|
printf '%s' "$input" | sha256sum | cut -d' ' -f1
|
||||||
|
elif command -v shasum >/dev/null; then
|
||||||
|
printf '%s' "$input" | shasum -a 256 | cut -d' ' -f1
|
||||||
|
elif command -v openssl >/dev/null; then
|
||||||
|
printf '%s' "$input" | openssl dgst -sha256 | cut -d' ' -f2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to download a file using cURL.
|
# Function to download a file using cURL.
|
||||||
# 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
|
||||||
@ -118,7 +132,7 @@ get() {
|
|||||||
sudo curl "${curl_opts[@]}" "${links[0]}"
|
sudo curl "${curl_opts[@]}" "${links[0]}"
|
||||||
else
|
else
|
||||||
if [ "$runner" = "self-hosted" ]; then
|
if [ "$runner" = "self-hosted" ]; then
|
||||||
lock_path="$file_path.lock"
|
lock_path="/tmp/sp-lck-$(get_sha256 "$file_path")"
|
||||||
acquire_lock "$lock_path"
|
acquire_lock "$lock_path"
|
||||||
if [ "$execute" = "-e" ]; then
|
if [ "$execute" = "-e" ]; then
|
||||||
until [ -z "$(fuser "$file_path" 2>/dev/null)" ]; do
|
until [ -z "$(fuser "$file_path" 2>/dev/null)" ]; do
|
||||||
@ -131,7 +145,7 @@ get() {
|
|||||||
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
|
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
|
||||||
[ "$status_code" = "200" ] && break
|
[ "$status_code" = "200" ] && break
|
||||||
done
|
done
|
||||||
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
|
[[ "$execute" = "-e" && -e "$file_path" ]] && sudo chmod a+x "$file_path"
|
||||||
[ "$mode" = "-v" ] && echo "$status_code"
|
[ "$mode" = "-v" ] && echo "$status_code"
|
||||||
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
|
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
|
||||||
fi
|
fi
|
||||||
@ -157,10 +171,10 @@ add_path() {
|
|||||||
path_to_add=$1
|
path_to_add=$1
|
||||||
[[ ":$PATH:" == *":$path_to_add:"* ]] && return
|
[[ ":$PATH:" == *":$path_to_add:"* ]] && return
|
||||||
if [[ -n "$GITHUB_PATH" ]]; then
|
if [[ -n "$GITHUB_PATH" ]]; then
|
||||||
echo "$path_to_add" | tee -a "$GITHUB_PATH" >/dev/null 2>&1
|
echo "$path_to_add" | tee -a "$GITHUB_PATH"
|
||||||
else
|
else
|
||||||
profile=$(get_shell_profile)
|
profile=$(get_shell_profile)
|
||||||
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile" >/dev/null 2>&1
|
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile"
|
||||||
fi
|
fi
|
||||||
export PATH="${PATH:+${PATH}:}$path_to_add"
|
export PATH="${PATH:+${PATH}:}$path_to_add"
|
||||||
}
|
}
|
||||||
@ -182,10 +196,10 @@ add_env() {
|
|||||||
env_name=$1
|
env_name=$1
|
||||||
env_value=$2
|
env_value=$2
|
||||||
if [[ -n "$GITHUB_ENV" ]]; then
|
if [[ -n "$GITHUB_ENV" ]]; then
|
||||||
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV" >/dev/null 2>&1
|
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV"
|
||||||
else
|
else
|
||||||
profile=$(get_shell_profile)
|
profile=$(get_shell_profile)
|
||||||
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile" >/dev/null 2>&1
|
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile"
|
||||||
fi
|
fi
|
||||||
export "$env_name"="$env_value"
|
export "$env_name"="$env_value"
|
||||||
}
|
}
|
||||||
@ -206,8 +220,8 @@ self_hosted_setup() {
|
|||||||
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
|
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
self_hosted_helper >/dev/null 2>&1
|
self_hosted_helper
|
||||||
add_env RUNNER_TOOL_CACHE /tmp
|
add_env RUNNER_TOOL_CACHE /opt/hostedtoolcache
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -230,10 +244,12 @@ configure_php() {
|
|||||||
add_php_config
|
add_php_config
|
||||||
ini_config_dir="${src:?}"/configs/ini
|
ini_config_dir="${src:?}"/configs/ini
|
||||||
ini_config_files=("$ini_config_dir"/php.ini)
|
ini_config_files=("$ini_config_dir"/php.ini)
|
||||||
jit_config_files=("$ini_config_dir"/jit.ini)
|
arch="$(uname -m)"
|
||||||
|
[[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && jit_ini="$ini_config_dir"/jit_aarch64.ini || jit_ini="$ini_config_dir"/jit.ini
|
||||||
|
jit_config_files=("$jit_ini")
|
||||||
[[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
|
[[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
|
||||||
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}" >/dev/null 2>&1
|
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}"
|
||||||
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1
|
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get PHP version in semver format.
|
# Function to get PHP version in semver format.
|
||||||
|
|||||||
@ -323,7 +323,7 @@ $php_builder = "$github/shivammathur/php-builder-windows"
|
|||||||
$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.[2-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')
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|||||||
$bin_dir = 'C:\tools\bin'
|
$bin_dir = 'C:\tools\bin'
|
||||||
$php_dir = "$php_dir$version"
|
$php_dir = "$php_dir$version"
|
||||||
$ext_dir = "$php_dir\ext"
|
$ext_dir = "$php_dir\ext"
|
||||||
Get-CleanPSProfile >$null 2>&1
|
Get-CleanPSProfile
|
||||||
New-Item $bin_dir -Type Directory -Force > $null 2>&1
|
New-Item $bin_dir -Type Directory -Force > $null 2>&1
|
||||||
Add-Path -PathItem $bin_dir
|
Add-Path -PathItem $bin_dir
|
||||||
if($version -lt 5.6) {
|
if($version -lt 5.6) {
|
||||||
@ -368,12 +368,12 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|||||||
}
|
}
|
||||||
New-Item $php_dir -Type Directory -Force > $null 2>&1
|
New-Item $php_dir -Type Directory -Force > $null 2>&1
|
||||||
Add-Path -PathItem $php_dir
|
Add-Path -PathItem $php_dir
|
||||||
setx PHPROOT $php_dir >$null 2>&1
|
setx PHPROOT $php_dir
|
||||||
Add-Env -EnvName RUNNER_TOOL_CACHE -EnvValue $env:TEMP
|
Add-Env -EnvName RUNNER_TOOL_CACHE -EnvValue $env:TEMP
|
||||||
} else {
|
} else {
|
||||||
$current_profile = "$PSHOME\Profile.ps1"
|
$current_profile = "$PSHOME\Profile.ps1"
|
||||||
if(-not(Test-Path -LiteralPath $current_profile)) {
|
if(-not(Test-Path -LiteralPath $current_profile)) {
|
||||||
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
|
New-Item -Path $current_profile -ItemType "file" -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,9 +381,9 @@ $src = Join-Path -Path $PSScriptRoot -ChildPath \..
|
|||||||
. $src\scripts\tools\add_tools.ps1
|
. $src\scripts\tools\add_tools.ps1
|
||||||
. $src\scripts\extensions\add_extensions.ps1
|
. $src\scripts\extensions\add_extensions.ps1
|
||||||
|
|
||||||
Add-Printf >$null 2>&1
|
Add-Printf
|
||||||
Step-Log "Setup PhpManager"
|
Step-Log "Setup PhpManager"
|
||||||
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php >$null 2>&1
|
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php
|
||||||
Add-Log $tick "PhpManager" "Installed"
|
Add-Log $tick "PhpManager" "Installed"
|
||||||
|
|
||||||
Step-Log "Setup PHP"
|
Step-Log "Setup PHP"
|
||||||
@ -412,7 +412,7 @@ if($version -eq 'pre') {
|
|||||||
}
|
}
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
||||||
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ($version -match $nightly_versions) {
|
if ($version -match $nightly_versions) {
|
||||||
@ -425,7 +425,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
} catch { }
|
} catch { }
|
||||||
} else {
|
} else {
|
||||||
if($env:update -eq 'true') {
|
if($env:update -eq 'true') {
|
||||||
Update-Php $php_dir >$null 2>&1
|
Update-Php $php_dir
|
||||||
$status = "Updated to"
|
$status = "Updated to"
|
||||||
} else {
|
} else {
|
||||||
$status = "Found"
|
$status = "Found"
|
||||||
@ -443,11 +443,14 @@ if($installed.MajorMinorVersion -ne $version) {
|
|||||||
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
if($version -lt "5.5") {
|
if($version -lt "5.5") {
|
||||||
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ }
|
||||||
} else {
|
} elseif($version -lt "8.5") {
|
||||||
$enable_extensions += ('opcache')
|
$enable_extensions += ('opcache')
|
||||||
}
|
}
|
||||||
Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
|
if($version -ge "8.5" -and (Test-Path $ext_dir\php_opcache.dll)) {
|
||||||
|
Remove-Item $ext_dir\php_opcache.dll -Force
|
||||||
|
}
|
||||||
|
Enable-PhpExtension -Extension ($enable_extensions | Where-Object { Test-Path $ext_dir\php_$_.dll }) -Path $php_dir
|
||||||
Add-PhpCAInfo
|
Add-PhpCAInfo
|
||||||
Add-OpenSSLConf
|
Add-OpenSSLConf
|
||||||
Copy-Item -Path $src\configs\pm\*.json -Destination $env:RUNNER_TOOL_CACHE
|
Copy-Item -Path $src\configs\pm\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||||
|
|||||||
47
src/tools.ts
47
src/tools.ts
@ -1,5 +1,6 @@
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import * as cv from 'compare-versions';
|
||||||
import * as fetch from './fetch';
|
import * as fetch from './fetch';
|
||||||
import * as packagist from './packagist';
|
import * as packagist from './packagist';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
@ -20,6 +21,11 @@ interface IRef {
|
|||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
export async function getSemverVersion(data: RS): Promise<string> {
|
export async function getSemverVersion(data: RS): Promise<string> {
|
||||||
|
const fixSemver = (t: string): string => {
|
||||||
|
if (/^\d+\.\d+\.\d+(-|$)/.test(t)) return t;
|
||||||
|
const m = t.match(/^(\d+\.\d+\.\d+)([A-Za-z]+[0-9A-Za-z.]+)$/);
|
||||||
|
return m ? `${m[1]}-${m[2]}` : t;
|
||||||
|
};
|
||||||
const search: string = data['version_prefix'] + data['version'];
|
const search: string = data['version_prefix'] + data['version'];
|
||||||
const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`;
|
const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`;
|
||||||
const github_token: string =
|
const github_token: string =
|
||||||
@ -30,10 +36,24 @@ export async function getSemverVersion(data: RS): Promise<string> {
|
|||||||
data['error'] = response.error ?? `No version found with prefix ${search}.`;
|
data['error'] = response.error ?? `No version found with prefix ${search}.`;
|
||||||
return data['version'];
|
return data['version'];
|
||||||
} else {
|
} else {
|
||||||
const refs = JSON.parse(response['data']).reverse();
|
const refs: IRef[] = JSON.parse(response['data']);
|
||||||
const ref = refs.find((i: IRef) => /.*\d+.\d+.\d+$/.test(i['ref']));
|
const tags = refs
|
||||||
const tag: string = (ref || refs[0])['ref'].split('/').pop();
|
.map((i: IRef) => (i.ref?.split('/').pop() ?? '').replace(/^v(?=\d)/, ''))
|
||||||
return tag.replace(/^v(\d)/, '$1');
|
.filter((t: string) => t.length > 0);
|
||||||
|
const fixedToOriginal = new Map<string, string>();
|
||||||
|
const fixed = tags.map(t => {
|
||||||
|
const f = fixSemver(t);
|
||||||
|
fixedToOriginal.set(f, t);
|
||||||
|
return f;
|
||||||
|
});
|
||||||
|
fixed.sort((a, b) => {
|
||||||
|
try {
|
||||||
|
return cv.compareVersions(b, a);
|
||||||
|
} catch {
|
||||||
|
return b.localeCompare(a, 'en', {numeric: true, sensitivity: 'base'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return fixedToOriginal.get(fixed[0]) ?? fixed[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +156,7 @@ export async function filterList(tools_list: string[]): Promise<string[]> {
|
|||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
export async function getUrl(data: RS): Promise<string> {
|
export async function getUrl(data: RS): Promise<string> {
|
||||||
if (data['version'] === 'latest') {
|
if ((data['version'] ?? 'latest') === 'latest') {
|
||||||
return [
|
return [
|
||||||
data['domain'],
|
data['domain'],
|
||||||
data['repository'],
|
data['repository'],
|
||||||
@ -263,30 +283,33 @@ export async function addComposer(data: RS): Promise<string> {
|
|||||||
const github = data['github'];
|
const github = data['github'];
|
||||||
const getcomposer = data['domain'];
|
const getcomposer = data['domain'];
|
||||||
const cds = 'https://dl.cloudsmith.io';
|
const cds = 'https://dl.cloudsmith.io';
|
||||||
|
const spc = 'https://artifacts.setup-php.com';
|
||||||
const filename = `composer-${data['php_version']}-${channel}.phar`;
|
const filename = `composer-${data['php_version']}-${channel}.phar`;
|
||||||
const releases_url = `${github}/shivammathur/composer-cache/releases/latest/download/${filename}`;
|
const releases_url = `${github}/shivammathur/composer-cache/releases/latest/download/${filename}`;
|
||||||
const cds_url = `${cds}/public/shivammathur/composer-cache/raw/files/${filename}`;
|
const cds_url = `${cds}/public/shivammathur/composer-cache/raw/files/${filename}`;
|
||||||
|
const spc_url = `${spc}/composer/${filename}`;
|
||||||
const lts_url = `${getcomposer}/download/latest-2.2.x/composer.phar`;
|
const lts_url = `${getcomposer}/download/latest-2.2.x/composer.phar`;
|
||||||
const is_lts = /^5\.[3-6]$|^7\.[0-1]$/.test(data['php_version']);
|
const is_lts = /^5\.[3-6]$|^7\.[0-1]$/.test(data['php_version']);
|
||||||
const version_source_url = `${getcomposer}/composer-${channel}.phar`;
|
const channel_source_url = `${getcomposer}/composer-${channel}.phar`;
|
||||||
let cache_url = `${releases_url},${cds_url}`;
|
const version_source_url = `${getcomposer}/download/${channel}/composer.phar`;
|
||||||
|
let cache_url = `${releases_url},${spc_url},${cds_url}`;
|
||||||
let source_url = `${getcomposer}/composer.phar`;
|
let source_url = `${getcomposer}/composer.phar`;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case /^snapshot$/.test(channel):
|
case /^snapshot$/.test(channel):
|
||||||
source_url = is_lts ? lts_url : source_url;
|
source_url = is_lts ? lts_url : source_url;
|
||||||
break;
|
break;
|
||||||
case /^preview$|^2$/.test(channel):
|
case /^preview$|^2$/.test(channel):
|
||||||
source_url = is_lts ? lts_url : version_source_url;
|
source_url = is_lts ? lts_url : channel_source_url;
|
||||||
break;
|
break;
|
||||||
case /^1$/.test(channel):
|
case /^1$/.test(channel):
|
||||||
source_url = version_source_url;
|
source_url = channel_source_url;
|
||||||
break;
|
break;
|
||||||
case /^\d+\.\d+\.\d+[\w-]*$/.test(data['version']):
|
case /^\d+\.\d+\.\d+[\w-]*$/.test(data['version']):
|
||||||
cache_url = `${github}/${data['repository']}/releases/download/${data['version']}/composer.phar`;
|
cache_url = `${github}/${data['repository']}/releases/download/${data['version']}/composer.phar`;
|
||||||
source_url = version_source_url;
|
source_url = version_source_url;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
source_url = is_lts ? lts_url : version_source_url;
|
source_url = is_lts ? lts_url : channel_source_url;
|
||||||
}
|
}
|
||||||
const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
|
const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
|
||||||
data['url'] = use_cache ? `${cache_url},${source_url}` : source_url;
|
data['url'] = use_cache ? `${cache_url},${source_url}` : source_url;
|
||||||
@ -401,6 +424,9 @@ export async function addPhive(data: RS): Promise<string> {
|
|||||||
case /7\.2/.test(data['php_version']):
|
case /7\.2/.test(data['php_version']):
|
||||||
data['version'] = '0.14.5';
|
data['version'] = '0.14.5';
|
||||||
break;
|
break;
|
||||||
|
case /7\.3|7\.4/.test(data['php_version']):
|
||||||
|
data['version'] = '0.15.3';
|
||||||
|
break;
|
||||||
case /^latest$/.test(data['version']):
|
case /^latest$/.test(data['version']):
|
||||||
data['version'] = await getLatestVersion(data);
|
data['version'] = await getLatestVersion(data);
|
||||||
break;
|
break;
|
||||||
@ -416,6 +442,7 @@ export async function addPhive(data: RS): Promise<string> {
|
|||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
export async function addPHPUnitTools(data: RS): Promise<string> {
|
export async function addPHPUnitTools(data: RS): Promise<string> {
|
||||||
|
/* istanbul ignore next */
|
||||||
if (data['version'] === 'latest') {
|
if (data['version'] === 'latest') {
|
||||||
data['version'] =
|
data['version'] =
|
||||||
(await packagist.search(data['packagist'], data['php_version'])) ??
|
(await packagist.search(data['packagist'], data['php_version'])) ??
|
||||||
|
|||||||
25
src/utils.ts
25
src/utils.ts
@ -48,8 +48,11 @@ export async function getInput(
|
|||||||
/**
|
/**
|
||||||
* Function to get manifest URL
|
* Function to get manifest URL
|
||||||
*/
|
*/
|
||||||
export async function getManifestURL(): Promise<string> {
|
export async function getManifestURLS(): Promise<string[]> {
|
||||||
return 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json';
|
return [
|
||||||
|
'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json',
|
||||||
|
'https://setup-php.com/php-versions.json'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,9 +63,13 @@ export async function getManifestURL(): Promise<string> {
|
|||||||
export async function parseVersion(version: string): Promise<string> {
|
export async function parseVersion(version: string): Promise<string> {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case /^(latest|lowest|highest|nightly|\d+\.x)$/.test(version):
|
case /^(latest|lowest|highest|nightly|\d+\.x)$/.test(version):
|
||||||
return JSON.parse((await fetch.fetch(await getManifestURL()))['data'])[
|
for (const manifestURL of await getManifestURLS()) {
|
||||||
version
|
const fetchResult = await fetch.fetch(manifestURL);
|
||||||
];
|
if (fetchResult['data'] ?? false) {
|
||||||
|
return JSON.parse(fetchResult['data'])[version];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error(`Could not fetch the PHP version manifest.`);
|
||||||
default:
|
default:
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case version.length > 1:
|
case version.length > 1:
|
||||||
@ -278,10 +285,10 @@ export async function getExtensionPrefix(extension: string): Promise<string> {
|
|||||||
export async function suppressOutput(os: string): Promise<string> {
|
export async function suppressOutput(os: string): Promise<string> {
|
||||||
switch (os) {
|
switch (os) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return ' >$null 2>&1';
|
return ' ';
|
||||||
case 'linux':
|
case 'linux':
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return ' >/dev/null 2>&1';
|
return ' ';
|
||||||
default:
|
default:
|
||||||
return await log('Platform ' + os + ' is not supported', os, 'error');
|
return await log('Platform ' + os + ' is not supported', os, 'error');
|
||||||
}
|
}
|
||||||
@ -393,7 +400,7 @@ export async function customPackage(
|
|||||||
version: string,
|
version: string,
|
||||||
os: string
|
os: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const pkg_name: string = pkg.replace(/\d+|(pdo|pecl)[_-]/, '');
|
const pkg_name: string = pkg.replace(/\d+|(pdo|pecl)[_-]|[_-]db2/, '');
|
||||||
const script_extension: string = await scriptExtension(os);
|
const script_extension: string = await scriptExtension(os);
|
||||||
const script: string = path.join(
|
const script: string = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
@ -449,6 +456,7 @@ export async function readPHPVersion(): Promise<string> {
|
|||||||
const composerLock = path.join(composerProjectDir, 'composer.lock');
|
const composerLock = path.join(composerProjectDir, 'composer.lock');
|
||||||
if (fs.existsSync(composerLock)) {
|
if (fs.existsSync(composerLock)) {
|
||||||
const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
|
const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
|
||||||
|
/* istanbul ignore next */
|
||||||
if (
|
if (
|
||||||
lockFileContents['platform-overrides'] &&
|
lockFileContents['platform-overrides'] &&
|
||||||
lockFileContents['platform-overrides']['php']
|
lockFileContents['platform-overrides']['php']
|
||||||
@ -462,6 +470,7 @@ export async function readPHPVersion(): Promise<string> {
|
|||||||
const composerFileContents = JSON.parse(
|
const composerFileContents = JSON.parse(
|
||||||
fs.readFileSync(composerJson, 'utf8')
|
fs.readFileSync(composerJson, 'utf8')
|
||||||
);
|
);
|
||||||
|
/* istanbul ignore next */
|
||||||
if (
|
if (
|
||||||
composerFileContents['config'] &&
|
composerFileContents['config'] &&
|
||||||
composerFileContents['config']['platform'] &&
|
composerFileContents['config']['platform'] &&
|
||||||
|
|||||||
Reference in New Issue
Block a user