mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-08 08:00:33 +07:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
28c92ba4ee | |||
ffd019edc6 | |||
0e506b34ac | |||
aa0ecfbc6f | |||
f29cd24dbf | |||
2a41b9d1ba | |||
2a0c477416 | |||
61aa0dc2f9 | |||
f4e1b8d33e | |||
e3a498a6a5 | |||
fbdd58c5bc | |||
2c5cb7a75e | |||
ab12e42197 | |||
5588437714 | |||
d7eb9ade23 | |||
938988b211 | |||
e030852d0e | |||
3aa870b0fe | |||
1229133602 | |||
b1b8d8367c | |||
60ff55130a | |||
e5690a9659 | |||
7958a5ccff | |||
113a31fceb | |||
c9aea8708f | |||
7435bb8e4a | |||
5227e2cd5c | |||
906893d397 | |||
f1b6b2bbe0 | |||
e59c938e82 |
6
.github/FUNDING.yml
vendored
6
.github/FUNDING.yml
vendored
@ -1,7 +1,3 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
open_collective: setup-php
|
github:shivammathur
|
||||||
tidelift: "npm/setup-php"
|
|
||||||
community_bridge: setup-php
|
|
||||||
patreon: shivammathur
|
|
||||||
custom: https://www.paypal.me/shivammathur
|
|
3
.github/SECURITY.md
vendored
3
.github/SECURITY.md
vendored
@ -7,7 +7,7 @@ The following versions of this project are supported for security updates.
|
|||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
| ------- | ------------------ |
|
| ------- | ------------------ |
|
||||||
| 1.11.x | :white_check_mark: |
|
| 1.11.x | :white_check_mark: |
|
||||||
| 2.11.x | :white_check_mark: |
|
| 2.14.x | :white_check_mark: |
|
||||||
|
|
||||||
## Supported PHP Versions
|
## Supported PHP Versions
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ This security policy only applies to the latest patches of the following PHP ver
|
|||||||
| 7.3 | :white_check_mark: |
|
| 7.3 | :white_check_mark: |
|
||||||
| 7.4 | :white_check_mark: |
|
| 7.4 | :white_check_mark: |
|
||||||
| 8.0 | :white_check_mark: |
|
| 8.0 | :white_check_mark: |
|
||||||
|
| 8.1 | :white_check_mark: |
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
4
.github/codeql/codeql-configuration.yml
vendored
Normal file
4
.github/codeql/codeql-configuration.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name : CodeQL Configuration
|
||||||
|
|
||||||
|
paths:
|
||||||
|
- './src'
|
25
.github/workflows/codeql-workflow.yml
vendored
Normal file
25
.github/workflows/codeql-workflow.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: CodeQL Workflow
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 15 * * 6'
|
||||||
|
jobs:
|
||||||
|
codeql:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
config-file: ./.github/codeql/codeql-configuration.yml
|
||||||
|
languages: javascript
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
17
.github/workflows/node-workflow.yml
vendored
17
.github/workflows/node-workflow.yml
vendored
@ -24,10 +24,10 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node.js 15.x
|
- name: Setup Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 15.x
|
node-version: 16.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
@ -41,7 +41,14 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm test
|
run: npm test
|
||||||
|
|
||||||
|
- name: Run npm audit
|
||||||
|
run: npm audit
|
||||||
|
|
||||||
- name: Send Coverage
|
- name: Send Coverage
|
||||||
continue-on-error: true
|
uses: codecov/codecov-action@v2
|
||||||
timeout-minutes: 1
|
with:
|
||||||
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/lcov.info -n github-actions-codecov-${{ matrix.operating-system }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
files: coverage/lcov.info
|
||||||
|
name: github-actions-codecov-${{ matrix.operating-system }}
|
||||||
|
fail_ci_if_error: false
|
||||||
|
verbose: true
|
||||||
|
139
README.md
139
README.md
@ -28,7 +28,6 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
- [Usage](#memo-usage)
|
- [Usage](#memo-usage)
|
||||||
- [Basic Setup](#basic-setup)
|
- [Basic Setup](#basic-setup)
|
||||||
- [Matrix Setup](#matrix-setup)
|
- [Matrix Setup](#matrix-setup)
|
||||||
- [Nightly Build Setup](#nightly-build-setup)
|
|
||||||
- [Thread Safe Setup](#thread-safe-setup)
|
- [Thread Safe Setup](#thread-safe-setup)
|
||||||
- [Cache Dependencies](#cache-dependencies)
|
- [Cache Dependencies](#cache-dependencies)
|
||||||
- [Composer GitHub OAuth](#composer-github-oauth)
|
- [Composer GitHub OAuth](#composer-github-oauth)
|
||||||
@ -42,27 +41,27 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
|
|
||||||
## :tada: PHP Support
|
## :tada: PHP Support
|
||||||
|
|
||||||
|PHP Version|Stability|Release Support|
|
| PHP Version | Stability | Release Support |
|
||||||
|--- |--- |--- |
|
|-------------|-----------|-----------------------|
|
||||||
|5.6|`Stable`|`End of life`|
|
| 5.6 | `Stable` | `End of life` |
|
||||||
|7.0|`Stable`|`End of life`|
|
| 7.0 | `Stable` | `End of life` |
|
||||||
|7.1|`Stable`|`End of life`|
|
| 7.1 | `Stable` | `End of life` |
|
||||||
|7.2|`Stable`|`Security fixes only`|
|
| 7.2 | `Stable` | `End of life` |
|
||||||
|7.3|`Stable`|`Active`|
|
| 7.3 | `Stable` | `End of life` |
|
||||||
|7.4|`Stable`|`Active`|
|
| 7.4 | `Stable` | `Security fixes only` |
|
||||||
|8.0|`Nightly`|`In development`|
|
| 8.0 | `Stable` | `Active` |
|
||||||
|
|
||||||
**Note:** Specifying `8.0` in `php-version` input installs a nightly build of `PHP 8.0.0-dev` with `PHP JIT`, `Union Types v2` and other [new features](https://wiki.php.net/rfc#php_80 "New features implemented in PHP 8"). See [nightly build setup](#nightly-build-setup) for more information.
|
|
||||||
|
|
||||||
## :cloud: GitHub-Hosted Runner Support
|
## :cloud: GitHub-Hosted Runner Support
|
||||||
|
|
||||||
|Virtual environment|YAML workflow label|Pre-installed PHP|
|
| Virtual environment | YAML workflow label | Pre-installed PHP |
|
||||||
|--- |--- |--- |
|
|----------------------|------------------------------------|------------------------|
|
||||||
|Ubuntu 18.04|`ubuntu-18.04`|`PHP 7.1` to `PHP 8.0`|
|
| Ubuntu 20.04 | `ubuntu-latest` or `ubuntu-20.04` | `PHP 7.4` to `PHP 8.1` |
|
||||||
|Ubuntu 20.04|`ubuntu-latest` or `ubuntu-20.04`|`PHP 7.4` to `PHP 8.0`|
|
| Ubuntu 18.04 | `ubuntu-18.04` | `PHP 7.2` to `PHP 8.1` |
|
||||||
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 8.0`|
|
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.1` |
|
||||||
|macOS 10.15 Catalina|`macos-latest` or `macos-10.15`|`PHP 8.0`|
|
| Windows Server 2019 | `windows-2019` | `PHP 8.1` |
|
||||||
|macOS 11.0 Big Sur|`macos-11.0`|`PHP 8.0`|
|
| macOS Monterey 12.x | `macos-12` | `PHP 8.1` |
|
||||||
|
| macOS Big Sur 11.x | `macos-latest` or `macos-11` | `PHP 8.1` |
|
||||||
|
| macOS Catalina 10.15 | `macos-10.15` | `PHP 8.1` |
|
||||||
|
|
||||||
## :heavy_plus_sign: PHP Extension Support
|
## :heavy_plus_sign: PHP Extension Support
|
||||||
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
||||||
@ -213,29 +212,6 @@ jobs:
|
|||||||
tools: php-cs-fixer, phpunit #optional, setup tools globally
|
tools: php-cs-fixer, phpunit #optional, setup tools globally
|
||||||
```
|
```
|
||||||
|
|
||||||
### Nightly Build Setup
|
|
||||||
|
|
||||||
> Setup a nightly build of `PHP 8.0.0-dev` from the [master branch](https://github.com/php/php-src/tree/master "Master branch on PHP source repository") of PHP.
|
|
||||||
|
|
||||||
- Some extensions might not support this version currently.
|
|
||||||
- Refer to this [RFC](https://wiki.php.net/rfc/jit "PHP JIT RFC configuration") for configuring `PHP JIT` on this version.
|
|
||||||
- Refer to this [list of RFCs](https://wiki.php.net/rfc#php_80 "List of RFCs implemented in PHP8") implemented in this version.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v1
|
|
||||||
with:
|
|
||||||
php-version: '8.0'
|
|
||||||
extensions: mbstring #optional, setup extensions
|
|
||||||
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 #optional, setup php.ini configuration
|
|
||||||
coverage: pcov #optional, setup PCOV, Xdebug does not support this version yet.
|
|
||||||
tools: php-cs-fixer, phpunit #optional, setup tools globally
|
|
||||||
```
|
|
||||||
|
|
||||||
### Thread Safe Setup
|
### Thread Safe Setup
|
||||||
|
|
||||||
- `NTS` versions are setup by default.
|
- `NTS` versions are setup by default.
|
||||||
@ -379,29 +355,29 @@ For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-p
|
|||||||
|
|
||||||
Examples for setting up this GitHub Action with different PHP Frameworks/Packages.
|
Examples for setting up this GitHub Action with different PHP Frameworks/Packages.
|
||||||
|
|
||||||
|Framework/Package|Runs on|Workflow|
|
| Framework/Package | Runs on | Workflow |
|
||||||
|--- |--- |--- |
|
|---------------------------------------|---------------------------------|---------------------------------------------------------------------------------------------------------------|
|
||||||
|CakePHP with `MySQL` and `Redis`|`ubuntu`|[cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis")|
|
| CakePHP with `MySQL` and `Redis` | `ubuntu` | [cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis") |
|
||||||
|CakePHP with `PostgreSQL` and `Redis`|`ubuntu`|[cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis")|
|
| CakePHP with `PostgreSQL` and `Redis` | `ubuntu` | [cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis") |
|
||||||
|CakePHP without services|`macOS`, `ubuntu` and `windows`|[cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services")|
|
| CakePHP without services | `macOS`, `ubuntu` and `windows` | [cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services") |
|
||||||
|CodeIgniter|`macOS`, `ubuntu` and `windows`|[codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter")|
|
| CodeIgniter | `macOS`, `ubuntu` and `windows` | [codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter") |
|
||||||
|Laravel with `MySQL` and `Redis`|`ubuntu`|[laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis")|
|
| Laravel with `MySQL` and `Redis` | `ubuntu` | [laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis") |
|
||||||
|Laravel with `PostgreSQL` and `Redis`|`ubuntu`|[laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis")|
|
| Laravel with `PostgreSQL` and `Redis` | `ubuntu` | [laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis") |
|
||||||
|Laravel without services|`macOS`, `ubuntu` and `windows`|[laravel.yml](./examples/laravel.yml "GitHub Action for Laravel without services")|
|
| Laravel without services | `macOS`, `ubuntu` and `windows` | [laravel.yml](./examples/laravel.yml "GitHub Action for Laravel without services") |
|
||||||
|Lumen with `MySQL` and `Redis`|`ubuntu`|[lumen-mysql.yml](./examples/lumen-mysql.yml "GitHub Action for Lumen with MySQL and Redis")|
|
| Lumen with `MySQL` and `Redis` | `ubuntu` | [lumen-mysql.yml](./examples/lumen-mysql.yml "GitHub Action for Lumen with MySQL and Redis") |
|
||||||
|Lumen with `PostgreSQL` and `Redis`|`ubuntu`|[lumen-postgres.yml](./examples/lumen-postgres.yml "GitHub Action for Lumen with PostgreSQL and Redis")|
|
| Lumen with `PostgreSQL` and `Redis` | `ubuntu` | [lumen-postgres.yml](./examples/lumen-postgres.yml "GitHub Action for Lumen with PostgreSQL and Redis") |
|
||||||
|Lumen without services|`macOS`, `ubuntu` and `windows`|[lumen.yml](./examples/lumen.yml "GitHub Action for Lumen without services")|
|
| Lumen without services | `macOS`, `ubuntu` and `windows` | [lumen.yml](./examples/lumen.yml "GitHub Action for Lumen without services") |
|
||||||
|Phalcon with `MySQL`|`ubuntu`|[phalcon-mysql.yml](./examples/phalcon-mysql.yml "GitHub Action for Phalcon with MySQL")|
|
| Phalcon with `MySQL` | `ubuntu` | [phalcon-mysql.yml](./examples/phalcon-mysql.yml "GitHub Action for Phalcon with MySQL") |
|
||||||
|Phalcon with `PostgreSQL`|`ubuntu`|[phalcon-postgres.yml](./examples/phalcon-postgres.yml "GitHub Action for Phalcon with PostgreSQL")|
|
| Phalcon with `PostgreSQL` | `ubuntu` | [phalcon-postgres.yml](./examples/phalcon-postgres.yml "GitHub Action for Phalcon with PostgreSQL") |
|
||||||
|Roots/bedrock|`ubuntu`|[bedrock.yml](./examples/bedrock.yml "GitHub Action for Wordpress Development using @roots/bedrock")|
|
| Roots/bedrock | `ubuntu` | [bedrock.yml](./examples/bedrock.yml "GitHub Action for Wordpress Development using @roots/bedrock") |
|
||||||
|Roots/sage|`ubuntu`|[sage.yml](./examples/sage.yml "GitHub Action for Wordpress Development using @roots/sage")|
|
| Roots/sage | `ubuntu` | [sage.yml](./examples/sage.yml "GitHub Action for Wordpress Development using @roots/sage") |
|
||||||
|Slim Framework|`macOS`, `ubuntu` and `windows`|[slim-framework.yml](./examples/slim-framework.yml "GitHub Action for Slim Framework")|
|
| Slim Framework | `macOS`, `ubuntu` and `windows` | [slim-framework.yml](./examples/slim-framework.yml "GitHub Action for Slim Framework") |
|
||||||
|Symfony with `MySQL`|`ubuntu`|[symfony-mysql.yml](./examples/symfony-mysql.yml "GitHub Action for Symfony with MySQL")|
|
| Symfony with `MySQL` | `ubuntu` | [symfony-mysql.yml](./examples/symfony-mysql.yml "GitHub Action for Symfony with MySQL") |
|
||||||
|Symfony with `PostgreSQL`|`ubuntu`|[symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL")|
|
| Symfony with `PostgreSQL` | `ubuntu` | [symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL") |
|
||||||
|Symfony without services|`macOS`, `ubuntu` and `windows`|[symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services")|
|
| Symfony without services | `macOS`, `ubuntu` and `windows` | [symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services") |
|
||||||
|Yii2 Starter Kit with `MySQL`|`ubuntu`|[yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL")|
|
| Yii2 Starter Kit with `MySQL` | `ubuntu` | [yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL") |
|
||||||
|Yii2 Starter Kit with `PostgreSQL`|`ubuntu`|[yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL")|
|
| Yii2 Starter Kit with `PostgreSQL` | `ubuntu` | [yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL") |
|
||||||
|Zend Framework|`macOS`, `ubuntu` and `windows`|[zend-framework.yml](./examples/zend-framework.yml "GitHub Action for Zend Framework")|
|
| Zend Framework | `macOS`, `ubuntu` and `windows` | [zend-framework.yml](./examples/zend-framework.yml "GitHub Action for Zend Framework") |
|
||||||
|
|
||||||
## :scroll: License
|
## :scroll: License
|
||||||
|
|
||||||
@ -413,32 +389,39 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package
|
|||||||
|
|
||||||
Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide"). If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/setup-php/issues "Issues reported").
|
Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide"). If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/setup-php/issues "Issues reported").
|
||||||
|
|
||||||
|
|
||||||
## :sparkling_heart: Support This Project
|
## :sparkling_heart: Support This Project
|
||||||
|
|
||||||
- If setup-php saved your developer time, please consider sponsoring setup-php:
|
- Please star the project and share it. If you blog, please share your experience of using `setup-php`.
|
||||||
- [Open Collective](https://opencollective.com/setup-php "setup-php Open Collective")
|
- Please [reach out](mailto:contact@setup-php.com) if you have any questions about sponsoring setup-php.
|
||||||
- [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal")
|
|
||||||
- [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon")
|
|
||||||
- Please [reach out](mailto:contact@setup-php.com) if you have any questions regarding sponsoring setup-php.
|
|
||||||
- Please star the project and share it. If you blog, please share your experience of using this action.
|
|
||||||
|
|
||||||
*Huge thanks to the following companies for supporting `setup-php`*
|
Many users and organisations support setup-php via [GitHub Sponsors](https://github.com/sponsors/shivammathur).
|
||||||
|
|
||||||
|
<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>
|
||||||
|
|
||||||
|
These companies generously provide setup-php their products and services to aid in the development of this project.
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="https://www.jetbrains.com/?from=setup-php">
|
<a href="https://www.jetbrains.com/?from=setup-php">
|
||||||
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
|
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://blackfire.io/?utm_source=setup-php">
|
<a href="https://www.macstadium.com/opensource/members#gh-light-mode-only">
|
||||||
<img src="https://setup-php.com/sponsors//blackfire.svg" alt="Blackfire" width="212" height="60">
|
<img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="148" height="60">
|
||||||
</a>
|
</a>
|
||||||
|
<a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only">
|
||||||
<a href="https://www.macstadium.com/?source=setup-php">
|
<img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="148" height="60">
|
||||||
<img src="https://setup-php.com/sponsors//macstadium.png" alt="Mac Stadium" width="148" height="60">
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
||||||
<img src="https://setup-php.com/sponsors//tidelift.png" alt="Tidelift" width="70" height="60">
|
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="70" height="60">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="https://www.scaleway.com/en/about-us/open-source-program#gh-light-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/scaleway.png" alt="Scaleway" width="174" height="60">
|
||||||
|
</a>
|
||||||
|
<a href="https://www.scaleway.com/en/about-us/open-source-program#gh-dark-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/scaleway-white.png" alt="Scaleway" width="174" height="60">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -73,12 +73,13 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
let darwin: string = await extensions.addExtension(
|
let darwin: string = await extensions.addExtension(
|
||||||
'Xdebug, pcov, grpc, igbinary, imagick, phalcon3, phalcon4, protobuf, psr, rdkafka, swoole, sqlite, ast-beta',
|
'Xdebug, pcov, expect, grpc, igbinary, imagick, phalcon3, phalcon4, protobuf, psr, rdkafka, ssh2, swoole, vips, sqlite, ast-beta',
|
||||||
'7.2',
|
'7.2',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
expect(darwin).toContain('add_brew_extension pcov');
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
|
expect(darwin).toContain('add_brew_extension expect');
|
||||||
expect(darwin).toContain('add_brew_extension grpc');
|
expect(darwin).toContain('add_brew_extension grpc');
|
||||||
expect(darwin).toContain('add_brew_extension igbinary');
|
expect(darwin).toContain('add_brew_extension igbinary');
|
||||||
expect(darwin).toContain('add_brew_extension imagick');
|
expect(darwin).toContain('add_brew_extension imagick');
|
||||||
@ -87,7 +88,9 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('add_brew_extension protobuf');
|
expect(darwin).toContain('add_brew_extension protobuf');
|
||||||
expect(darwin).toContain('add_brew_extension psr');
|
expect(darwin).toContain('add_brew_extension psr');
|
||||||
expect(darwin).toContain('add_brew_extension rdkafka');
|
expect(darwin).toContain('add_brew_extension rdkafka');
|
||||||
|
expect(darwin).toContain('add_brew_extension ssh2');
|
||||||
expect(darwin).toContain('add_brew_extension swoole');
|
expect(darwin).toContain('add_brew_extension swoole');
|
||||||
|
expect(darwin).toContain('add_brew_extension vips');
|
||||||
expect(darwin).toContain('pecl_install sqlite3');
|
expect(darwin).toContain('pecl_install sqlite3');
|
||||||
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
||||||
|
|
||||||
|
@ -127,6 +127,11 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
script = await tools.addPhive('latest', '7.2', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getPhpunitUri', async () => {
|
it('checking getPhpunitUri', async () => {
|
||||||
@ -193,37 +198,37 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking getComposerUrl', async () => {
|
it('checking getComposerUrl', async () => {
|
||||||
expect(await tools.getComposerUrl('latest')).toContain(
|
expect(await tools.getComposerUrl('latest', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-stable.phar'
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('stable')).toContain(
|
expect(await tools.getComposerUrl('stable', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-stable.phar'
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('snapshot')).toContain(
|
expect(await tools.getComposerUrl('snapshot', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer.phar'
|
'https://getcomposer.org/composer.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('preview')).toContain(
|
expect(await tools.getComposerUrl('preview', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-preview.phar'
|
'https://getcomposer.org/composer-preview.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('1')).toContain(
|
expect(await tools.getComposerUrl('1', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-1.phar'
|
'https://getcomposer.org/composer-1.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('2')).toContain(
|
expect(await tools.getComposerUrl('2', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-2.phar'
|
'https://getcomposer.org/composer-2.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('1.7.2')).toContain(
|
expect(await tools.getComposerUrl('1.7.2', '7.4')).toContain(
|
||||||
'https://github.com/composer/composer/releases/download/1.7.2/composer.phar'
|
'https://github.com/composer/composer/releases/download/1.7.2/composer.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('1.7.2')).toContain(
|
expect(await tools.getComposerUrl('1.7.2', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-1.7.2.phar'
|
'https://getcomposer.org/composer-1.7.2.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('2.0.0-RC2')).toContain(
|
expect(await tools.getComposerUrl('2.0.0-RC2', '7.4')).toContain(
|
||||||
'https://github.com/composer/composer/releases/download/2.0.0-RC2/composer.phar'
|
'https://github.com/composer/composer/releases/download/2.0.0-RC2/composer.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('2.0.0-RC2')).toContain(
|
expect(await tools.getComposerUrl('2.0.0-RC2', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-2.0.0-RC2.phar'
|
'https://getcomposer.org/composer-2.0.0-RC2.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('wrong')).toContain(
|
expect(await tools.getComposerUrl('wrong', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-stable.phar'
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -342,7 +347,7 @@ describe('Tools tests', () => {
|
|||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
||||||
@ -376,7 +381,7 @@ describe('Tools tests', () => {
|
|||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
|
||||||
@ -413,7 +418,7 @@ describe('Tools tests', () => {
|
|||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
||||||
@ -442,7 +447,7 @@ describe('Tools tests', () => {
|
|||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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://getcomposer.org/composer-1.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
||||||
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
||||||
@ -457,12 +462,12 @@ describe('Tools tests', () => {
|
|||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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://getcomposer.org/composer-1.phar composer'
|
||||||
);
|
);
|
||||||
|
|
||||||
script = await tools.addTools('composer:preview', '7.4', 'linux');
|
script = await tools.addTools('composer:preview', '7.4', 'linux');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer'
|
||||||
);
|
);
|
||||||
script = await tools.addTools(
|
script = await tools.addTools(
|
||||||
'composer:v1, composer:preview, composer:snapshot',
|
'composer:v1, composer:preview, composer:snapshot',
|
||||||
@ -470,7 +475,7 @@ describe('Tools tests', () => {
|
|||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,11 @@ async function cleanup(path: string): Promise<void> {
|
|||||||
describe('Utils tests', () => {
|
describe('Utils tests', () => {
|
||||||
it('checking readEnv', async () => {
|
it('checking readEnv', async () => {
|
||||||
process.env['test'] = 'setup-php';
|
process.env['test'] = 'setup-php';
|
||||||
|
process.env['test-hyphen'] = 'setup-php';
|
||||||
expect(await utils.readEnv('test')).toBe('setup-php');
|
expect(await utils.readEnv('test')).toBe('setup-php');
|
||||||
|
expect(await utils.readEnv('TEST')).toBe('setup-php');
|
||||||
|
expect(await utils.readEnv('test_hyphen')).toBe('setup-php');
|
||||||
|
expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php');
|
||||||
expect(await utils.readEnv('undefined')).toBe('');
|
expect(await utils.readEnv('undefined')).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
1306
dist/index.js
vendored
1306
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
6243
package-lock.json
generated
6243
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
64
package.json
64
package.json
@ -1,14 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.11.2",
|
"version": "1.11.7",
|
||||||
"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",
|
||||||
|
"types": "lib/install.d.ts",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__",
|
||||||
|
"src": "src"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"src"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"lint": "eslint **/*.ts --cache --fix",
|
"lint": "eslint **/src/*.ts --cache --fix",
|
||||||
"format": "prettier --write **/*.ts && git add .",
|
"format": "prettier --write **/src/*.ts && git add .",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/src/*.ts",
|
||||||
"release": "ncc build -o dist && git add -f dist/",
|
"release": "ncc build -o dist && git add -f dist/",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
@ -24,33 +34,33 @@
|
|||||||
"author": "shivammathur",
|
"author": "shivammathur",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.4.0",
|
"@actions/core": "^1.6.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.1",
|
"@actions/io": "^1.1.2",
|
||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.24",
|
"@types/jest": "^27.4.1",
|
||||||
"@types/node": "^16.3.1",
|
"@types/node": "^17.0.23",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.28.3",
|
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||||
"@typescript-eslint/parser": "^4.28.3",
|
"@typescript-eslint/parser": "^5.18.0",
|
||||||
"@vercel/ncc": "^0.28.6",
|
"@vercel/ncc": "^0.33.3",
|
||||||
"eslint": "^7.30.0",
|
"eslint": "^8.13.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-import": "^2.23.4",
|
"eslint-plugin-import": "^2.26.0",
|
||||||
"eslint-plugin-jest": "^24.3.6",
|
"eslint-plugin-jest": "^26.1.4",
|
||||||
"eslint-plugin-prettier": "^3.4.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"husky": "^4.3.8",
|
"jest": "^27.5.1",
|
||||||
"jest": "^27.0.6",
|
"jest-circus": "^27.5.1",
|
||||||
"jest-circus": "^27.0.6",
|
"prettier": "^2.6.2",
|
||||||
"prettier": "^2.3.2",
|
"simple-git-hooks": "^2.7.0",
|
||||||
"ts-jest": "^27.0.3",
|
"ts-jest": "^27.1.4",
|
||||||
"typescript": "^4.3.5"
|
"typescript": "^4.6.3"
|
||||||
},
|
},
|
||||||
"husky": {
|
"bugs": {
|
||||||
"skipCI": true,
|
"url": "https://github.com/shivammathur/setup-php/issues"
|
||||||
"hooks": {
|
},
|
||||||
|
"simple-git-hooks": {
|
||||||
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
|
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
28
src/configs/brew_extensions
Normal file
28
src/configs/brew_extensions
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
amqp=amqp
|
||||||
|
apcu=apcu
|
||||||
|
expect=expect
|
||||||
|
grpc=grpc
|
||||||
|
igbinary=igbinary
|
||||||
|
imagick=imagick
|
||||||
|
imap=imap
|
||||||
|
memcache=memcache
|
||||||
|
memcached=memcached
|
||||||
|
mongodb=mongodb
|
||||||
|
msgpack=msgpack
|
||||||
|
pcov=pcov
|
||||||
|
pecl_http=http
|
||||||
|
phalcon3=phalcon
|
||||||
|
phalcon4=phalcon
|
||||||
|
propro=propro
|
||||||
|
protobuf=protobuf
|
||||||
|
psr=psr
|
||||||
|
raphf=raphf
|
||||||
|
rdkafka=rdkafka
|
||||||
|
redis=redis
|
||||||
|
ssh2=ssh2
|
||||||
|
swoole=swoole
|
||||||
|
vips=vips
|
||||||
|
xdebug=xdebug
|
||||||
|
xdebug2=xdebug
|
||||||
|
yaml=yaml
|
||||||
|
zmq=zmq
|
@ -30,15 +30,17 @@ export async function addExtensionDarwin(
|
|||||||
' ' +
|
' ' +
|
||||||
ext_prefix;
|
ext_prefix;
|
||||||
return;
|
return;
|
||||||
// match 5.6 to 8.0 amqp, grpc, igbinary, imagick, imap, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, swoole, xdebug, xdebug2, zmq
|
// match 5.6 to 8.0 amqp, expect, grpc, igbinary, imagick, imap, mongodb, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|swoole|xdebug|xdebug2|zmq)/.test(
|
// match 7.0vips to 8.0vips
|
||||||
|
case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mcrypt|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||||
case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(
|
case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
|
case /(7\.[0-4]|8\.0])vips/.test(version_extension):
|
||||||
command = 'add_brew_extension ' + extension_name.replace('pecl_', '');
|
command = 'add_brew_extension ' + extension_name.replace('pecl_', '');
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
|
@ -67,9 +67,9 @@ export async function run(): Promise<void> {
|
|||||||
const version: string = await utils.parseVersion(
|
const version: string = await utils.parseVersion(
|
||||||
await utils.getInput('php-version', true)
|
await utils.getInput('php-version', true)
|
||||||
);
|
);
|
||||||
if (version == '8.1') {
|
if (parseFloat(version) < 5.6 || parseFloat(version) > 8.0) {
|
||||||
core.setFailed(
|
core.setFailed(
|
||||||
'PHP 8.1 is not supported on setup-php v1.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2'
|
`setup-php v1 supports only PHP 5.6 to 8.0.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ export async function run(): Promise<void> {
|
|||||||
core.setFailed('Unable to get the PHP version');
|
core.setFailed('Unable to get the PHP version');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error as Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ add_log() {
|
|||||||
|
|
||||||
# Function to remove extensions
|
# Function to remove extensions
|
||||||
remove_extension() {
|
remove_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
|
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
||||||
@ -26,7 +26,7 @@ remove_extension() {
|
|||||||
|
|
||||||
# Function to test if extension is loaded
|
# Function to test if extension is loaded
|
||||||
check_extension() {
|
check_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
if [ "$extension" != "mysql" ]; then
|
if [ "$extension" != "mysql" ]; then
|
||||||
php -m | grep -i -q -w "$extension"
|
php -m | grep -i -q -w "$extension"
|
||||||
else
|
else
|
||||||
@ -42,7 +42,7 @@ pecl_install() {
|
|||||||
|
|
||||||
# Function to get the PECL version
|
# Function to get the PECL version
|
||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
||||||
@ -55,7 +55,7 @@ get_pecl_version() {
|
|||||||
|
|
||||||
# Function to install a PECL version
|
# Function to install a PECL version
|
||||||
add_pecl_extension() {
|
add_pecl_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
pecl_version=$2
|
pecl_version=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
||||||
@ -95,7 +95,7 @@ add_brew_tap() {
|
|||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
fetch_brew_tap "$tap" >/dev/null 2>&1
|
fetch_brew_tap "$tap" >/dev/null 2>&1
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
brew tap --shallow "$tap" >/dev/null 2>&1
|
brew tap "$tap" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -103,7 +103,8 @@ add_brew_tap() {
|
|||||||
# Function to install a php extension from shivammathur/extensions tap.
|
# Function to install a php extension from shivammathur/extensions tap.
|
||||||
add_brew_extension() {
|
add_brew_extension() {
|
||||||
formula=$1
|
formula=$1
|
||||||
extension=${formula//[0-9]/}
|
extension=$(grep "$formula=" "$dist"/../src/configs/brew_extensions | cut -d '=' -f 2)
|
||||||
|
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")"
|
||||||
add_brew_tap shivammathur/homebrew-php
|
add_brew_tap shivammathur/homebrew-php
|
||||||
add_brew_tap shivammathur/homebrew-extensions
|
add_brew_tap shivammathur/homebrew-extensions
|
||||||
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$formula"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$formula"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
||||||
@ -113,7 +114,7 @@ add_brew_extension() {
|
|||||||
|
|
||||||
# Function to setup extensions
|
# Function to setup extensions
|
||||||
add_extension() {
|
add_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
install_command=$2
|
install_command=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
@ -131,7 +132,7 @@ add_extension() {
|
|||||||
|
|
||||||
# Function to pre-release extensions using PECL
|
# Function to pre-release extensions using PECL
|
||||||
add_unstable_extension() {
|
add_unstable_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
stability=$2
|
stability=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
pecl_version=$(get_pecl_version "$extension" "$stability")
|
pecl_version=$(get_pecl_version "$extension" "$stability")
|
||||||
@ -241,31 +242,39 @@ link_libraries() {
|
|||||||
formula_prefix="$(brew --prefix "$formula")"
|
formula_prefix="$(brew --prefix "$formula")"
|
||||||
sudo mkdir -p "$formula_prefix"/lib
|
sudo mkdir -p "$formula_prefix"/lib
|
||||||
for lib in "$formula_prefix"/lib/*.dylib; do
|
for lib in "$formula_prefix"/lib/*.dylib; do
|
||||||
[ -f "$lib" ] || break
|
|
||||||
lib_name=$(basename "$lib")
|
lib_name=$(basename "$lib")
|
||||||
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
|
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_brew() {
|
patch_brew() {
|
||||||
sudo sed -i '' "s/ keg.link(verbose: verbose?)/ keg.link(verbose: verbose?, overwrite: true)/" "$brew_repo"/Library/Homebrew/formula_installer.rb
|
formula_installer="$brew_repo"/Library/Homebrew/formula_installer.rb
|
||||||
|
code=" keg.link\(verbose: verbose\?"
|
||||||
|
sudo sed -Ei '' "s/$code.*/$code, overwrite: true\)/" "$formula_installer"
|
||||||
# shellcheck disable=SC2064
|
# shellcheck disable=SC2064
|
||||||
trap "git -C $brew_repo stash >/dev/null 2>&1" exit
|
trap "sudo sed -Ei '' 's/$code.*/$code, overwrite: overwrite?\)/' $formula_installer" exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# Helper function to update the dependencies.
|
||||||
|
update_dependencies_helper() {
|
||||||
|
dependency=$1
|
||||||
|
curl -o "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "${curl_opts[@]}" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb"
|
||||||
|
link_libraries "$dependency"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update dependencies
|
# Function to update dependencies
|
||||||
update_dependencies() {
|
update_dependencies() {
|
||||||
|
if ! [ -e /tmp/update_dependencies ]; then
|
||||||
if [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
if [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
||||||
patch_brew
|
patch_brew
|
||||||
while read -r formula; do
|
while read -r dependency; do
|
||||||
(
|
update_dependencies_helper "$dependency" &
|
||||||
curl -o "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "${curl_opts[@]}" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb"
|
to_wait+=($!)
|
||||||
link_libraries "$formula"
|
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
||||||
) &
|
|
||||||
to_wait+=( $! )
|
|
||||||
done < "$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
fi
|
fi
|
||||||
|
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get PHP version if it is already installed using Homebrew.
|
# Function to get PHP version if it is already installed using Homebrew.
|
||||||
@ -311,6 +320,7 @@ brew_repo="$(brew --repository)"
|
|||||||
tap_dir="$brew_repo"/Library/Taps
|
tap_dir="$brew_repo"/Library/Taps
|
||||||
existing_version=$(get_brewed_php)
|
existing_version=$(get_brewed_php)
|
||||||
export HOMEBREW_CHANGE_ARCH_TO_ARM=1
|
export HOMEBREW_CHANGE_ARCH_TO_ARM=1
|
||||||
|
export HOMEBREW_DEVELOPER=1
|
||||||
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||||
export HOMEBREW_NO_AUTO_UPDATE=1
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||||
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
||||||
|
@ -20,7 +20,7 @@ update_ppa() {
|
|||||||
|
|
||||||
# Function to install phalcon
|
# Function to install phalcon
|
||||||
install_phalcon() {
|
install_phalcon() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
version=$2
|
version=$2
|
||||||
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
|
@ -62,7 +62,7 @@ configure_pecl() {
|
|||||||
|
|
||||||
# Function to get the PECL version
|
# Function to get the PECL version
|
||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
||||||
@ -89,7 +89,7 @@ enable_extension() {
|
|||||||
|
|
||||||
# Function to test if extension is loaded
|
# Function to test if extension is loaded
|
||||||
check_extension() {
|
check_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
if [ "$extension" != "mysql" ]; then
|
if [ "$extension" != "mysql" ]; then
|
||||||
php -m | grep -i -q -w "$extension"
|
php -m | grep -i -q -w "$extension"
|
||||||
else
|
else
|
||||||
@ -99,7 +99,7 @@ check_extension() {
|
|||||||
|
|
||||||
# Function to delete extensions
|
# Function to delete extensions
|
||||||
delete_extension() {
|
delete_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
||||||
@ -109,7 +109,7 @@ delete_extension() {
|
|||||||
|
|
||||||
# Function to disable and delete extensions
|
# Function to disable and delete extensions
|
||||||
remove_extension() {
|
remove_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
if [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
if [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
||||||
sudo phpdismod -v "$version" "$extension"
|
sudo phpdismod -v "$version" "$extension"
|
||||||
fi
|
fi
|
||||||
@ -118,7 +118,7 @@ remove_extension() {
|
|||||||
|
|
||||||
# Function to setup extensions
|
# Function to setup extensions
|
||||||
add_extension() {
|
add_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
install_command=$2
|
install_command=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
@ -135,7 +135,7 @@ add_extension() {
|
|||||||
|
|
||||||
# Function to install a PECL version
|
# Function to install a PECL version
|
||||||
add_pecl_extension() {
|
add_pecl_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
pecl_version=$2
|
pecl_version=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
configure_pecl
|
configure_pecl
|
||||||
@ -158,7 +158,7 @@ add_pecl_extension() {
|
|||||||
|
|
||||||
# Function to pre-release extensions using PECL
|
# Function to pre-release extensions using PECL
|
||||||
add_unstable_extension() {
|
add_unstable_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
stability=$2
|
stability=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
pecl_version=$(get_pecl_version "$extension" "$stability")
|
pecl_version=$(get_pecl_version "$extension" "$stability")
|
||||||
@ -313,7 +313,7 @@ cross="✗"
|
|||||||
version=$1
|
version=$1
|
||||||
dist=$2
|
dist=$2
|
||||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||||
apt_install="sudo $debconf_fix apt-fast install -y"
|
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
|
||||||
tool_path_dir="/usr/local/bin"
|
tool_path_dir="/usr/local/bin"
|
||||||
curl_opts=(-sL)
|
curl_opts=(-sL)
|
||||||
composer_home="$HOME/.composer"
|
composer_home="$HOME/.composer"
|
||||||
|
@ -46,13 +46,13 @@ Function Add-ToProfile {
|
|||||||
Function Add-Printf {
|
Function Add-Printf {
|
||||||
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
|
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
|
||||||
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
||||||
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe
|
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe -Force > $null 2>&1
|
||||||
} else {
|
} else {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$php_dir\printf.zip"
|
Invoke-WebRequest -UseBasicParsing -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$php_dir\printf.zip"
|
||||||
Expand-Archive -Path $php_dir\printf.zip -DestinationPath $php_dir -Force
|
Expand-Archive -Path $php_dir\printf.zip -DestinationPath $php_dir -Force
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value "C:\Program Files\Git\usr\bin\printf.exe"
|
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value "C:\Program Files\Git\usr\bin\printf.exe" -Force > $null 2>&1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ Function Install-PSPackage() {
|
|||||||
Add-ToProfile $current_profile "$package-search" "Import-Module $module_path"
|
Add-ToProfile $current_profile "$package-search" "Import-Module $module_path"
|
||||||
|
|
||||||
if($null -eq (Get-Command $cmdlet -ErrorAction SilentlyContinue)) {
|
if($null -eq (Get-Command $cmdlet -ErrorAction SilentlyContinue)) {
|
||||||
Install-Module -Name $cmdlet -Force
|
Install-Module -Name $package -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +277,6 @@ $github = 'https://github.com'
|
|||||||
$composer_bin = "$env:APPDATA\Composer\vendor\bin"
|
$composer_bin = "$env:APPDATA\Composer\vendor\bin"
|
||||||
$composer_json = "$env:APPDATA\Composer\composer.json"
|
$composer_json = "$env:APPDATA\Composer\composer.json"
|
||||||
$composer_lock = "$env:APPDATA\Composer\composer.lock"
|
$composer_lock = "$env:APPDATA\Composer\composer.lock"
|
||||||
$master_version = '8.0'
|
|
||||||
$arch = 'x64'
|
$arch = 'x64'
|
||||||
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||||
$arch = 'x86'
|
$arch = 'x86'
|
||||||
@ -304,17 +303,11 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|||||||
}
|
}
|
||||||
$status = "Installed"
|
$status = "Installed"
|
||||||
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 (Get-InstalledModule).Name -notcontains 'VcRedist') {
|
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ($version -eq $master_version) {
|
|
||||||
$version = 'master'
|
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri https://github.com/shivammathur/php-builder-windows/releases/latest/download/Get-Php.ps1 -OutFile $php_dir\Get-Php.ps1 > $null 2>&1
|
|
||||||
& $php_dir\Get-Php.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir
|
|
||||||
} else {
|
|
||||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
||||||
}
|
|
||||||
} catch { }
|
} catch { }
|
||||||
} else {
|
} else {
|
||||||
$status = "Found"
|
$status = "Found"
|
||||||
@ -329,5 +322,5 @@ if($installed.MajorMinorVersion -ne $version) {
|
|||||||
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
||||||
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
||||||
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||||
New-Item -ItemType Directory -Path $composer_bin -Force 2>&1 | Out-Null
|
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
|
||||||
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
||||||
|
12
src/tools.ts
12
src/tools.ts
@ -119,6 +119,9 @@ export async function addPhive(
|
|||||||
case /7\.1/.test(php_version):
|
case /7\.1/.test(php_version):
|
||||||
version = version.replace('latest', '0.13.5');
|
version = version.replace('latest', '0.13.5');
|
||||||
break;
|
break;
|
||||||
|
case /7\.2/.test(php_version):
|
||||||
|
version = version.replace('latest', '0.14.5');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 'latest':
|
case 'latest':
|
||||||
@ -242,8 +245,11 @@ export async function addComposer(tools_list: string[]): Promise<string[]> {
|
|||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
*/
|
*/
|
||||||
export async function getComposerUrl(version: string): Promise<string> {
|
export async function getComposerUrl(
|
||||||
let cache_url = `https://github.com/shivammathur/composer-cache/releases/latest/download/composer-${version.replace(
|
version: string,
|
||||||
|
php_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
let cache_url = `https://github.com/shivammathur/composer-cache/releases/latest/download/composer-${php_version}-${version.replace(
|
||||||
'latest',
|
'latest',
|
||||||
'stable'
|
'stable'
|
||||||
)}.phar`;
|
)}.phar`;
|
||||||
@ -412,7 +418,7 @@ export async function addTools(
|
|||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version);
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case 'composer':
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version, php_version);
|
||||||
script += await addArchive('composer', url, os_version);
|
script += await addArchive('composer', url, os_version);
|
||||||
break;
|
break;
|
||||||
case 'codeception':
|
case 'codeception':
|
||||||
|
19
src/utils.ts
19
src/utils.ts
@ -10,13 +10,16 @@ import * as core from '@actions/core';
|
|||||||
* @param property
|
* @param property
|
||||||
*/
|
*/
|
||||||
export async function readEnv(property: string): Promise<string> {
|
export async function readEnv(property: string): Promise<string> {
|
||||||
const value = process.env[property];
|
const property_lc: string = property.toLowerCase();
|
||||||
switch (value) {
|
const property_uc: string = property.toUpperCase();
|
||||||
case undefined:
|
return (
|
||||||
return '';
|
process.env[property] ||
|
||||||
default:
|
process.env[property_lc] ||
|
||||||
return value;
|
process.env[property_uc] ||
|
||||||
}
|
process.env[property_lc.replace('_', '-')] ||
|
||||||
|
process.env[property_uc.replace('_', '-')] ||
|
||||||
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +71,7 @@ export async function fetch(url: string): Promise<string> {
|
|||||||
*/
|
*/
|
||||||
export async function parseVersion(version: string): Promise<string> {
|
export async function parseVersion(version: string): Promise<string> {
|
||||||
const manifest =
|
const manifest =
|
||||||
'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json';
|
'https://raw.githubusercontent.com/shivammathur/setup-php/releases/v1/src/configs/php-versions.json';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case /^(latest|\d+\.x)$/.test(version):
|
case /^(latest|\d+\.x)$/.test(version):
|
||||||
return JSON.parse(await fetch(manifest))[version];
|
return JSON.parse(await fetch(manifest))[version];
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"declaration": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": [
|
"lib": [
|
||||||
"ESNext"
|
"ES2020"
|
||||||
],
|
],
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
@ -12,7 +13,7 @@
|
|||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "ESNext"
|
"target": "ES2019"
|
||||||
},
|
},
|
||||||
"exclude": ["__tests__", "lib", "node_modules"]
|
"exclude": ["__tests__", "lib", "node_modules"]
|
||||||
}
|
}
|
Reference in New Issue
Block a user