Compare commits

...

45 Commits

Author SHA1 Message Date
cdb037c2a4 Bump version to 2.20.0 2022-07-06 00:43:26 +05:30
261f13a7c5 Add composer plugins to allow list before installing 2022-07-06 00:43:25 +05:30
9eaa66d89b Add support for event extension on unix 2022-07-05 16:22:07 +05:30
da9dfe4a71 Set RUNNER_TOOL_CACHE on self-hosted environments 2022-07-05 12:03:30 +05:30
a863ab6d3d Add support to allow composer plugins 2022-07-05 06:25:04 +05:30
050cb8061b Add coverage driver version in logs 2022-06-30 17:36:40 +05:30
3fda17f3fa Merge pull request #609 from dino182/develop
Fix Add-Path for self-hosted Windows
2022-06-27 17:24:50 +05:30
1a2cb4f872 Fix Add-Path for self-hosted Windows 2022-06-23 10:51:33 +01:00
4969814b69 Merge pull request #607 from markseuffert/patch-1
Updated documentation
2022-06-21 13:38:26 +05:30
07f2ea7d02 Updated documentation, review 2022-06-21 10:04:28 +02:00
a1c17b4b18 Updated documentation 2022-06-21 09:39:42 +02:00
3eda583472 Bump version to 2.19.1
Update Node.js dependencies
2022-06-06 08:22:16 +05:30
74d43be8a3 Fix support for deployer 2022-05-31 10:12:38 +05:30
aa1fe473f9 Bump version to 2.19.0 2022-05-30 07:52:31 +05:30
a92acf13e4 Remove years from LICENSE 2022-05-30 07:52:30 +05:30
0533892eb4 Fix jsdoc in fetch.ts 2022-05-30 07:52:30 +05:30
43fb4ad30e Bump ES version to 2021 2022-05-30 07:27:29 +05:30
b88a8c89d1 Fix protoc support 2022-05-26 10:21:36 +05:30
36d7f6c7c5 Set target-branch to develop in dependabot.yml 2022-05-26 09:47:27 +05:30
a1a52db9f3 Merge pull request #598 from shivammathur/dependabot/github_actions/codecov/codecov-action-3
Bump codecov/codecov-action from 2 to 3
2022-05-26 09:45:58 +05:30
88e54b10ca Merge pull request #599 from shivammathur/dependabot/github_actions/github/codeql-action-2
Bump github/codeql-action from 1 to 2
2022-05-26 09:45:50 +05:30
203099e007 Merge pull request #600 from shivammathur/dependabot/github_actions/actions/setup-node-3
Bump actions/setup-node from 1 to 3
2022-05-26 09:45:41 +05:30
4e9ea33f8d Bump actions/setup-node from 1 to 3
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 1 to 3.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-26 04:11:48 +00:00
68ba5ba947 Bump github/codeql-action from 1 to 2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-26 04:11:43 +00:00
99af32331c Bump codecov/codecov-action from 2 to 3
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-26 04:11:36 +00:00
810a92a9b0 Merge pull request #597 from turrisxyz/Dependabot-GitHub-Actions
chore: Included githubactions in the dependabot config
2022-05-26 09:40:26 +05:30
9c760dd6e2 chore: Included githubactions in the dependabot config
This should help with keeping the GitHub actions updated on new releases. This will also help with keeping it secure.

Dependabot helps in keeping the supply chain secure https://docs.github.com/en/code-security/dependabot

GitHub actions up to date https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot

https://github.com/ossf/scorecard/blob/main/docs/checks.md#dependency-update-tool
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2022-05-26 02:48:43 +00:00
dea233d702 Merge pull request #596 from turrisxyz/Pinned-Dependencies-GitHub
chore: Set permissions for GitHub actions
2022-05-26 06:59:24 +05:30
787285e08a chore: Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
2022-05-26 00:50:23 +00:00
ee065c5938 Append custom ini files to php.ini files 2022-05-25 20:43:46 +05:30
dbc8ba0844 Fix enabling cached dependent extensions on lower PHP versions 2022-05-25 19:44:02 +05:30
fe9e23a16a Add unixodbc if missing in sqlsrv setup 2022-05-25 10:16:23 +05:30
16de39288a Fix couchbase cache on macOS 2022-05-24 18:59:36 +05:30
67ff09364d Fix support for couchbase 4.x 2022-05-24 15:45:18 +05:30
1dfe0dc4a4 Add support to specify couchbase version 2022-05-19 23:56:27 +05:30
6f83b63bf5 Fix couchbase setup
Fix couchbase version to 3.x till 4.x is stable

The couchbase 4.x is based on a C++ client library and it shipped with the extension. So we only add the C client library for earlier versions
2022-05-19 15:09:52 +05:30
f0db57dcab Fix pecl support on PHP 5.3
Remove pecl suffix option support from PHP 5.3 as Console_Getopt version used does not support it
2022-05-19 11:56:00 +05:30
6cba851606 Add support for Ubuntu 22.04 2022-05-06 05:43:20 +05:30
209324abab Prefix extension formula with tap name on macOS 2022-05-05 23:43:11 +05:30
846135c190 Create empty composer.json in scoped directory
When installing composer based tools in a scoped directory with old composer versions it breaks if a composer.json is not present in the scoped directory
2022-05-02 11:22:58 +05:30
32d20248ae Improve support for composer fallback URLs 2022-04-23 11:57:06 +05:30
ba8485d89f Update OS support for self-hosted runners in README 2022-04-21 17:13:31 +05:30
97721a77b9 Fix shivammathur/node image tag in README 2022-04-21 17:06:25 +05:30
7dfee150df Remove fs dependency 2022-04-17 10:53:49 +05:30
251330ef7f Switch to node16 in actions.yml 2022-04-15 06:20:31 +05:30
33 changed files with 2850 additions and 3028 deletions

View File

