Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e94dfca93 | ||
|
|
7e68292070 | ||
|
|
51d5ac37df | ||
|
|
51c455198d | ||
|
|
b95ad9e061 | ||
|
|
c9a96cbdd1 | ||
|
|
60a4a89981 | ||
|
|
a36d464b4a | ||
|
|
669a423ff1 | ||
|
|
113fcc64e3 | ||
|
|
afefcaf556 | ||
|
|
df4388ca60 | ||
|
|
fa18c2b29f | ||
|
|
399ab79d14 | ||
|
|
9601a19811 | ||
|
|
60ff151fc1 | ||
|
|
121cb19a65 | ||
|
|
739ccacdc4 | ||
|
|
cff0bdeaa3 | ||
|
|
70d858dd49 | ||
|
|
3340d60d91 | ||
|
|
57c17e3349 | ||
|
|
356e1a5128 | ||
|
|
633920d001 | ||
|
|
406f3c410a | ||
|
|
17349dafc1 | ||
|
|
962f570776 | ||
|
|
f66ac5d5a6 | ||
|
|
3f466981fc | ||
|
|
fd62612e9e | ||
|
|
26791e8412 | ||
|
|
f42065d568 | ||
|
|
912f27c42c |
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
"plugin:import/warnings",
|
"plugin:import/warnings",
|
||||||
"plugin:import/typescript",
|
"plugin:import/typescript",
|
||||||
"plugin:prettier/recommended",
|
"plugin:prettier/recommended",
|
||||||
"prettier/@typescript-eslint"
|
"prettier"
|
||||||
],
|
],
|
||||||
"plugins": ["@typescript-eslint", "jest"]
|
"plugins": ["@typescript-eslint", "jest"]
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ name: Docs workflow
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 15 * * 2'
|
- cron: '0 15 * * 6'
|
||||||
jobs:
|
jobs:
|
||||||
create:
|
create:
|
||||||
name: Create
|
name: Create
|
||||||
@@ -10,7 +10,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, windows-2019, macos-10.15, macos-11.0]
|
operating-system: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, windows-2019, macos-10.15]
|
||||||
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
|
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
|
||||||
steps:
|
steps:
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@@ -62,7 +62,11 @@ jobs:
|
|||||||
for os in ubuntu-20.04 ubuntu-18.04 ubuntu-16.04 windows-2019 macos-10.15 macos-11.0; do
|
for os in ubuntu-20.04 ubuntu-18.04 ubuntu-16.04 windows-2019 macos-10.15 macos-11.0; 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; 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; do
|
||||||
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
|
if [ "$os" = "macos-11.0" ]; then
|
||||||
|
cat lists/php"$version"-macos-10.15.md >> Php-extensions-loaded-on-"$os".md
|
||||||
|
else
|
||||||
|
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
rm -rf ./lists
|
rm -rf ./lists
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ Both `GitHub-hosted` and `self-hosted` runners are suppported by `setup-php` on
|
|||||||
|Virtual environment|YAML workflow label|Pre-installed PHP|
|
|Virtual environment|YAML workflow label|Pre-installed PHP|
|
||||||
|--- |--- |--- |
|
|--- |--- |--- |
|
||||||
|Ubuntu 16.04|`ubuntu-16.04`|`PHP 5.6` to `PHP 8.0`|
|
|Ubuntu 16.04|`ubuntu-16.04`|`PHP 5.6` to `PHP 8.0`|
|
||||||
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|`PHP 7.1` to `PHP 8.0`|
|
|Ubuntu 18.04|`ubuntu-18.04`|`PHP 7.1` to `PHP 8.0`|
|
||||||
|Ubuntu 20.04|`ubuntu-20.04`|`PHP 7.4` to `PHP 8.0`|
|
|Ubuntu 20.04|`ubuntu-latest` or `ubuntu-20.04`|`PHP 7.4` to `PHP 8.0`|
|
||||||
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 8.0`|
|
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 8.0`|
|
||||||
|macOS Catalina 10.15|`macos-latest` or `macos-10.15`|`PHP 8.0`|
|
|macOS Catalina 10.15|`macos-latest` or `macos-10.15`|`PHP 8.0`|
|
||||||
|macOS Big Sur 11.0|`macos-11.0`|`PHP 8.0`|
|
|macOS Big Sur 11.0|`macos-11.0`|`PHP 8.0`|
|
||||||
@@ -117,7 +117,7 @@ On all supported OS/Platforms the following PHP versions are supported as per th
|
|||||||
|
|
||||||
PHP extensions can be setup using the `extensions` input. It accepts a `string` in csv-format.
|
PHP extensions can be setup using the `extensions` input. It accepts a `string` in csv-format.
|
||||||
|
|
||||||
- On `Ubuntu`, extensions which are available as a package or available on `PECL` can be setup.
|
- On `Ubuntu`, extensions which are available as a package, available on `PECL`, or hosted on GitHub can be setup.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with PECL extension
|
- name: Setup PHP with PECL extension
|
||||||
@@ -129,7 +129,7 @@ PHP extensions can be setup using the `extensions` input. It accepts a `string`
|
|||||||
|
|
||||||
- On `Windows`, extensions available on `PECL` which have the `DLL` binary can be setup.
|
- On `Windows`, extensions available on `PECL` which have the `DLL` binary can be setup.
|
||||||
|
|
||||||
- On `macOS`, extensions available on `PECL` can be installed.
|
- On `macOS`, extensions available on `PECL` or hosted on GitHub can be installed.
|
||||||
|
|
||||||
- Extensions installed along with PHP if specified are enabled.
|
- Extensions installed along with PHP if specified are enabled.
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ PHP extensions can be setup using the `extensions` input. It accepts a `string`
|
|||||||
- These extensions have custom support:
|
- These extensions have custom support:
|
||||||
- `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`.
|
- `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`.
|
||||||
- `geos` on `Ubuntu` and `macOS`.
|
- `geos` on `Ubuntu` and `macOS`.
|
||||||
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
|
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_oci`, `pecl_http`, `phalcon3` and `phalcon4` on all supported OS.
|
||||||
|
|
||||||
- By default, extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
|
- By default, extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
|
||||||
|
|
||||||
@@ -192,11 +192,23 @@ PHP extensions can be setup using the `extensions` input. It accepts a `string`
|
|||||||
fail-fast: true
|
fail-fast: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Extensions can be compiled from source if they are hosted on GitHub. In this case, the version specification contains the repository and branch/tag to clone:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PHP and remove shared extension
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
extensions: mongodb-mongodb/mongo-php-driver@v1.9
|
||||||
|
```
|
||||||
|
|
||||||
|
The version can be a branch name or tag as supported by `git clone -b <name>`. The clone is performed recursively, i.e. submodules will be cloned as well.
|
||||||
|
|
||||||
## :wrench: Tools Support
|
## :wrench: Tools Support
|
||||||
|
|
||||||
These tools can be setup globally using the `tools` input. It accepts a string in csv-format.
|
These tools can be setup globally using the `tools` input. It accepts a string in csv-format.
|
||||||
|
|
||||||
`behat`, `blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpspec`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
`behat`, `blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `php-config`, `php-cs-fixer`, `phpcbf`, `phpcpd`, `phpcs`, `phpize`, `phplint`, `phpmd`, `phpspec`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony` or `symfony-cli`, `vapor` or `vapor-cli`, `wp` or `wp-cli`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with tools
|
- name: Setup PHP with tools
|
||||||
@@ -206,7 +218,7 @@ These tools can be setup globally using the `tools` input. It accepts a string i
|
|||||||
tools: php-cs-fixer, phpunit
|
tools: php-cs-fixer, phpunit
|
||||||
```
|
```
|
||||||
|
|
||||||
- To set up a particular version of a tool, specify it in the form `tool:version`. The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying `v1`, `v2`, `snapshot` or `preview` as versions or the exact version in semver format.
|
- To set up a particular version of a tool, specify it in the form `tool:version`. The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying `v1`, `v2`, `snapshot` or `preview` as versions, or the exact version in semver format.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with composer v2
|
- name: Setup PHP with composer v2
|
||||||
@@ -302,8 +314,9 @@ Runs on PHP 7.1 and newer PHP versions.
|
|||||||
|
|
||||||
### Disable Coverage
|
### Disable Coverage
|
||||||
|
|
||||||
Specify `coverage: none` to remove both `Xdebug` and `PCOV`.
|
Specify `coverage: none` to remove both `Xdebug` and `PCOV`.
|
||||||
Consider disabling the coverage using this PHP action for these reasons.
|
|
||||||
|
Disable coverage for these reasons:
|
||||||
|
|
||||||
- You are not generating coverage reports while testing.
|
- You are not generating coverage reports while testing.
|
||||||
- It will remove `Xdebug`, which will have a positive impact on PHP performance.
|
- It will remove `Xdebug`, which will have a positive impact on PHP performance.
|
||||||
@@ -370,7 +383,7 @@ Consider disabling the coverage using this PHP action for these reasons.
|
|||||||
|
|
||||||
#### `phpts` (optional)
|
#### `phpts` (optional)
|
||||||
|
|
||||||
- Specify to set up thread-safe version of PHP on windows.
|
- Specify to set up thread-safe version of PHP on Windows.
|
||||||
- Accepts `ts` and `nts`.
|
- Accepts `ts` and `nts`.
|
||||||
- By default, it is set to `nts`.
|
- By default, it is set to `nts`.
|
||||||
- See [thread safe setup](#thread-safe-setup) for more info.
|
- See [thread safe setup](#thread-safe-setup) for more info.
|
||||||
@@ -485,8 +498,8 @@ jobs:
|
|||||||
|
|
||||||
> Update to the latest patch of PHP versions.
|
> Update to the latest patch of PHP versions.
|
||||||
|
|
||||||
- Pre-installed PHP versions on the GitHub Actions runner are not updated to their latest patch release by default.
|
- Pre-installed PHP versions on the GitHub Actions images are not updated to their latest patch release by default.
|
||||||
- You can specify the `update` environment variable to `true` to force update to the latest release.
|
- You can specify the `update` environment variable to `true` for updating to the latest release.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with latest versions
|
- name: Setup PHP with latest versions
|
||||||
@@ -547,7 +560,7 @@ jobs:
|
|||||||
|
|
||||||
- To set up a dockerized self-hosted runner, refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Ubuntu) to set up in an `Ubuntu` container and refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows) to set up in a `Windows` container.
|
- To set up a dockerized self-hosted runner, refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Ubuntu) to set up in an `Ubuntu` container and refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows) to set up in a `Windows` container.
|
||||||
- To set up the runner directly on the host OS or in a virtual machine, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
|
- To set up the runner directly on the host OS or in a virtual machine, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
|
||||||
- If your workflow uses [services](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices "GitHub Actions Services"), then setup the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.
|
- If your workflow uses [service containers](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices "GitHub Actions Services"), then setup the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.
|
||||||
|
|
||||||
Specify the environment variable `runner` with the value `self-hosted`. Without this your workflow will fail.
|
Specify the environment variable `runner` with the value `self-hosted`. Without this your workflow will fail.
|
||||||
|
|
||||||
@@ -572,8 +585,8 @@ jobs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Notes**
|
**Notes**
|
||||||
- Do not setup multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
|
- Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
|
||||||
- Do not setup self-hosted runners on the side on your development environment or your production server.
|
- Do not set up self-hosted runners on the side on your development environment or your production server.
|
||||||
- Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
|
- Avoid using the same labels for your `self-hosted` runners which are used by `GitHub-hosted` runners.
|
||||||
|
|
||||||
### Local Testing Setup
|
### Local Testing Setup
|
||||||
@@ -597,6 +610,8 @@ jobs:
|
|||||||
|
|
||||||
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
|
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
|
||||||
|
|
||||||
|
Choose the image tag which matches the `runs-on` property in your workflow:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# For runs-on: ubuntu-latest
|
# For runs-on: ubuntu-latest
|
||||||
act -P ubuntu-latest=shivammathur/node:latest
|
act -P ubuntu-latest=shivammathur/node:latest
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import * as extensions from '../src/extensions';
|
|||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it('checking addExtensionOnWindows', async () => {
|
||||||
let win32: string = await extensions.addExtension(
|
let win32: string = await extensions.addExtension(
|
||||||
'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2, sqlsrv-1.2.3preview1',
|
'Xdebug, pcov, sqlite, :intl, phalcon4, pecl_http, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2, sqlsrv-1.2.3preview1',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
@@ -12,6 +12,7 @@ describe('Extension tests', () => {
|
|||||||
expect(win32).toContain('Add-Extension sqlite3');
|
expect(win32).toContain('Add-Extension sqlite3');
|
||||||
expect(win32).toContain('Remove-Extension intl');
|
expect(win32).toContain('Remove-Extension intl');
|
||||||
expect(win32).toContain('Add-Phalcon phalcon4');
|
expect(win32).toContain('Add-Phalcon phalcon4');
|
||||||
|
expect(win32).toContain('Add-Http');
|
||||||
expect(win32).toContain('Add-Ioncube');
|
expect(win32).toContain('Add-Ioncube');
|
||||||
expect(win32).toContain('Add-Oci oci8');
|
expect(win32).toContain('Add-Oci oci8');
|
||||||
expect(win32).toContain('Add-Oci pdo_oci');
|
expect(win32).toContain('Add-Oci pdo_oci');
|
||||||
@@ -58,6 +59,15 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
||||||
expect(win32).toContain('Add-Blackfire blackfire-1.31.0');
|
expect(win32).toContain('Add-Blackfire blackfire-1.31.0');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension(
|
||||||
|
'mongodb-mongodb/mongo-php-driver@master',
|
||||||
|
'7.3',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
expect(win32).toContain(
|
||||||
|
'Add-Log "$cross" "mongodb-mongodb/mongo-php-driver@master" "mongodb-mongodb/mongo-php-driver@master is not supported on PHP 7.3"'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
@@ -113,6 +123,12 @@ describe('Extension tests', () => {
|
|||||||
linux = await extensions.addExtension('geos', '7.3', 'linux');
|
linux = await extensions.addExtension('geos', '7.3', 'linux');
|
||||||
expect(linux).toContain('add_geos');
|
expect(linux).toContain('add_geos');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('pecl_http', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('add_http');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('http-1.2.3', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('add_http http-1.2.3');
|
||||||
|
|
||||||
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
||||||
expect(linux).toContain('add_oci oci8');
|
expect(linux).toContain('add_oci oci8');
|
||||||
expect(linux).toContain('add_oci pdo_oci');
|
expect(linux).toContain('add_oci pdo_oci');
|
||||||
@@ -131,11 +147,20 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
linux = await extensions.addExtension('intl-68.2', '8.0', 'linux');
|
linux = await extensions.addExtension('intl-68.2', '8.0', 'linux');
|
||||||
expect(linux).toContain('add_intl intl-68.2');
|
expect(linux).toContain('add_intl intl-68.2');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension(
|
||||||
|
'mongodb-mongodb/mongo-php-driver@master',
|
||||||
|
'7.3',
|
||||||
|
'linux'
|
||||||
|
);
|
||||||
|
expect(linux).toContain(
|
||||||
|
'add_extension_from_github mongodb mongodb mongo-php-driver master'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
let darwin: string = await extensions.addExtension(
|
let darwin: string = await extensions.addExtension(
|
||||||
'amqp, Xdebug, pcov, grpc, igbinary, imagick, imap, protobuf, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
|
'amqp, Xdebug, pcov, grpc, igbinary, imagick, imap, msgpack, protobuf, redis, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
|
||||||
'7.2',
|
'7.2',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
@@ -146,7 +171,9 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('add_brew_extension igbinary extension');
|
expect(darwin).toContain('add_brew_extension igbinary extension');
|
||||||
expect(darwin).toContain('add_brew_extension imagick extension');
|
expect(darwin).toContain('add_brew_extension imagick extension');
|
||||||
expect(darwin).toContain('add_brew_extension imap extension');
|
expect(darwin).toContain('add_brew_extension imap extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension msgpack extension');
|
||||||
expect(darwin).toContain('add_brew_extension protobuf extension');
|
expect(darwin).toContain('add_brew_extension protobuf extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension redis extension');
|
||||||
expect(darwin).toContain('add_brew_extension swoole extension');
|
expect(darwin).toContain('add_brew_extension swoole extension');
|
||||||
expect(darwin).toContain('add_extension sqlite3');
|
expect(darwin).toContain('add_extension sqlite3');
|
||||||
expect(darwin).toContain('remove_extension intl');
|
expect(darwin).toContain('remove_extension intl');
|
||||||
@@ -171,6 +198,12 @@ describe('Extension tests', () => {
|
|||||||
darwin = await extensions.addExtension('geos', '7.3', 'darwin');
|
darwin = await extensions.addExtension('geos', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('add_geos');
|
expect(darwin).toContain('add_geos');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('pecl_http', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('add_http');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('http-1.2.3', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('add_http http-1.2.3');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('add_oci oci8');
|
expect(darwin).toContain('add_oci oci8');
|
||||||
expect(darwin).toContain('add_oci pdo_oci');
|
expect(darwin).toContain('add_oci pdo_oci');
|
||||||
@@ -195,12 +228,6 @@ describe('Extension tests', () => {
|
|||||||
darwin = await extensions.addExtension('xdebug2', '7.2', 'darwin');
|
darwin = await extensions.addExtension('xdebug2', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('add_brew_extension xdebug2');
|
expect(darwin).toContain('add_brew_extension xdebug2');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
|
||||||
expect(darwin).toContain('add_extension redis-2.2.8');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
|
||||||
expect(darwin).toContain('add_extension redis');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('imagick', '5.5', 'darwin');
|
darwin = await extensions.addExtension('imagick', '5.5', 'darwin');
|
||||||
expect(darwin).toContain('add_extension imagick');
|
expect(darwin).toContain('add_extension imagick');
|
||||||
|
|
||||||
@@ -220,5 +247,14 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
darwin = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||||
expect(darwin).toContain('Platform openbsd is not supported');
|
expect(darwin).toContain('Platform openbsd is not supported');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension(
|
||||||
|
'mongodb-mongodb/mongo-php-driver@master',
|
||||||
|
'7.3',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain(
|
||||||
|
'add_extension_from_github mongodb mongodb mongo-php-driver master'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-90
@@ -79,93 +79,6 @@ describe('Tools tests', () => {
|
|||||||
).toBe('releases/download/v1.2.3/tool.phar');
|
).toBe('releases/download/v1.2.3/tool.phar');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getCodeceptionUriBuilder', async () => {
|
|
||||||
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php56')).toBe(
|
|
||||||
'releases/3.2.1/php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php54')).toBe(
|
|
||||||
'releases/3.2.1/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUriBuilder('3.2.1', '')).toBe(
|
|
||||||
'releases/3.2.1/codecept.phar'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getCodeceptionUri', async () => {
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '5.6')).toBe(
|
|
||||||
'php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.0')).toBe(
|
|
||||||
'php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.1')).toBe(
|
|
||||||
'php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.2')).toBe(
|
|
||||||
'codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.3')).toBe(
|
|
||||||
'codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.4')).toBe(
|
|
||||||
'codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('4.0.0', '7.4')).toBe(
|
|
||||||
'releases/4.0.0/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('4.0.0', '5.6')).toBe(
|
|
||||||
'releases/4.0.0/php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('4.0.0', '7.1')).toBe(
|
|
||||||
'releases/4.0.0/php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('3.1.0', '7.4')).toBe(
|
|
||||||
'releases/3.1.0/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('3.1.0', '5.6')).toBe(
|
|
||||||
'releases/3.1.0/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.5.4', '7.4')).toBe(
|
|
||||||
'releases/2.5.4/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.5.4', '5.6')).toBe(
|
|
||||||
'releases/2.5.4/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.3.4', '7.4')).toBe(
|
|
||||||
'releases/2.3.4/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.3.4', '5.4')).toBe(
|
|
||||||
'releases/2.3.4/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.2.4', '5.6')).toBe(
|
|
||||||
'releases/2.2.4/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.2.4', '7.4')).toBe(
|
|
||||||
'releases/2.2.4/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.2.4', '5.4')).toBe(
|
|
||||||
'releases/2.2.4/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.1.7', '5.6')).toBe(
|
|
||||||
'releases/2.1.7/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.1.7', '5.4')).toBe(
|
|
||||||
'releases/2.1.7/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.1.5', '5.4')).toBe(
|
|
||||||
'releases/2.1.5/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.1.5', '7.4')).toBe(
|
|
||||||
'releases/2.1.5/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('1.6.9', '7.4')).toBe(
|
|
||||||
'releases/1.6.9/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('1.5.0', '7.4')).toBe(
|
|
||||||
'releases/1.5.0/codecept.phar'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addPhive', async () => {
|
it('checking addPhive', async () => {
|
||||||
let script: string = await tools.addPhive('1.2.3', '7.4', 'linux');
|
let script: string = await tools.addPhive('1.2.3', '7.4', 'linux');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
@@ -497,7 +410,7 @@ describe('Tools tests', () => {
|
|||||||
'phpspec',
|
'phpspec',
|
||||||
'protoc:v1.2.3',
|
'protoc:v1.2.3',
|
||||||
'psalm',
|
'psalm',
|
||||||
'symfony',
|
'symfony-cli',
|
||||||
'symfony:1.2.3',
|
'symfony:1.2.3',
|
||||||
'vapor-cli',
|
'vapor-cli',
|
||||||
'wp-cli'
|
'wp-cli'
|
||||||
@@ -581,7 +494,6 @@ describe('Tools tests', () => {
|
|||||||
const listOfTools = [
|
const listOfTools = [
|
||||||
'blackfire',
|
'blackfire',
|
||||||
'blackfire-player:1.8.1',
|
'blackfire-player:1.8.1',
|
||||||
'codeception',
|
|
||||||
'cs2pr',
|
'cs2pr',
|
||||||
'deployer',
|
'deployer',
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
@@ -592,7 +504,7 @@ describe('Tools tests', () => {
|
|||||||
'phpize',
|
'phpize',
|
||||||
'phpmd',
|
'phpmd',
|
||||||
'symfony',
|
'symfony',
|
||||||
'wp-cli'
|
'wp'
|
||||||
];
|
];
|
||||||
|
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
@@ -635,6 +547,7 @@ describe('Tools tests', () => {
|
|||||||
it('checking addTools with composer tool using user/tool as input', async () => {
|
it('checking addTools with composer tool using user/tool as input', async () => {
|
||||||
const listOfTools = [
|
const listOfTools = [
|
||||||
'composer:v1',
|
'composer:v1',
|
||||||
|
'codeception/codeception',
|
||||||
'hirak/prestissimo',
|
'hirak/prestissimo',
|
||||||
'narrowspark/automatic-composer-prefetcher',
|
'narrowspark/automatic-composer-prefetcher',
|
||||||
'robmorgan/phinx'
|
'robmorgan/phinx'
|
||||||
|
|||||||
@@ -107,16 +107,16 @@ describe('Utils tests', () => {
|
|||||||
await cleanup(script_path);
|
await cleanup(script_path);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking extensionArray', async () => {
|
it('checking packageArray', async () => {
|
||||||
expect(await utils.extensionArray('a, b, php_c, php-d')).toEqual([
|
expect(await utils.packageArray('a, b, php_c, php-d')).toEqual([
|
||||||
'a',
|
'a',
|
||||||
'b',
|
'b',
|
||||||
'c',
|
'c',
|
||||||
'd'
|
'd'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(await utils.extensionArray('')).toEqual([]);
|
expect(await utils.packageArray('')).toEqual([]);
|
||||||
expect(await utils.extensionArray(' ')).toEqual([]);
|
expect(await utils.packageArray(' ')).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking INIArray', async () => {
|
it('checking INIArray', async () => {
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ inputs:
|
|||||||
coverage:
|
coverage:
|
||||||
description: 'Setup code coverage driver.'
|
description: 'Setup code coverage driver.'
|
||||||
required: false
|
required: false
|
||||||
|
sapi:
|
||||||
|
description: 'Setup PHP Server API.'
|
||||||
|
required: false
|
||||||
tools:
|
tools:
|
||||||
description: 'Setup popular tools globally.'
|
description: 'Setup popular tools globally.'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
Vendored
+2118
-2115
File diff suppressed because it is too large
Load Diff
Generated
+2684
-2143
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.9.0",
|
"version": "2.10.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@@ -30,22 +30,22 @@
|
|||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.19",
|
"@types/jest": "^26.0.20",
|
||||||
"@types/node": "^14.14.14",
|
"@types/node": "^14.14.31",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.10.0",
|
"@typescript-eslint/eslint-plugin": "^4.15.1",
|
||||||
"@typescript-eslint/parser": "^4.10.0",
|
"@typescript-eslint/parser": "^4.15.1",
|
||||||
"@zeit/ncc": "^0.22.3",
|
"@vercel/ncc": "^0.27.0",
|
||||||
"eslint": "^7.16.0",
|
"eslint": "^7.20.0",
|
||||||
"eslint-config-prettier": "^7.1.0",
|
"eslint-config-prettier": "^8.0.0",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
"eslint-plugin-jest": "^24.1.3",
|
"eslint-plugin-jest": "^24.1.5",
|
||||||
"eslint-plugin-prettier": "^3.3.0",
|
"eslint-plugin-prettier": "^3.3.1",
|
||||||
"husky": "^4.3.6",
|
"husky": "^4.3.8",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
"jest-circus": "^26.6.3",
|
"jest-circus": "^26.6.3",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.2.1",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^26.5.1",
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.1.5"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"skipCI": true,
|
"skipCI": true,
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
LoadModule phpPHP_MAJOR_module PHP_DIR\PHP_APACHE_DLL
|
||||||
|
AddHandler application/x-httpd-php .php
|
||||||
|
PHPIniDir PHP_DIR
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
LoadModule proxy_module modules/mod_proxy.so
|
||||||
|
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
|
||||||
|
LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so
|
||||||
|
<FilesMatch "\.php$">
|
||||||
|
<If "-f %{REQUEST_FILENAME}">
|
||||||
|
SetHandler "proxy:fcgi://127.0.0.1:9000/"
|
||||||
|
</If>
|
||||||
|
</FilesMatch>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root html;
|
||||||
|
index index.php index.html index.htm;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root html;
|
||||||
|
}
|
||||||
|
location ~ \.php$ {
|
||||||
|
root html;
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin webmaster@localhost
|
||||||
|
DocumentRoot "/var/www/html"
|
||||||
|
ServerName localhost
|
||||||
|
</VirtualHost>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName localhost
|
||||||
|
ServerAdmin webmaster@localhost
|
||||||
|
DocumentRoot /var/www/html
|
||||||
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
|
</VirtualHost>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include snippets/fastcgi-php.conf;
|
||||||
|
fastcgi_pass unix:/run/php/phpPHP_VERSION-fpm.sock;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.ht {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
+69
-32
@@ -10,13 +10,15 @@ export async function addExtensionDarwin(
|
|||||||
extension_csv: string,
|
extension_csv: string,
|
||||||
version: string
|
version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
const extensions: Array<string> = await utils.packageArray(extension_csv);
|
||||||
let add_script = '\n';
|
let add_script = '\n';
|
||||||
let remove_script = '';
|
let remove_script = '';
|
||||||
await utils.asyncForEach(extensions, async function (extension: string) {
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
|
let matches: RegExpExecArray;
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match :extension
|
// match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
@@ -24,17 +26,17 @@ export async function addExtensionDarwin(
|
|||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...8.0blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
// match pdo_oci and oci8
|
// match couchbase, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.6couchbase...7.4couchbase
|
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^couchbase$|^pdo_oci$|^oci8$|^http|^pecl_http|^pdo_firebird$/.test(
|
||||||
|
extension
|
||||||
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^5\.6couchbase$|^7\.[0-4]couchbase$/.test(version_extension):
|
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
'ext',
|
'ext',
|
||||||
@@ -43,9 +45,7 @@ export async function addExtensionDarwin(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_unstable_extension',
|
'\nadd_unstable_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@@ -53,8 +53,21 @@ export async function addExtensionDarwin(
|
|||||||
ext_prefix
|
ext_prefix
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
|
// the version may match that as well
|
||||||
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
|
matches = /.+-(.+)\/(.+)@(.+)/.exec(extension) as RegExpExecArray;
|
||||||
|
add_script += await utils.joins(
|
||||||
|
'\nadd_extension_from_github',
|
||||||
|
ext_name,
|
||||||
|
matches[1],
|
||||||
|
matches[2],
|
||||||
|
matches[3],
|
||||||
|
ext_prefix
|
||||||
|
);
|
||||||
|
return;
|
||||||
// match semver
|
// match semver
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+.*/.test(extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_pecl_extension',
|
'\nadd_pecl_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@@ -66,11 +79,13 @@ export async function addExtensionDarwin(
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match 5.6 to 8.9 for amqp, grpc, igbinary, imagick, imap, protobuf, swoole and xdebug
|
// match 5.6 to 8.9 for amqp, grpc, igbinary, imagick, imap, msgpack, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq
|
||||||
// match 7.1 to 8.9 for pcov
|
// match 7.1 to 8.9 for pcov
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])(amqp|grpc|igbinary|imagick|imap|protobuf|swoole|xdebug)/.test(
|
// match 5.6 to 7.4 for propro
|
||||||
|
case /(5\.6|7\.[0-4]|8\.[0-9])(amqp|grpc|igbinary|imagick|imap|msgpack|protobuf|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
|
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_brew_extension',
|
'\nadd_brew_extension',
|
||||||
@@ -78,10 +93,6 @@ export async function addExtensionDarwin(
|
|||||||
ext_prefix
|
ext_prefix
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match 5.6redis
|
|
||||||
case /5\.6redis/.test(version_extension):
|
|
||||||
extension = 'redis-2.2.8';
|
|
||||||
break;
|
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
@@ -104,7 +115,7 @@ export async function addExtensionWindows(
|
|||||||
extension_csv: string,
|
extension_csv: string,
|
||||||
version: string
|
version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
const extensions: Array<string> = await utils.packageArray(extension_csv);
|
||||||
let add_script = '\n';
|
let add_script = '\n';
|
||||||
let remove_script = '';
|
let remove_script = '';
|
||||||
await utils.asyncForEach(extensions, async function (extension: string) {
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
||||||
@@ -121,12 +132,14 @@ export async function addExtensionWindows(
|
|||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
// match 5.3ioncube...7.4ioncube
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
|
// match 7.1pecl_http...8.0pecl_http and 7.1http...8.0http
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
|
case /^(7\.[1-4]|8\.0)(http|pecl_http)$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
'ext',
|
'ext',
|
||||||
@@ -135,15 +148,24 @@ export async function addExtensionWindows(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.+-(stable|beta|alpha|devel|snapshot)/.test(extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nAdd-Extension',
|
'\nAdd-Extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
ext_version.replace('stable', '')
|
ext_version.replace('stable', '')
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
|
// the version may match that as well
|
||||||
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
|
add_script += await utils.getUnsupportedLog(
|
||||||
|
extension,
|
||||||
|
version,
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
break;
|
||||||
// match semver without state
|
// match semver without state
|
||||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+$/.test(extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nAdd-Extension',
|
'\nAdd-Extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@@ -152,8 +174,8 @@ export async function addExtensionWindows(
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
// match semver with state
|
// match semver with state
|
||||||
case /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension):
|
||||||
matches = /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.exec(
|
matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec(
|
||||||
version_extension
|
version_extension
|
||||||
) as RegExpExecArray;
|
) as RegExpExecArray;
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
@@ -181,7 +203,7 @@ export async function addExtensionWindows(
|
|||||||
// match 7.0mysql..8.9mysql
|
// match 7.0mysql..8.9mysql
|
||||||
// match 7.0mysqli..8.9mysqli
|
// match 7.0mysqli..8.9mysqli
|
||||||
// match 7.0mysqlnd..8.9mysqlnd
|
// match 7.0mysqlnd..8.9mysqlnd
|
||||||
case /[7-8]\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
case /[7-8]\.\d+(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||||
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
@@ -207,13 +229,15 @@ export async function addExtensionLinux(
|
|||||||
extension_csv: string,
|
extension_csv: string,
|
||||||
version: string
|
version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
const extensions: Array<string> = await utils.packageArray(extension_csv);
|
||||||
let add_script = '\n';
|
let add_script = '\n';
|
||||||
let remove_script = '';
|
let remove_script = '';
|
||||||
await utils.asyncForEach(extensions, async function (extension: string) {
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
|
let matches: RegExpExecArray;
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// Match :extension
|
// Match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
@@ -222,21 +246,23 @@ export async function addExtensionLinux(
|
|||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...8.0blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match pdo_oci and oci8
|
// match couchbase, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.6gearman...7.4gearman, 5.6couchbase...7.4couchbase
|
// match 5.6gearman...8.1gearman
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)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 /^pdo_oci$|^oci8$/.test(extension):
|
case /^couchbase$|^pdo_oci$|^oci8$|^http|^pecl_http|^pdo_firebird$/.test(
|
||||||
|
extension
|
||||||
|
):
|
||||||
case /^(5\.6|7\.[0-4]|8\.0)intl-[\d]+\.[\d]+$/.test(version_extension):
|
case /^(5\.6|7\.[0-4]|8\.0)intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^((5\.6)|(7\.[0-4]))(gearman|couchbase)$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-9])gearman$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
'ext',
|
'ext',
|
||||||
@@ -245,9 +271,7 @@ export async function addExtensionLinux(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_unstable_extension',
|
'\nadd_unstable_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@@ -255,8 +279,21 @@ export async function addExtensionLinux(
|
|||||||
ext_prefix
|
ext_prefix
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
|
// the version may match that as well
|
||||||
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
|
matches = /.+-(.+)\/(.+)@(.+)/.exec(extension) as RegExpExecArray;
|
||||||
|
add_script += await utils.joins(
|
||||||
|
'\nadd_extension_from_github',
|
||||||
|
ext_name,
|
||||||
|
matches[1],
|
||||||
|
matches[2],
|
||||||
|
matches[3],
|
||||||
|
ext_prefix
|
||||||
|
);
|
||||||
|
return;
|
||||||
// match semver versions
|
// match semver versions
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+.*/.test(extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_pecl_extension',
|
'\nadd_pecl_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@@ -278,7 +315,7 @@ export async function addExtensionLinux(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_-].*/.test(version_extension):
|
case /^pdo[_-].+/.test(extension):
|
||||||
extension = extension.replace(/pdo[_-]|3/, '');
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
|
|||||||
+11
-3
@@ -1,8 +1,9 @@
|
|||||||
import {exec} from '@actions/exec/lib/exec';
|
import {exec} from '@actions/exec';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as config from './config';
|
import * as config from './config';
|
||||||
import * as coverage from './coverage';
|
import * as coverage from './coverage';
|
||||||
import * as extensions from './extensions';
|
import * as extensions from './extensions';
|
||||||
|
import * as sapi from './sapi';
|
||||||
import * as tools from './tools';
|
import * as tools from './tools';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
|
|
||||||
@@ -26,10 +27,13 @@ export async function getScript(
|
|||||||
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);
|
||||||
const tools_csv: string = await utils.getInput('tools', false);
|
const tools_csv: string = await utils.getInput('tools', false);
|
||||||
|
const sapi_csv: string = await utils.getInput('sapi', false);
|
||||||
|
|
||||||
let script: string = await utils.readScript(filename);
|
let script: string = await utils.readScript(filename);
|
||||||
|
if (sapi_csv) {
|
||||||
|
script += await sapi.addSAPI(sapi_csv, os_version);
|
||||||
|
}
|
||||||
script += await tools.addTools(tools_csv, version, os_version);
|
script += await tools.addTools(tools_csv, version, os_version);
|
||||||
|
|
||||||
if (extension_csv) {
|
if (extension_csv) {
|
||||||
script += await extensions.addExtension(extension_csv, version, os_version);
|
script += await extensions.addExtension(extension_csv, version, os_version);
|
||||||
}
|
}
|
||||||
@@ -69,4 +73,8 @@ export async function run(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call the run function
|
// call the run function
|
||||||
run();
|
(async () => {
|
||||||
|
await run();
|
||||||
|
})().catch(error => {
|
||||||
|
core.setFailed(error.message);
|
||||||
|
});
|
||||||
|
|||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
import * as utils from './utils';
|
||||||
|
|
||||||
|
export async function getSapiList(sapi_csv: string): Promise<Array<string>> {
|
||||||
|
const sapi_list: Array<string> = await utils.packageArray(sapi_csv);
|
||||||
|
const servers: Array<string> = sapi_list.filter(sapi => /.*:.*/.test(sapi));
|
||||||
|
return [servers[servers.length - 1]].concat(
|
||||||
|
sapi_list.filter(sapi => /.*[^:].*/.test(sapi))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to set sapi
|
||||||
|
*
|
||||||
|
* @param sapi_csv
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function addSAPI(
|
||||||
|
sapi_csv: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
let script: string = '\n' + (await utils.stepLog('Setup SAPI', os_version));
|
||||||
|
let sapi_list: Array<string>;
|
||||||
|
switch (true) {
|
||||||
|
case sapi_csv.split(':').length - 1 > 1:
|
||||||
|
sapi_list = await getSapiList(sapi_csv);
|
||||||
|
script +=
|
||||||
|
'\n' +
|
||||||
|
utils.log(
|
||||||
|
'Multiple SAPI with web servers specified, choosing the last one ' +
|
||||||
|
sapi_list[0],
|
||||||
|
os_version,
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sapi_list = await utils.packageArray(sapi_csv);
|
||||||
|
}
|
||||||
|
await utils.asyncForEach(sapi_list, async function (sapi: string) {
|
||||||
|
sapi = sapi.toLowerCase();
|
||||||
|
switch (os_version) {
|
||||||
|
case 'linux':
|
||||||
|
case 'darwin':
|
||||||
|
script += '\nadd_sapi ' + sapi;
|
||||||
|
break;
|
||||||
|
case 'win32':
|
||||||
|
script += '\nAdd-Sapi ' + sapi;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return script;
|
||||||
|
}
|
||||||
+47
-22
@@ -9,6 +9,7 @@ export xdebug3_versions="7.[2-4]|8.[0-9]"
|
|||||||
export tool_path_dir="/usr/local/bin"
|
export tool_path_dir="/usr/local/bin"
|
||||||
export composer_bin="$HOME/.composer/vendor/bin"
|
export composer_bin="$HOME/.composer/vendor/bin"
|
||||||
export composer_json="$HOME/.composer/composer.json"
|
export composer_json="$HOME/.composer/composer.json"
|
||||||
|
export composer_lock="$HOME/.composer/composer.lock"
|
||||||
export latest="releases/latest/download"
|
export latest="releases/latest/download"
|
||||||
export github="https://github.com/shivammathur"
|
export github="https://github.com/shivammathur"
|
||||||
export bintray="https://dl.bintray/shivammathur"
|
export bintray="https://dl.bintray/shivammathur"
|
||||||
@@ -77,7 +78,7 @@ run_script() {
|
|||||||
repo=$1
|
repo=$1
|
||||||
shift
|
shift
|
||||||
args=("$@")
|
args=("$@")
|
||||||
get -q -e /tmp/install.sh "$bintray/php/$repo.sh" "$github/$repo/$latest/install.sh"
|
get -q -e /tmp/install.sh "$github/$repo/$latest/install.sh" "$bintray/php/$repo.sh"
|
||||||
bash /tmp/install.sh "${args[@]}"
|
bash /tmp/install.sh "${args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,8 +106,9 @@ check_extension() {
|
|||||||
|
|
||||||
# Function to enable existing extensions.
|
# Function to enable existing extensions.
|
||||||
enable_extension() {
|
enable_extension() {
|
||||||
modules_dir="/var/lib/php/modules/$version"
|
if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then
|
||||||
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
if ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
|
if ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
|
||||||
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
|
||||||
@@ -190,6 +192,10 @@ configure_composer() {
|
|||||||
add_log "$cross" "composer" "Could not download composer"
|
add_log "$cross" "composer" "Could not download composer"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if ! [ -e "$composer_json" ]; then
|
||||||
|
echo '{}' | tee "$composer_json" >/dev/null 2>&1
|
||||||
|
sudo chmod 644 "$composer_json"
|
||||||
|
fi
|
||||||
composer -q config -g process-timeout 0
|
composer -q config -g process-timeout 0
|
||||||
echo "$composer_bin" >> "$GITHUB_PATH"
|
echo "$composer_bin" >> "$GITHUB_PATH"
|
||||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
@@ -217,21 +223,7 @@ add_tool() {
|
|||||||
status_code=$(get -v -e "$tool_path" "${url[0]}")
|
status_code=$(get -v -e "$tool_path" "${url[0]}")
|
||||||
fi
|
fi
|
||||||
if [ "$status_code" = "200" ]; then
|
if [ "$status_code" = "200" ]; then
|
||||||
if [ "$tool" = "composer" ]; then
|
add_tools_helper "$tool"
|
||||||
configure_composer "$tool_path"
|
|
||||||
elif [ "$tool" = "cs2pr" ]; then
|
|
||||||
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path" 2>/dev/null ||
|
|
||||||
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
|
||||||
elif [ "$tool" = "phan" ]; then
|
|
||||||
add_extension fileinfo extension >/dev/null 2>&1
|
|
||||||
add_extension ast extension >/dev/null 2>&1
|
|
||||||
elif [ "$tool" = "phive" ]; then
|
|
||||||
add_extension curl extension >/dev/null 2>&1
|
|
||||||
add_extension mbstring extension >/dev/null 2>&1
|
|
||||||
add_extension xml extension >/dev/null 2>&1
|
|
||||||
elif [ "$tool" = "wp-cli" ]; then
|
|
||||||
sudo cp -p "$tool_path" "$tool_path_dir"/wp
|
|
||||||
fi
|
|
||||||
tool_version=$(get_tool_version "$tool" "$ver_param")
|
tool_version=$(get_tool_version "$tool" "$ver_param")
|
||||||
add_log "$tick" "$tool" "Added $tool $tool_version"
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
else
|
else
|
||||||
@@ -253,17 +245,50 @@ add_composertool() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
(
|
(
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
||||||
|
composer global require "$prefix$release" >/dev/null 2>&1
|
||||||
json=$(grep "$prefix$tool" "$composer_json") &&
|
json=$(grep "$prefix$tool" "$composer_json") &&
|
||||||
tool_version=$(get_tool_version 'echo' "$json") &&
|
tool_version=$(get_tool_version 'echo' "$json") &&
|
||||||
add_log "$tick" "$tool" "Added $tool $tool_version"
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
|
add_tools_helper "$tool"
|
||||||
if [ -e "$composer_bin/composer" ]; then
|
if [ -e "$composer_bin/composer" ]; then
|
||||||
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get PHP version in semver format.
|
# Function to get versions of PHP binaries in semver format.
|
||||||
php_semver() {
|
php_semver() {
|
||||||
php"$version" -v | grep -Eo -m 1 "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1
|
binary=${1:-"php$version"}
|
||||||
}
|
arg=${2:-'-v'}
|
||||||
|
"$binary" "$arg" | grep -Eo -m 1 "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get the tag for a php version.
|
||||||
|
php_src_tag() {
|
||||||
|
php_src_tag='master'
|
||||||
|
if ! [[ ${version:?} =~ $nightly_versions ]]; then
|
||||||
|
php_src_tag="php-$semver"
|
||||||
|
fi
|
||||||
|
echo "$php_src_tag"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install extension from a GitHub repository
|
||||||
|
add_extension_from_github() {
|
||||||
|
extension=$1
|
||||||
|
org=$2
|
||||||
|
repo=$3
|
||||||
|
release=$4
|
||||||
|
prefix=$5
|
||||||
|
(
|
||||||
|
add_devtools phpize
|
||||||
|
delete_extension "$extension"
|
||||||
|
git clone -n https://github.com/"$org"/"$repo" /tmp/"$repo-$release" || exit 1
|
||||||
|
cd /tmp/"$repo-$release" || exit 1
|
||||||
|
git checkout "$release" || exit 1
|
||||||
|
git submodule update --init --recursive || exit 1
|
||||||
|
phpize && ./configure && make -j"$(nproc)" && sudo make install
|
||||||
|
enable_extension "$extension" "$prefix"
|
||||||
|
) >/dev/null 2>&1
|
||||||
|
add_extension_log "$extension-$org/$repo@$release" "Installed and enabled"
|
||||||
|
}
|
||||||
|
|||||||
+22
-7
@@ -70,14 +70,14 @@ add_brew_tap() {
|
|||||||
add_brew_extension() {
|
add_brew_extension() {
|
||||||
formula=$1
|
formula=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
extension=${formula//[0-9]/}
|
extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")"
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
add_log "${tick:?}" "$extension" "Enabled"
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
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/"$extension"/* "$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
|
||||||
brew install "$formula@$version" >/dev/null 2>&1
|
brew install "$formula@$version" >/dev/null 2>&1
|
||||||
sudo cp "$brew_prefix/opt/$formula@$version/$extension.so" "$ext_dir"
|
sudo cp "$brew_prefix/opt/$formula@$version/$extension.so" "$ext_dir"
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
@@ -111,17 +111,29 @@ add_pecl() {
|
|||||||
add_log "${tick:?}" "PECL" "Found PECL $pecl_version"
|
add_log "${tick:?}" "PECL" "Found PECL $pecl_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to link all libraries of a formula
|
||||||
|
link_libraries() {
|
||||||
|
formula=$1
|
||||||
|
formula_prefix="$(brew --prefix "$formula")"
|
||||||
|
sudo mkdir -p "$formula_prefix"/lib
|
||||||
|
sudo cp -a "$formula_prefix"/lib/*.dylib "$brew_prefix/lib" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
update_dependencies_helper() {
|
||||||
|
formula=$1
|
||||||
|
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb"
|
||||||
|
link_libraries "$formula"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to update dependencies.
|
# Function to update dependencies.
|
||||||
update_dependencies() {
|
update_dependencies() {
|
||||||
if [[ "$version" =~ ${nightly_versions:?} ]] && [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
if [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
||||||
while read -r formula; do
|
while read -r formula; do
|
||||||
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb" &
|
update_dependencies_helper "$formula" &
|
||||||
to_wait+=($!)
|
to_wait+=($!)
|
||||||
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
fi
|
fi
|
||||||
# Remove once commit with bottle syntax breaking change is in images
|
|
||||||
git -C "$brew_repo" pull origin master
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup PHP 5.6 and newer using Homebrew.
|
# Function to setup PHP 5.6 and newer using Homebrew.
|
||||||
@@ -174,12 +186,15 @@ dist=$2
|
|||||||
brew_prefix="$(brew --prefix)"
|
brew_prefix="$(brew --prefix)"
|
||||||
brew_repo="$(brew --repository)"
|
brew_repo="$(brew --repository)"
|
||||||
tap_dir="$brew_repo"/Library/Taps
|
tap_dir="$brew_repo"/Library/Taps
|
||||||
|
scripts="${dist}"/../src/scripts
|
||||||
export HOMEBREW_CHANGE_ARCH_TO_ARM=1
|
export HOMEBREW_CHANGE_ARCH_TO_ARM=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
|
||||||
|
|
||||||
# shellcheck source=.
|
# shellcheck source=.
|
||||||
. "${dist}"/../src/scripts/common.sh
|
. "${scripts:?}"/tools/add_tools.sh
|
||||||
|
. "${scripts:?}"/common.sh
|
||||||
read_env
|
read_env
|
||||||
self_hosted_setup
|
self_hosted_setup
|
||||||
setup_php
|
setup_php
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
# Function to install libraries required by couchbase
|
# Function to install libraries required by couchbase
|
||||||
add_couchbase_libs() {
|
add_couchbase_libs() {
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
if [[ ${version:?} =~ 5.6|7.[0-1] ]]; then
|
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
||||||
trunk="http://packages.couchbase.com/ubuntu"
|
release="2.10.9"
|
||||||
list="deb $trunk ${DISTRIB_CODENAME:?} ${DISTRIB_CODENAME:?}/main"
|
trunk="https://github.com/couchbase/libcouchbase/releases/download"
|
||||||
|
package="libcouchbase-${release}_ubuntu${DISTRIB_RELEASE/./}_${DISTRIB_CODENAME}_amd64.tar"
|
||||||
|
get -q -n /tmp/libcouchbase.tar "$trunk/$release/$package"
|
||||||
|
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
|
||||||
|
install_packages libev4
|
||||||
|
sudo dpkg -i /tmp/libcouchbase-*/*.deb
|
||||||
else
|
else
|
||||||
trunk="http://packages.couchbase.com/clients/c/repos/deb"
|
trunk="http://packages.couchbase.com/clients/c/repos/deb"
|
||||||
list="deb $trunk/ubuntu${DISTRIB_RELEASE/./} ${DISTRIB_CODENAME:?} ${DISTRIB_CODENAME:?}/main"
|
list="deb $trunk/ubuntu${DISTRIB_RELEASE/./} ${DISTRIB_CODENAME:?} ${DISTRIB_CODENAME:?}/main"
|
||||||
|
get -s -n "" "$trunk/couchbase.key" | sudo apt-key add
|
||||||
|
echo "$list" | sudo tee /etc/apt/sources.list.d/couchbase.list
|
||||||
|
sudo apt-get update
|
||||||
fi
|
fi
|
||||||
add_pecl
|
|
||||||
get -s -n "" "$trunk/couchbase.key" | sudo apt-key add
|
|
||||||
echo "$list" | sudo tee /etc/apt/sources.list.d/couchbase.list
|
|
||||||
sudo apt-get update
|
|
||||||
${apt_install:?} libcouchbase-dev
|
${apt_install:?} libcouchbase-dev
|
||||||
else
|
else
|
||||||
if [[ ${version:?} =~ 5.6|7.[0-1] ]]; then
|
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
||||||
brew install libcouchbase@2
|
brew install libcouchbase@2
|
||||||
brew link --overwrite --force libcouchbase@2
|
brew link --overwrite --force libcouchbase@2
|
||||||
else
|
else
|
||||||
@@ -30,9 +34,11 @@ add_couchbase() {
|
|||||||
if check_extension "couchbase"; then
|
if check_extension "couchbase"; then
|
||||||
add_log "${tick:?}" "couchbase" "Enabled"
|
add_log "${tick:?}" "couchbase" "Enabled"
|
||||||
else
|
else
|
||||||
if [[ ${version:?} =~ 5.6|7.[0-1] ]]; then
|
if [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
||||||
|
pecl_install couchbase-2.2.3 >/dev/null 2>&1
|
||||||
|
elif [[ "${version:?}" =~ 5.6|7.[0-1] ]]; then
|
||||||
pecl_install couchbase-2.6.2 >/dev/null 2>&1
|
pecl_install couchbase-2.6.2 >/dev/null 2>&1
|
||||||
elif [[ ${version:?} =~ 7.2 ]]; then
|
elif [[ "${version:?}" =~ 7.2 ]]; then
|
||||||
pecl_install couchbase-3.0.4 >/dev/null 2>&1
|
pecl_install couchbase-3.0.4 >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
pecl_install couchbase >/dev/null 2>&1
|
pecl_install couchbase >/dev/null 2>&1
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ add_license_log() {
|
|||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
@@ -30,11 +39,13 @@ add_cubrid_helper() {
|
|||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
set_cubrid_repo
|
set_cubrid_repo
|
||||||
set_cubrid_branch
|
set_cubrid_branch
|
||||||
|
[ "$DISTRIB_RELEASE" = "16.04" ] && setup_compiler
|
||||||
(
|
(
|
||||||
git clone -b "$cubrid_branch" --recursive "https://github.com/CUBRID/$cubrid_repo" "/tmp/$cubrid_repo"
|
git clone -b "$cubrid_branch" --recursive "https://github.com/CUBRID/$cubrid_repo" "/tmp/$cubrid_repo"
|
||||||
cd "/tmp/$cubrid_repo" || exit
|
cd "/tmp/$cubrid_repo" || exit
|
||||||
! [[ "$version" =~ ${old_versions:?} ]] && add_devtools
|
! [[ "$version" =~ ${old_versions:?} ]] && add_devtools
|
||||||
phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=shared
|
phpize
|
||||||
|
sudo ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=shared
|
||||||
make -j"$(nproc)"
|
make -j"$(nproc)"
|
||||||
sudo make install
|
sudo make install
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Function Add-Choco() {
|
||||||
|
try {
|
||||||
|
if($null -eq (Get-Command -Name choco.exe -ErrorAction SilentlyContinue)) {
|
||||||
|
# Source: https://docs.chocolatey.org/en-us/choco/setup
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||||
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Add-Firebird() {
|
||||||
|
Add-Choco > $null 2>&1
|
||||||
|
choco install firebird -params '/ClientAndDevTools' -y --force > $null 2>&1
|
||||||
|
if((Get-ChildItem $env:ProgramFiles\**\**\fbclient.dll | Measure-Object).Count -eq 1) {
|
||||||
|
Add-Extension pdo_firebird
|
||||||
|
} else {
|
||||||
|
Add-Log $cross pdo_firebird "Could not install pdo_firebird on PHP $( $installed.FullVersion )"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
add_firebird_client_darwin() {
|
||||||
|
pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/latest | grep -Eo "Firebird-.*.pkg" | head -n 1)
|
||||||
|
get -q -e "/tmp/firebird.pkg" https://github.com/FirebirdSQL/firebird/releases/latest/download/"$pkg_name"
|
||||||
|
sudo installer -pkg /tmp/firebird.pkg -target /
|
||||||
|
sudo mkdir -p /opt/firebird/include /opt/firebird/lib
|
||||||
|
sudo find /Library/Frameworks/Firebird.framework -name '*.h' -exec cp "{}" /opt/firebird/include \;
|
||||||
|
sudo find /Library/Frameworks/Firebird.framework -name '*.dylib' -exec cp "{}" /opt/firebird/lib \;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_firebird_helper() {
|
||||||
|
firebird_dir=$1
|
||||||
|
tag="$(php_src_tag)"
|
||||||
|
get -s -n "" https://github.com/php/php-src/archive/"$tag".tar.gz | tar -xzf - -C /tmp
|
||||||
|
(
|
||||||
|
cd /tmp/php-src-"$tag"/ext/pdo_firebird || exit
|
||||||
|
if [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
||||||
|
sudo sed -i '' '/PHP_CHECK_PDO_INCLUDES/d' config.m4 2>/dev/null || sudo sed -i '/PHP_CHECK_PDO_INCLUDES/d' config.m4
|
||||||
|
fi
|
||||||
|
sudo phpize
|
||||||
|
sudo ./configure --with-pdo-firebird="$firebird_dir"
|
||||||
|
sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
|
||||||
|
sudo make install
|
||||||
|
enable_extension pdo_firebird extension
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
add_firebird() {
|
||||||
|
enable_extension pdo_firebird
|
||||||
|
if ! check_extension pdo_firebird; then
|
||||||
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
|
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
|
||||||
|
lib_arch=$(gcc -dumpmachine)
|
||||||
|
install_packages firebird-dev >/dev/null 2>&1
|
||||||
|
sudo ln -sf /usr/lib/"$lib_arch"/libfbclient.so.2 /usr/lib/libfbclient.so >/dev/null 2>&1
|
||||||
|
sudo ln -sf /usr/lib/"$lib_arch"/libib_util.so /usr/lib/ >/dev/null 2>&1
|
||||||
|
add_firebird_helper /usr >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
add_pdo_extension firebird >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
add_firebird_client_darwin >/dev/null 2>&1
|
||||||
|
add_firebird_helper /opt/firebird >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
add_extension_log pdo_firebird "Installed and enabled"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
# Helper function to add gearman extension.
|
# Helper function to add gearman extension.
|
||||||
add_gearman_helper() {
|
add_gearman_helper() {
|
||||||
sudo "${debconf_fix:?}" add-apt-repository ppa:ondrej/pkg-gearman -y
|
add_ppa ondrej/pkg-gearman
|
||||||
if [ -e "${ext_dir:?}/gearman.so" ] && [ "$DISTRIB_RELEASE" != "16.04" ]; then
|
install_packages libgearman-dev
|
||||||
${apt_install:?} libgearman-dev
|
enable_extension gearman extension
|
||||||
echo "extension=gearman.so" | sudo tee -a "${scan_dir:?}/20-gearman.ini" >/dev/null 2>&1
|
if ! check_extension gearman; then
|
||||||
else
|
|
||||||
status="Installed and enabled"
|
status="Installed and enabled"
|
||||||
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
if [[ "${version:?}" =~ 5.[3-5] ]]; then
|
||||||
sudo "${debconf_fix:?}" apt-get update -y
|
pecl_install gearman-1.1.2
|
||||||
${apt_install:?} php"${version:?}"-gearman
|
|
||||||
else
|
else
|
||||||
${apt_install:?} libgearman-dev php"${version:?}"-gearman
|
install_packages php"${version:?}"-gearman || pecl_install gearman
|
||||||
fi
|
fi
|
||||||
|
enable_extension gearman extension
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
Function Get-ICUUrl() {
|
||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
$icu_version,
|
||||||
|
[Parameter(Position = 1, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
$arch,
|
||||||
|
[Parameter(Position = 2, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
$vs_version
|
||||||
|
)
|
||||||
|
$trunk = "https://windows.php.net"
|
||||||
|
$urls=@("${trunk}/downloads/php-sdk/deps/${vs_version}/${arch}", "${trunk}/downloads/php-sdk/deps/archives/${vs_version}/${arch}")
|
||||||
|
foreach ($url in $urls) {
|
||||||
|
$web_content = Invoke-WebRequest -Uri $url
|
||||||
|
foreach ($link in $web_content.Links) {
|
||||||
|
if ($link -match "/.*ICU-${icu_version}.*/") {
|
||||||
|
return $trunk + $link.HREF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Repair-ICU() {
|
||||||
|
$icu = deplister $ext_dir\php_http.dll | Select-String "icu[a-z]+(\d+).dll,([A-Z]+)" | Foreach-Object { $_.Matches }
|
||||||
|
if($icu -and $icu.Groups[2].Value -ne 'OK') {
|
||||||
|
$vs = "vs" + $installed.VCVersion
|
||||||
|
if ($installed.VCVersion -lt 16) {
|
||||||
|
$vs = "vc" + $installed.VCVersion
|
||||||
|
}
|
||||||
|
$zip_url = Get-ICUUrl $icu.Groups[1].Value $installed.Architecture $vs
|
||||||
|
if ($zip_url -ne '') {
|
||||||
|
New-Item -Path "$php_dir" -Name "icu" -ItemType "directory" | Out-Null
|
||||||
|
Invoke-WebRequest -Uri $zip_url -OutFile "$php_dir\icu\icu.zip"
|
||||||
|
Expand-Archive -Path $php_dir\icu\icu.zip -DestinationPath $php_dir\icu -Force
|
||||||
|
Get-ChildItem $php_dir\icu\bin -Filter *.dll | Copy-Item -Destination $php_dir -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Add-Http() {
|
||||||
|
Add-Extension raphf >$null 2>&1
|
||||||
|
if($version -lt '8.0') {
|
||||||
|
Add-Extension propro >$null 2>&1
|
||||||
|
}
|
||||||
|
Add-Extension pecl_http >$null 2>&1
|
||||||
|
Repair-ICU
|
||||||
|
try {
|
||||||
|
php --ri "http" 2> $null | Out-Null
|
||||||
|
Add-Log $tick "http" "Installed and enabled"
|
||||||
|
} catch {
|
||||||
|
Add-Log $cross "http" "Could not install http on PHP $( $installed.FullVersion )"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
# Function to get http version for a PHP version.
|
||||||
|
get_http_version() {
|
||||||
|
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
||||||
|
echo "pecl_http-2.6.0"
|
||||||
|
elif [[ ${version:?} =~ 7.[0-4] ]]; then
|
||||||
|
echo "pecl_http-3.2.4"
|
||||||
|
else
|
||||||
|
echo "pecl_http-$(get_pecl_version "pecl_http" "stable")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to enable http extension.
|
||||||
|
enable_http() {
|
||||||
|
enable_extension propro extension
|
||||||
|
enable_extension raphf extension
|
||||||
|
if (! [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension propro && check_extension raphf) ||
|
||||||
|
( [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension raphf); then
|
||||||
|
enable_extension http extension
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install linux dependencies.
|
||||||
|
add_http_dependencies_linux() {
|
||||||
|
! [[ ${version:?} =~ ${nightly_versions:?} ]] && add_devtools phpize
|
||||||
|
install_packages zlib1g libbrotli-dev libcurl4-openssl-dev libevent-dev libicu-dev libidn2-dev
|
||||||
|
if [[ ${version:?} =~ ${old_versions:?} ]]; then
|
||||||
|
add_pecl_extension raphf 1.1.2 extension
|
||||||
|
add_pecl_extension propro 1.0.2 extension
|
||||||
|
elif [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
||||||
|
add_extension propro extension
|
||||||
|
add_extension raphf extension
|
||||||
|
else
|
||||||
|
add_extension raphf extension
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install darwin dependencies.
|
||||||
|
add_http_dependencies_darwin() {
|
||||||
|
brew install brotli curl icu4c libevent libidn2
|
||||||
|
if ! [[ ${version:?} =~ ${old_versions:?} ]]; then
|
||||||
|
if [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
||||||
|
add_brew_extension propro extension
|
||||||
|
fi
|
||||||
|
add_brew_extension raphf extension
|
||||||
|
else
|
||||||
|
add_pecl_extension raphf 1.1.2 extension
|
||||||
|
add_pecl_extension propro 1.0.2 extension
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install the dependencies.
|
||||||
|
add_http_dependencies() {
|
||||||
|
os=$1
|
||||||
|
if [ "$os" = 'Linux' ]; then
|
||||||
|
add_http_dependencies_linux
|
||||||
|
else
|
||||||
|
add_http_dependencies_darwin
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get configure options for http.
|
||||||
|
get_http_configure_opts() {
|
||||||
|
os=$1
|
||||||
|
if [ "$os" = 'Linux' ]; then
|
||||||
|
for lib in zlib libbrotli libcurl libevent libicu libidn2 libidn libidnkit2 libidnkit; do
|
||||||
|
http_opts+=( "--with-http-$lib-dir=/usr" )
|
||||||
|
done
|
||||||
|
else
|
||||||
|
http_opts+=( "--with-http-zlib-dir=$(xcrun --show-sdk-path)/usr" )
|
||||||
|
http_opts+=( "--with-http-libbrotli-dir=$(brew --prefix brotli)" )
|
||||||
|
http_opts+=( "--with-http-libcurl-dir=$(brew --prefix curl)" )
|
||||||
|
http_opts+=( "--with-http-libicu-dir=$(brew --prefix icu4c)" )
|
||||||
|
http_opts+=( "--with-http-libevent-dir=$(brew --prefix libevent)" )
|
||||||
|
http_opts+=( "--with-http-libidn2-dir=$(brew --prefix libidn2)" )
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
patch_http_source() {
|
||||||
|
ext=$1
|
||||||
|
os=$2
|
||||||
|
if [ "$os" = 'Darwin' ] && ! [[ ${version:?} =~ ${old_versions:?} ]]; then
|
||||||
|
if [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
||||||
|
sed -i '' -e "s|ext/propro|$(brew --prefix propro@"${version:?}")/include/php/ext/propro@${version:?}|" "/tmp/pecl_http-${ext##*-}/src/php_http_api.h"
|
||||||
|
fi
|
||||||
|
sed -i '' -e "s|ext/raphf|$(brew --prefix raphf@"${version:?}")/include/php/ext/raphf@${version:?}|" "/tmp/pecl_http-${ext##*-}/src/php_http_api.h"
|
||||||
|
if [ "${version:?}" = "5.6" ]; then
|
||||||
|
sed -i '' -e "s|\$abs_srcdir|\$abs_srcdir ${brew_prefix:?}/include|" -e "s|/ext/propro|/php/ext/propro@5.6|" -e "s|/ext/raphf|/php/ext/raphf@5.6|" "/tmp/pecl_http-${ext##*-}/config9.m4"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Helper function to compile and install http.
|
||||||
|
build_http() {
|
||||||
|
ext=$1
|
||||||
|
os=$2
|
||||||
|
(
|
||||||
|
http_opts=() && get_http_configure_opts "$os"
|
||||||
|
c_opts="CFLAGS=-Wno-implicit-function-declaration"
|
||||||
|
cd /tmp/pecl_http-"${ext##*-}" || exit
|
||||||
|
sudo phpize
|
||||||
|
sudo "$c_opts" ./configure --with-http --with-php-config="$(command -v php-config)" "${http_opts[@]}"
|
||||||
|
sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
|
||||||
|
sudo make install
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Compile and install http explicitly.
|
||||||
|
# This is done as pecl compiles raphf and propro as well.
|
||||||
|
add_http_helper() {
|
||||||
|
ext=$1
|
||||||
|
os=$2
|
||||||
|
add_http_dependencies "$os"
|
||||||
|
get -q -n /tmp/http.tgz https://pecl.php.net/get/pecl_http-"${ext##*-}".tgz
|
||||||
|
tar -xzf /tmp/http.tgz -C /tmp
|
||||||
|
patch_http_source "$ext" "$os"
|
||||||
|
build_http "$ext" "$os"
|
||||||
|
enable_extension http extension
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to setup latest http extension.
|
||||||
|
add_http_latest() {
|
||||||
|
os=$1
|
||||||
|
enable_http
|
||||||
|
if ! check_extension http; then
|
||||||
|
if [ "$os" = "Linux" ]; then
|
||||||
|
if ! [[ "${version:?}" =~ ${old_versions:?}|${nightly_versions:?} ]]; then
|
||||||
|
if [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
||||||
|
install_packages "php$version-propro"
|
||||||
|
fi
|
||||||
|
install_packages "php$version-raphf" "php$version-http"
|
||||||
|
else
|
||||||
|
add_http_helper "$(get_http_version)" "$os"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
||||||
|
add_brew_extension pecl_http extension
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
status="Installed and enabled"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to setup http extension given a version.
|
||||||
|
add_http_version() {
|
||||||
|
ext=$1
|
||||||
|
os=$2
|
||||||
|
enable_http
|
||||||
|
if [ "x$(php -r "echo phpversion('http');")" != "x${ext##*-}" ]; then
|
||||||
|
remove_extension http >/dev/null
|
||||||
|
add_http_helper pecl_http-"${ext##*-}" "$os"
|
||||||
|
status="Installed and enabled"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to setup http extension
|
||||||
|
add_http() {
|
||||||
|
ext=$1
|
||||||
|
os="$(uname -s)"
|
||||||
|
status="Enabled"
|
||||||
|
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
||||||
|
add_http_latest "$os" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
add_http_version "$ext" "$os" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
add_extension_log "http" "$status"
|
||||||
|
}
|
||||||
@@ -37,11 +37,13 @@ Function Add-Oci() {
|
|||||||
} else {
|
} else {
|
||||||
if(-not(Test-Path $ext_dir\php_oci8.dll)) {
|
if(-not(Test-Path $ext_dir\php_oci8.dll)) {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
$ociVersion = '2.2.0'
|
$ociVersion = Get-PeclPackageVersion oci8 -MinimumStability stable -MaximumStability stable | Select-Object -First 1
|
||||||
if ($version -eq '7.0') {
|
if ($version -eq '7.0') {
|
||||||
$ociVersion = '2.1.8'
|
$ociVersion = '2.1.8'
|
||||||
} elseif ($version -lt '7.0') {
|
} elseif ($version -lt '7.0') {
|
||||||
$ociVersion = '2.0.12'
|
$ociVersion = '2.0.12'
|
||||||
|
} elseif ($version -lt '8.0') {
|
||||||
|
$ociVersion = '2.2.0'
|
||||||
}
|
}
|
||||||
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
||||||
Invoke-WebRequest -Uri $ociUrl -OutFile $php_dir\oci8.zip
|
Invoke-WebRequest -Uri $ociUrl -OutFile $php_dir\oci8.zip
|
||||||
|
|||||||
+3
-15
@@ -7,17 +7,6 @@ add_license_log() {
|
|||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the tag for a php version.
|
|
||||||
get_tag() {
|
|
||||||
tag='master'
|
|
||||||
if ! [[ ${version:?} =~ $nightly_versions ]]; then
|
|
||||||
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
|
||||||
elif [ "${version:?}" = '8.0' ]; then
|
|
||||||
tag="PHP-8.0"
|
|
||||||
fi
|
|
||||||
echo "$tag"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install instantclient and SDK.
|
# Function to install instantclient and SDK.
|
||||||
add_client() {
|
add_client() {
|
||||||
sudo mkdir -p -m 777 "$oracle_home"
|
sudo mkdir -p -m 777 "$oracle_home"
|
||||||
@@ -49,7 +38,7 @@ get_php() {
|
|||||||
|
|
||||||
# Function to get phpize location on darwin.
|
# Function to get phpize location on darwin.
|
||||||
get_phpize() {
|
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)"
|
echo "/usr/local/bin/$(readlink /usr/local/bin/phpize)"
|
||||||
@@ -94,14 +83,14 @@ add_oci_helper() {
|
|||||||
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
phpize_orig=$(get_phpize)
|
phpize_orig=$(get_phpize)
|
||||||
tag=$(get_tag)
|
tag=$(php_src_tag)
|
||||||
get_php
|
get_php
|
||||||
patch_phpize
|
patch_phpize
|
||||||
(
|
(
|
||||||
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
||||||
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
||||||
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
||||||
sudo make -j"$(nproc)"
|
sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
|
||||||
sudo cp ./modules/* "$ext_dir/"
|
sudo cp ./modules/* "$ext_dir/"
|
||||||
)
|
)
|
||||||
restore_phpize
|
restore_phpize
|
||||||
@@ -116,7 +105,6 @@ 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)
|
||||||
nightly_versions='8.[0-1]'
|
|
||||||
add_client >/dev/null 2>&1
|
add_client >/dev/null 2>&1
|
||||||
add_dependencies >/dev/null 2>&1
|
add_dependencies >/dev/null 2>&1
|
||||||
add_oci_helper >/dev/null 2>&1
|
add_oci_helper >/dev/null 2>&1
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ add_phalcon_helper() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sed -i '' '/extension.*psr/d' "${ini_file:?}"
|
sed -i '' '/extension.*psr/d' "${ini_file:?}"
|
||||||
brew tap shivammathur/homebrew-phalcon
|
add_brew_tap shivammathur/homebrew-phalcon
|
||||||
brew install phalcon@"${version:?}"_"$extension_major_version"
|
brew install phalcon@"${version:?}"_"$extension_major_version"
|
||||||
sudo cp /usr/local/opt/psr@"${version:?}"/psr.so "${ext_dir:?}"
|
sudo cp "${brew_prefix:?}"/opt/psr@"${version:?}"/psr.so "${ext_dir:?}"
|
||||||
sudo cp /usr/local/opt/phalcon@"${version:?}"_"$extension_major_version"/phalcon.so "${ext_dir:?}"
|
sudo cp "${brew_prefix:?}"/opt/phalcon@"${version:?}"_"$extension_major_version"/phalcon.so "${ext_dir:?}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+33
-28
@@ -4,15 +4,16 @@ 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
|
||||||
fi
|
fi
|
||||||
install_packages curl make software-properties-common unzip autoconf automake gcc g++
|
install_packages curl make software-properties-common unzip autoconf automake gcc g++
|
||||||
add_ppa
|
add_ppa ondrej/ppa
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to backup and cleanup package lists.
|
# Function to backup and cleanup package lists.
|
||||||
cleanup_lists() {
|
cleanup_lists() {
|
||||||
|
ppa_prefix=${1-ondrej}
|
||||||
if [ ! -e /etc/apt/sources.list.d.save ]; then
|
if [ ! -e /etc/apt/sources.list.d.save ]; then
|
||||||
sudo mv /etc/apt/sources.list.d /etc/apt/sources.list.d.save
|
sudo mv /etc/apt/sources.list.d /etc/apt/sources.list.d.save
|
||||||
sudo mkdir /etc/apt/sources.list.d
|
sudo mkdir /etc/apt/sources.list.d
|
||||||
sudo mv /etc/apt/sources.list.d.save/*ondrej*.list /etc/apt/sources.list.d/
|
sudo mv /etc/apt/sources.list.d.save/*"${ppa_prefix}"*.list /etc/apt/sources.list.d/
|
||||||
sudo mv /etc/apt/sources.list.d.save/*dotdeb*.list /etc/apt/sources.list.d/ 2>/dev/null || true
|
sudo mv /etc/apt/sources.list.d.save/*dotdeb*.list /etc/apt/sources.list.d/ 2>/dev/null || true
|
||||||
trap "sudo mv /etc/apt/sources.list.d.save/*.list /etc/apt/sources.list.d/ 2>/dev/null" exit
|
trap "sudo mv /etc/apt/sources.list.d.save/*.list /etc/apt/sources.list.d/ 2>/dev/null" exit
|
||||||
fi
|
fi
|
||||||
@@ -20,15 +21,33 @@ cleanup_lists() {
|
|||||||
|
|
||||||
# Function to add ppa:ondrej/php.
|
# Function to add ppa:ondrej/php.
|
||||||
add_ppa() {
|
add_ppa() {
|
||||||
if ! apt-cache policy | grep -q ondrej/php; then
|
ppa=${1:-ondrej/php}
|
||||||
cleanup_lists
|
if ! apt-cache policy | grep -q "$ppa"; then
|
||||||
LC_ALL=C.UTF-8 sudo apt-add-repository ppa:ondrej/php -y
|
cleanup_lists "$(dirname "$ppa")"
|
||||||
|
LC_ALL=C.UTF-8 sudo apt-add-repository ppa:"$ppa" -y
|
||||||
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
||||||
sudo "$debconf_fix" apt-get update
|
sudo "$debconf_fix" apt-get update
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to add SAPI
|
||||||
|
add_sapi() {
|
||||||
|
sapi=$1
|
||||||
|
status='true'
|
||||||
|
if [ "$sapi" != "cli" ]; then
|
||||||
|
# shellcheck source=.
|
||||||
|
. "${dist}"/../src/scripts/sapi.sh
|
||||||
|
setup_sapi "$sapi" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
check_sapi "$sapi"
|
||||||
|
if check_sapi "$sapi"; then
|
||||||
|
add_log "${tick:?}" "$sapi" "Added $sapi"
|
||||||
|
else
|
||||||
|
add_log "${cross:?}" "$sapi" "Could not setup $sapi"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to update the package lists.
|
# Function to update the package lists.
|
||||||
update_lists() {
|
update_lists() {
|
||||||
if [ ! -e /tmp/setup_php ]; then
|
if [ ! -e /tmp/setup_php ]; then
|
||||||
@@ -58,7 +77,9 @@ delete_extension() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
disable_extension "$extension"
|
disable_extension "$extension"
|
||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
||||||
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
|
$apt_remove "php-$extension" "php$version-$extension" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to disable and delete extensions.
|
# Function to disable and delete extensions.
|
||||||
@@ -67,6 +88,7 @@ remove_extension() {
|
|||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
||||||
sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1
|
sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1
|
||||||
|
echo "$extension" | sudo tee -a /tmp/setup_php_dismod >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
||||||
@@ -145,25 +167,6 @@ add_pecl_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install extension from source
|
|
||||||
add_extension_from_source() {
|
|
||||||
extension=$1
|
|
||||||
repo=$2
|
|
||||||
release=$3
|
|
||||||
args=$4
|
|
||||||
prefix=$5
|
|
||||||
(
|
|
||||||
add_devtools phpize
|
|
||||||
delete_extension "$extension"
|
|
||||||
get -q -n "/tmp/$extension.tar.gz" "https://github.com/$repo/archive/$release.tar.gz"
|
|
||||||
tar xf /tmp/"$extension".tar.gz -C /tmp
|
|
||||||
cd /tmp/"$extension-$release" || exit 1
|
|
||||||
phpize && ./configure "$args" && make -j"$(nproc)" && sudo make install
|
|
||||||
enable_extension "$extension" "$prefix"
|
|
||||||
) >/dev/null 2>&1
|
|
||||||
add_extension_log "$extension-$release" "Installed and enabled"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to setup phpize and php-config.
|
# Function to setup phpize and php-config.
|
||||||
add_devtools() {
|
add_devtools() {
|
||||||
tool=$1
|
tool=$1
|
||||||
@@ -216,14 +219,14 @@ add_packaged_php() {
|
|||||||
IFS=' ' read -r -a packages <<<"$(echo "cli curl mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")"
|
IFS=' ' read -r -a packages <<<"$(echo "cli curl mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")"
|
||||||
$apt_install "${packages[@]}"
|
$apt_install "${packages[@]}"
|
||||||
else
|
else
|
||||||
run_script "php-ubuntu" "$version"
|
run_script "test-setup-php" "$version"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update PHP.
|
# Function to update PHP.
|
||||||
update_php() {
|
update_php() {
|
||||||
initial_version=$(php_semver)
|
initial_version=$(php_semver)
|
||||||
use_package_cache="false" add_packaged_php
|
add_packaged_php
|
||||||
updated_version=$(php_semver)
|
updated_version=$(php_semver)
|
||||||
if [ "$updated_version" != "$initial_version" ]; then
|
if [ "$updated_version" != "$initial_version" ]; then
|
||||||
status="Updated to"
|
status="Updated to"
|
||||||
@@ -301,9 +304,11 @@ 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"
|
||||||
apt_remove="sudo $debconf_fix apt-fast remove -y"
|
apt_remove="sudo $debconf_fix apt-fast remove -y"
|
||||||
|
scripts="${dist}"/../src/scripts
|
||||||
|
|
||||||
# shellcheck source=.
|
# shellcheck source=.
|
||||||
. "${dist}"/../src/scripts/common.sh
|
. "${scripts:?}"/tools/add_tools.sh
|
||||||
|
. "${scripts:?}"/common.sh
|
||||||
. /etc/lsb-release
|
. /etc/lsb-release
|
||||||
read_env
|
read_env
|
||||||
self_hosted_setup
|
self_hosted_setup
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
install_httpd() {
|
||||||
|
sudo mkdir -p /var/www/html
|
||||||
|
sudo chown -R _www:_www /var/www
|
||||||
|
brew services stop nginx 2>/dev/null || true
|
||||||
|
if ! command -v httpd >/dev/null; then
|
||||||
|
brew install httpd
|
||||||
|
fi
|
||||||
|
sudo sed -Ei '' 's/Listen.*/Listen 80/' "$httpd_conf"
|
||||||
|
sudo sed -Ei '' 's/DirectoryIndex.*/DirectoryIndex index.php index.html/' "$httpd_conf"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_nginx() {
|
||||||
|
sudo mkdir -p /var/www/html
|
||||||
|
sudo chown -R "$(id -un)":"$(id -gn)" /var/www
|
||||||
|
brew services stop httpd 2>/dev/null || true
|
||||||
|
if ! command -v nginx >/dev/null; then
|
||||||
|
brew install nginx
|
||||||
|
fi
|
||||||
|
sudo sed -Ei '' 's/listen.*/listen 80;/' "$nginx_conf"
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_sapi() {
|
||||||
|
sapi=$1
|
||||||
|
conf_dir="${dist:?}"/../src/configs
|
||||||
|
|
||||||
|
case $sapi in
|
||||||
|
apache*:apache*)
|
||||||
|
install_httpd
|
||||||
|
(
|
||||||
|
echo "LoadModule proxy_module lib/httpd/modules/mod_proxy.so"
|
||||||
|
echo "LoadModule proxy_module lib/httpd/modules/mod_proxy_fcgi.so"
|
||||||
|
) | sudo tee -a "$httpd_conf"
|
||||||
|
echo "Include $httpd_extra/httpd-php.conf" | sudo tee -a "$httpd_conf"
|
||||||
|
|
||||||
|
|
||||||
|
sudo cp "$conf_dir"/default_apache /etc/apache2/sites-available/000-default.conf
|
||||||
|
sudo a2dismod mpm_event 2>/dev/null || true
|
||||||
|
sudo a2enmod mpm_prefork php"${version:?}"
|
||||||
|
sudo service apache2 restart
|
||||||
|
;;
|
||||||
|
fpm:apache*)
|
||||||
|
install_httpd
|
||||||
|
sudo cp "$conf_dir"/default_apache /etc/apache2/sites-available/000-default.conf
|
||||||
|
sudo a2dismod php"${version:?}" 2>/dev/null || true
|
||||||
|
sudo a2enmod proxy_fcgi
|
||||||
|
sudo a2enconf php"${version:?}"-fpm
|
||||||
|
sudo service apache2 restart
|
||||||
|
;;
|
||||||
|
cgi:apache*)
|
||||||
|
install_httpd
|
||||||
|
sudo cp "$conf_dir"/default_apache /etc/apache2/sites-available/000-default.conf
|
||||||
|
echo "Action application/x-httpd-php /cgi-bin/php${version:?}" | sudo tee -a /etc/apache2/conf-available/php"${version:?}"-cgi.conf
|
||||||
|
sudo a2dismod php"${version:?}" mpm_event 2>/dev/null || true
|
||||||
|
sudo a2enmod mpm_prefork actions cgi
|
||||||
|
sudo a2disconf php"${version:?}"-fpm 2>/dev/null || true
|
||||||
|
sudo a2enconf php"${version:?}"-cgi
|
||||||
|
sudo service apache2 restart
|
||||||
|
;;
|
||||||
|
fpm:nginx)
|
||||||
|
install_nginx
|
||||||
|
sudo cp "$conf_dir"/default_nginx /etc/nginx/sites-available/default
|
||||||
|
sudo sed -i "s/PHP_VERSION/${version:?}/" /etc/nginx/sites-available/default
|
||||||
|
sudo service nginx restart
|
||||||
|
;;
|
||||||
|
apache* | fpm | cgi | phpdbg) ;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
check_service() {
|
||||||
|
service=$1
|
||||||
|
if ! pidof "$service"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
(
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$service" "Click to check $service status"
|
||||||
|
sudo service "$service" status
|
||||||
|
echo "::endgroup::"
|
||||||
|
) | sudo tee -a /tmp/sapi.log >/dev/null 2>&1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
check_version() {
|
||||||
|
sapi=$1
|
||||||
|
sapi_version=$(php_semver "$sapi")
|
||||||
|
if [ ${sapi_version%.*} != "${version:?}" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
add_log "${tick:?}" "$sapi" "Added $sapi $sapi_version" | sudo tee -a /tmp/sapi.log >/dev/null 2>&1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
check_sapi() {
|
||||||
|
sapi=$1
|
||||||
|
sudo rm /tmp/sapi.log
|
||||||
|
if [[ "$sapi" =~ fpm|cgi ]]; then status=$(check_version php-"$sapi"); fi
|
||||||
|
if [[ "$sapi" =~ ^phpdbg$ ]]; then status=$(check_version phpdbg); fi
|
||||||
|
if [[ "$sapi" =~ .*fpm.* ]]; then status=$(check_service php"${version:?}"-fpm); fi
|
||||||
|
if [[ "$sapi" =~ .*:apache.* ]]; then status=$(check_service apache2); fi
|
||||||
|
if [[ "$sapi" =~ .*:nginx.* ]]; then status=$(check_service nginx); fi
|
||||||
|
|
||||||
|
if [ "$status" = "0" ]; then
|
||||||
|
if [[ "$sapi" =~ .*:.* ]]; then
|
||||||
|
add_log "${tick:?}" "$sapi" "Added $sapi"
|
||||||
|
fi
|
||||||
|
cat /tmp/sapi.log && sudo rm /tmp/sapi.log
|
||||||
|
else
|
||||||
|
add_log "${cross:?}" "$sapi" "Could not setup $sapi"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
httpd_conf=${brew_prefix:?}/etc/httpd/httpd.conf
|
||||||
|
httpd_extra=${brew_prefix:?}/etc/httpd/extra
|
||||||
|
nginx_conf=${brew_prefix:?}/etc/nginx/nginx.conf
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
install_apache2() {
|
||||||
|
sudo mkdir -p /var/www/html
|
||||||
|
sudo service nginx stop 2>/dev/null || true
|
||||||
|
if ! command -v apache2 >/dev/null; then
|
||||||
|
install_packages apache2-bin apache2 -y;
|
||||||
|
else
|
||||||
|
if ! [[ "$(apache2 -v 2>/dev/null | grep -Eo "([0-9]+\.[0-9]+)")" =~ 2.[4-9] ]]; then
|
||||||
|
sudo "${debconf_fix:?}" apt-get purge apache* apache-* >/dev/null
|
||||||
|
install_packages apache2-bin apache2 -y;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_nginx() {
|
||||||
|
sudo mkdir -p /var/www/html
|
||||||
|
sudo service apache2 stop 2>/dev/null || true
|
||||||
|
if ! command -v nginx >/dev/null; then
|
||||||
|
install_packages nginx -y
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_sapi() {
|
||||||
|
sapi=$1
|
||||||
|
conf_dir="${dist:?}"/../src/configs
|
||||||
|
|
||||||
|
if [[ "${version:?}" =~ ${old_versions:?}|${nightly_versions:?} ]]; then
|
||||||
|
switch_sapi "$sapi"
|
||||||
|
else
|
||||||
|
case $sapi in
|
||||||
|
apache*:apache*)
|
||||||
|
install_apache2
|
||||||
|
sudo cp "$conf_dir"/default_apache /etc/apache2/sites-available/000-default.conf
|
||||||
|
install_packages libapache2-mod-php"${version:?}" -y
|
||||||
|
sudo a2dismod mpm_event 2>/dev/null || true
|
||||||
|
sudo a2enmod mpm_prefork php"${version:?}"
|
||||||
|
sudo service apache2 restart
|
||||||
|
;;
|
||||||
|
fpm:apache*)
|
||||||
|
install_apache2
|
||||||
|
sudo cp "$conf_dir"/default_apache /etc/apache2/sites-available/000-default.conf
|
||||||
|
install_packages libapache2-mod-fcgid php"${version:?}"-fpm -y
|
||||||
|
sudo a2dismod php"${version:?}" 2>/dev/null || true
|
||||||
|
sudo a2enmod proxy_fcgi
|
||||||
|
sudo a2enconf php"${version:?}"-fpm
|
||||||
|
sudo service apache2 restart
|
||||||
|
;;
|
||||||
|
cgi:apache*)
|
||||||
|
install_apache2
|
||||||
|
install_packages php"${version:?}"-cgi -y
|
||||||
|
sudo cp "$conf_dir"/default_apache /etc/apache2/sites-available/000-default.conf
|
||||||
|
echo "Action application/x-httpd-php /cgi-bin/php${version:?}" | sudo tee -a /etc/apache2/conf-available/php"${version:?}"-cgi.conf
|
||||||
|
sudo a2dismod php"${version:?}" mpm_event 2>/dev/null || true
|
||||||
|
sudo a2enmod mpm_prefork actions cgi
|
||||||
|
sudo a2disconf php"${version:?}"-fpm 2>/dev/null || true
|
||||||
|
sudo a2enconf php"${version:?}"-cgi
|
||||||
|
sudo service apache2 restart
|
||||||
|
;;
|
||||||
|
fpm:nginx)
|
||||||
|
install_nginx
|
||||||
|
install_packages php"${version:?}"-fpm -y
|
||||||
|
sudo cp "$conf_dir"/default_nginx /etc/nginx/sites-available/default
|
||||||
|
sudo sed -i "s/PHP_VERSION/${version:?}/" /etc/nginx/sites-available/default
|
||||||
|
sudo service nginx restart
|
||||||
|
;;
|
||||||
|
apache*)
|
||||||
|
install_packages libapache2-mod-php"${version:?}" -y
|
||||||
|
;;
|
||||||
|
fpm|embed|cgi|phpdbg)
|
||||||
|
install_packages php"${version:?}"-"$sapi" -y
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_service() {
|
||||||
|
service=$1
|
||||||
|
if ! pidof "$service"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
(
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$service" "Click to check $service status"
|
||||||
|
sudo service "$service" status
|
||||||
|
echo "::endgroup::"
|
||||||
|
) | sudo tee -a /tmp/sapi.log >/dev/null 2>&1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
check_version() {
|
||||||
|
sapi=$1
|
||||||
|
sapi_version=$(php_semver "$sapi")
|
||||||
|
if [ "${sapi_version%.*}" != "${version:?}" ]; then
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
add_log "${tick:?}" "$sapi" "Added $sapi $sapi_version" | sudo tee -a /tmp/sapi.log >/dev/null 2>&1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
check_sapi() {
|
||||||
|
sapi=$1
|
||||||
|
sudo rm /tmp/sapi.log
|
||||||
|
if [[ "$sapi" =~ fpm|cgi ]]; then status=$(check_version php-"$sapi"); fi
|
||||||
|
if [[ "$sapi" =~ ^phpdbg$ ]]; then status=$(check_version phpdbg); fi
|
||||||
|
if [[ "$sapi" =~ .*fpm.* ]]; then status=$(check_service php"${version:?}"-fpm); fi
|
||||||
|
if [[ "$sapi" =~ .*:apache.* ]]; then status=$(check_service apache2); fi
|
||||||
|
if [[ "$sapi" =~ .*:nginx.* ]]; then status=$(check_service nginx); fi
|
||||||
|
|
||||||
|
if [ "$status" = "0" ]; then
|
||||||
|
if [[ "$sapi" =~ .*:.* ]]; then
|
||||||
|
add_log "${tick:?}" "$sapi" "Added $sapi"
|
||||||
|
fi
|
||||||
|
cat /tmp/sapi.log && sudo rm /tmp/sapi.log
|
||||||
|
else
|
||||||
|
add_log "${cross:?}" "$sapi" "Could not setup $sapi"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
Function Add-ToolsHelper() {
|
||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
$tool
|
||||||
|
)
|
||||||
|
if($tool -eq "codeception") {
|
||||||
|
Copy-Item $composer_bin\codecept.bat -Destination $composer_bin\codeception.bat
|
||||||
|
} elseif($tool -eq "composer") {
|
||||||
|
Edit-ComposerConfig $bin_dir\$tool
|
||||||
|
} elseif($tool -eq "cs2pr") {
|
||||||
|
(Get-Content $bin_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $bin_dir/cs2pr
|
||||||
|
} elseif($tool -eq "phan") {
|
||||||
|
Add-Extension fileinfo >$null 2>&1
|
||||||
|
Add-Extension ast >$null 2>&1
|
||||||
|
} elseif($tool -eq "phive") {
|
||||||
|
Add-Extension xml >$null 2>&1
|
||||||
|
} elseif($tool -eq "symfony") {
|
||||||
|
Add-ToProfile $current_profile "symfony" "New-Alias symfony $bin_dir\$tool.exe"
|
||||||
|
Add-ToProfile $current_profile "symfony-cli" "New-Alias symfony-cli $bin_dir\$tool.exe"
|
||||||
|
} elseif($tool -eq "vapor-cli") {
|
||||||
|
Copy-Item $composer_bin\vapor.bat -Destination $composer_bin\vapor-cli.bat
|
||||||
|
} elseif($tool -eq "wp-cli") {
|
||||||
|
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
add_tools_helper() {
|
||||||
|
tool=$1
|
||||||
|
if [ "$tool" = "codeception" ]; then
|
||||||
|
sudo ln -s "${composer_bin:?}"/codecept "${composer_bin:?}"/codeception
|
||||||
|
elif [ "$tool" = "composer" ]; then
|
||||||
|
configure_composer "${tool_path:?}"
|
||||||
|
elif [ "$tool" = "cs2pr" ]; then
|
||||||
|
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "${tool_path:?}" 2>/dev/null ||
|
||||||
|
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "${tool_path:?}"
|
||||||
|
elif [ "$tool" = "phan" ]; then
|
||||||
|
add_extension fileinfo extension >/dev/null 2>&1
|
||||||
|
add_extension ast extension >/dev/null 2>&1
|
||||||
|
elif [ "$tool" = "phive" ]; then
|
||||||
|
add_extension curl extension >/dev/null 2>&1
|
||||||
|
add_extension mbstring extension >/dev/null 2>&1
|
||||||
|
add_extension xml extension >/dev/null 2>&1
|
||||||
|
elif [ "$tool" = "symfony" ]; then
|
||||||
|
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/symfony-cli
|
||||||
|
elif [ "$tool" = "vapor-cli" ]; then
|
||||||
|
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/vapor-cli
|
||||||
|
elif [ "$tool" = "wp-cli" ]; then
|
||||||
|
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/wp
|
||||||
|
fi
|
||||||
|
}
|
||||||
+36
-31
@@ -201,6 +201,9 @@ Function Edit-ComposerConfig() {
|
|||||||
Add-Log "$cross" "composer" "Could not download composer"
|
Add-Log "$cross" "composer" "Could not download composer"
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
if (-not(Test-Path $composer_json)) {
|
||||||
|
Set-Content -Path $composer_json -Value "{}"
|
||||||
|
}
|
||||||
composer -q config -g process-timeout 0
|
composer -q config -g process-timeout 0
|
||||||
Write-Output $composer_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
Write-Output $composer_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||||
if (Test-Path env:COMPOSER_TOKEN) {
|
if (Test-Path env:COMPOSER_TOKEN) {
|
||||||
@@ -245,20 +248,21 @@ Function Add-Tool() {
|
|||||||
if (Test-Path $bin_dir\$tool) {
|
if (Test-Path $bin_dir\$tool) {
|
||||||
Remove-Item $bin_dir\$tool
|
Remove-Item $bin_dir\$tool
|
||||||
}
|
}
|
||||||
if($url.Count -gt 1) { $url = $url[0] }
|
if($url.Count -gt 1) {
|
||||||
if ($tool -eq "symfony") {
|
$url = $url[0]
|
||||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\$tool.exe
|
}
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.exe" >$null 2>&1
|
$tool_path = "$bin_dir\$tool"
|
||||||
} else {
|
if (($url | Split-Path -Extension) -eq ".exe") {
|
||||||
try {
|
$tool_path = "$tool_path.exe"
|
||||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\$tool
|
}
|
||||||
} catch {
|
try {
|
||||||
if($url -match '.*github.com.*releases.*latest.*') {
|
Invoke-WebRequest -Uri $url -OutFile $tool_path
|
||||||
try {
|
} catch {
|
||||||
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Invoke-WebRequest -Uri ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
if($url -match '.*github.com.*releases.*latest.*') {
|
||||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\$tool
|
try {
|
||||||
} catch { }
|
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Invoke-WebRequest -Uri ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
||||||
}
|
Invoke-WebRequest -Uri $url -OutFile $tool_path
|
||||||
|
} catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
|
if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
|
||||||
@@ -269,18 +273,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-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" >$null 2>&1
|
||||||
if($tool -eq "phan") {
|
Add-ToolsHelper $tool
|
||||||
Add-Extension fileinfo >$null 2>&1
|
|
||||||
Add-Extension ast >$null 2>&1
|
|
||||||
} elseif($tool -eq "phive") {
|
|
||||||
Add-Extension xml >$null 2>&1
|
|
||||||
} elseif($tool -eq "cs2pr") {
|
|
||||||
(Get-Content $bin_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $bin_dir/cs2pr
|
|
||||||
} elseif($tool -eq "composer") {
|
|
||||||
Edit-ComposerConfig $bin_dir\$tool
|
|
||||||
} elseif($tool -eq "wp-cli") {
|
|
||||||
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.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 {
|
||||||
@@ -312,11 +305,15 @@ Function Add-Composertool() {
|
|||||||
Add-Log $cross $tool "Skipped"
|
Add-Log $cross $tool "Skipped"
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
composer global require $prefix$release 2>&1 | out-null
|
if(Test-Path $composer_lock) {
|
||||||
|
Remove-Item -Path $composer_lock -Force
|
||||||
|
}
|
||||||
|
composer global require $prefix$release >$null 2>&1
|
||||||
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
|
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
|
||||||
if(Test-Path $composer_bin\composer) {
|
if(Test-Path $composer_bin\composer) {
|
||||||
Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force
|
Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force
|
||||||
}
|
}
|
||||||
|
Add-ToolsHelper $tool
|
||||||
if($json) {
|
if($json) {
|
||||||
$tool_version = Get-ToolVersion "Write-Output" "$json"
|
$tool_version = Get-ToolVersion "Write-Output" "$json"
|
||||||
Add-Log $tick $tool "Added $tool $tool_version"
|
Add-Log $tick $tool "Added $tool $tool_version"
|
||||||
@@ -339,9 +336,12 @@ $bin_dir = $php_dir
|
|||||||
$bintray = 'https://dl.bintray.com/shivammathur/php'
|
$bintray = 'https://dl.bintray.com/shivammathur/php'
|
||||||
$github = 'https://github.com'
|
$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_lock = "$env:APPDATA\Composer\composer.lock"
|
||||||
$current_profile = "$env:TEMP\setup-php.ps1"
|
$current_profile = "$env:TEMP\setup-php.ps1"
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
$nightly_version = '8.[0-9]'
|
$jit_versions = '8.[0-9]'
|
||||||
|
$nightly_versions = '8.[1-9]'
|
||||||
$cert_source='CurrentUser'
|
$cert_source='CurrentUser'
|
||||||
$enable_extensions = ('openssl', 'curl', 'mbstring')
|
$enable_extensions = ('openssl', 'curl', 'mbstring')
|
||||||
|
|
||||||
@@ -380,6 +380,8 @@ if($env:RUNNER -eq 'self-hosted') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
. $dist\..\src\scripts\tools\add_tools.ps1
|
||||||
|
|
||||||
Add-Printf >$null 2>&1
|
Add-Printf >$null 2>&1
|
||||||
Step-Log "Setup PhpManager"
|
Step-Log "Setup PhpManager"
|
||||||
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" >$null 2>&1
|
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" >$null 2>&1
|
||||||
@@ -398,14 +400,17 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ($version -match $nightly_version) {
|
if ($version -match $nightly_versions) {
|
||||||
Invoke-WebRequest -Uri $bintray/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
Invoke-WebRequest -UseBasicParsing -Uri https://github.com/shivammathur/php-builder-windows/releases/latest/download/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
||||||
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir > $null 2>&1
|
||||||
} else {
|
} 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 {
|
||||||
|
if($version -match $jit_versions) {
|
||||||
|
('opcache.enable=1', 'opcache.jit_buffer_size=256M', 'opcache.jit=1235') | ForEach-Object { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
|
||||||
|
}
|
||||||
if($env:update -eq 'true') {
|
if($env:update -eq 'true') {
|
||||||
Update-Php $php_dir >$null 2>&1
|
Update-Php $php_dir >$null 2>&1
|
||||||
$status = "Updated to"
|
$status = "Updated to"
|
||||||
|
|||||||
+11
-86
@@ -76,83 +76,6 @@ export async function getUri(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function to get the codeception url
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param suffix
|
|
||||||
*/
|
|
||||||
export async function getCodeceptionUriBuilder(
|
|
||||||
version: string,
|
|
||||||
suffix: string
|
|
||||||
): Promise<string> {
|
|
||||||
return ['releases', version, suffix, 'codecept.phar']
|
|
||||||
.filter(Boolean)
|
|
||||||
.join('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to get the codeception url
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param php_version
|
|
||||||
*/
|
|
||||||
export async function getCodeceptionUri(
|
|
||||||
version: string,
|
|
||||||
php_version: string
|
|
||||||
): Promise<string> {
|
|
||||||
const codecept: string = await getCodeceptionUriBuilder(version, '');
|
|
||||||
const codecept54: string = await getCodeceptionUriBuilder(version, 'php54');
|
|
||||||
const codecept56: string = await getCodeceptionUriBuilder(version, 'php56');
|
|
||||||
// Refer to https://codeception.com/builds
|
|
||||||
switch (true) {
|
|
||||||
case /latest/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6|7\.[0|1]/.test(php_version):
|
|
||||||
return 'php56/codecept.phar';
|
|
||||||
case /7\.[2-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return 'codecept.phar';
|
|
||||||
}
|
|
||||||
case /(^[4-9]|\d{2,})\..*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6|7\.[0|1]/.test(php_version):
|
|
||||||
return codecept56;
|
|
||||||
case /7\.[2-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.[4-5]\.\d+|^3\.[0-1]\.\d+).*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /7\.[0-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /^2\.3\.\d+.*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.[4-6]/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /^7\.[0-4]$/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.(1\.([6-9]|\d{2,}))|^2\.2\.\d+).*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.[4-5]/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /5.6|7\.[0-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.(1\.[0-5]|0\.\d+)|^1\.[6-8]\.\d+).*/.test(version):
|
|
||||||
return codecept;
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup phive
|
* Helper function to get script to setup phive
|
||||||
*
|
*
|
||||||
@@ -375,7 +298,7 @@ export async function getCleanedToolsList(
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(
|
.replace(
|
||||||
/-agent|behat\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//,
|
/-agent|behat\/|codeception\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@@ -487,6 +410,7 @@ export async function addTools(
|
|||||||
script += await utils.customPackage(tool, 'tools', version, os_version);
|
script += await utils.customPackage(tool, 'tools', version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'behat':
|
case 'behat':
|
||||||
|
case 'codeception':
|
||||||
case 'phpspec':
|
case 'phpspec':
|
||||||
script += await addPackage(tool, release, tool + '/', os_version);
|
script += await addPackage(tool, release, tool + '/', os_version);
|
||||||
break;
|
break;
|
||||||
@@ -494,12 +418,6 @@ export async function addTools(
|
|||||||
url = await getBlackfirePlayerUrl(version, php_version);
|
url = await getBlackfirePlayerUrl(version, php_version);
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'codeception':
|
|
||||||
url =
|
|
||||||
'https://codeception.com/' +
|
|
||||||
(await getCodeceptionUri(version, php_version));
|
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
|
||||||
break;
|
|
||||||
case 'composer':
|
case 'composer':
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version);
|
||||||
script += await addArchive('composer', url, os_version, version);
|
script += await addArchive('composer', url, os_version, version);
|
||||||
@@ -602,11 +520,18 @@ export async function addTools(
|
|||||||
script += await addArchive('symfony', url, os_version, 'version');
|
script += await addArchive('symfony', url, os_version, 'version');
|
||||||
break;
|
break;
|
||||||
case 'vapor-cli':
|
case 'vapor-cli':
|
||||||
script += await addPackage(tool, release, 'laravel/', os_version);
|
case 'vapor':
|
||||||
|
script += await addPackage(
|
||||||
|
'vapor-cli',
|
||||||
|
release,
|
||||||
|
'laravel/',
|
||||||
|
os_version
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
case 'wp':
|
||||||
case 'wp-cli':
|
case 'wp-cli':
|
||||||
url = github + (await getWpCliUrl(version));
|
url = github + (await getWpCliUrl(version));
|
||||||
script += await addArchive(tool, url, os_version, '"--version"');
|
script += await addArchive('wp-cli', url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
script += await utils.addLog(
|
script += await utils.addLog(
|
||||||
|
|||||||
+9
-9
@@ -70,7 +70,7 @@ 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/develop/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];
|
||||||
default:
|
default:
|
||||||
switch (true) {
|
switch (true) {
|
||||||
@@ -234,20 +234,20 @@ export async function writeScript(
|
|||||||
/**
|
/**
|
||||||
* Function to break extension csv into an array
|
* Function to break extension csv into an array
|
||||||
*
|
*
|
||||||
* @param extension_csv
|
* @param package_csv
|
||||||
*/
|
*/
|
||||||
export async function extensionArray(
|
export async function packageArray(
|
||||||
extension_csv: string
|
package_csv: string
|
||||||
): Promise<Array<string>> {
|
): Promise<Array<string>> {
|
||||||
switch (extension_csv) {
|
switch (package_csv) {
|
||||||
case '':
|
case '':
|
||||||
case ' ':
|
case ' ':
|
||||||
return [];
|
return [];
|
||||||
default:
|
default:
|
||||||
return extension_csv
|
return package_csv
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(function (extension: string) {
|
.map(function (package_name: string) {
|
||||||
return extension
|
return package_name
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/^php[-_]/, '');
|
.replace(/^php[-_]/, '');
|
||||||
@@ -429,7 +429,7 @@ export async function customPackage(
|
|||||||
version: string,
|
version: string,
|
||||||
os_version: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const pkg_name: string = pkg.replace(/\d+|pdo[_-]/, '');
|
const pkg_name: string = pkg.replace(/\d+|(pdo|pecl)[_-]/, '');
|
||||||
const script_extension: string = await scriptExtension(os_version);
|
const script_extension: string = await scriptExtension(os_version);
|
||||||
const script: string = path.join(
|
const script: string = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
|||||||
Reference in New Issue
Block a user