@ -1,7 +1,7 @@
{ {
"env": { "node": true, "jest": true }, "env": { "node": true, "jest": true },
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "ecmaVersion": 2019, "sourceType": "module" }, "parserOptions": { "ecmaVersion": 2021, "sourceType": "module" },
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/eslint-recommended",

7
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "develop"
schedule:
interval: "weekly"

View File

@ -3,8 +3,15 @@ on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: '0 15 * * 6' - cron: '0 15 * * 6'
permissions:
contents: read
jobs: jobs:
codeql: codeql:
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/autobuild to send a status report
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -13,13 +20,13 @@ jobs:
fetch-depth: 2 fetch-depth: 2
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v1 uses: github/codeql-action/init@v2
with: with:
config-file: ./.github/codeql/codeql-configuration.yml config-file: ./.github/codeql/codeql-configuration.yml
languages: javascript languages: javascript
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v1 uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1 uses: github/codeql-action/analyze@v2

View File

@ -3,14 +3,19 @@ on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: '0 15 * * 6' - cron: '0 15 * * 6'
permissions:
contents: read
jobs: jobs:
create: create:
permissions:
contents: none
name: Create name: Create
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-20.04, ubuntu-18.04, windows-2022, macos-11] operating-system: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, windows-2022, macos-11]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
steps: steps:
- name: Setup PHP - name: Setup PHP
@ -45,6 +50,8 @@ jobs:
name: lists name: lists
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
update: update:
permissions:
contents: write # for Git to git push
name: Update name: Update
needs: create needs: create
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -63,7 +70,7 @@ jobs:
git config --local user.name "${{ github.repository_owner }}" git config --local user.name "${{ github.repository_owner }}"
- name: Combine - name: Combine
run: | run: |
for os in ubuntu-20.04 ubuntu-18.04 windows-2022 windows-2019 macos-11 macos-10.15; do for os in ubuntu-22.04 ubuntu-20.04 ubuntu-18.04 windows-2022 windows-2019 macos-11 macos-10.15; do
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2; do for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2; do
if [ "$os" = "macos-10.15" ]; then if [ "$os" = "macos-10.15" ]; then

View File

@ -16,6 +16,9 @@ on:
paths-ignore: paths-ignore:
- '**.md' - '**.md'
- 'examples/**' - 'examples/**'
permissions:
contents: read
jobs: jobs:
run: run:
name: Run name: Run
@ -31,7 +34,7 @@ jobs:
fetch-depth: 2 fetch-depth: 2
- name: Setup Node.js 16.x - name: Setup Node.js 16.x
uses: actions/setup-node@v1 uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 16.x
@ -51,7 +54,7 @@ jobs:
run: npm audit run: npm audit
- name: Send Coverage - name: Send Coverage
uses: codecov/codecov-action@v2 uses: codecov/codecov-action@v3
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info files: coverage/lcov.info

View File

@ -17,6 +17,9 @@ on:
paths-ignore: paths-ignore:
- '**.md' - '**.md'
- 'examples/**' - 'examples/**'
permissions:
contents: read
jobs: jobs:
run: run:
name: Run name: Run
@ -24,7 +27,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-20.04, ubuntu-18.04, windows-2019, macos-latest] operating-system: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, windows-2019, macos-latest]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
env: env:
extensions: xml, opcache, xdebug, pcov extensions: xml, opcache, xdebug, pcov

View File

@ -28,7 +28,7 @@ jobs:
ref: ${{ github.event.inputs.tag }} ref: ${{ github.event.inputs.tag }}
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: '16.x' node-version: '16.x'
registry-url: https://registry.npmjs.org registry-url: https://registry.npmjs.org
@ -46,7 +46,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Change to GitHub Packages registry - name: Change to GitHub Packages registry
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
registry-url: https://npm.pkg.github.com registry-url: https://npm.pkg.github.com
scope: '@shivammathur' scope: '@shivammathur'

View File

@ -1,7 +1,7 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2019-2021 shivammathur and contributors Copyright (c) shivammathur and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -70,6 +70,7 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
| Virtual environment | YAML workflow label | Pre-installed PHP | | Virtual environment | YAML workflow label | Pre-installed PHP |
|----------------------|------------------------------------|------------------------| |----------------------|------------------------------------|------------------------|
| Ubuntu 22.04 | `ubuntu-22.04` | `PHP 8.1` |
| Ubuntu 20.04 | `ubuntu-latest` or `ubuntu-20.04` | `PHP 7.4` to `PHP 8.1` | | Ubuntu 20.04 | `ubuntu-latest` or `ubuntu-20.04` | `PHP 7.4` to `PHP 8.1` |
| Ubuntu 18.04 | `ubuntu-18.04` | `PHP 7.2` to `PHP 8.1` | | Ubuntu 18.04 | `ubuntu-18.04` | `PHP 7.2` to `PHP 8.1` |
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.1` | | Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.1` |
@ -82,12 +83,11 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
| Host OS/Virtual environment | YAML workflow label | | Host OS/Virtual environment | YAML workflow label |
|----------------------------------|----------------------------| |----------------------------------|----------------------------|
| Ubuntu 21.04 | `self-hosted` or `Linux` | | Ubuntu 22.04 | `self-hosted` or `Linux` |
| Ubuntu 20.04 | `self-hosted` or `Linux` | | Ubuntu 20.04 | `self-hosted` or `Linux` |
| Ubuntu 18.04 | `self-hosted` or `Linux` | | Ubuntu 18.04 | `self-hosted` or `Linux` |
| Debian 11 | `self-hosted` or `Linux` | | Debian 11 | `self-hosted` or `Linux` |
| Debian 10 | `self-hosted` or `Linux` | | Debian 10 | `self-hosted` or `Linux` |
| Debian 9 | `self-hosted` or `Linux` |
| Windows 7 and newer | `self-hosted` or `Windows` | | Windows 7 and newer | `self-hosted` or `Windows` |
| Windows Server 2012 R2 and newer | `self-hosted` or `Windows` | | Windows Server 2012 R2 and newer | `self-hosted` or `Windows` |
| macOS Monterey 12.x x86_64/arm64 | `self-hosted` or `macOS` | | macOS Monterey 12.x x86_64/arm64 | `self-hosted` or `macOS` |
@ -204,7 +204,7 @@ PHP extensions can be set up 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` and `event` on `Ubuntu` and `macOS`.
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_oci`, `pecl_http`, `phalcon3` and `phalcon4` on all supported OS. - `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_oci`, `pecl_http`, `phalcon3` and `phalcon4` on all supported OS.
- By default, extensions which cannot be added or disabled gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`. - By default, extensions which cannot be added or disabled gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
@ -264,7 +264,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
``` ```
- The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format, Additionally for composer `snapshot` and `preview` can also be specified to set up the respective releases. - The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format. Additionally for composer `snapshot` and `preview` can also be specified to set up the respective releases.
```yaml ```yaml
- name: Setup PHP with composer v2 - name: Setup PHP with composer v2
@ -425,7 +425,7 @@ Disable coverage for these reasons:
- Specify the tools you want to set up. - Specify the tools you want to set up.
- Accepts a `string` in csv-format. For example: `phpunit, phpcs` - Accepts a `string` in csv-format. For example: `phpunit, phpcs`
- See [tools Support](#wrench-tools-support) for tools supported. - See [tools support](#wrench-tools-support) for tools supported.
### Outputs ### Outputs
@ -662,12 +662,15 @@ 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. For example, if you are using `ubuntu-20.04` in your workflow, run `act -P ubuntu-20.04=shivammathur/node:20.04`. Choose the image tag which matches the `runs-on` property in your workflow. For example, if you are using `ubuntu-20.04` in your workflow, run `act -P ubuntu-20.04=shivammathur/node:2004`.
```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
# For runs-on: ubuntu-22.04
act -P ubuntu-22.04=shivammathur/node:2204
# For runs-on: ubuntu-20.04 # For runs-on: ubuntu-20.04
act -P ubuntu-20.04=shivammathur/node:2004 act -P ubuntu-20.04=shivammathur/node:2004
@ -677,7 +680,7 @@ act -P ubuntu-18.04=shivammathur/node:1804
### JIT Configuration ### JIT Configuration
> Enable Just-in-time(JIT) on PHP 8.0 and above. > Enable Just-in-time (JIT) on PHP 8.0 and above.
- To enable JIT, enable `opcache` in cli mode by setting `opcache.enable_cli=1`. - To enable JIT, enable `opcache` in cli mode by setting `opcache.enable_cli=1`.
- JIT conflicts with `Xdebug`, `PCOV`, and other extensions which override `zend_execute_ex` function, so set `coverage: none` and disable any such extension if added. - JIT conflicts with `Xdebug`, `PCOV`, and other extensions which override `zend_execute_ex` function, so set `coverage: none` and disable any such extension if added.
@ -838,7 +841,7 @@ For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-p
### Examples ### Examples
Examples of using `setup-php` with various PHP Frameworks and Packages. Examples of using `setup-php` with various PHP frameworks and packages.
| Framework/Package | Runs on | Workflow | | Framework/Package | Runs on | Workflow |
|----------------------------------------|---------------------------------|---------------------------------------------------------------------------------------------------------------| |----------------------------------------|---------------------------------|---------------------------------------------------------------------------------------------------------------|

View File

@ -4,6 +4,8 @@ describe('Config tests', () => {
it.each` it.each`
driver | php | os | output driver | php | os | output
${'PCOV'} | ${'7.4'} | ${'win32'} | ${'Add-Extension pcov,Disable-Extension xdebug false'} ${'PCOV'} | ${'7.4'} | ${'win32'} | ${'Add-Extension pcov,Disable-Extension xdebug false'}
${'pcov'} | ${'7.4'} | ${'win32'} | ${'$pcov_version = php -r "echo phpversion(\'pcov\');"'}
${'pcov'} | ${'7.4'} | ${'win32'} | ${'PCOV $pcov_version enabled as coverage driver'}
${'pcov'} | ${'7.0'} | ${'win32'} | ${'PHP 7.1 or newer is required'} ${'pcov'} | ${'7.0'} | ${'win32'} | ${'PHP 7.1 or newer is required'}
${'pcov'} | ${'5.6'} | ${'win32'} | ${'PHP 7.1 or newer is required'} ${'pcov'} | ${'5.6'} | ${'win32'} | ${'PHP 7.1 or newer is required'}
${'pcov'} | ${'7.4'} | ${'win32'} | ${'Add-Extension pcov,Disable-Extension xdebug false'} ${'pcov'} | ${'7.4'} | ${'win32'} | ${'Add-Extension pcov,Disable-Extension xdebug false'}
@ -15,6 +17,8 @@ describe('Config tests', () => {
${'xdebug'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'} ${'xdebug'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'}
${'xdebug3'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'} ${'xdebug3'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'}
${'xdebug2'} | ${'7.4'} | ${'linux'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'} ${'xdebug2'} | ${'7.4'} | ${'linux'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
${'xdebug'} | ${'7.4'} | ${'linux'} | ${'xdebug_version="$(php -r "echo phpversion(\'xdebug\');")"'}
${'xdebug'} | ${'7.4'} | ${'linux'} | ${'Xdebug $xdebug_version enabled as coverage driver'}
${'xdebug'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'} ${'xdebug'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'}
${'xdebug3'} | ${'7.1'} | ${'darwin'} | ${'xdebug3 is not supported on PHP 7.1'} ${'xdebug3'} | ${'7.1'} | ${'darwin'} | ${'xdebug3 is not supported on PHP 7.1'}
${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2'} ${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2'}

View File

@ -45,7 +45,11 @@ jest.mock('../src/fetch', () => ({
.fn() .fn()
.mockImplementation( .mockImplementation(
async (url: string, token?: string): Promise<Record<string, string>> => { async (url: string, token?: string): Promise<Record<string, string>> => {
if (url.includes('atom') && !url.includes('no-')) { if (url.includes('deployer')) {
return {
data: '[{"version": "1.2.3", "url": "https://deployer.org/releases/v1.2.3/deployer.phar"}]'
};
} else if (url.includes('atom') && !url.includes('no-')) {
return { return {
data: '"releases/tag/1.2.3", "releases/tag/3.2.1", "releases/tag/2.3.1"' data: '"releases/tag/1.2.3", "releases/tag/3.2.1", "releases/tag/2.3.1"'
}; };
@ -283,6 +287,7 @@ describe('Tools tests', () => {
version | url version | url
${'latest'} | ${'https://deployer.org/deployer.phar'} ${'latest'} | ${'https://deployer.org/deployer.phar'}
${'1.2.3'} | ${'https://deployer.org/releases/v1.2.3/deployer.phar'} ${'1.2.3'} | ${'https://deployer.org/releases/v1.2.3/deployer.phar'}
${'3.2.1'} | ${'Version missing in deployer manifest'}
`('checking addDeployer: $version', async ({version, url}) => { `('checking addDeployer: $version', async ({version, url}) => {
const data = getData({ const data = getData({
tool: 'deployer', tool: 'deployer',
@ -293,31 +298,41 @@ describe('Tools tests', () => {
}); });
it.each` it.each`
version | no_tool_cache | cache_url | source_url version | php_version | no_tool_cache | cache_url | source_url
${'latest'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'} ${'latest'} | ${'7.4'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
${'stable'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'} ${'stable'} | ${'7.4'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
${'snapshot'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'} ${'snapshot'} | ${'7.4'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
${'preview'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'} ${'preview'} | ${'7.4'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
${'1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'} ${'1'} | ${'7.4'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
${'2'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'} ${'2'} | ${'7.4'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
${'1.2.3'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'} ${'latest'} | ${'7.4'} | ${'true'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
${'1.2.3-RC1'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'} ${'stable'} | ${'7.4'} | ${'true'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
${'snapshot'} | ${'7.4'} | ${'true'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
${'preview'} | ${'7.4'} | ${'true'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
${'1'} | ${'7.4'} | ${'false'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
${'2'} | ${'7.4'} | ${'false'} | ${'https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
${'latest'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
${'stable'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
${'snapshot'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-snapshot.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
${'preview'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-preview.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
${'1'} | ${'7.1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
${'2'} | ${'7.1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-2.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
${'1.2.3'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'}
${'1.2.3-RC1'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'}
`( `(
'checking addComposer: $version, $no_tool_cache', 'checking addComposer: $version, $php_version, $no_tool_cache',
async ({version, no_tool_cache, cache_url, source_url}) => { async ({version, php_version, no_tool_cache, cache_url, source_url}) => {
const data = getData({ const data = getData({
tool: 'composer', tool: 'composer',
php_version: php_version,
domain: 'https://getcomposer.org', domain: 'https://getcomposer.org',
repository: 'composer/composer', repository: 'composer/composer',
version: version version: version
}); });
process.env['no_tools_cache'] = no_tool_cache; process.env['no_tools_cache'] = no_tool_cache;
if (no_tool_cache !== 'true') {
expect(await tools.addComposer(data)).toContain(
`${cache_url},${source_url}`
);
} else {
expect(await tools.addComposer(data)).toContain(source_url); expect(await tools.addComposer(data)).toContain(source_url);
if (no_tool_cache !== 'true') {
expect(await tools.addComposer(data)).toContain(cache_url);
} }
} }
); );
@ -359,7 +374,7 @@ describe('Tools tests', () => {
[ [
'blackfire, blackfire-player, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, php-config, phpize, protoc, symfony, vapor, wp', 'blackfire, blackfire-player, churn, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, php-config, phpize, protoc, symfony, vapor, wp',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_blackfire', 'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"', 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"', 'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
@ -398,7 +413,7 @@ describe('Tools tests', () => {
[ [
'behat, blackfire, blackfire-player, churn, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, symfony-cli, vapor-cli, wp-cli', 'behat, blackfire, blackfire-player, churn, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, symfony-cli, vapor-cli, wp-cli',
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_composertool behat behat behat/ scoped', 'add_composertool behat behat behat/ scoped',
'add_blackfire', 'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"', 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
@ -443,7 +458,7 @@ describe('Tools tests', () => {
[ [
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp', 'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp',
[ [
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'Add-Blackfire', 'Add-Blackfire',
'Add-Tool https://get.blackfire.io/blackfire-player-v1.2.3.phar blackfire-player "-V"', 'Add-Tool https://get.blackfire.io/blackfire-player-v1.2.3.phar blackfire-player "-V"',
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"', 'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
@ -472,7 +487,7 @@ describe('Tools tests', () => {
[ [
'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2', 'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2',
[ [
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer', 'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer',
'Add-Composertool codeception codeception codeception/ global', 'Add-Composertool codeception codeception codeception/ global',
'Add-Composertool prestissimo prestissimo hirak/ global', 'Add-Composertool prestissimo prestissimo hirak/ global',
'Add-Composertool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/ global', 'Add-Composertool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/ global',
@ -495,10 +510,10 @@ describe('Tools tests', () => {
it.each` it.each`
tools_csv | script tools_csv | script
${'none'} | ${''} ${'none'} | ${''}
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'} ${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'}
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'} ${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'} ${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'} ${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
`('checking composer setup: $tools_csv', async ({tools_csv, script}) => { `('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script); expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
}); });

View File

@ -256,4 +256,13 @@ describe('Utils tests', () => {
'\nadd_extension_from_source ext https://sub.domain.XN--tld org repo release extension' '\nadd_extension_from_source ext https://sub.domain.XN--tld org repo release extension'
); );
}); });
it('checking setVariable', async () => {
let script: string = await utils.setVariable('var', 'command', 'linux');
expect(script).toEqual('\nvar="$(command)"\n');
script = await utils.setVariable('var', 'command', 'darwin');
expect(script).toEqual('\nvar="$(command)"\n');
script = await utils.setVariable('var', 'command', 'win32');
expect(script).toEqual('\n$var = command\n');
});
}); });

View File

@ -29,5 +29,5 @@ outputs:
php-version: php-version:
description: 'PHP version in semver format' description: 'PHP version in semver format'
runs: runs:
using: 'node12' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'

788
dist/index.js vendored

File diff suppressed because it is too large Load Diff

4327
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "2.18.1", "version": "2.20.0",
"private": false, "private": false,
"description": "Setup PHP for use with GitHub Actions", "description": "Setup PHP for use with GitHub Actions",
"main": "lib/install.js", "main": "lib/install.js",
@ -34,29 +34,28 @@
"author": "shivammathur", "author": "shivammathur",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.6.0", "@actions/core": "^1.9.0",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2", "@actions/io": "^1.1.2"
"fs": "0.0.1-security"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.4.1", "@types/jest": "^28.1.4",
"@types/node": "^17.0.23", "@types/node": "^18.0.1",
"@typescript-eslint/eslint-plugin": "^5.18.0", "@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.18.0", "@typescript-eslint/parser": "^5.30.5",
"@vercel/ncc": "^0.33.3", "@vercel/ncc": "^0.34.0",
"eslint": "^8.13.0", "eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.1.4", "eslint-plugin-jest": "^26.5.3",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.2.1",
"jest": "^27.5.1", "jest": "^28.1.2",
"jest-circus": "^27.5.1", "jest-circus": "^28.1.2",
"nock": "^13.2.4", "nock": "^13.2.8",
"prettier": "^2.6.2", "prettier": "^2.7.1",
"simple-git-hooks": "^2.7.0", "simple-git-hooks": "^2.8.0",
"ts-jest": "^27.1.4", "ts-jest": "^28.0.5",
"typescript": "^4.6.3" "typescript": "^4.7.4"
}, },
"bugs": { "bugs": {
"url": "https://github.com/shivammathur/setup-php/issues" "url": "https://github.com/shivammathur/setup-php/issues"

View File

@ -1,5 +1,7 @@
amqp=amqp amqp=amqp
apcu=apcu apcu=apcu
couchbase=couchbase
event=event
expect=expect expect=expect
gnupg=gnupg gnupg=gnupg
grpc=grpc grpc=grpc

View File

@ -38,7 +38,12 @@ export async function addCoverageXdebug(
extension = extension == 'xdebug3' ? 'xdebug' : extension; extension = extension == 'xdebug3' ? 'xdebug' : extension;
script += script +=
(await extensions.addExtension(extension, version, os, true)) + pipe; (await extensions.addExtension(extension, version, os, true)) + pipe;
message = 'Xdebug enabled as coverage driver'; script += await utils.setVariable(
'xdebug_version',
'php -r "echo phpversion(\'xdebug\');"',
os
);
message = 'Xdebug $xdebug_version enabled as coverage driver';
status = '$tick'; status = '$tick';
} }
script += await utils.addLog(status, extension, message, os); script += await utils.addLog(status, extension, message, os);
@ -66,12 +71,16 @@ export async function addCoveragePCOV(
script += script +=
(await extensions.addExtension('pcov', version, os, true)) + pipe; (await extensions.addExtension('pcov', version, os, true)) + pipe;
script += (await config.addINIValues('pcov.enabled=1', os, true)) + '\n'; script += (await config.addINIValues('pcov.enabled=1', os, true)) + '\n';
script += await utils.setVariable(
'pcov_version',
'php -r "echo phpversion(\'pcov\');"',
os
);
// success // success
script += await utils.addLog( script += await utils.addLog(
'$tick', '$tick',
'coverage: pcov', 'coverage: pcov',
'PCOV enabled as coverage driver', 'PCOV $pcov_version enabled as coverage driver',
os os
); );
// version is not supported // version is not supported

View File

@ -33,13 +33,13 @@ export async function addExtensionDarwin(
return; return;
// match 5.3blackfire...8.1blackfire // match 5.3blackfire...8.1blackfire
// match 5.3blackfire-(semver)...8.1blackfire-(semver) // match 5.3blackfire-(semver)...8.1blackfire-(semver)
// match couchbase, geos, pdo_oci, oci8, http, pecl_http // match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
// 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
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test( case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension version_extension
): ):
case /^couchbase$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test( case /^couchbase|^event|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
extension extension
): ):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
@ -262,7 +262,7 @@ export async function addExtensionLinux(
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test( case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
version_extension version_extension
): ):
case /^couchbase$|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test( case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
extension extension
): ):
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension): case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):

View File

@ -3,10 +3,11 @@ import * as https from 'https';
import * as url from 'url'; import * as url from 'url';
/** /**
* Function to fetch an URL * Function to fetch a URL
* *
* @param input_url * @param input_url
* @param auth_token * @param auth_token
* @param redirect_count
*/ */
export async function fetch( export async function fetch(
input_url: string, input_url: string,

View File

@ -79,6 +79,7 @@ copy_brew_extensions() {
extension_file="$brew_prefix/opt/$dependency/$(get_extension_from_formula "${dependency%@*}").so" extension_file="$brew_prefix/opt/$dependency/$(get_extension_from_formula "${dependency%@*}").so"
[ -e "$extension_file" ] && sudo cp "$extension_file" "$ext_dir" [ -e "$extension_file" ] && sudo cp "$extension_file" "$ext_dir"
done done
sudo find -- "$brew_prefix"/Cellar/"$formula"@"$version" -name "*.dylib" -exec cp {} "$ext_dir" \;
} }
# Function to install a php extension from shivammathur/extensions tap. # Function to install a php extension from shivammathur/extensions tap.
@ -95,7 +96,7 @@ add_brew_extension() {
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "$core_repo/Formula/" 2>/dev/null || true sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "$core_repo/Formula/" 2>/dev/null || true
update_dependencies >/dev/null 2>&1 update_dependencies >/dev/null 2>&1
disable_dependency_extensions "$extension" >/dev/null 2>&1 disable_dependency_extensions "$extension" >/dev/null 2>&1
brew install -f "$formula@$version" >/dev/null 2>&1 brew install -f "$ext_tap/$formula@$version" >/dev/null 2>&1
copy_brew_extensions "$formula" copy_brew_extensions "$formula"
add_extension_log "$extension" "Installed and enabled" add_extension_log "$extension" "Installed and enabled"
fi fi

View File

@ -30,7 +30,8 @@ enable_cache_extension_dependencies() {
cache_dir=$(find /tmp/extcache -maxdepth 1 -type d -regex ".*$1[0-9]*") cache_dir=$(find /tmp/extcache -maxdepth 1 -type d -regex ".*$1[0-9]*")
if [[ -n "$cache_dir" ]]; then if [[ -n "$cache_dir" ]]; then
IFS=" " read -r -a deps <<<"$(find "$cache_dir" -maxdepth 1 -type f -name "*" -exec basename {} \; | tr '\n' ' ')" IFS=" " read -r -a deps <<<"$(find "$cache_dir" -maxdepth 1 -type f -name "*" -exec basename {} \; | tr '\n' ' ')"
if [[ -n "${deps[*]}" ]] && php "${deps[@]/#/-d ${2}=}" -d "${2}=$1" -m 2>/dev/null | grep -i -q "$1"; then IFS="#" read -r -a deps_enable <<<"$(printf -- "-d ${2}=%s.so#" "${deps[@]}")"
if [[ -n "${deps[*]}" ]] && php "${deps_enable[@]}" -d "${2}=$1.so" -m 2>/dev/null | grep -i -q "$1"; then
for ext in "${deps[@]}"; do for ext in "${deps[@]}"; do
sudo rm -rf /tmp/extcache/"$ext" sudo rm -rf /tmp/extcache/"$ext"
enable_extension "$ext" "$2" enable_extension "$ext" "$2"
@ -162,7 +163,11 @@ pecl_install() {
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)" suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)" IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1 (( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
if [ "$version" = "5.3" ]; then
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
else
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1 yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
fi
} }
# Function to install a specific version of PECL extension. # Function to install a specific version of PECL extension.

View File

@ -1,43 +1,76 @@
# Function to install libraries required by couchbase # Function to install libraries required by couchbase
add_couchbase_libs() { add_couchbase_clibs() {
if [ "$(uname -s)" = "Linux" ]; then ext=$1
trunk="https://github.com/couchbase/libcouchbase/releases" trunk="https://github.com/couchbase/libcouchbase/releases"
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then if [[ "$ext" =~ couchbase-2.+ ]]; then
release="2.10.9" release="2.10.9"
else else
release="$(curl -sL $trunk/latest | grep -Eo "libcouchbase-[0-9]+\.[0-9]+\.[0-9]+" | head -n 1 | cut -d'-' -f 2)" release="$(curl -sL $trunk/latest | grep -Eo "libcouchbase-[0-9]+\.[0-9]+\.[0-9]+" | head -n 1 | cut -d'-' -f 2)"
fi fi
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${VERSION_ID/./}_${VERSION_CODENAME}_amd64.tar" [ "$VERSION_ID" = "22.04" ] && vid=20.04 || vid="$VERSION_ID"
[ "$VERSION_CODENAME" = "jammy" ] && vcn=focal || vcn="$VERSION_CODENAME"
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${vid/./}_${vcn}_amd64.tar"
get -q -n /tmp/libcouchbase.tar "$deb_url" get -q -n /tmp/libcouchbase.tar "$deb_url"
sudo tar -xf /tmp/libcouchbase.tar -C /tmp sudo tar -xf /tmp/libcouchbase.tar -C /tmp
install_packages libev4 libevent-dev install_packages libev4 libevent-dev
sudo dpkg -i /tmp/libcouchbase-*/*.deb sudo dpkg -i /tmp/libcouchbase-*/*.deb
else }
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
brew install libcouchbase@2 add_couchbase_cxxlibs() {
brew link --overwrite --force libcouchbase@2 if [ "$VERSION_ID" = "18.04" ]; then
else if ! command -v gcc-8 >/dev/null || ! command -v g++-8 >/dev/null; then
brew install libcouchbase install_packages gcc-8 g++-8 -y
fi fi
printf "gcc g++" | xargs -d ' ' -I {} sudo update-alternatives --install /usr/bin/{} {} /usr/bin/{}-8 8
fi
if [ "${runner:?}" = "self-hosted" ]; then
add_list cmake https://apt.kitware.com/ubuntu/ https://apt.kitware.com/keys/kitware-archive-latest.asc "$VERSION_CODENAME" main
fi
install_packages cmake ccache
}
get_couchbase_version() {
if [[ "${version:?}" =~ ${old_versions:?} ]]; then
echo couchbase-2.2.3
elif [[ "${version:?}" =~ 5.6|7.[0-1] ]]; then
echo couchbase-2.6.2
elif [ "${version:?}" = '7.2' ]; then
echo couchbase-3.0.4
elif [ "${version:?}" = '7.3' ]; then
echo couchbase-3.2.2
else
echo couchbase
fi fi
} }
# Function to add couchbase. # Function to add couchbase.
add_couchbase() { add_couchbase() {
add_couchbase_libs >/dev/null 2>&1 ext=$1
if [ "$(uname -s)" = "Linux" ]; then
if [ "$ext" = "couchbase" ]; then
ext=$(get_couchbase_version)
fi
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
add_couchbase_clibs "$ext" >/dev/null 2>&1
else
add_couchbase_cxxlibs >/dev/null 2>&1
fi
enable_extension "couchbase" "extension" enable_extension "couchbase" "extension"
if check_extension "couchbase"; then if check_extension "couchbase"; then
add_log "${tick:?}" "couchbase" "Enabled" add_log "${tick:?}" "couchbase" "Enabled"
else else
if [[ "${version:?}" =~ ${old_versions:?} ]]; then if [ "$ext" = "couchbase" ]; then
pecl_install couchbase-2.2.3 >/dev/null 2>&1 ext="couchbase-$(get_pecl_version "couchbase" "stable")"
elif [[ "${version:?}" =~ 5.6|7.[0-1] ]]; then add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
pecl_install couchbase-2.6.2 >/dev/null 2>&1
elif [[ "${version:?}" =~ 7.2 ]]; then
pecl_install couchbase-3.0.4 >/dev/null 2>&1
else else
pecl_install couchbase >/dev/null 2>&1 pecl_install "${ext}" >/dev/null 2>&1
fi fi
add_extension_log "couchbase" "Installed and enabled" add_extension_log "couchbase" "Installed and enabled"
fi fi
else
if [ -e "${ext_dir:?}"/libcouchbase_php_core.dylib ]; then
sudo cp "${ext_dir:?}"/libcouchbase_php_core.dylib ${brew_prefix:?}/lib
fi
add_brew_extension couchbase extension
fi
} }

View File

@ -0,0 +1,50 @@
# Function to get event configure options
get_event_configure_opts() {
event_opts=(
--with-event-core
--with-event-extra
--with-event-openssl
--enable-event-sockets
)
if [ "$os" = 'Linux' ]; then
event_opts+=(
--with-openssl-dir=yes
--with-event-libevent-dir=/usr
)
else
event_opts+=(
--with-openssl-dir="$(brew --prefix openssl@1.1)"
--with-event-libevent-dir="$(brew --prefix libevent)"
)
fi
}
# Helper function to compile and install event
add_event_helper() {
local ext=$1
[[ "$ext" =~ ^event$ ]] && ext="event-$(get_pecl_version "event" "stable")"
event_opts=() && get_event_configure_opts
export EVENT_LINUX_LIBS='libevent-dev'
export EVENT_DARWIN_LIBS='libevent'
event_configure_opts="--with-php-config=$(command -v php-config) ${event_opts[*]}"
export EVENT_CONFIGURE_OPTS="$event_configure_opts"
add_extension_from_source event https://pecl.php.net event event "${ext##*-}" extension pecl
}
# Function to add event
add_event() {
local ext=$1
enable_extension "event" "extension"
if check_extension "event"; then
add_log "${tick:?}" "event" "Enabled"
else
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
add_brew_extension event extension >/dev/null 2>&1
else
add_event_helper "$ext" >/dev/null 2>&1
fi
add_extension_log "event" "Installed and enabled"
fi
}
os="$(uname -s)"

View File

@ -7,9 +7,18 @@ get_sqlsrv_version() {
fi fi
} }
add_unixodbc() {
if [ "$(uname -s)" = 'Linux' ]; then
install_packages unixodbc-dev
else
brew install unixodbc
fi
}
# Function to install sqlsrv and pdo_sqlsrv. # Function to install sqlsrv and pdo_sqlsrv.
add_sqlsrv() { add_sqlsrv() {
ext=$1 ext=$1
ext_version=$(get_sqlsrv_version) ext_version=$(get_sqlsrv_version)
add_unixodbc >/dev/null 2>&1
add_pecl_extension "$ext" "$ext_version" extension add_pecl_extension "$ext" "$ext_version" extension
} }

View File

@ -37,7 +37,7 @@ Function Get-ToolVersion() {
[Parameter(Position = 1, Mandatory = $true)] [Parameter(Position = 1, Mandatory = $true)]
$param $param
) )
$alp = "[a-zA-Z0-9]" $alp = "[a-zA-Z0-9\.]"
$version_regex = "[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}" $version_regex = "[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
if($tool -eq 'composer') { if($tool -eq 'composer') {
$composer_branch_alias = Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value } $composer_branch_alias = Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
@ -67,6 +67,13 @@ Function Add-ToolsHelper() {
Edit-ComposerConfig $bin_dir\$tool Edit-ComposerConfig $bin_dir\$tool
} elseif($tool -eq "cs2pr") { } elseif($tool -eq "cs2pr") {
(Get-Content $bin_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $bin_dir/cs2pr (Get-Content $bin_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $bin_dir/cs2pr
} elseif($tool -eq "deployer") {
if(Test-Path $composer_bin\deployer.phar.bat) {
Copy-Item $composer_bin\deployer.phar.bat -Destination $composer_bin\dep.bat
}
if(Test-Path $composer_bin\dep.bat) {
Copy-Item $composer_bin\dep.bat -Destination $composer_bin\deployer.bat
}
} elseif($tool -eq "phan") { } elseif($tool -eq "phan") {
$extensions += @('fileinfo', 'ast') $extensions += @('fileinfo', 'ast')
} elseif($tool -eq "phinx") { } elseif($tool -eq "phinx") {
@ -175,6 +182,9 @@ Function Add-ComposertoolHelper() {
if(Test-Path $composer_lock) { if(Test-Path $composer_lock) {
Remove-Item -Path $composer_lock -Force Remove-Item -Path $composer_lock -Force
} }
if(composer global show $prefix$tool -a 2>&1 | findstr '^type *: *composer-plugin') {
composer global config --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
}
composer global require $prefix$release $composer_args >$null 2>&1 composer global require $prefix$release $composer_args >$null 2>&1
return composer global show $prefix$tool 2>&1 | findstr '^versions' return composer global show $prefix$tool 2>&1 | findstr '^versions'
} else { } else {
@ -182,6 +192,9 @@ Function Add-ComposertoolHelper() {
$scoped_dir_suffix = (Get-FileHash -InputStream $release_stream -Algorithm sha256).Hash $scoped_dir_suffix = (Get-FileHash -InputStream $release_stream -Algorithm sha256).Hash
$scoped_dir = "$composer_bin\_tools\$tool-$scoped_dir_suffix" $scoped_dir = "$composer_bin\_tools\$tool-$scoped_dir_suffix"
$unix_scoped_dir = $scoped_dir.replace('\', '/') $unix_scoped_dir = $scoped_dir.replace('\', '/')
if(composer show $prefix$tool -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') {
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$release" true >$null 2>&1
}
if(-not(Test-Path $scoped_dir)) { if(-not(Test-Path $scoped_dir)) {
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1 New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1 composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1

View File

@ -9,7 +9,7 @@ export composer_lock="$composer_home/composer.lock"
get_tool_version() { get_tool_version() {
tool=$1 tool=$1
param=$2 param=$2
alp="[a-zA-Z0-9]" alp="[a-zA-Z0-9\.]"
version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}" version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
if [ "$tool" = "composer" ]; then if [ "$tool" = "composer" ]; then
composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")" composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
@ -61,6 +61,13 @@ add_tools_helper() {
elif [ "$tool" = "cs2pr" ]; then 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" 2>/dev/null ||
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "$tool_path" sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
elif [ "$tool" = "deployer" ]; then
if [ -e "$composer_bin"/deployer.phar ]; then
sudo ln -s "$composer_bin"/deployer.phar "$composer_bin"/dep
fi
if [ -e "$composer_bin"/dep ]; then
sudo ln -s "$composer_bin"/dep "$composer_bin"/deployer
fi
elif [ "$tool" = "phan" ]; then elif [ "$tool" = "phan" ]; then
extensions+=(fileinfo ast) extensions+=(fileinfo ast)
elif [ "$tool" = "phinx" ]; then elif [ "$tool" = "phinx" ]; then
@ -136,12 +143,19 @@ add_composertool_helper() {
enable_extensions curl mbstring openssl enable_extensions curl mbstring openssl
if [ "$scope" = "global" ]; then if [ "$scope" = "global" ]; then
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
if composer global show "$prefix$tool" -a 2>&1 | grep -qE '^type *: *composer-plugin'; then
composer global config --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
fi
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1 composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1 composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer_show.log >/dev/null 2>&1
else else
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)" scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
if ! [ -d "$scoped_dir" ]; then if ! [ -d "$scoped_dir" ]; then
mkdir -p "$scoped_dir" mkdir -p "$scoped_dir"
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
if composer show "$prefix$tool" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin'; then
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
fi
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1 composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1 composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
fi fi

View File

@ -1,12 +1,12 @@
get_protobuf_tag() { get_protobuf_tag() {
if [ "$protobuf_tag" = "latest" ]; then if [ "$protobuf_tag" = "latest" ]; then
protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1) protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
else else
status_code=$(get -v -n /tmp/protobuf.tmp "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag") status_code=$(get -v -n /tmp/protobuf.tmp "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
if [ "$status_code" = "200" ]; then if [ "$status_code" = "200" ]; then
protobuf_tag="v$protobuf_tag" protobuf_tag="v$protobuf_tag"
else else
protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1) protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
fi fi
fi fi
} }

View File

@ -151,6 +151,7 @@ self_hosted_setup() {
exit 1 exit 1
else else
self_hosted_helper >/dev/null 2>&1 self_hosted_helper >/dev/null 2>&1
add_env RUNNER_TOOL_CACHE /tmp
fi fi
fi fi
} }
@ -159,10 +160,10 @@ self_hosted_setup() {
configure_php() { configure_php() {
add_php_config add_php_config
ini_config_dir="${src:?}"/configs/ini ini_config_dir="${src:?}"/configs/ini
ini_files=("$ini_config_dir"/php.ini) ini_config_files=("$ini_config_dir"/php.ini)
[[ "$version" =~ $jit_versions ]] && ini_files+=("$ini_config_dir"/jit.ini) [[ "$version" =~ $jit_versions ]] && ini_config_files+=("$ini_config_dir"/jit.ini)
[[ "$version" =~ $xdebug3_versions ]] && ini_files+=("$ini_config_dir"/xdebug.ini) [[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
cat "${ini_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1 cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}" >/dev/null 2>&1
} }
# Function to get PHP version in semver format. # Function to get PHP version in semver format.

View File

@ -88,6 +88,7 @@ Function Add-Path {
} }
if ($env:GITHUB_PATH) { if ($env:GITHUB_PATH) {
Add-Content $PathItem -Path $env:GITHUB_PATH -Encoding utf8 Add-Content $PathItem -Path $env:GITHUB_PATH -Encoding utf8
$env:PATH += "$PathItem;"
} else { } else {
$newPath = (Get-ItemProperty -Path 'hkcu:\Environment' -Name PATH).Path.replace("$PathItem;", '') $newPath = (Get-ItemProperty -Path 'hkcu:\Environment' -Name PATH).Path.replace("$PathItem;", '')
$newPath = $PathItem + ';' + $newPath $newPath = $PathItem + ';' + $newPath
@ -295,6 +296,7 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
New-Item $php_dir -Type Directory -Force > $null 2>&1 New-Item $php_dir -Type Directory -Force > $null 2>&1
Add-Path -PathItem $php_dir Add-Path -PathItem $php_dir
setx PHPROOT $php_dir >$null 2>&1 setx PHPROOT $php_dir >$null 2>&1
Add-Env -EnvName RUNNER_TOOL_CACHE -EnvValue $env:TEMP
} else { } else {
$current_profile = "$PSHOME\Profile.ps1" $current_profile = "$PSHOME\Profile.ps1"
if(-not(Test-Path -LiteralPath $current_profile)) { if(-not(Test-Path -LiteralPath $current_profile)) {

View File

@ -230,24 +230,34 @@ export async function addBlackfirePlayer(data: RS): Promise<string> {
* @param data * @param data
*/ */
export async function addComposer(data: RS): Promise<string> { export async function addComposer(data: RS): Promise<string> {
const channel = data['version'].replace('latest', 'stable');
const github = data['github']; const github = data['github'];
const getcomposer = data['domain']; const getcomposer = data['domain'];
let cache_url = `${github}/shivammathur/composer-cache/releases/latest/download/composer-${ const cds = 'https://dl.cloudsmith.io';
data['php_version'] const filename = `composer-${data['php_version']}-${channel}.phar`;
}-${data['version'].replace('latest', 'stable')}.phar`; const releases_url = `${github}/shivammathur/composer-cache/releases/latest/download/${filename}`;
const cds_url = `${cds}/public/shivammathur/composer-cache/raw/files/${filename}`;
const lts_url = `${getcomposer}/download/latest-2.2.x/composer.phar`;
const is_lts = /^5\.[3-6]$|^7\.[0-1]$/.test(data['php_version']);
const version_source_url = `${getcomposer}/composer-${channel}.phar`;
let cache_url = `${releases_url},${cds_url}`;
let source_url = `${getcomposer}/composer.phar`; let source_url = `${getcomposer}/composer.phar`;
switch (true) { switch (true) {
case /^snapshot$/.test(data['version']): case /^snapshot$/.test(channel):
source_url = is_lts ? lts_url : source_url;
break; break;
case /^preview$|^[1-2]$/.test(data['version']): case /^preview$|^2$/.test(channel):
source_url = `${getcomposer}/composer-${data['version']}.phar`; source_url = is_lts ? lts_url : version_source_url;
break;
case /^1$/.test(channel):
source_url = version_source_url;
break; break;
case /^\d+\.\d+\.\d+[\w-]*$/.test(data['version']): case /^\d+\.\d+\.\d+[\w-]*$/.test(data['version']):
cache_url = `${github}/${data['repository']}/releases/download/${data['version']}/composer.phar`; cache_url = `${github}/${data['repository']}/releases/download/${data['version']}/composer.phar`;
source_url = `${getcomposer}/composer-${data['version']}.phar`; source_url = version_source_url;
break; break;
default: default:
source_url = `${getcomposer}/composer-stable.phar`; source_url = is_lts ? lts_url : version_source_url;
} }
const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true'; const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
data['url'] = use_cache ? `${cache_url},${source_url}` : source_url; data['url'] = use_cache ? `${cache_url},${source_url}` : source_url;
@ -264,8 +274,25 @@ export async function addDeployer(data: RS): Promise<string> {
if (data['version'] === 'latest') { if (data['version'] === 'latest') {
data['url'] = data['domain'] + '/deployer.phar'; data['url'] = data['domain'] + '/deployer.phar';
} else { } else {
data['url'] = const manifest: RS = await fetch.fetch(
data['domain'] + '/releases/v' + data['version'] + '/deployer.phar'; 'https://deployer.org/manifest.json'
);
const version_data: RSRS = JSON.parse(manifest.data);
const version_key: string | undefined = Object.keys(version_data).find(
(key: string) => {
return version_data[key]['version'] === data['version'];
}
);
if (version_key) {
data['url'] = version_data[version_key]['url'];
} else {
return await utils.addLog(
'$cross',
'deployer',
'Version missing in deployer manifest',
data['os']
);
}
} }
return await addArchive(data); return await addArchive(data);
} }

View File

@ -413,3 +413,26 @@ export async function parseExtensionSource(
prefix prefix
); );
} }
/**
* Log to console
*
* @param variable
* @param command
* @param os
*/
export async function setVariable(
variable: string,
command: string,
os: string
): Promise<string> {
switch (os) {
case 'win32':
return '\n$' + variable + ' = ' + command + '\n';
case 'linux':
case 'darwin':
default:
return '\n' + variable + '="$(' + command + ')"\n';
}
}

View File

@ -3,7 +3,7 @@
"declaration": true, "declaration": true,
"esModuleInterop": true, "esModuleInterop": true,
"lib": [ "lib": [
"ES2020" "ES2021"
], ],
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
@ -13,7 +13,7 @@
"rootDir": "./src", "rootDir": "./src",
"sourceMap": true, "sourceMap": true,
"strict": true, "strict": true,
"target": "ES2019" "target": "ES2021"
}, },
"exclude": ["__tests__", "lib", "node_modules"] "exclude": ["__tests__", "lib", "node_modules"]
} }