Compare commits
No commits in common. "main" and "2.12.0" have entirely different histories.
16
.eslintrc.json
Normal file
16
.eslintrc.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"env": { "node": true, "jest": true },
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": { "ecmaVersion": 2019, "sourceType": "module" },
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:import/errors",
|
||||||
|
"plugin:import/warnings",
|
||||||
|
"plugin:import/typescript",
|
||||||
|
"plugin:prettier/recommended",
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"plugins": ["@typescript-eslint", "jest"]
|
||||||
|
}
|
||||||
79
.github/CONTRIBUTING.md
vendored
79
.github/CONTRIBUTING.md
vendored
@ -1,26 +1,37 @@
|
|||||||
# Contributing to setup-php
|
# Contributing to setup-php
|
||||||
|
|
||||||
## Welcome!
|
|
||||||
|
|
||||||
We look forward to your contributions! Here are some examples how you can contribute:
|
|
||||||
|
|
||||||
* [Ask any questions you may have](https://github.com/shivammathur/setup-php/discussions/new?category=Q-A-Help)
|
|
||||||
* [Report a bug](https://github.com/shivammathur/setup-php/issues/new?labels=type/bug&template=bug.md)
|
|
||||||
* [Propose a new feature](https://github.com/shivammathur/setup-php/issues/new?labels=enhancement&template=feature.md)
|
|
||||||
* [Send a pull request](https://github.com/shivammathur/setup-php/pulls)
|
|
||||||
|
|
||||||
## Contributor Code of Conduct
|
## Contributor Code of Conduct
|
||||||
|
|
||||||
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
||||||
|
|
||||||
## Getting Started
|
## Workflow
|
||||||
|
|
||||||
To get started fork `setup-php` and clone it using git:
|
* Fork the project.
|
||||||
|
* Make your bug fix or feature addition.
|
||||||
|
* Add tests for it, so we don't break it in a future version unintentionally.
|
||||||
|
* If editing the scripts, create a demo integration test.
|
||||||
|
* Send a pull request to the develop branch with all the details.
|
||||||
|
|
||||||
|
Please make sure that you have [set up your user name and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git. Strings such as `silly nick name <root@localhost>` look really stupid in the commit history of a project.
|
||||||
|
|
||||||
|
Due to time constraints, you may not always get a quick response. Please do not take delays personally and feel free to remind.
|
||||||
|
|
||||||
|
## Coding Guidelines
|
||||||
|
|
||||||
|
## Using setup-php from a Git checkout
|
||||||
|
|
||||||
|
The following commands can be used to perform the initial checkout of setup-php:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/<your-username>/setup-php.git
|
$ git clone https://github.com/shivammathur/setup-php.git
|
||||||
|
|
||||||
cd setup-php
|
$ cd setup-php
|
||||||
|
```
|
||||||
|
|
||||||
|
Install setup-php dependencies using [npm](https://www.npmjs.com/):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using `Windows` configure `git` to handle line endings.
|
If you are using `Windows` configure `git` to handle line endings.
|
||||||
@ -29,55 +40,31 @@ If you are using `Windows` configure `git` to handle line endings.
|
|||||||
git config --local core.autocrlf true
|
git config --local core.autocrlf true
|
||||||
```
|
```
|
||||||
|
|
||||||
Install `setup-php` dependencies using [npm](https://www.npmjs.com/):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
## Workflow to create Pull Requests
|
|
||||||
|
|
||||||
* Fork the `setup-php` project and clone it.
|
|
||||||
* Create a new branch from the develop branch.
|
|
||||||
* Make your bug fix or feature addition.
|
|
||||||
* Add tests for it, so we don't break it in a future version unintentionally.
|
|
||||||
* Ensure the test suite passes and the code complies with our coding guidelines (see below).
|
|
||||||
* Send a pull request to the develop branch with all the details.
|
|
||||||
* If possible, create a GitHub Actions workflow with an integration test for the change in a demo repository and link it in your pull request.
|
|
||||||
|
|
||||||
Please make sure that you have [set up your user name and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git. Strings such as `silly nick name <root@localhost>` look really stupid in the commit history of a project.
|
|
||||||
|
|
||||||
Due to time constraints, you may not always get a quick response. Please do not take delays personally and feel free to remind.
|
|
||||||
|
|
||||||
## Coding Guidelines
|
|
||||||
|
|
||||||
This project comes with `.prettierrc.json` and `eslintrc.json` configuration files. Please run the following commands to fix and verify the code quality.
|
This project comes with `.prettierrc.json` and `eslintrc.json` configuration files. Please run the following commands to fix and verify the code quality.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run format
|
$ npm run format
|
||||||
npm run lint
|
$ npm run lint
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running the test suite
|
## Running the test suite
|
||||||
|
|
||||||
After following the steps shown above, The `setup-php` tests in the `__tests__` directory can be run using this command:
|
After following the steps shown above, The `setup-php` tests in the `__tests__` directory can be run using this command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm test
|
$ npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
### Creating a release
|
## Creating a release
|
||||||
|
|
||||||
Creating a release means compiling all the TypeScript code to a single file which `setup-php` can run. Run this, before you push your changes.
|
Create a release before you push your changes.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
$ npm run release
|
||||||
npm run release
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Reporting issues and discussions
|
## Reporting issues
|
||||||
|
|
||||||
For questions or support, we prefer GitHub Discussions. For any bugs or new features you can create an issue using the appropriate template:
|
Please submit the issue using the appropriate template provided for a bug report or a feature request:
|
||||||
|
|
||||||
* [Discussions](https://github.com/shivammathur/setup-php/discussions)
|
|
||||||
* [Issues](https://github.com/shivammathur/setup-php/issues)
|
* [Issues](https://github.com/shivammathur/setup-php/issues)
|
||||||
|
|||||||
6
.github/FUNDING.yml
vendored
6
.github/FUNDING.yml
vendored
@ -1,3 +1,7 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: shivammathur
|
open_collective: setup-php
|
||||||
|
tidelift: "npm/setup-php"
|
||||||
|
community_bridge: setup-php
|
||||||
|
patreon: shivammathur
|
||||||
|
custom: https://www.paypal.me/shivammathur
|
||||||
|
|||||||
94
.github/ISSUE_TEMPLATE/bug.yml
vendored
94
.github/ISSUE_TEMPLATE/bug.yml
vendored
@ -1,94 +0,0 @@
|
|||||||
name: Bug report
|
|
||||||
description: Nice, you found a bug!
|
|
||||||
title: "Bug: "
|
|
||||||
labels: ["bug"]
|
|
||||||
assignees: ["shivammathur"]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: "Please fill out the sections below to help us address your issue."
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: bug-description
|
|
||||||
attributes:
|
|
||||||
label: "Describe the bug"
|
|
||||||
placeholder: "Please describe the bug concisely."
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
id: version
|
|
||||||
attributes:
|
|
||||||
label: "Version"
|
|
||||||
description: "I have checked releases, and the bug exists in the latest patch version of `v1` or `v2`."
|
|
||||||
options:
|
|
||||||
- label: "v2"
|
|
||||||
- label: "v1"
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: dropdown
|
|
||||||
id: runners
|
|
||||||
attributes:
|
|
||||||
label: "Runners"
|
|
||||||
description: "Please choose the GitHub Action runner your workflow uses."
|
|
||||||
options:
|
|
||||||
- "GitHub Hosted"
|
|
||||||
- "Self Hosted"
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: operating-systems
|
|
||||||
attributes:
|
|
||||||
label: "Operating systems"
|
|
||||||
placeholder: "e.g., Ubuntu 22.04, Windows Server 2022, etc."
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: php-versions
|
|
||||||
attributes:
|
|
||||||
label: "PHP versions"
|
|
||||||
placeholder: "e.g., PHP 7.4, PHP 8.0, etc."
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: steps-to-reproduce
|
|
||||||
attributes:
|
|
||||||
label: "To Reproduce"
|
|
||||||
placeholder: "Please provide the relevant steps of your workflow `.yml` file."
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: expected-behavior
|
|
||||||
attributes:
|
|
||||||
label: "Expected behavior"
|
|
||||||
placeholder: "A clear and concise description of what you expected to happen."
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: screenshots-logs
|
|
||||||
attributes:
|
|
||||||
label: "Screenshots/Logs"
|
|
||||||
placeholder: "Drag and drop images or paste logs here..."
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: additional-context
|
|
||||||
attributes:
|
|
||||||
label: "Additional context"
|
|
||||||
placeholder: "Add any other context about the problem here."
|
|
||||||
|
|
||||||
- type: dropdown
|
|
||||||
id: willing-to-submit-pr
|
|
||||||
attributes:
|
|
||||||
label: "Are you willing to submit a PR?"
|
|
||||||
description: "We accept pull requests targeting the develop branch."
|
|
||||||
options:
|
|
||||||
- "Yes"
|
|
||||||
- "No"
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
42
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
42
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Nice, you found a bug!
|
||||||
|
title: ''
|
||||||
|
labels: 'bug'
|
||||||
|
assignees: 'shivammathur'
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
<!-- Please describe the bug concisely. -->
|
||||||
|
|
||||||
|
**Version**
|
||||||
|
- [ ] I have checked releases, and the bug exists in the latest patch version of `v1` or `v2`.
|
||||||
|
- [ ] `v2`
|
||||||
|
- [ ] `v1`
|
||||||
|
|
||||||
|
**Runners**
|
||||||
|
<!-- Please mark the GitHub Action runner your workflow uses. -->
|
||||||
|
- [ ] GitHub Hosted
|
||||||
|
- [ ] Self Hosted
|
||||||
|
|
||||||
|
**Operating systems**
|
||||||
|
<!-- Please mention the operating systems your workflow uses. -->
|
||||||
|
|
||||||
|
**PHP versions**
|
||||||
|
<!-- Please mention the PHP versions your workflow uses. -->
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
<!-- Please provide the relevant steps of your workflow `.yml` file. -->
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
<!-- A clear and concise description of what you expected to happen. -->
|
||||||
|
|
||||||
|
**Screenshots/Logs**
|
||||||
|
<!-- If applicable, add screenshots or logs to help explain your problem. -->
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
<!-- Add any other context about the problem here. -->
|
||||||
|
|
||||||
|
**Are you willing to submit a PR?**
|
||||||
|
<!-- We accept pull requests targeting the develop branch. -->
|
||||||
58
.github/ISSUE_TEMPLATE/feature.yml
vendored
58
.github/ISSUE_TEMPLATE/feature.yml
vendored
@ -1,58 +0,0 @@
|
|||||||
name: Feature request
|
|
||||||
description: Suggest a new feature
|
|
||||||
title: "Feature: "
|
|
||||||
labels: ["enhancement"]
|
|
||||||
assignees: ["shivammathur"]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: "Please fill out the sections below to help us understand your new feature proposal."
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: feature-description
|
|
||||||
attributes:
|
|
||||||
label: "Describe the feature"
|
|
||||||
placeholder: "A clear and concise description of what you want and why."
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
id: version-check
|
|
||||||
attributes:
|
|
||||||
label: "Please check the latest release"
|
|
||||||
options:
|
|
||||||
- label: "I have checked releases, and the feature is missing in the latest patch version of `v2`."
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: underlying-issue
|
|
||||||
attributes:
|
|
||||||
label: "Underlying issue"
|
|
||||||
placeholder: "Please describe the issue this would solve."
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: alternatives
|
|
||||||
attributes:
|
|
||||||
label: "Describe alternatives"
|
|
||||||
placeholder: "Please mention any alternative solutions you've considered."
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: additional-context
|
|
||||||
attributes:
|
|
||||||
label: "Additional context"
|
|
||||||
placeholder: "Drag and drop images or paste any additional information here..."
|
|
||||||
|
|
||||||
- type: dropdown
|
|
||||||
id: willing-to-submit-pr
|
|
||||||
attributes:
|
|
||||||
label: "Are you willing to submit a PR?"
|
|
||||||
description: "We accept pull requests targeting the develop branch."
|
|
||||||
options:
|
|
||||||
- "Yes"
|
|
||||||
- "No"
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
26
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
26
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest a new feature
|
||||||
|
title: ''
|
||||||
|
labels: 'enhancement'
|
||||||
|
assignees: 'shivammathur'
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the feature**
|
||||||
|
<!-- Please describe concisely the feature you want to add. -->
|
||||||
|
|
||||||
|
**Version**
|
||||||
|
- [ ] I have checked releases, and the feature is missing in the latest patch version of `v2`.
|
||||||
|
|
||||||
|
**Underlying issue**
|
||||||
|
<!-- Please describe the issue this would solve. -->
|
||||||
|
|
||||||
|
**Describe alternatives**
|
||||||
|
<!-- Please mention any alternative solutions you've considered. -->
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
<!-- Add any other context or screenshots about the feature request here. -->
|
||||||
|
|
||||||
|
**Are you willing to submit a PR?**
|
||||||
|
<!-- We accept pull requests targeting the develop branch. -->
|
||||||
24
.github/SECURITY.md
vendored
24
.github/SECURITY.md
vendored
@ -2,20 +2,28 @@
|
|||||||
|
|
||||||
## Supported Versions
|
## Supported Versions
|
||||||
|
|
||||||
The latest patch version of `v2` release of this project is supported for security updates.
|
The following versions of this project are supported for security updates.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 1.11.x | :white_check_mark: |
|
||||||
|
| 2.11.x | :white_check_mark: |
|
||||||
|
|
||||||
## Supported PHP Versions
|
## Supported PHP Versions
|
||||||
|
|
||||||
This security policy only applies to the latest patch releases of the following PHP versions.
|
This security policy only applies to the latest patches of the following PHP versions.
|
||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
|---------|--------------------|
|
| ------- | ------------------ |
|
||||||
| 8.1 | :white_check_mark: |
|
| 7.3 | :white_check_mark: |
|
||||||
| 8.2 | :white_check_mark: |
|
| 7.4 | :white_check_mark: |
|
||||||
| 8.3 | :white_check_mark: |
|
| 8.0 | :white_check_mark: |
|
||||||
| 8.4 | :white_check_mark: |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
If you have found any issues that might have security implications in the versions supported, please send a report privately to [contact@setup-php.com](mailto:contact@setup-php.com).
|
If you have found any issues that might have security implications in the versions supported, please send a report privately to [contact@shivammathur.com](mailto:contact@shivammathur.com).
|
||||||
Do not report security reports publicly.
|
Do not report security reports publicly.
|
||||||
|
|
||||||
|
## Tidelift
|
||||||
|
|
||||||
|
If you use this GitHub Action through a Tidelift subscription, please refer to [https://tidelift.com/security](https://tidelift.com/security).
|
||||||
4
.github/codeql/codeql-configuration.yml
vendored
4
.github/codeql/codeql-configuration.yml
vendored
@ -1,4 +0,0 @@
|
|||||||
name : CodeQL Configuration
|
|
||||||
|
|
||||||
paths:
|
|
||||||
- './src'
|
|
||||||
7
.github/dependabot.yml
vendored
7
.github/dependabot.yml
vendored
@ -1,7 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
target-branch: "develop"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
33
.github/workflows/codeql.yml
vendored
33
.github/workflows/codeql.yml
vendored
@ -1,33 +0,0 @@
|
|||||||
name: CodeQL Workflow
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 15 * * 6'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
codeql:
|
|
||||||
if: github.event.repository.fork == false
|
|
||||||
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
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v4
|
|
||||||
with:
|
|
||||||
config-file: ./.github/codeql/codeql-configuration.yml
|
|
||||||
languages: javascript
|
|
||||||
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v4
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v4
|
|
||||||
97
.github/workflows/docs.yml
vendored
97
.github/workflows/docs.yml
vendored
@ -3,134 +3,73 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 15 * * 6'
|
- cron: '0 15 * * 6'
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create:
|
create:
|
||||||
if: github.event.repository.fork == false
|
|
||||||
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-24.04, ubuntu-22.04, windows-2022, macos-15-intel]
|
operating-system: [ubuntu-20.04, ubuntu-18.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', '8.2', '8.3', '8.4', '8.5', '8.6']
|
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
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
tools: none
|
- name: Save unix
|
||||||
- name: Create file with all extensions for Linux and macOS
|
|
||||||
env:
|
env:
|
||||||
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
||||||
version: ${{ matrix.php-versions }}
|
version: ${{ matrix.php-versions }}
|
||||||
if: matrix.operating-system != 'windows-2022'
|
if: matrix.operating-system != 'windows-2019'
|
||||||
run: |
|
|
||||||
php -m >> "$file.all"
|
|
||||||
- name: Create file with all extensions for Windows
|
|
||||||
env:
|
|
||||||
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
|
||||||
version: ${{ matrix.php-versions }}
|
|
||||||
if: matrix.operating-system == 'windows-2022'
|
|
||||||
run: |
|
|
||||||
php -m | Out-File -FilePath "$env:file.all" -Append
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php-versions }}
|
|
||||||
extensions: none
|
|
||||||
tools: none
|
|
||||||
- name: Create final file for Linux and macOS
|
|
||||||
env:
|
|
||||||
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
|
||||||
version: ${{ matrix.php-versions }}
|
|
||||||
if: matrix.operating-system != 'windows-2022'
|
|
||||||
run: |
|
run: |
|
||||||
echo "## PHP $version" >> "$file"
|
echo "## PHP $version" >> "$file"
|
||||||
printf "\n" >> "$file"
|
printf "\n" >> "$file"
|
||||||
echo "\`\`\`" >> "$file"
|
echo "\`\`\`" >> "$file"
|
||||||
php -m >> "$file.builtin"
|
php -m >> "$file"
|
||||||
while IFS= read -r line; do
|
|
||||||
if [[ $line == [* || -z "${line// }" ]]; then
|
|
||||||
echo "$line" >> "$file"
|
|
||||||
elif grep -q "^$line" "$file.builtin"; then
|
|
||||||
echo "$line (builtin)" >> "$file"
|
|
||||||
else
|
|
||||||
echo "$line (shared)" >> "$file"
|
|
||||||
fi
|
|
||||||
done < "$file.all"
|
|
||||||
echo "\`\`\`" >> "$file"
|
echo "\`\`\`" >> "$file"
|
||||||
printf "\n" >> "$file"
|
printf "\n" >> "$file"
|
||||||
rm "$file.all" "$file.builtin"
|
- name: Save Windows
|
||||||
- name: Create final file for Windows
|
|
||||||
env:
|
env:
|
||||||
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
||||||
version: ${{ matrix.php-versions }}
|
version: ${{ matrix.php-versions }}
|
||||||
if: matrix.operating-system == 'windows-2022'
|
if: matrix.operating-system == 'windows-2019'
|
||||||
run: |
|
run: |
|
||||||
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
|
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
|
||||||
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
|
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
|
||||||
php -m | Out-File -FilePath "$env:file.builtin" -Append
|
php -m | Out-File -FilePath "$env:file" -Append
|
||||||
Get-Content "$env:file.all" | ForEach-Object {
|
|
||||||
if ($_.startsWith('[') -or -not $_.trim()) {
|
|
||||||
Write-Output "$_" | Out-File -FilePath "$env:file" -Append
|
|
||||||
} elseif ($_ -in (Get-Content "$env:file.builtin")) {
|
|
||||||
Write-Output "$_ (builtin)" | Out-File -FilePath "$env:file" -Append
|
|
||||||
} else {
|
|
||||||
Write-Output "$_ (shared)" | Out-File -FilePath "$env:file" -Append
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
|
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
|
||||||
Remove-Item "$env:file.all" -Force
|
- uses: actions/upload-artifact@v2
|
||||||
Remove-Item "$env:file.builtin" -Force
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
with:
|
||||||
name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
name: lists
|
||||||
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
||||||
update:
|
update:
|
||||||
if: github.event.repository.fork == false
|
|
||||||
permissions:
|
|
||||||
contents: write # for Git to git push
|
|
||||||
name: Update
|
name: Update
|
||||||
needs: create
|
needs: create
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
repository: ${{ github.repository }}.wiki
|
repository: ${{ github.repository }}.wiki
|
||||||
- name: Download artifacts
|
- uses: actions/download-artifact@v2
|
||||||
uses: actions/download-artifact@v8
|
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/lists
|
path: ${{ github.workspace }}
|
||||||
pattern: lists-*
|
- name: Combine
|
||||||
merge-multiple: true
|
|
||||||
- name: Configure Git
|
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "${{ secrets.email }}"
|
git config --local user.email "${{ secrets.email }}"
|
||||||
git config --local user.name "${{ github.repository_owner }}"
|
git config --local user.name "${{ github.repository_owner }}"
|
||||||
- name: Combine
|
for os in ubuntu-20.04 ubuntu-18.04 windows-2019 macos-10.15 macos-11.0; do
|
||||||
run: |
|
|
||||||
for os in ubuntu-24.04 ubuntu-22.04 windows-2025 windows-2022 windows-2019 macos-13 macos-14 macos-15 macos-26; do
|
|
||||||
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
|
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
|
||||||
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5 8.6; 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
|
||||||
if [[ "${os%-*}" = "macos" ]]; then
|
if [ "$os" = "macos-11.0" ]; then
|
||||||
cat lists/php"$version"-macos-15-intel.md >> Php-extensions-loaded-on-"$os".md
|
cat lists/php"$version"-macos-10.15.md >> Php-extensions-loaded-on-"$os".md
|
||||||
elif [ "${os%-*}" = "windows" ]; then
|
|
||||||
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
|
|
||||||
else
|
else
|
||||||
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
|
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
rm -rf ./lists
|
rm -rf ./lists
|
||||||
- name: Update
|
|
||||||
run: |
|
|
||||||
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
|
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')"
|
git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')"
|
||||||
|
|||||||
@ -2,7 +2,7 @@ name: Node workflow
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- master
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -10,15 +10,12 @@ on:
|
|||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- master
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
name: Run
|
name: Run
|
||||||
@ -29,14 +26,12 @@ jobs:
|
|||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
- name: Setup Node.js 24.x
|
- name: Setup Node.js 15.x
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 24.x
|
node-version: 15.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
@ -50,14 +45,7 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm test
|
run: npm test
|
||||||
|
|
||||||
- name: Run npm audit
|
|
||||||
run: npm audit
|
|
||||||
|
|
||||||
- name: Send Coverage
|
- name: Send Coverage
|
||||||
uses: codecov/codecov-action@v5
|
continue-on-error: true
|
||||||
with:
|
timeout-minutes: 1
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/lcov.info -n github-actions-codecov-${{ matrix.operating-system }}
|
||||||
files: coverage/lcov.info
|
|
||||||
name: github-actions-codecov-${{ matrix.operating-system }}
|
|
||||||
fail_ci_if_error: false
|
|
||||||
verbose: true
|
|
||||||
62
.github/workflows/publish.yml
vendored
62
.github/workflows/publish.yml
vendored
@ -1,62 +0,0 @@
|
|||||||
name: Publish Package
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [created]
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
skip:
|
|
||||||
description: Skip release to repository
|
|
||||||
required: false
|
|
||||||
tag:
|
|
||||||
description: Tag name
|
|
||||||
required: true
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout release
|
|
||||||
if: github.event_name != 'workflow_dispatch'
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Checkout tag
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
if: github.event_name == 'workflow_dispatch'
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.inputs.tag }}
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '20.x'
|
|
||||||
registry-url: https://registry.npmjs.org
|
|
||||||
|
|
||||||
- name: Install dependencies and add lib
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
sed -i -e '/lib\//d' .gitignore
|
|
||||||
|
|
||||||
- name: Publish to NPM
|
|
||||||
if: "!contains(github.event.inputs.skip, 'skip-npm')"
|
|
||||||
run: npm publish --access public
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
|
|
||||||
- name: Change to GitHub Packages registry
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
registry-url: https://npm.pkg.github.com
|
|
||||||
scope: '@shivammathur'
|
|
||||||
|
|
||||||
- name: Patch package.json
|
|
||||||
run: |
|
|
||||||
sed -i 's#"name": "#"name": "@shivammathur/#' package.json
|
|
||||||
|
|
||||||
- name: Publish to GitHub Packages
|
|
||||||
if: "!contains(github.event.inputs.skip, 'skip-github-packages')"
|
|
||||||
run: npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
@ -3,7 +3,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- master
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@ -11,16 +11,12 @@ on:
|
|||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- master
|
||||||
- develop
|
- develop
|
||||||
- verbose
|
- verbose
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
env:
|
|
||||||
default-php-version: '8.2'
|
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
name: Run
|
name: Run
|
||||||
@ -28,51 +24,41 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-15-intel]
|
operating-system: [ubuntu-20.04, ubuntu-18.04, windows-latest, 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', '8.3', '8.4', '8.5', '8.6']
|
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
|
||||||
include:
|
|
||||||
- operating-system: ubuntu-24.04
|
|
||||||
php-versions: ''
|
|
||||||
php-version-file: 'php-version-file'
|
|
||||||
env:
|
env:
|
||||||
extensions: xml, opcache, xdebug, pcov, gd
|
extensions: xml, opcache, xdebug, pcov
|
||||||
key: cache-v5
|
key: cache-v3
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup cache environment
|
- name: Setup cache environment
|
||||||
id: cache-env
|
id: cache-env
|
||||||
uses: shivammathur/cache-extensions@develop
|
uses: shivammathur/cache-extensions@develop
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions || env.default-php-version }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: ${{ env.extensions }}
|
extensions: ${{ env.extensions }}
|
||||||
key: ${{ env.key }}
|
key: ${{ env.key }}
|
||||||
|
|
||||||
- name: Cache extensions
|
- name: Cache extensions
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.cache-env.outputs.dir }}
|
path: ${{ steps.cache-env.outputs.dir }}
|
||||||
key: ${{ steps.cache-env.outputs.key }}
|
key: ${{ steps.cache-env.outputs.key }}
|
||||||
restore-keys: ${{ steps.cache-env.outputs.key }}
|
restore-keys: ${{ steps.cache-env.outputs.key }}
|
||||||
|
|
||||||
- name: Stage php-version-file
|
|
||||||
if: ${{ matrix.php-version-file == 'php-version-file' }}
|
|
||||||
run: |
|
|
||||||
echo ${{ env.default-php-version }} > php-version-file
|
|
||||||
|
|
||||||
- name: Setup PHP with extensions and custom config
|
- name: Setup PHP with extensions and custom config
|
||||||
run: node dist/index.js
|
run: node dist/index.js
|
||||||
env:
|
env:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
php-version-file: ${{ matrix.php-version-file }}
|
|
||||||
extensions: ${{ env.extensions }}
|
extensions: ${{ env.extensions }}
|
||||||
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata
|
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata
|
||||||
|
|
||||||
- name: Testing PHP version
|
- name: Testing PHP version
|
||||||
run: |
|
run: |
|
||||||
php -v
|
php -v
|
||||||
php -r "if(strpos(phpversion(), '${{ matrix.php-versions || env.default-php-version }}') === false) {throw new Exception('Wrong PHP version Installed');}"
|
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}"
|
||||||
|
|
||||||
- name: Testing Composer version
|
- name: Testing Composer version
|
||||||
run: |
|
run: |
|
||||||
@ -81,7 +67,6 @@ jobs:
|
|||||||
- name: Testing Extensions
|
- name: Testing Extensions
|
||||||
run: |
|
run: |
|
||||||
php -m
|
php -m
|
||||||
php -r "if(! extension_loaded('gd')) {throw new Exception('gd not found');}"
|
|
||||||
php -r "if(! extension_loaded('xml')) {throw new Exception('xml not found');}"
|
php -r "if(! extension_loaded('xml')) {throw new Exception('xml not found');}"
|
||||||
php -r "if(! extension_loaded('Xdebug')) {throw new Exception('Xdebug not found');}"
|
php -r "if(! extension_loaded('Xdebug')) {throw new Exception('Xdebug not found');}"
|
||||||
php -r "if(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
|
php -r "if(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@ node_modules/
|
|||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
lib/
|
lib/
|
||||||
|
|
||||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/main/Node.gitignore
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
20
|
|
||||||
2
LICENSE
2
LICENSE
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) shivammathur and contributors
|
Copyright (c) 2019-2021 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
|
||||||
|
|||||||
@ -1,16 +1,52 @@
|
|||||||
import * as config from '../src/config';
|
import * as config from '../src/config';
|
||||||
|
|
||||||
describe('Config tests', () => {
|
describe('Config tests', () => {
|
||||||
it.each`
|
it('checking addINIValuesOnWindows', async () => {
|
||||||
ini_values | os | output
|
let win32: string = await config.addINIValues(
|
||||||
${'a=b, c=d'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=b\nc=d"'}
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
${'a=b, c=d'} | ${'linux'} | ${'echo "a=b\nc=d" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'}
|
'win32'
|
||||||
${'a=b, c=d'} | ${'darwin'} | ${'echo "a=b\nc=d" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'}
|
);
|
||||||
${'a=b & ~c'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=\'b & ~c\'"'}
|
expect(win32).toContain(
|
||||||
${'a="~(b)"'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=\'~(b)\'"'}
|
'Add-Content "$php_dir\\php.ini" "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
|
||||||
${'a="b, c"'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=b, c"'}
|
);
|
||||||
${'a=b, c=d'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
|
||||||
`('checking addINIValues on $os', async ({ini_values, os, output}) => {
|
win32 = await config.addINIValues(
|
||||||
expect(await config.addINIValues(ini_values, os)).toContain(output);
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'openbsd'
|
||||||
|
);
|
||||||
|
expect(win32).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addINIValuesOnLinux', async () => {
|
||||||
|
let linux: string = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'linux',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
expect(linux).toContain(
|
||||||
|
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
|
||||||
|
);
|
||||||
|
|
||||||
|
linux = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'openbsd'
|
||||||
|
);
|
||||||
|
expect(linux).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addINIValuesOnDarwin', async () => {
|
||||||
|
let darwin: string = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain(
|
||||||
|
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
|
||||||
|
);
|
||||||
|
|
||||||
|
darwin = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'openbsd'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('Platform openbsd is not supported');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,106 +0,0 @@
|
|||||||
import * as core from '../src/core';
|
|
||||||
|
|
||||||
describe('Core tests', () => {
|
|
||||||
const originalEnv = process.env;
|
|
||||||
const originalExitCode = process.exitCode;
|
|
||||||
let stdoutOutput: string;
|
|
||||||
const originalWrite = process.stdout.write;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
process.env = {...originalEnv};
|
|
||||||
process.exitCode = undefined;
|
|
||||||
stdoutOutput = '';
|
|
||||||
process.stdout.write = jest.fn((chunk: string | Uint8Array): boolean => {
|
|
||||||
stdoutOutput += chunk.toString();
|
|
||||||
return true;
|
|
||||||
}) as unknown as typeof process.stdout.write;
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
process.env = originalEnv;
|
|
||||||
process.exitCode = originalExitCode;
|
|
||||||
process.stdout.write = originalWrite;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking issueCommand with no properties', () => {
|
|
||||||
core.issueCommand('warning', {}, 'test message');
|
|
||||||
expect(stdoutOutput).toContain('::warning::test message');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking issueCommand with properties', () => {
|
|
||||||
core.issueCommand('error', {file: 'test.ts', line: '10'}, 'error message');
|
|
||||||
expect(stdoutOutput).toContain(
|
|
||||||
'::error file=test.ts,line=10::error message'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking issueCommand escapes special characters in message', () => {
|
|
||||||
core.issueCommand('warning', {}, 'line1\nline2\rline3%percent');
|
|
||||||
expect(stdoutOutput).toContain(
|
|
||||||
'::warning::line1%0Aline2%0Dline3%25percent'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking issueCommand escapes special characters in properties', () => {
|
|
||||||
core.issueCommand('error', {file: 'path:to,file'}, 'message');
|
|
||||||
expect(stdoutOutput).toContain('::error file=path%3Ato%2Cfile::message');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking issueCommand with Error object', () => {
|
|
||||||
const error = new Error('test error');
|
|
||||||
core.issueCommand('error', {}, error);
|
|
||||||
expect(stdoutOutput).toContain('::error::Error: test error');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking issueCommand filters empty properties', () => {
|
|
||||||
core.issueCommand('warning', {file: 'test.ts', line: ''}, 'message');
|
|
||||||
expect(stdoutOutput).toContain('::warning file=test.ts::message');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking error', () => {
|
|
||||||
core.error('error message');
|
|
||||||
expect(stdoutOutput).toContain('::error::error message');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking error with Error object', () => {
|
|
||||||
core.error(new Error('error instance'));
|
|
||||||
expect(stdoutOutput).toContain('::error::Error: error instance');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking setFailed', () => {
|
|
||||||
core.setFailed('failure message');
|
|
||||||
expect(process.exitCode).toBe(1);
|
|
||||||
expect(stdoutOutput).toContain('::error::failure message');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking setFailed with Error object', () => {
|
|
||||||
core.setFailed(new Error('failure error'));
|
|
||||||
expect(process.exitCode).toBe(1);
|
|
||||||
expect(stdoutOutput).toContain('::error::Error: failure error');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getInput returns value', () => {
|
|
||||||
process.env['INPUT_TEST-INPUT'] = 'test value';
|
|
||||||
expect(core.getInput('test-input')).toBe('test value');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getInput trims value', () => {
|
|
||||||
process.env['INPUT_TEST-INPUT'] = ' trimmed ';
|
|
||||||
expect(core.getInput('test-input')).toBe('trimmed');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getInput returns empty string for missing input', () => {
|
|
||||||
expect(core.getInput('missing-input')).toBe('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getInput throws for required missing input', () => {
|
|
||||||
expect(() => core.getInput('missing-input', true)).toThrow(
|
|
||||||
'Input required and not supplied: missing-input'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getInput handles spaces in name', () => {
|
|
||||||
process.env['INPUT_INPUT_WITH_SPACES'] = 'spaced value';
|
|
||||||
expect(core.getInput('input with spaces')).toBe('spaced value');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -1,44 +1,110 @@
|
|||||||
import * as coverage from '../src/coverage';
|
import * as coverage from '../src/coverage';
|
||||||
|
|
||||||
describe('Config tests', () => {
|
describe('Config tests', () => {
|
||||||
it.each`
|
it('checking addCoverage with PCOV on windows', async () => {
|
||||||
driver | php | os | output
|
let win32: string = await coverage.addCoverage('PCOV', '7.4', 'win32');
|
||||||
${'PCOV'} | ${'7.4'} | ${'win32'} | ${'Add-Extension pcov,Disable-Extension xdebug false'}
|
expect(win32).toContain('Add-Extension pcov');
|
||||||
${'pcov'} | ${'7.4'} | ${'win32'} | ${'$pcov_version = php -r "echo phpversion(\'pcov\');"'}
|
expect(win32).toContain('Remove-Extension xdebug');
|
||||||
${'pcov'} | ${'7.4'} | ${'win32'} | ${'PCOV $pcov_version enabled as coverage driver'}
|
|
||||||
${'pcov'} | ${'7.0'} | ${'win32'} | ${'PHP 7.1 or newer is required'}
|
win32 = await coverage.addCoverage('pcov', '7.0', 'win32');
|
||||||
${'pcov'} | ${'5.6'} | ${'win32'} | ${'PHP 7.1 or newer is required'}
|
expect(win32).toContain('PHP 7.1 or newer is required');
|
||||||
${'pcov'} | ${'7.4'} | ${'win32'} | ${'Add-Extension pcov,Disable-Extension xdebug false'}
|
|
||||||
${'pcov'} | ${'7.4'} | ${'linux'} | ${'add_extension pcov,disable_extension xdebug false'}
|
win32 = await coverage.addCoverage('pcov', '5.6', 'win32');
|
||||||
${'pcov'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension pcov,disable_extension xdebug false'}
|
expect(win32).toContain('PHP 7.1 or newer is required');
|
||||||
${'xdebug'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug'}
|
|
||||||
${'xdebug3'} | ${'7.1'} | ${'win32'} | ${'xdebug3 is not supported on PHP 7.1'}
|
|
||||||
${'xdebug2'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug stable 2.9.8'}
|
|
||||||
${'xdebug'} | ${'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'}
|
|
||||||
${'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'}
|
|
||||||
${'xdebug3'} | ${'7.1'} | ${'darwin'} | ${'xdebug3 is not supported on PHP 7.1'}
|
|
||||||
${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2'}
|
|
||||||
${'xdebug2'} | ${'8.0'} | ${'darwin'} | ${'xdebug2 is not supported on PHP 8.0'}
|
|
||||||
${'none'} | ${'7.4'} | ${'win32'} | ${'Disable-Extension xdebug false,Disable-Extension pcov false'}
|
|
||||||
${'none'} | ${'7.4'} | ${'linux'} | ${'disable_extension xdebug false,disable_extension pcov false'}
|
|
||||||
${'none'} | ${'7.4'} | ${'darwin'} | ${'disable_extension xdebug false,disable_extension pcov false'}
|
|
||||||
${'nocov'} | ${'7.x'} | ${'any'} | ${''}
|
|
||||||
${''} | ${'7.x'} | ${'any'} | ${''}
|
|
||||||
`(
|
|
||||||
'checking addCoverage with $driver on $os',
|
|
||||||
async ({driver, php, os, output}) => {
|
|
||||||
const script: string = await coverage.addCoverage(driver, php, os);
|
|
||||||
if (output) {
|
|
||||||
output.split(',').forEach((command: string) => {
|
|
||||||
expect(script).toContain(command);
|
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
expect(script).toEqual(output);
|
it('checking addCoverage with PCOV on linux', async () => {
|
||||||
}
|
const linux: string = await coverage.addCoverage('pcov', '7.4', 'linux');
|
||||||
}
|
expect(linux).toContain('add_extension pcov');
|
||||||
|
expect(linux).toContain('remove_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with PCOV on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage('pcov', '7.4', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
|
expect(darwin).toContain('remove_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on windows', async () => {
|
||||||
|
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
|
||||||
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug3 on windows', async () => {
|
||||||
|
const win32: string = await coverage.addCoverage('xdebug3', '7.4', 'win32');
|
||||||
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug2 on windows', async () => {
|
||||||
|
const win32: string = await coverage.addCoverage('xdebug2', '7.4', 'win32');
|
||||||
|
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
||||||
|
expect(linux).toContain('add_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug3 on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug3', '8.0', 'linux');
|
||||||
|
expect(linux).toContain('add_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug2 on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug2', '7.4', 'linux');
|
||||||
|
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage(
|
||||||
|
'xdebug',
|
||||||
|
'7.4',
|
||||||
|
'darwin'
|
||||||
);
|
);
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug3 on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage(
|
||||||
|
'xdebug3',
|
||||||
|
'7.4',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug2 on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage(
|
||||||
|
'xdebug2',
|
||||||
|
'7.4',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug2');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking disableCoverage windows', async () => {
|
||||||
|
const win32 = await coverage.addCoverage('none', '7.4', 'win32');
|
||||||
|
expect(win32).toContain('Remove-Extension xdebug');
|
||||||
|
expect(win32).toContain('Remove-Extension pcov');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking disableCoverage on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('none', '7.4', 'linux');
|
||||||
|
expect(linux).toContain('remove_extension xdebug');
|
||||||
|
expect(linux).toContain('remove_extension pcov');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking disableCoverage on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage('none', '7.4', 'darwin');
|
||||||
|
expect(darwin).toContain('remove_extension xdebug');
|
||||||
|
expect(darwin).toContain('remove_extension pcov');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking no or invalid coverage driver', async () => {
|
||||||
|
let nocov: string = await coverage.addCoverage('nocov', '7.x', 'any');
|
||||||
|
expect(nocov).toEqual('');
|
||||||
|
|
||||||
|
nocov = await coverage.addCoverage('', '7.x', 'any');
|
||||||
|
expect(nocov).toEqual('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,161 +1,261 @@
|
|||||||
import * as fs from 'fs';
|
|
||||||
import * as extensions from '../src/extensions';
|
import * as extensions from '../src/extensions';
|
||||||
|
|
||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it.each`
|
it('checking addExtensionOnWindows', async () => {
|
||||||
extension | version | output
|
let win32: string = await extensions.addExtension(
|
||||||
${'none'} | ${'7.4'} | ${'Disable-AllShared'}
|
'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',
|
||||||
${':intl'} | ${'7.4'} | ${'Disable-Extension intl'}
|
'7.4',
|
||||||
${'ast-beta'} | ${'7.4'} | ${'Add-Extension ast beta'}
|
'win32'
|
||||||
${'blackfire'} | ${'7.3'} | ${'Add-Blackfire blackfire'}
|
);
|
||||||
${'blackfire-1.31.0'} | ${'7.3'} | ${'Add-Blackfire blackfire-1.31.0'}
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
${'grpc-1.2.3'} | ${'7.4'} | ${'Add-Extension grpc stable 1.2.3'}
|
expect(win32).toContain('Add-Extension pcov');
|
||||||
${'inotify-1.2.3alpha2'} | ${'7.4'} | ${'Add-Extension inotify alpha 1.2.3'}
|
expect(win32).toContain('Add-Extension sqlite3');
|
||||||
${'ioncube'} | ${'7.4'} | ${'Add-Ioncube'}
|
expect(win32).toContain('Remove-Extension intl');
|
||||||
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'Add-Log "$cross" "mongodb-mongodb/mongo-php-driver@master" "mongodb-mongodb/mongo-php-driver@master is not supported on PHP 7.3"'}
|
expect(win32).toContain('Add-Phalcon phalcon4');
|
||||||
${'mysql'} | ${'7.4'} | ${'Add-Extension mysqli\nAdd-Extension mysqlnd'}
|
expect(win32).toContain('Add-Http');
|
||||||
${'mysql'} | ${'5.5'} | ${'Add-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd'}
|
expect(win32).toContain('Add-Ioncube');
|
||||||
${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
|
expect(win32).toContain('Add-Oci oci8');
|
||||||
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
expect(win32).toContain('Add-Oci pdo_oci');
|
||||||
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
|
expect(win32).toContain('Add-Extension ast beta');
|
||||||
${'ibm_db2'} | ${'7.4'} | ${'Add-Ibm ibm_db2'}
|
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
||||||
${'pdo_ibm'} | ${'7.4'} | ${'Add-Ibm pdo_ibm'}
|
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
||||||
${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
|
expect(win32).toContain('Add-Extension sqlsrv devel 1.2.3');
|
||||||
${'pdo_sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv pdo_sqlsrv'}
|
|
||||||
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
|
win32 = await extensions.addExtension('pcov', '5.6', 'win32');
|
||||||
${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'}
|
expect(win32).toContain(
|
||||||
${'sqlite'} | ${'7.4'} | ${'Add-Extension sqlite3'}
|
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
${'sqlsrv'} | ${'5.6'} | ${'Add-Extension sqlsrv'}
|
|
||||||
${'sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv sqlsrv'}
|
|
||||||
${'sqlsrv-1.2.3preview1'} | ${'7.4'} | ${'Add-Extension sqlsrv devel 1.2.3'}
|
|
||||||
${'Xdebug'} | ${'7.4'} | ${'Add-Extension xdebug'}
|
|
||||||
${'xdebug2'} | ${'7.2'} | ${'Add-Extension xdebug stable 2.9.8'}
|
|
||||||
${'zephir_parser'} | ${'7.2'} | ${'Add-ZephirParser zephir_parser'}
|
|
||||||
`(
|
|
||||||
'checking addExtensionOnWindows for extension $extension on version $version',
|
|
||||||
async ({extension, version, output}) => {
|
|
||||||
expect(
|
|
||||||
await extensions.addExtension(extension, version, 'win32')
|
|
||||||
).toContain(output);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
it.each`
|
win32 = await extensions.addExtension('xdebug2', '7.2', 'win32');
|
||||||
extension | version | output
|
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
||||||
${'none'} | ${'7.4'} | ${'disable_all_shared'}
|
|
||||||
${':intl'} | ${'7.4'} | ${'disable_extension intl'}
|
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
||||||
${'ast-beta'} | ${'7.4'} | ${'add_unstable_extension ast beta extension'}
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
|
||||||
${'couchbase'} | ${'7.4'} | ${'add_couchbase'}
|
win32 = await extensions.addExtension('mysql', '8.0', 'win32');
|
||||||
${'gearman'} | ${'5.6'} | ${'add_gearman'}
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
${'geos'} | ${'7.3'} | ${'add_geos'}
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
${'grpc-1.2.3'} | ${'7.4'} | ${'add_pecl_extension grpc 1.2.3 extension'}
|
|
||||||
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
|
win32 = await extensions.addExtension('mysql', '5.5', 'win32');
|
||||||
${'intl-65.1'} | ${'5.6'} | ${'add_intl intl-65.1'}
|
expect(win32).toContain('Add-Extension mysql');
|
||||||
${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
${'memcache-8.2'} | ${'8.2'} | ${'add_pecl_extension memcache 8.2 extension'}
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
|
||||||
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
win32 = await extensions.addExtension(
|
||||||
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
|
'phalcon3, does_not_exist',
|
||||||
${'ibm_db2'} | ${'7.3'} | ${'add_ibm ibm_db2'}
|
'7.2',
|
||||||
${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
|
'win32',
|
||||||
${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
|
true
|
||||||
${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
|
|
||||||
${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
|
|
||||||
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
|
||||||
${'pdo_ibm'} | ${'7.3'} | ${'add_ibm pdo_ibm'}
|
|
||||||
${'pdo_sqlsrv'} | ${'7.4'} | ${'add_sqlsrv pdo_sqlsrv'}
|
|
||||||
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
|
||||||
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
|
|
||||||
${'relay'} | ${'7.4'} | ${'add_relay relay'}
|
|
||||||
${'relay-v1.2.3'} | ${'7.4'} | ${'add_relay relay-v1.2.3'}
|
|
||||||
${'sqlite'} | ${'7.4'} | ${'add_extension sqlite3'}
|
|
||||||
${'sqlsrv-1.2.3-beta1'} | ${'7.4'} | ${'add_pecl_extension sqlsrv 1.2.3beta1 extension'}
|
|
||||||
${'Xdebug'} | ${'7.4'} | ${'add_extension xdebug'}
|
|
||||||
${'xdebug-alpha'} | ${'7.4'} | ${'add_unstable_extension xdebug alpha zend_extension'}
|
|
||||||
${'xdebug2'} | ${'7.2'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
|
|
||||||
${'zephir_parser-1.2.3'} | ${'7.2'} | ${'add_zephir_parser zephir_parser-1.2.3'}
|
|
||||||
`(
|
|
||||||
'checking addExtensionOnLinux for extension $extension on version $version',
|
|
||||||
async ({extension, version, output}) => {
|
|
||||||
expect(
|
|
||||||
await extensions.addExtension(extension, version, 'linux')
|
|
||||||
).toContain(output);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
expect(win32).toContain('Add-Phalcon phalcon3');
|
||||||
|
expect(win32).toContain('Add-Extension does_not_exist');
|
||||||
|
|
||||||
it.each`
|
win32 = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||||
extension | version | output
|
expect(win32).toContain('Platform openbsd is not supported');
|
||||||
${'none'} | ${'7.2'} | ${'disable_all_shared'}
|
|
||||||
${':intl'} | ${'7.2'} | ${'disable_extension intl'}
|
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
||||||
${'ast-beta'} | ${'7.2'} | ${'add_unstable_extension ast beta extension'}
|
expect(win32).toContain('Add-Blackfire blackfire');
|
||||||
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
|
||||||
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
||||||
${'couchbase'} | ${'5.6'} | ${'add_couchbase'}
|
expect(win32).toContain('Add-Blackfire blackfire-1.31.0');
|
||||||
${'does_not_exist'} | ${'7.2'} | ${'add_extension does_not_exist'}
|
|
||||||
${'geos'} | ${'7.3'} | ${'add_geos'}
|
win32 = await extensions.addExtension(
|
||||||
${'grpc-1.2.3'} | ${'7.2'} | ${'add_pecl_extension grpc 1.2.3 extension'}
|
'mongodb-mongodb/mongo-php-driver@master',
|
||||||
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
|
'7.3',
|
||||||
${'imagick'} | ${'5.5'} | ${'add_extension imagick'}
|
'win32'
|
||||||
${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
|
|
||||||
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.2'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
|
||||||
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
|
||||||
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
|
||||||
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
|
||||||
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
|
||||||
${'relay-1.2.3'} | ${'7.4'} | ${'add_relay relay-1.2.3'}
|
|
||||||
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
|
|
||||||
${'zephir_parser-v1.2.3'} | ${'7.2'} | ${'add_zephir_parser zephir_parser-v1.2.3'}
|
|
||||||
`(
|
|
||||||
'checking addExtensionOnDarwin for extension $extension on version $version',
|
|
||||||
async ({extension, version, output}) => {
|
|
||||||
expect(
|
|
||||||
await extensions.addExtension(extension, version, 'darwin')
|
|
||||||
).toContain(output);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
expect(win32).toContain(
|
||||||
const data: string[][] = fs
|
'Add-Log "$cross" "mongodb-mongodb/mongo-php-driver@master" "mongodb-mongodb/mongo-php-driver@master is not supported on PHP 7.3"'
|
||||||
.readFileSync('src/configs/brew_extensions')
|
|
||||||
.toString()
|
|
||||||
.split(/\r?\n/)
|
|
||||||
.filter(Boolean)
|
|
||||||
.map(line => {
|
|
||||||
const [formula, extension]: string[] = line.split('=');
|
|
||||||
const prefix: string =
|
|
||||||
extension == 'xdebug' ? 'zend_extension' : 'extension';
|
|
||||||
const ext_name = extension.replace(/\d+|(pdo|pecl)[_-]/, '');
|
|
||||||
const output: string = fs.existsSync(
|
|
||||||
`src/scripts/extensions/${ext_name}.sh`
|
|
||||||
)
|
|
||||||
? `add_${ext_name}`
|
|
||||||
: `add_brew_extension ${formula} ${prefix}`;
|
|
||||||
return [
|
|
||||||
formula,
|
|
||||||
formula.match(/phalcon3|lua|propro/) ? '7.3' : '8.1',
|
|
||||||
output
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each(data)(
|
|
||||||
'checking addExtensionOnDarwin for brew extension %s',
|
|
||||||
async (extension, version, output) => {
|
|
||||||
expect(
|
|
||||||
await extensions.addExtension(extension, version, 'darwin')
|
|
||||||
).toContain(output);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it.each`
|
|
||||||
extension | version | output
|
|
||||||
${'xdebug'} | ${'7.2'} | ${'Platform openbsd is not supported'}
|
|
||||||
`(
|
|
||||||
'checking addExtension on openbsd for extension $extension on version $version',
|
|
||||||
async ({extension, version, output}) => {
|
|
||||||
expect(
|
|
||||||
await extensions.addExtension(extension, version, 'openbsd')
|
|
||||||
).toContain(output);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking addExtensionOnLinux', async () => {
|
||||||
|
let linux: string = await extensions.addExtension(
|
||||||
|
'Xdebug, pcov, sqlite, :intl, ast, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
||||||
|
'7.4',
|
||||||
|
'linux'
|
||||||
|
);
|
||||||
|
expect(linux).toContain('add_extension xdebug');
|
||||||
|
expect(linux).toContain('add_extension sqlite3');
|
||||||
|
expect(linux).toContain('remove_extension intl');
|
||||||
|
expect(linux).toContain('add_unstable_extension ast beta extension');
|
||||||
|
expect(linux).toContain('add_pdo_extension mysql');
|
||||||
|
expect(linux).toContain('add_pdo_extension odbc');
|
||||||
|
expect(linux).toContain('add_pecl_extension grpc 1.2.3 extension');
|
||||||
|
expect(linux).toContain(
|
||||||
|
'add_unstable_extension xdebug alpha zend_extension'
|
||||||
|
);
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('pcov', '5.6', 'linux');
|
||||||
|
expect(linux).toContain(
|
||||||
|
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('gearman', '5.6', 'linux');
|
||||||
|
expect(linux).toContain('add_gearman');
|
||||||
|
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
||||||
|
expect(linux).toContain('add_gearman');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('couchbase', '5.6', 'linux');
|
||||||
|
expect(linux).toContain('add_couchbase');
|
||||||
|
linux = await extensions.addExtension('couchbase', '7.4', 'linux');
|
||||||
|
expect(linux).toContain('add_couchbase');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('pdo_cubrid', '7.0', 'linux');
|
||||||
|
expect(linux).toContain('add_cubrid pdo_cubrid');
|
||||||
|
linux = await extensions.addExtension('cubrid', '7.4', 'linux');
|
||||||
|
expect(linux).toContain('add_cubrid cubrid');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('xdebug2', '7.2', 'linux');
|
||||||
|
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||||
|
expect(linux).toContain('Platform openbsd is not supported');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('add_phalcon phalcon3');
|
||||||
|
expect(linux).toContain('add_phalcon phalcon4');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('add_ioncube');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('geos', '7.3', 'linux');
|
||||||
|
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');
|
||||||
|
expect(linux).toContain('add_oci oci8');
|
||||||
|
expect(linux).toContain('add_oci pdo_oci');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('add_blackfire blackfire');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('add_blackfire blackfire-1.31.0');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('intl-65.1', '5.6', 'linux');
|
||||||
|
expect(linux).toContain('add_intl intl-65.1');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('intl-67.1', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('add_intl intl-67.1');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('intl-68.2', '8.0', 'linux');
|
||||||
|
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_source mongodb https://github.com mongodb mongo-php-driver master extension'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
|
let darwin: string = await extensions.addExtension(
|
||||||
|
'amqp, apcu, Xdebug, pcov, grpc, igbinary, imagick, imap, memcache, memcached, msgpack, phalcon3, phalcon4, protobuf, psr, rdkafka, redis, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
|
||||||
|
'7.2',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('add_brew_extension amqp extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension apcu extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug zend_extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension pcov extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension grpc extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension igbinary extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension imagick extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension imap extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension memcache extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension memcached extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension msgpack extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension phalcon3 extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension phalcon4 extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension protobuf extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension psr extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension rdkafka extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension redis extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension swoole extension');
|
||||||
|
expect(darwin).toContain('add_extension sqlite3');
|
||||||
|
expect(darwin).toContain('remove_extension intl');
|
||||||
|
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
||||||
|
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('couchbase', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('add_couchbase');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('couchbase', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('add_couchbase');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('add_ioncube');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('geos', '7.3', 'darwin');
|
||||||
|
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');
|
||||||
|
expect(darwin).toContain('add_oci oci8');
|
||||||
|
expect(darwin).toContain('add_oci pdo_oci');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain(
|
||||||
|
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug2', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug2');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('imagick', '5.5', 'darwin');
|
||||||
|
expect(darwin).toContain('add_extension imagick');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('add_blackfire blackfire');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('add_blackfire blackfire-1.31.0');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension(
|
||||||
|
'does_not_exist',
|
||||||
|
'7.2',
|
||||||
|
'darwin',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('add_extension does_not_exist');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||||
|
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_source mongodb https://github.com mongodb mongo-php-driver master extension'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
import * as fetch from '../src/fetch';
|
|
||||||
import nock from 'nock';
|
|
||||||
|
|
||||||
it('checking fetch', async () => {
|
|
||||||
const host_url = 'https://example.com';
|
|
||||||
const manifest_url = host_url + '/manifest';
|
|
||||||
const ping_url = host_url + '/ping';
|
|
||||||
|
|
||||||
nock(host_url)
|
|
||||||
.get('/manifest')
|
|
||||||
.reply(200, {latest: 'latest'})
|
|
||||||
.get('/manifest', '', {
|
|
||||||
reqheaders: {authorization: 'Bearer invalid_token'}
|
|
||||||
})
|
|
||||||
.reply(401, {error: '401: Unauthorized'})
|
|
||||||
.get('/ping')
|
|
||||||
.twice()
|
|
||||||
.reply(301, undefined, {
|
|
||||||
Location: host_url + '/pong'
|
|
||||||
})
|
|
||||||
.get('/pong')
|
|
||||||
.reply(200, 'pong')
|
|
||||||
.get('/error')
|
|
||||||
.replyWithError('Network failure');
|
|
||||||
|
|
||||||
let response: Record<string, string> = await fetch.fetch(manifest_url);
|
|
||||||
expect(response.error).toBe(undefined);
|
|
||||||
expect(response.data).toContain('latest');
|
|
||||||
|
|
||||||
response = await fetch.fetch(ping_url, '', 1);
|
|
||||||
expect(response.error).toBe(undefined);
|
|
||||||
expect(response.data).toContain('pong');
|
|
||||||
|
|
||||||
response = await fetch.fetch(ping_url, '', 0);
|
|
||||||
expect(response.error).toBe('301: Redirect error');
|
|
||||||
expect(response.data).toBe(undefined);
|
|
||||||
|
|
||||||
response = await fetch.fetch(manifest_url, 'invalid_token');
|
|
||||||
expect(response.error).not.toBe(undefined);
|
|
||||||
expect(response.data).toBe(undefined);
|
|
||||||
|
|
||||||
response = await fetch.fetch(host_url + '/error');
|
|
||||||
expect(response.error).toContain('Fetch error:');
|
|
||||||
expect(response.data).toBe(undefined);
|
|
||||||
});
|
|
||||||
@ -7,81 +7,169 @@ import * as utils from '../src/utils';
|
|||||||
jest.mock('../src/install', () => ({
|
jest.mock('../src/install', () => ({
|
||||||
getScript: jest
|
getScript: jest
|
||||||
.fn()
|
.fn()
|
||||||
.mockImplementation(async (os: string): Promise<string> => {
|
.mockImplementation(
|
||||||
const filename = os + (await utils.scriptExtension(os));
|
async (
|
||||||
const version: string = await utils.parseVersion(
|
filename: string,
|
||||||
await utils.readPHPVersion()
|
version: string,
|
||||||
);
|
os_version: string
|
||||||
const ini_file: string = await utils.parseIniFile(
|
): Promise<string> => {
|
||||||
await utils.getInput('ini-file', false)
|
|
||||||
);
|
|
||||||
const extension_csv: string = process.env['extensions'] || '';
|
const extension_csv: string = process.env['extensions'] || '';
|
||||||
const ini_values_csv: string = process.env['ini-values'] || '';
|
const ini_values_csv: string = process.env['ini-values'] || '';
|
||||||
const coverage_driver: string = process.env['coverage'] || '';
|
const coverage_driver: string = process.env['coverage'] || '';
|
||||||
const tools_csv: string = process.env['tools'] || '';
|
let tools_csv: string = process.env['tools'] || '';
|
||||||
let script = await utils.joins(filename, version, ini_file);
|
const pecl: string = process.env['pecl'] || '';
|
||||||
script += extension_csv ? ' install extensions' : '';
|
if (pecl == 'true') {
|
||||||
script += tools_csv ? ' add_tool' : '';
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
script += coverage_driver ? ' set coverage driver' : '';
|
}
|
||||||
script += ini_values_csv ? ' edit php.ini' : '';
|
|
||||||
|
let script = 'initial script ' + filename + version + os_version;
|
||||||
|
if (tools_csv) {
|
||||||
|
script += 'add_tool';
|
||||||
|
}
|
||||||
|
if (extension_csv) {
|
||||||
|
script += 'install extensions';
|
||||||
|
}
|
||||||
|
if (coverage_driver) {
|
||||||
|
script += 'set coverage driver';
|
||||||
|
}
|
||||||
|
if (ini_values_csv) {
|
||||||
|
script += 'edit php.ini';
|
||||||
|
}
|
||||||
|
|
||||||
return script;
|
return script;
|
||||||
}),
|
}
|
||||||
|
),
|
||||||
run: jest.fn().mockImplementation(async (): Promise<string> => {
|
run: jest.fn().mockImplementation(async (): Promise<string> => {
|
||||||
const os: string = process.env['RUNNER_OS'] || '';
|
const os_version: string = process.env['RUNNER_OS'] || '';
|
||||||
const tool = await utils.scriptTool(os);
|
const version: string = await utils.parseVersion(
|
||||||
return tool + (await install.getScript(os));
|
await utils.getInput('php-version', true)
|
||||||
|
);
|
||||||
|
const tool = await utils.scriptTool(os_version);
|
||||||
|
const filename = os_version + (await utils.scriptExtension(os_version));
|
||||||
|
return [
|
||||||
|
await install.getScript(filename, version, os_version),
|
||||||
|
tool,
|
||||||
|
filename,
|
||||||
|
version,
|
||||||
|
__dirname
|
||||||
|
].join(' ');
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock fetch.ts
|
* Function to set the process.env
|
||||||
|
*
|
||||||
|
* @param version
|
||||||
|
* @param os
|
||||||
|
* @param extension_csv
|
||||||
|
* @param ini_values_csv
|
||||||
|
* @param coverage_driver
|
||||||
|
* @param tools
|
||||||
*/
|
*/
|
||||||
jest.mock('../src/fetch', () => ({
|
function setEnv(
|
||||||
fetch: jest.fn().mockImplementation(() => {
|
version: string | number,
|
||||||
return {
|
os: string,
|
||||||
data: '{ "latest": "8.3", "lowest": "8.1", "highest": "8.3", "nightly": "8.4", "5.x": "5.6" }'
|
extension_csv: string,
|
||||||
};
|
ini_values_csv: string,
|
||||||
})
|
coverage_driver: string,
|
||||||
}));
|
tools: string
|
||||||
|
): void {
|
||||||
describe('Install', () => {
|
|
||||||
it.each`
|
|
||||||
version | os | extension_csv | ini_file | ini_values_csv | coverage_driver | tools | output
|
|
||||||
${'7.3'} | ${'darwin'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.3 production'}
|
|
||||||
${'7.3'} | ${'darwin'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${''} | ${'bash darwin.sh 7.3 development install extensions set coverage driver edit php.ini'}
|
|
||||||
${'7.4.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.4 none'}
|
|
||||||
${'8'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 production'}
|
|
||||||
${'8.0'} | ${'darwin'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 development'}
|
|
||||||
${'8.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.1 none'}
|
|
||||||
${'7.3'} | ${'linux'} | ${''} | ${'invalid'} | ${''} | ${''} | ${''} | ${'bash linux.sh 7.3 production'}
|
|
||||||
${'7.3'} | ${'linux'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${'phpunit'} | ${'bash linux.sh 7.3 development install extensions add_tool set coverage driver edit php.ini'}
|
|
||||||
${'latest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.3 none'}
|
|
||||||
${'lowest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.1 none'}
|
|
||||||
${'highest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.3 none'}
|
|
||||||
${'nightly'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.4 none'}
|
|
||||||
${'7.0'} | ${'win32'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.0 production'}
|
|
||||||
${'7.3'} | ${'win32'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.3 development'}
|
|
||||||
${'7.3'} | ${'win32'} | ${'a, b'} | ${'none'} | ${'a=b'} | ${'x'} | ${''} | ${'pwsh win32.ps1 7.3 none install extensions set coverage driver edit php.ini'}
|
|
||||||
`(
|
|
||||||
'Test install on $os for $version with extensions=$extension_csv, ini_values=$ini_values_csv, coverage_driver=$coverage_driver, tools=$tools',
|
|
||||||
async ({
|
|
||||||
version,
|
|
||||||
os,
|
|
||||||
extension_csv,
|
|
||||||
ini_file,
|
|
||||||
ini_values_csv,
|
|
||||||
coverage_driver,
|
|
||||||
tools,
|
|
||||||
output
|
|
||||||
}) => {
|
|
||||||
process.env['php-version'] = version.toString();
|
process.env['php-version'] = version.toString();
|
||||||
process.env['RUNNER_OS'] = os;
|
process.env['RUNNER_OS'] = os;
|
||||||
process.env['extensions'] = extension_csv;
|
process.env['extensions'] = extension_csv;
|
||||||
process.env['ini-file'] = ini_file;
|
|
||||||
process.env['ini-values'] = ini_values_csv;
|
process.env['ini-values'] = ini_values_csv;
|
||||||
process.env['coverage'] = coverage_driver;
|
process.env['coverage'] = coverage_driver;
|
||||||
process.env['tools'] = tools;
|
process.env['tools'] = tools;
|
||||||
expect(await install.run()).toBe(output);
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
describe('Install', () => {
|
||||||
|
it('Test install on windows', async () => {
|
||||||
|
setEnv('7.0', 'win32', '', '', '', '');
|
||||||
|
|
||||||
|
let script: string = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('pwsh win32.ps1 7.0 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv('7.3', 'win32', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('pwsh win32.ps1 7.3 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('install extensions');
|
||||||
|
expect(script).toContain('edit php.ini');
|
||||||
|
expect(script).toContain('set coverage driver');
|
||||||
|
expect(script).toContain('pwsh win32.ps1 7.3 ' + __dirname);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test install on linux', async () => {
|
||||||
|
setEnv('7.3', 'linux', '', '', '', '');
|
||||||
|
|
||||||
|
let script: string = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash linux.sh 7.3 ');
|
||||||
|
|
||||||
|
setEnv('latest', 'linux', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash linux.sh 8.0 ');
|
||||||
|
|
||||||
|
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('install extensions');
|
||||||
|
expect(script).toContain('edit php.ini');
|
||||||
|
expect(script).toContain('set coverage driver');
|
||||||
|
expect(script).toContain('bash linux.sh 7.3');
|
||||||
|
expect(script).toContain('add_tool');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test install on darwin', async () => {
|
||||||
|
setEnv('7.3', 'darwin', '', '', '', '');
|
||||||
|
|
||||||
|
let script: string = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash darwin.sh 7.3 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('install extensions');
|
||||||
|
expect(script).toContain('edit php.ini');
|
||||||
|
expect(script).toContain('set coverage driver');
|
||||||
|
expect(script).toContain('bash darwin.sh 7.3 ' + __dirname);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test malformed version inputs', async () => {
|
||||||
|
setEnv('7.4.1', 'darwin', '', '', '', '');
|
||||||
|
|
||||||
|
let script: string = '' + '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash darwin.sh 7.4 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv(8.0, 'darwin', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash darwin.sh 8.0 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv(8, 'darwin', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash darwin.sh 8.0 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv(8.1, 'darwin', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash darwin.sh 8.1 ' + __dirname);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
import * as packagist from '../src/packagist';
|
|
||||||
import nock from 'nock';
|
|
||||||
|
|
||||||
describe('search function', () => {
|
|
||||||
const mockResponse = {
|
|
||||||
packages: {
|
|
||||||
'test-package': [
|
|
||||||
{
|
|
||||||
require: {
|
|
||||||
php: '8.0.0'
|
|
||||||
},
|
|
||||||
version: '1.0.0'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
version: '2.0.0'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
test('should return the version if matching php version is found', async () => {
|
|
||||||
nock('https://repo.packagist.org')
|
|
||||||
.get('/p2/test-package.json')
|
|
||||||
.reply(200, mockResponse);
|
|
||||||
const result = await packagist.search('test-package', '8.0');
|
|
||||||
expect(result).toBe('1.0.0');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should return null if no matching php version is found', async () => {
|
|
||||||
nock('https://repo.packagist.org')
|
|
||||||
.get('/p2/test-package.json')
|
|
||||||
.reply(200, mockResponse);
|
|
||||||
const result = await packagist.search('test-package', '5.6');
|
|
||||||
expect(result).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should return null if fetch fails', async () => {
|
|
||||||
nock('https://repo.packagist.org').get('/p2/test-package.json').reply(404);
|
|
||||||
const result = await packagist.search('test-package', '8.0');
|
|
||||||
expect(result).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should return null if the response is empty', async () => {
|
|
||||||
nock('https://repo.packagist.org')
|
|
||||||
.get('/p2/test-package.json')
|
|
||||||
.reply(200, {error: true, data: '[]'});
|
|
||||||
const result = await packagist.search('test-package', '8.0');
|
|
||||||
expect(result).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -1,171 +1,69 @@
|
|||||||
import * as fs from 'fs';
|
|
||||||
import * as tools from '../src/tools';
|
import * as tools from '../src/tools';
|
||||||
import {ToolData, ToolInput} from '../src/tools';
|
import * as utils from '../src/utils';
|
||||||
|
|
||||||
function getData(data: Partial<ToolData>): ToolData {
|
interface IData {
|
||||||
const tool = data.tool || 'tool';
|
tool: string;
|
||||||
const version = data.version || '';
|
version: string;
|
||||||
|
domain?: string;
|
||||||
|
extension?: string;
|
||||||
|
os_version?: string;
|
||||||
|
php_version?: string;
|
||||||
|
release?: string;
|
||||||
|
repository?: string;
|
||||||
|
type?: string;
|
||||||
|
version_parameter?: string;
|
||||||
|
version_prefix?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData(data: IData): Record<string, string> {
|
||||||
return {
|
return {
|
||||||
tool,
|
tool: data.tool,
|
||||||
version,
|
version: data.version,
|
||||||
url: data.url || '',
|
|
||||||
domain: data.domain || 'https://example.com',
|
domain: data.domain || 'https://example.com',
|
||||||
extension: data.extension || '.phar',
|
extension: data.extension || '.phar',
|
||||||
os: data.os || 'linux',
|
os_version: data.os_version || 'linux',
|
||||||
php_version: data.php_version || '7.4',
|
php_version: data.php_version || '7.4',
|
||||||
release: data.release || [tool, version].join(':'),
|
release: data.release || [data.tool, data.version].join(':'),
|
||||||
repository: data.repository || '',
|
repository: data.repository || '',
|
||||||
scope: data.scope || 'global',
|
|
||||||
type: data.type || 'phar',
|
type: data.type || 'phar',
|
||||||
fetch_latest: data.fetch_latest || 'false',
|
|
||||||
version_parameter: data.version_parameter || '-V',
|
version_parameter: data.version_parameter || '-V',
|
||||||
version_prefix: data.version_prefix || '',
|
version_prefix: data.version_prefix || '',
|
||||||
github: data.github || 'https://github.com',
|
github: 'https://github.com',
|
||||||
prefix: data.prefix || 'releases',
|
prefix: 'releases',
|
||||||
verb: data.verb || 'download',
|
verb: 'download'
|
||||||
packagist: data.packagist || data.repository || '',
|
|
||||||
function: data.function,
|
|
||||||
alias: data.alias,
|
|
||||||
uri: data.uri,
|
|
||||||
error: data.error
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
jest
|
||||||
* Mock fetch.ts
|
.spyOn(utils, 'fetch')
|
||||||
*/
|
|
||||||
jest.mock('../src/fetch', () => ({
|
|
||||||
fetch: jest
|
|
||||||
.fn()
|
|
||||||
.mockImplementation(
|
.mockImplementation(
|
||||||
async (url: string, token?: string): Promise<Record<string, string>> => {
|
async (url: string, token?: string): Promise<Record<string, string>> => {
|
||||||
if (url.includes('deployer')) {
|
if (!token || token === 'valid_token') {
|
||||||
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 {
|
|
||||||
data: '"releases/tag/1.2.3", "releases/tag/3.2.1", "releases/tag/2.3.1"'
|
|
||||||
};
|
|
||||||
} else if (url.includes('no-data')) {
|
|
||||||
return {};
|
|
||||||
} else if (url.includes('no-release')) {
|
|
||||||
return {data: 'no-release'};
|
|
||||||
} else if (!token || token === 'valid_token') {
|
|
||||||
return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
|
return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
|
||||||
} else if (token === 'beta_token') {
|
} else if (token === 'beta_token') {
|
||||||
return {data: `[{"ref": "refs/tags/1.2.3beta1", "url": "${url}"}]`};
|
return {data: `[{"ref": "refs/tags/1.2.3-beta1", "url": "${url}"}]`};
|
||||||
} else if (token === 'rc_token') {
|
|
||||||
return {
|
|
||||||
data: `[{"ref":"refs/tags/3.0.0RC1"},{"ref":"refs/tags/3.0.0RC2"}]`
|
|
||||||
};
|
|
||||||
} else if (token === 'non_semver_tags') {
|
|
||||||
return {
|
|
||||||
data: `[{"ref":"refs/tags/release-2025-09-18"},{"ref":"refs/tags/release-2025-09-17"}]`
|
|
||||||
};
|
|
||||||
} else if (token === 'undefined_ref') {
|
|
||||||
return {
|
|
||||||
data: `[{"url":"${url}"},{"ref":"refs/tags/v1.2.4","url":"${url}"}]`
|
|
||||||
};
|
|
||||||
} else if (token === 'multi_refs') {
|
|
||||||
return {
|
|
||||||
data: `[{"ref":"refs/tags/v1.2.3","url":"${url}"},{"ref":"refs/tags/1.2.4","url":"${url}"}]`
|
|
||||||
};
|
|
||||||
} else if (token === 'no_data') {
|
} else if (token === 'no_data') {
|
||||||
return {data: '[]'};
|
return {data: '[]'};
|
||||||
} else {
|
} else {
|
||||||
return {error: 'Invalid token'};
|
return {error: 'Invalid token'};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}));
|
|
||||||
|
|
||||||
jest.mock('../src/packagist', () => ({
|
|
||||||
search: jest
|
|
||||||
.fn()
|
|
||||||
.mockImplementation(
|
|
||||||
async (
|
|
||||||
package_name: string,
|
|
||||||
php_version: string
|
|
||||||
): Promise<string | null> => {
|
|
||||||
if (package_name === 'phpunit/phpunit') {
|
|
||||||
return php_version + '.0';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('Tools tests', () => {
|
describe('Tools tests', () => {
|
||||||
it.each`
|
it.each`
|
||||||
token | version
|
token | version
|
||||||
${'invalid_token'} | ${'1.2'}
|
${'invalid_token'} | ${'1.2'}
|
||||||
${'valid_token'} | ${'1.2.3'}
|
${'valid_token'} | ${'1.2.3'}
|
||||||
${'beta_token'} | ${'1.2.3beta1'}
|
${'beta_token'} | ${'1.2.3-beta1'}
|
||||||
${'undefined_ref'} | ${'1.2.4'}
|
|
||||||
${'multi_refs'} | ${'1.2.4'}
|
|
||||||
${'non_semver_tags'} | ${'release-2025-09-18'}
|
|
||||||
${''} | ${'1.2.3'}
|
${''} | ${'1.2.3'}
|
||||||
`('checking getSemverVersion: $token', async ({token, version}) => {
|
`('checking getSemverVersion: $token', async ({token, version}) => {
|
||||||
process.env['GITHUB_TOKEN'] = token;
|
process.env['COMPOSER_TOKEN'] = token;
|
||||||
expect(
|
expect(
|
||||||
await tools.getSemverVersion(getData({tool: 'tool', version: '1.2'}))
|
await tools.getSemverVersion(getData({tool: 'tool', version: '1.2'}))
|
||||||
).toBe(version);
|
).toBe(version);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getSemverVersion triggers ?? fallback via Map#get mock', async () => {
|
|
||||||
process.env['GITHUB_TOKEN'] = 'rc_token';
|
|
||||||
const spy = jest
|
|
||||||
.spyOn(Map.prototype as Map<string, string>, 'get')
|
|
||||||
.mockImplementation(function (
|
|
||||||
this: Map<string, string>,
|
|
||||||
key: string
|
|
||||||
): string | undefined {
|
|
||||||
if (key === '3.0.0-RC2') {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return Map.prototype.get.call(this, key);
|
|
||||||
});
|
|
||||||
const result = await tools.getSemverVersion(
|
|
||||||
getData({tool: 'tool', version: '3.0.0'})
|
|
||||||
);
|
|
||||||
expect(result).toBe('3.0.0-RC2');
|
|
||||||
spy.mockRestore();
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each`
|
|
||||||
tool | fetch_latest | version
|
|
||||||
${'tool'} | ${'true'} | ${'3.2.1'}
|
|
||||||
${'tool-no-data'} | ${'true'} | ${'latest'}
|
|
||||||
${'tool-no-release'} | ${'true'} | ${'latest'}
|
|
||||||
${'tool'} | ${'false'} | ${'latest'}
|
|
||||||
`(
|
|
||||||
'checking getLatestVersion: $tool, $fetch_latest, $version',
|
|
||||||
async ({tool, fetch_latest, version}) => {
|
|
||||||
expect(
|
|
||||||
await tools.getLatestVersion(
|
|
||||||
getData({
|
|
||||||
tool: tool,
|
|
||||||
repository: 'user/' + tool,
|
|
||||||
fetch_latest: fetch_latest
|
|
||||||
})
|
|
||||||
)
|
|
||||||
).toBe(version);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it('checking getLatestVersion with fetch_latest=true but no repository', async () => {
|
|
||||||
expect(
|
|
||||||
await tools.getLatestVersion(
|
|
||||||
getData({
|
|
||||||
tool: 'tool',
|
|
||||||
repository: '',
|
|
||||||
fetch_latest: 'true'
|
|
||||||
})
|
|
||||||
)
|
|
||||||
).toBe('latest');
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | tool | type | expected
|
version | tool | type | expected
|
||||||
${'latest'} | ${'tool'} | ${'phar'} | ${'latest'}
|
${'latest'} | ${'tool'} | ${'phar'} | ${'latest'}
|
||||||
@ -249,21 +147,6 @@ describe('Tools tests', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it('checking getUrl handles undefined version without double slash', async () => {
|
|
||||||
const data: ToolInput = {
|
|
||||||
...getData({
|
|
||||||
tool: 'cs2pr',
|
|
||||||
repository: 'staabm/annotate-pull-request-from-checkstyle',
|
|
||||||
domain: 'https://github.com'
|
|
||||||
}),
|
|
||||||
version: undefined
|
|
||||||
};
|
|
||||||
data.extension = '';
|
|
||||||
expect(await tools.getUrl(data)).toBe(
|
|
||||||
'https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | version_prefix | url
|
version | version_prefix | url
|
||||||
${'latest'} | ${''} | ${'https://example.com/tool.phar'}
|
${'latest'} | ${''} | ${'https://example.com/tool.phar'}
|
||||||
@ -281,59 +164,58 @@ describe('Tools tests', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
os | script
|
os_version | script
|
||||||
${'linux'} | ${'add_tool https://example.com/tool.phar tool "-v"'}
|
${'linux'} | ${'add_tool https://example.com/tool.phar tool "-v"'}
|
||||||
${'darwin'} | ${'add_tool https://example.com/tool.phar tool "-v"'}
|
${'darwin'} | ${'add_tool https://example.com/tool.phar tool "-v"'}
|
||||||
${'win32'} | ${'Add-Tool https://example.com/tool.phar tool "-v"'}
|
${'win32'} | ${'Add-Tool https://example.com/tool.phar tool "-v"'}
|
||||||
${'openbsd'} | ${'Platform openbsd is not supported'}
|
${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||||
`('checking addArchive: $os', async ({os, script}) => {
|
`('checking addArchive: $os_version', async ({os_version, script}) => {
|
||||||
const data = getData({
|
const data = getData({
|
||||||
tool: 'tool',
|
tool: 'tool',
|
||||||
version: 'latest',
|
version: 'latest',
|
||||||
version_parameter: JSON.stringify('-v'),
|
version_parameter: JSON.stringify('-v'),
|
||||||
os: os,
|
os_version: os_version
|
||||||
url: 'https://example.com/tool.phar'
|
|
||||||
});
|
});
|
||||||
|
data['url'] = 'https://example.com/tool.phar';
|
||||||
expect(await tools.addArchive(data)).toContain(script);
|
expect(await tools.addArchive(data)).toContain(script);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
os | script | scope
|
os_version | script
|
||||||
${'linux'} | ${'add_composer_tool tool tool:1.2.3 user/ global'} | ${'global'}
|
${'linux'} | ${'add_composertool tool tool:1.2.3 user/'}
|
||||||
${'darwin'} | ${'add_composer_tool tool tool:1.2.3 user/ scoped'} | ${'scoped'}
|
${'darwin'} | ${'add_composertool tool tool:1.2.3 user/'}
|
||||||
${'win32'} | ${'Add-ComposerTool tool tool:1.2.3 user/ scoped'} | ${'scoped'}
|
${'win32'} | ${'Add-Composertool tool tool:1.2.3 user/'}
|
||||||
${'openbsd'} | ${'Platform openbsd is not supported'} | ${'global'}
|
${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||||
`('checking addPackage: $os, $scope', async ({os, script, scope}) => {
|
`('checking addPackage: $os_version', async ({os_version, script}) => {
|
||||||
const data = getData({
|
const data = getData({
|
||||||
tool: 'tool',
|
tool: 'tool',
|
||||||
version: '1.2.3',
|
version: '1.2.3',
|
||||||
repository: 'user/tool',
|
repository: 'user/tool',
|
||||||
os: os,
|
os_version: os_version
|
||||||
scope: scope
|
|
||||||
});
|
});
|
||||||
data['release'] = [data['tool'], data['version']].join(':');
|
data['release'] = [data['tool'], data['version']].join(':');
|
||||||
expect(await tools.addPackage(data)).toContain(script);
|
expect(await tools.addPackage(data)).toContain(script);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | php_version | os | script
|
version | php_version | os_version | script
|
||||||
${'latest'} | ${'8.0'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'}
|
${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://phar.io/releases/phive.phar phive'}
|
||||||
${'1.2.3'} | ${'8.0'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
|
${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
|
||||||
${'1.2.3'} | ${'7.4'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive'}
|
|
||||||
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
|
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
|
||||||
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
|
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
|
||||||
${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
|
${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
|
||||||
${'latest'} | ${'5.5'} | ${'win32'} | ${'Phive is not supported on PHP 5.5'}
|
${'latest'} | ${'5.5'} | ${'win32'} | ${'Phive is not supported on PHP 5.5'}
|
||||||
`(
|
`(
|
||||||
'checking addPhive: $version, $php_version, $os',
|
'checking addPhive: $version, $php_version, $os_version',
|
||||||
async ({version, php_version, os, script}) => {
|
async ({version, php_version, os_version, script}) => {
|
||||||
const data = getData({
|
const data = getData({
|
||||||
tool: 'phive',
|
tool: 'phive',
|
||||||
|
domain: 'https://phar.io',
|
||||||
repository: 'phar-io/phive',
|
repository: 'phar-io/phive',
|
||||||
version_parameter: 'status',
|
version_parameter: 'status',
|
||||||
version: version,
|
version: version,
|
||||||
php_version: php_version,
|
php_version: php_version,
|
||||||
os: os
|
os_version: os_version
|
||||||
});
|
});
|
||||||
script = await tools.addPhive(data);
|
script = await tools.addPhive(data);
|
||||||
expect(script).toContain(script);
|
expect(script).toContain(script);
|
||||||
@ -341,18 +223,15 @@ describe('Tools tests', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
os | version | php_version | url
|
version | php_version | url
|
||||||
${'linux'} | ${'latest'} | ${'8.1'} | ${'https://get.blackfire.io/blackfire-player.phar'}
|
${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player.phar'}
|
||||||
${'linux'} | ${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
|
${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
|
||||||
${'linux'} | ${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.22.0.phar'}
|
${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
|
||||||
${'linux'} | ${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
|
${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
|
||||||
${'linux'} | ${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
|
|
||||||
${'win32'} | ${'latest'} | ${'7.0'} | ${'blackfire-player is not a windows tool'}
|
|
||||||
`(
|
`(
|
||||||
'checking addBlackfirePlayer: $os, $version, $php_version',
|
'checking addBlackfirePlayer: $version, $php_version',
|
||||||
async ({os, version, php_version, url}) => {
|
async ({version, php_version, url}) => {
|
||||||
const data = getData({
|
const data = getData({
|
||||||
os: os,
|
|
||||||
tool: 'blackfire-player',
|
tool: 'blackfire-player',
|
||||||
domain: 'https://get.blackfire.io',
|
domain: 'https://get.blackfire.io',
|
||||||
version_prefix: 'v',
|
version_prefix: 'v',
|
||||||
@ -367,7 +246,6 @@ 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',
|
||||||
@ -378,48 +256,48 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | php_version | no_tool_cache | cache_url | source_url
|
version | cache_url | source_url
|
||||||
${'latest'} | ${'7.4'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
${'latest'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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'}
|
${'stable'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
||||||
${'snapshot'} | ${'7.4'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
|
${'snapshot'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar'} | ${'https://getcomposer.org/composer.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'}
|
${'preview'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar'} | ${'https://getcomposer.org/composer-preview.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'}
|
${'1'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar'} | ${'https://getcomposer.org/composer-1.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'}
|
${'2'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-2.phar'} | ${'https://getcomposer.org/composer-2.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'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.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'}
|
${'1.2.3-RC1'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.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.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
|
||||||
${'stable'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
|
||||||
${'snapshot'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
|
|
||||||
${'preview'} | ${'7.4'} | ${'true'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
|
|
||||||
${'1'} | ${'7.4'} | ${'false'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
|
||||||
${'2'} | ${'7.4'} | ${'false'} | ${'https://artifacts.setup-php.com/composer/composer-7.4-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
|
|
||||||
${'latest'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-stable.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
|
||||||
${'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/download/1.2.3/composer.phar'}
|
|
||||||
${'1.2.3-RC1'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/download/1.2.3-RC1/composer.phar'}
|
|
||||||
`(
|
`(
|
||||||
'checking addComposer: $version, $php_version, $no_tool_cache',
|
'checking addComposer: $version',
|
||||||
async ({version, php_version, no_tool_cache, cache_url, source_url}) => {
|
async ({version, 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;
|
|
||||||
expect(await tools.addComposer(data)).toContain(source_url);
|
|
||||||
if (no_tool_cache !== 'true') {
|
|
||||||
expect(await tools.addComposer(data)).toContain(cache_url);
|
expect(await tools.addComposer(data)).toContain(cache_url);
|
||||||
|
expect(await tools.addComposer(data)).toContain(source_url);
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each`
|
||||||
|
version | os_version | uri
|
||||||
|
${'latest'} | ${'linux'} | ${'releases/latest/download/symfony_linux_amd64'}
|
||||||
|
${'1.2.3'} | ${'linux'} | ${'releases/download/v1.2.3/symfony_linux_amd64'}
|
||||||
|
${'latest'} | ${'darwin'} | ${'releases/latest/download/symfony_darwin_amd64'}
|
||||||
|
${'1.2.3'} | ${'darwin'} | ${'releases/download/v1.2.3/symfony_darwin_amd64'}
|
||||||
|
${'latest'} | ${'win32'} | ${'releases/latest/download/symfony_windows_amd64.exe'}
|
||||||
|
${'1.2.3'} | ${'win32'} | ${'releases/download/v1.2.3/symfony_windows_amd64.exe'}
|
||||||
|
${'latest'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||||
|
`(
|
||||||
|
'checking addSymfony: $version, $os_version',
|
||||||
|
async ({version, os_version, uri}) => {
|
||||||
|
const data = getData({
|
||||||
|
tool: 'symfony',
|
||||||
|
php_version: '7.4',
|
||||||
|
version: version,
|
||||||
|
os_version: os_version
|
||||||
|
});
|
||||||
|
expect(await tools.addSymfony(data)).toContain(uri);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -439,7 +317,7 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
tool | os | script
|
tool | os_version | script
|
||||||
${'phpize'} | ${'linux'} | ${'add_devtools phpize'}
|
${'phpize'} | ${'linux'} | ${'add_devtools phpize'}
|
||||||
${'php-config'} | ${'linux'} | ${'add_devtools php-config'}
|
${'php-config'} | ${'linux'} | ${'add_devtools php-config'}
|
||||||
${'phpize'} | ${'darwin'} | ${'add_devtools phpize'}
|
${'phpize'} | ${'darwin'} | ${'add_devtools phpize'}
|
||||||
@ -447,51 +325,44 @@ describe('Tools tests', () => {
|
|||||||
${'phpize'} | ${'win32'} | ${'Add-Log "$tick" "phpize" "phpize is not a windows tool"'}
|
${'phpize'} | ${'win32'} | ${'Add-Log "$tick" "phpize" "phpize is not a windows tool"'}
|
||||||
${'php-config'} | ${'win32'} | ${'Add-Log "$tick" "php-config" "php-config is not a windows tool"'}
|
${'php-config'} | ${'win32'} | ${'Add-Log "$tick" "php-config" "php-config is not a windows tool"'}
|
||||||
${'phpize'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
${'phpize'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||||
`('checking addDevTools: $tool, $os', async ({tool, os, script}) => {
|
`(
|
||||||
|
'checking addDevTools: $tool, $os_version',
|
||||||
|
async ({tool, os_version, script}) => {
|
||||||
const data = getData({
|
const data = getData({
|
||||||
version: '7.4',
|
version: '7.4',
|
||||||
tool: tool,
|
tool: tool,
|
||||||
os: os
|
os_version: os_version
|
||||||
});
|
});
|
||||||
expect(await tools.addDevTools(data)).toContain(script);
|
expect(await tools.addDevTools(data)).toContain(script);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'blackfire, blackfire-player, box, churn, cs2pr, flex, grpc_php_plugin, mago, name-collision-detector, parallel-lint, php-cs-fixer, php-scoper, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, pint, php-config, phpize, protoc, symfony, vapor, wp, pie',
|
'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, php-cs-fixer, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, php-config, phpize, protoc, symfony, vapor, wp',
|
||||||
[
|
[
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||||
'add_blackfire',
|
'add_blackfire',
|
||||||
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
|
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
|
||||||
'add_tool https://github.com/box-project/box/releases/latest/download/box.phar box "--version"',
|
|
||||||
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-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"',
|
||||||
'add_composer_tool flex flex symfony/ global',
|
'add_composertool flex flex symfony/',
|
||||||
'add_grpc_php_plugin latest',
|
'add_grpc_php_plugin latest',
|
||||||
'add_mago',
|
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar php-cs-fixer "-V"',
|
||||||
'add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped',
|
'add_composertool phplint phplint overtrue/',
|
||||||
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
|
|
||||||
'add_tool https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
|
|
||||||
'add_tool https://github.com/humbug/php-scoper/releases/latest/download/php-scoper.phar php-scoper "--version"',
|
|
||||||
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
|
|
||||||
'add_composer_tool phplint phplint overtrue/',
|
|
||||||
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
|
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
|
||||||
'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"',
|
'add_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"',
|
||||||
'add_pecl',
|
'add_pecl',
|
||||||
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
|
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
|
||||||
'add_composer_tool phinx phinx robmorgan/ scoped',
|
'add_composertool phinx phinx robmorgan/',
|
||||||
'add_composer_tool phinx phinx:1.2.3 robmorgan/ scoped',
|
'add_composertool phinx phinx:1.2.3 robmorgan/',
|
||||||
'add_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status"',
|
'add_tool https://phar.io/releases/phive.phar phive "status"',
|
||||||
'add_composer_tool phpunit-bridge phpunit-bridge symfony/ global',
|
'add_composertool phpunit-bridge phpunit-bridge symfony/',
|
||||||
'add_composer_tool phpunit-polyfills phpunit-polyfills yoast/ global',
|
|
||||||
'add_tool https://github.com/laravel/pint/releases/latest/download/pint.phar pint "-V"',
|
|
||||||
'add_devtools php-config',
|
'add_devtools php-config',
|
||||||
'add_devtools phpize',
|
'add_devtools phpize',
|
||||||
'add_protoc latest',
|
'add_protoc latest',
|
||||||
'add_symfony latest',
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony-cli "version"',
|
||||||
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
|
'add_composertool vapor-cli vapor-cli laravel/',
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
'add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on linux', async (tools_csv, scripts) => {
|
])('checking addTools on linux', async (tools_csv, scripts) => {
|
||||||
@ -503,47 +374,38 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'backward-compatibility-check, behat, blackfire, blackfire-player, churn, composer-dependency-analyser, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, ecs, flex, grpc_php_plugin:1.2.3, infection, mago:0.26.1, name-collision-detector, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, rector, symfony-cli, vapor-cli, wp-cli, pie',
|
'behat, blackfire, blackfire-player, 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, phpize, phpmd, phpspec, phpunit-bridge:5.6, protoc:v1.2.3, psalm, symfony-cli, symfony:1.2.3, vapor-cli, wp-cli',
|
||||||
[
|
[
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||||
'add_composer_tool behat behat behat/ scoped',
|
'add_composertool behat behat behat/',
|
||||||
'add_blackfire',
|
'add_blackfire',
|
||||||
'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
|
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
|
||||||
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
|
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"',
|
||||||
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "diagnose"',
|
'add_composertool composer-require-checker composer-require-checker maglnet/',
|
||||||
'add_composer_tool composer-dependency-analyser composer-dependency-analyser shipmonk/ scoped',
|
'add_composertool composer-unused composer-unused icanhazstring/',
|
||||||
'add_composer_tool composer-require-checker composer-require-checker maglnet/ scoped',
|
|
||||||
'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused "-V"',
|
|
||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"',
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"',
|
||||||
'add_composer_tool flex flex symfony/ global',
|
'add_composertool flex flex symfony/',
|
||||||
'add_grpc_php_plugin 1.2.3',
|
'add_grpc_php_plugin 1.2.3',
|
||||||
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
|
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
|
||||||
'add_mago 0.26.1',
|
|
||||||
'add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped',
|
|
||||||
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
|
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
|
||||||
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
||||||
'add_tool https://www.phing.info/get/phing-1.2.3.phar,https://github.com/phingofficial/phing/releases/download/1.2.3/phing-1.2.3.phar phing "-v"',
|
'add_tool https://www.phing.info/get/phing-1.2.3.phar phing "-v"',
|
||||||
'add_composer_tool phinx phinx robmorgan/ scoped',
|
'add_composertool phinx phinx robmorgan/',
|
||||||
'add_tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive',
|
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive',
|
||||||
'add_devtools php-config',
|
'add_devtools php-config',
|
||||||
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
|
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
|
||||||
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
|
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
|
||||||
'add_tool https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
|
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
|
||||||
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
|
|
||||||
'add_devtools phpize',
|
'add_devtools phpize',
|
||||||
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
||||||
'add_tool https://github.com/phpspec/phpspec/releases/latest/download/phpspec.phar phpspec "-V"',
|
'add_composertool phpspec phpspec phpspec/',
|
||||||
'add_composer_tool phpunit-bridge phpunit-bridge:5.6.* symfony/ global',
|
'add_composertool phpunit-bridge phpunit-bridge:5.6.* symfony/',
|
||||||
'add_composer_tool phpunit-polyfills phpunit-polyfills:1.0.1 yoast/ global',
|
|
||||||
'add_protoc 1.2.3',
|
'add_protoc 1.2.3',
|
||||||
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
||||||
'add_composer_tool rector rector rector/ scoped',
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony-cli "version"',
|
||||||
'add_composer_tool backward-compatibility-check backward-compatibility-check roave/ scoped',
|
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony-cli "version"',
|
||||||
'add_symfony latest',
|
'add_composertool vapor-cli vapor-cli laravel/',
|
||||||
'add_composer_tool vapor-cli vapor-cli laravel/ scoped',
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
|
|
||||||
'add_composer_tool easy-coding-standard easy-coding-standard symplify/ scoped',
|
|
||||||
'add_tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on darwin', async (tools_csv, scripts) => {
|
])('checking addTools on darwin', async (tools_csv, scripts) => {
|
||||||
@ -555,27 +417,23 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'blackfire, blackfire-player:1.2.3, cs2pr, churn, deployer, does_not_exist, flex, mago, name-collision-detector, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp, pie',
|
'blackfire, blackfire-player:1.2.3, cs2pr, 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://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||||
'Add-Blackfire',
|
'Add-Blackfire',
|
||||||
'blackfire-player is not a windows tool',
|
'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"',
|
||||||
'Add-Tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
|
|
||||||
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
|
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
|
||||||
'Tool does_not_exist is not supported',
|
'Tool does_not_exist is not supported',
|
||||||
'Add-ComposerTool flex flex symfony/ global',
|
'Add-Composertool flex flex symfony/',
|
||||||
'Add-Mago',
|
'Add-Composertool phinx phinx robmorgan/',
|
||||||
'Add-ComposerTool name-collision-detector name-collision-detector shipmonk/ scoped',
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive "status"',
|
||||||
'Add-ComposerTool phinx phinx robmorgan/ scoped',
|
|
||||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.15.3/phive-0.15.3.phar phive "status"',
|
|
||||||
'php-config is not a windows tool',
|
'php-config is not a windows tool',
|
||||||
'phpize is not a windows tool',
|
'phpize is not a windows tool',
|
||||||
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
||||||
'Add-ComposerTool phpunit-bridge phpunit-bridge symfony/ global',
|
'Add-Composertool phpunit-bridge phpunit-bridge symfony/',
|
||||||
'Add-Symfony',
|
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony-cli "version"',
|
||||||
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"',
|
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
'Add-Tool https://github.com/php/pie/releases/latest/download/pie.phar pie "-V"'
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])('checking addTools on Windows', async (tools_csv, scripts) => {
|
])('checking addTools on Windows', async (tools_csv, scripts) => {
|
||||||
@ -589,14 +447,14 @@ 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://artifacts.setup-php.com/composer/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer',
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer',
|
||||||
'Add-ComposerTool codeception codeception codeception/ global',
|
'Add-Composertool codeception codeception codeception/',
|
||||||
'Add-ComposerTool prestissimo prestissimo hirak/ global',
|
'Add-Composertool prestissimo prestissimo hirak/',
|
||||||
'Add-ComposerTool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/ global',
|
'Add-Composertool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/',
|
||||||
'Add-ComposerTool phinx phinx:1.2.* robmorgan/ scoped',
|
'Add-Composertool phinx phinx:1.2.* robmorgan/',
|
||||||
'Add-ComposerTool phinx phinx:^1.2 robmorgan/ global',
|
'Add-Composertool phinx phinx:^1.2 robmorgan/',
|
||||||
'Add-ComposerTool tool tool:1.2.3 user/ global',
|
'Add-Composertool tool tool:1.2.3 user/',
|
||||||
'Add-ComposerTool tool tool:~1.2 user/ global'
|
'Add-Composertool tool tool:~1.2 user/'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
])(
|
])(
|
||||||
@ -609,39 +467,13 @@ describe('Tools tests', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it.each`
|
|
||||||
version | os | uri
|
|
||||||
${'latest'} | ${'linux'} | ${'releases/latest/download/castor.linux-amd64.phar'}
|
|
||||||
${'0.5.1'} | ${'linux'} | ${'releases/download/v0.5.1/castor.linux-amd64.phar'}
|
|
||||||
${'latest'} | ${'darwin'} | ${'releases/latest/download/castor.darwin-amd64.phar'}
|
|
||||||
${'0.5.1'} | ${'darwin'} | ${'releases/download/v0.5.1/castor.darwin-amd64.phar'}
|
|
||||||
${'latest'} | ${'win32'} | ${'releases/latest/download/castor.windows-amd64.phar'}
|
|
||||||
${'0.5.1'} | ${'win32'} | ${'releases/download/v0.5.1/castor.windows-amd64.phar castor -V'}
|
|
||||||
${'latest'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
|
||||||
`('checking addCastor: $version, $os', async ({version, os, uri}) => {
|
|
||||||
const data = getData({
|
|
||||||
tool: 'castor',
|
|
||||||
php_version: '8.1',
|
|
||||||
version_prefix: 'v',
|
|
||||||
version: version,
|
|
||||||
os: os
|
|
||||||
});
|
|
||||||
if (os === 'win32' && version === '0.5.1') {
|
|
||||||
fs.writeFileSync('castor.php', '');
|
|
||||||
expect(await tools.addCastor(data)).toContain(uri);
|
|
||||||
fs.unlinkSync('castor.php');
|
|
||||||
} else {
|
|
||||||
expect(await tools.addCastor(data)).toContain(uri);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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://artifacts.setup-php.com/composer/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"'}
|
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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://artifacts.setup-php.com/composer/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
|
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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://artifacts.setup-php.com/composer/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
|
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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://artifacts.setup-php.com/composer/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
|
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-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);
|
||||||
});
|
});
|
||||||
@ -652,64 +484,7 @@ describe('Tools tests', () => {
|
|||||||
${'phpunit:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "phpunit" "Invalid token"'}
|
${'phpunit:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "phpunit" "Invalid token"'}
|
||||||
${'phpunit:0.1'} | ${'no_data'} | ${'add_log "$cross" "phpunit" "No version found with prefix 0.1."'}
|
${'phpunit:0.1'} | ${'no_data'} | ${'add_log "$cross" "phpunit" "No version found with prefix 0.1."'}
|
||||||
`('checking error: $tools_csv', async ({tools_csv, token, script}) => {
|
`('checking error: $tools_csv', async ({tools_csv, token, script}) => {
|
||||||
process.env['GITHUB_TOKEN'] = token;
|
process.env['COMPOSER_TOKEN'] = token;
|
||||||
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking error when custom-function tool is missing function field', async () => {
|
|
||||||
const brokenToolsJson = JSON.stringify({
|
|
||||||
composer: {
|
|
||||||
type: 'custom-function',
|
|
||||||
domain: 'https://getcomposer.org',
|
|
||||||
repository: 'composer/composer',
|
|
||||||
function: 'composer'
|
|
||||||
},
|
|
||||||
'broken-tool': {
|
|
||||||
type: 'custom-function'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let result: string = '';
|
|
||||||
await jest.isolateModulesAsync(async () => {
|
|
||||||
jest.doMock('fs', () => ({
|
|
||||||
...jest.requireActual('fs'),
|
|
||||||
readFileSync: (
|
|
||||||
filePath: fs.PathOrFileDescriptor,
|
|
||||||
options?: unknown
|
|
||||||
) => {
|
|
||||||
if (String(filePath).includes('tools.json')) {
|
|
||||||
return brokenToolsJson;
|
|
||||||
}
|
|
||||||
return (jest.requireActual('fs') as typeof fs).readFileSync(
|
|
||||||
filePath,
|
|
||||||
options as fs.ObjectEncodingOptions & {flag?: string}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
const isolatedTools = await import('../src/tools');
|
|
||||||
result = await isolatedTools.addTools('broken-tool', '7.4', 'linux');
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(result).toContain(
|
|
||||||
'add_log "$cross" "broken-tool" "broken-tool has no function defined. Please report this issue."'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each`
|
|
||||||
tools_csv | php_version | resolved
|
|
||||||
${'phpunit'} | ${'8.2'} | ${'/phpunit-8.2.0.phar'}
|
|
||||||
${'phpunit'} | ${'8.1'} | ${'/phpunit-8.1.0.phar'}
|
|
||||||
${'phpunit'} | ${'8.0'} | ${'/phpunit-8.0.0.phar'}
|
|
||||||
${'phpunit'} | ${'7.3'} | ${'/phpunit-7.3.0.phar'}
|
|
||||||
${'phpunit'} | ${'7.2'} | ${'/phpunit-7.2.0.phar'}
|
|
||||||
${'phpunit'} | ${'7.1'} | ${'/phpunit-7.1.0.phar'}
|
|
||||||
${'phpunit'} | ${'7.0'} | ${'/phpunit-7.0.0.phar'}
|
|
||||||
`(
|
|
||||||
'checking error: $tools_csv',
|
|
||||||
async ({tools_csv, php_version, resolved}) => {
|
|
||||||
expect(await tools.addTools(tools_csv, php_version, 'linux')).toContain(
|
|
||||||
resolved
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,62 +1,70 @@
|
|||||||
import fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as utils from '../src/utils';
|
import * as utils from '../src/utils';
|
||||||
import * as fetchModule from '../src/fetch';
|
|
||||||
|
jest.mock('@actions/core', () => ({
|
||||||
|
getInput: jest.fn().mockImplementation(key => {
|
||||||
|
return ['setup-php'].indexOf(key) !== -1 ? key : '';
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
|
||||||
|
async function cleanup(path: string): Promise<void> {
|
||||||
|
fs.unlink(path, error => {
|
||||||
|
if (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
describe('Utils tests', () => {
|
describe('Utils tests', () => {
|
||||||
it('checking readEnv', async () => {
|
it('checking readEnv', async () => {
|
||||||
process.env['test'] = 'setup-php';
|
process.env['test'] = 'setup-php';
|
||||||
process.env['test-hyphen'] = 'setup-php';
|
|
||||||
expect(await utils.readEnv('test')).toBe('setup-php');
|
expect(await utils.readEnv('test')).toBe('setup-php');
|
||||||
expect(await utils.readEnv('TEST')).toBe('setup-php');
|
|
||||||
expect(await utils.readEnv('test_hyphen')).toBe('setup-php');
|
|
||||||
expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php');
|
|
||||||
expect(await utils.readEnv('undefined')).toBe('');
|
expect(await utils.readEnv('undefined')).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getInput', async () => {
|
it('checking getInput', async () => {
|
||||||
process.env['test'] = 'setup-php';
|
process.env['test'] = 'setup-php';
|
||||||
process.env['INPUT_SETUP-PHP'] = 'setup-php';
|
|
||||||
expect(await utils.getInput('test', false)).toBe('setup-php');
|
expect(await utils.getInput('test', false)).toBe('setup-php');
|
||||||
expect(await utils.getInput('setup-php', false)).toBe('setup-php');
|
expect(await utils.getInput('setup-php', false)).toBe('setup-php');
|
||||||
expect(await utils.getInput('DoesNotExist', false)).toBe('');
|
expect(await utils.getInput('DoesNotExist', false)).toBe('');
|
||||||
await expect(async () => {
|
await expect(async () => {
|
||||||
await utils.getInput('DoesNotExist', true);
|
await utils.getInput('DoesNotExist', true);
|
||||||
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
|
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
|
||||||
delete process.env['INPUT_SETUP-PHP'];
|
});
|
||||||
|
|
||||||
|
it('checking fetch', async () => {
|
||||||
|
const manifest = await utils.getManifestURL();
|
||||||
|
let response: Record<string, string> = await utils.fetch(manifest);
|
||||||
|
expect(response.error).toBe(undefined);
|
||||||
|
expect(response.data).toContain('latest');
|
||||||
|
|
||||||
|
response = await utils.fetch(manifest, 'invalid_token');
|
||||||
|
expect(response.error).not.toBe(undefined);
|
||||||
|
expect(response.data).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getManifestURL', async () => {
|
it('checking getManifestURL', async () => {
|
||||||
for (const url of await utils.getManifestURLS()) {
|
expect(await utils.getManifestURL()).toContain('php-versions.json');
|
||||||
expect(url).toContain('php-versions.json');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking parseVersion', async () => {
|
it('checking parseVersion', async () => {
|
||||||
const fetchSpy = jest
|
jest
|
||||||
.spyOn(fetchModule, 'fetch')
|
.spyOn(utils, 'fetch')
|
||||||
.mockResolvedValue({data: '{ "latest": "8.1", "5.x": "5.6" }'});
|
.mockImplementation(
|
||||||
expect(await utils.parseVersion('latest')).toBe('8.1');
|
async (url, token?): Promise<Record<string, string>> => {
|
||||||
|
if (!token || token === 'valid_token') {
|
||||||
|
return {data: `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`};
|
||||||
|
} else {
|
||||||
|
return {error: 'Invalid token'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
expect(await utils.parseVersion('latest')).toBe('8.0');
|
||||||
expect(await utils.parseVersion('7')).toBe('7.0');
|
expect(await utils.parseVersion('7')).toBe('7.0');
|
||||||
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
||||||
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
||||||
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
||||||
|
|
||||||
fetchSpy.mockReset();
|
|
||||||
fetchSpy.mockResolvedValueOnce({}).mockResolvedValueOnce({});
|
|
||||||
await expect(utils.parseVersion('latest')).rejects.toThrow(
|
|
||||||
'Could not fetch the PHP version manifest.'
|
|
||||||
);
|
|
||||||
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking parseIniFile', async () => {
|
|
||||||
expect(await utils.parseIniFile('production')).toBe('production');
|
|
||||||
expect(await utils.parseIniFile('development')).toBe('development');
|
|
||||||
expect(await utils.parseIniFile('none')).toBe('none');
|
|
||||||
expect(await utils.parseIniFile('php.ini-production')).toBe('production');
|
|
||||||
expect(await utils.parseIniFile('php.ini-development')).toBe('development');
|
|
||||||
expect(await utils.parseIniFile('invalid')).toBe('production');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking asyncForEach', async () => {
|
it('checking asyncForEach', async () => {
|
||||||
@ -78,10 +86,48 @@ describe('Utils tests', () => {
|
|||||||
expect(await utils.color('warning')).toBe('33');
|
expect(await utils.color('warning')).toBe('33');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking readFile', async () => {
|
||||||
|
const darwin: string = fs.readFileSync(
|
||||||
|
path.join(__dirname, '../src/scripts/darwin.sh'),
|
||||||
|
'utf8'
|
||||||
|
);
|
||||||
|
const linux: string = fs.readFileSync(
|
||||||
|
path.join(__dirname, '../src/scripts/linux.sh'),
|
||||||
|
'utf8'
|
||||||
|
);
|
||||||
|
const win32: string = fs.readFileSync(
|
||||||
|
path.join(__dirname, '../src/scripts/win32.ps1'),
|
||||||
|
'utf8'
|
||||||
|
);
|
||||||
|
expect(await utils.readFile('darwin.sh', 'src/scripts')).toBe(darwin);
|
||||||
|
expect(await utils.readFile('darwin.sh', 'src/scripts')).toBe(darwin);
|
||||||
|
expect(await utils.readFile('linux.sh', 'src/scripts')).toBe(linux);
|
||||||
|
expect(await utils.readFile('linux.sh', 'src/scripts')).toBe(linux);
|
||||||
|
expect(await utils.readFile('win32.ps1', 'src/scripts')).toBe(win32);
|
||||||
|
expect(await utils.readFile('win32.ps1', 'src/scripts')).toBe(win32);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking writeScripts', async () => {
|
||||||
|
const testString = 'sudo apt-get install php';
|
||||||
|
const runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || '';
|
||||||
|
const script_path: string = path.join(runner_dir, 'test.sh');
|
||||||
|
await utils.writeScript('test.sh', testString);
|
||||||
|
await fs.readFile(
|
||||||
|
script_path,
|
||||||
|
function (error: Error | null, data: Buffer) {
|
||||||
|
expect(testString).toBe(data.toString());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await cleanup(script_path);
|
||||||
|
});
|
||||||
|
|
||||||
it('checking extensionArray', async () => {
|
it('checking extensionArray', async () => {
|
||||||
expect(
|
expect(await utils.extensionArray('a, b, php_c, php-d')).toEqual([
|
||||||
await utils.extensionArray('a, :b, php_c, none, php-d, Zend e, :Zend f')
|
'a',
|
||||||
).toEqual(['none', 'a', ':b', 'c', 'd', 'e', ':f']);
|
'b',
|
||||||
|
'c',
|
||||||
|
'd'
|
||||||
|
]);
|
||||||
|
|
||||||
expect(await utils.extensionArray('')).toEqual([]);
|
expect(await utils.extensionArray('')).toEqual([]);
|
||||||
expect(await utils.extensionArray(' ')).toEqual([]);
|
expect(await utils.extensionArray(' ')).toEqual([]);
|
||||||
@ -107,9 +153,6 @@ describe('Utils tests', () => {
|
|||||||
expect(
|
expect(
|
||||||
await utils.CSVArray('a=E_ALL, b=E_ALL & ~ E_ALL, c="E_ALL", d=\'E_ALL\'')
|
await utils.CSVArray('a=E_ALL, b=E_ALL & ~ E_ALL, c="E_ALL", d=\'E_ALL\'')
|
||||||
).toEqual(['a=E_ALL', 'b=E_ALL & ~ E_ALL', 'c=E_ALL', 'd=E_ALL']);
|
).toEqual(['a=E_ALL', 'b=E_ALL & ~ E_ALL', 'c=E_ALL', 'd=E_ALL']);
|
||||||
expect(
|
|
||||||
await utils.CSVArray('a="b=c;d=e", b=\'c=d,e\', c="g=h,i=j", d=g=h, a===')
|
|
||||||
).toEqual(["a='b=c;d=e'", "b='c=d,e'", "c='g=h,i=j'", "d='g=h'", "a='=='"]);
|
|
||||||
expect(await utils.CSVArray('')).toEqual([]);
|
expect(await utils.CSVArray('')).toEqual([]);
|
||||||
expect(await utils.CSVArray(' ')).toEqual([]);
|
expect(await utils.CSVArray(' ')).toEqual([]);
|
||||||
});
|
});
|
||||||
@ -191,7 +234,6 @@ describe('Utils tests', () => {
|
|||||||
expect(await utils.getCommand('linux', 'tool')).toBe('add_tool ');
|
expect(await utils.getCommand('linux', 'tool')).toBe('add_tool ');
|
||||||
expect(await utils.getCommand('darwin', 'tool')).toBe('add_tool ');
|
expect(await utils.getCommand('darwin', 'tool')).toBe('add_tool ');
|
||||||
expect(await utils.getCommand('win32', 'tool')).toBe('Add-Tool ');
|
expect(await utils.getCommand('win32', 'tool')).toBe('Add-Tool ');
|
||||||
expect(await utils.getCommand('win32', 'tool_name')).toBe('Add-ToolName ');
|
|
||||||
expect(await utils.getCommand('openbsd', 'tool')).toContain(
|
expect(await utils.getCommand('openbsd', 'tool')).toContain(
|
||||||
'Platform openbsd is not supported'
|
'Platform openbsd is not supported'
|
||||||
);
|
);
|
||||||
@ -258,62 +300,4 @@ 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 readPHPVersion', async () => {
|
|
||||||
expect(await utils.readPHPVersion()).toBe('latest');
|
|
||||||
|
|
||||||
process.env['php-version-file'] = '.phpenv-version';
|
|
||||||
await expect(utils.readPHPVersion()).rejects.toThrow(
|
|
||||||
"Could not find '.phpenv-version' file."
|
|
||||||
);
|
|
||||||
|
|
||||||
const existsSync = jest.spyOn(fs, 'existsSync').mockImplementation();
|
|
||||||
const readFileSync = jest.spyOn(fs, 'readFileSync').mockImplementation();
|
|
||||||
|
|
||||||
existsSync.mockReturnValue(true);
|
|
||||||
readFileSync.mockReturnValue('8.1');
|
|
||||||
|
|
||||||
expect(await utils.readPHPVersion()).toBe('8.1');
|
|
||||||
|
|
||||||
process.env['php-version'] = '8.2';
|
|
||||||
expect(await utils.readPHPVersion()).toBe('8.2');
|
|
||||||
|
|
||||||
delete process.env['php-version-file'];
|
|
||||||
delete process.env['php-version'];
|
|
||||||
|
|
||||||
existsSync.mockReturnValue(true);
|
|
||||||
readFileSync.mockReturnValue('ruby 1.2.3\nphp 8.4.2\nnode 20.1.2');
|
|
||||||
expect(await utils.readPHPVersion()).toBe('8.4.2');
|
|
||||||
|
|
||||||
existsSync.mockReturnValue(true);
|
|
||||||
readFileSync.mockReturnValue('setup-php');
|
|
||||||
expect(await utils.readPHPVersion()).toBe('setup-php');
|
|
||||||
|
|
||||||
existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true);
|
|
||||||
readFileSync.mockReturnValue(
|
|
||||||
'{ "platform-overrides": { "php": "7.3.25" } }'
|
|
||||||
);
|
|
||||||
expect(await utils.readPHPVersion()).toBe('7.3.25');
|
|
||||||
|
|
||||||
existsSync
|
|
||||||
.mockReturnValueOnce(false)
|
|
||||||
.mockReturnValueOnce(false)
|
|
||||||
.mockReturnValueOnce(true);
|
|
||||||
readFileSync.mockReturnValue(
|
|
||||||
'{ "config": { "platform": { "php": "7.4.33" } } }'
|
|
||||||
);
|
|
||||||
expect(await utils.readPHPVersion()).toBe('7.4.33');
|
|
||||||
|
|
||||||
existsSync.mockClear();
|
|
||||||
readFileSync.mockClear();
|
|
||||||
});
|
|
||||||
|
|
||||||
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');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
15
action.yml
15
action.yml
@ -7,17 +7,11 @@ branding:
|
|||||||
inputs:
|
inputs:
|
||||||
php-version:
|
php-version:
|
||||||
description: 'Setup PHP version.'
|
description: 'Setup PHP version.'
|
||||||
required: false
|
default: '8.0'
|
||||||
php-version-file:
|
required: true
|
||||||
description: 'Setup PHP version from a file.'
|
|
||||||
required: false
|
|
||||||
extensions:
|
extensions:
|
||||||
description: 'Setup PHP extensions.'
|
description: 'Setup PHP extensions.'
|
||||||
required: false
|
required: false
|
||||||
ini-file:
|
|
||||||
description: 'Set base ini file.'
|
|
||||||
required: false
|
|
||||||
default: 'production'
|
|
||||||
ini-values:
|
ini-values:
|
||||||
description: 'Add values to php.ini.'
|
description: 'Add values to php.ini.'
|
||||||
required: false
|
required: false
|
||||||
@ -27,12 +21,9 @@ inputs:
|
|||||||
tools:
|
tools:
|
||||||
description: 'Setup popular tools globally.'
|
description: 'Setup popular tools globally.'
|
||||||
required: false
|
required: false
|
||||||
github-token:
|
|
||||||
description: 'GitHub token to use for authentication.'
|
|
||||||
default: ${{ github.token }}
|
|
||||||
outputs:
|
outputs:
|
||||||
php-version:
|
php-version:
|
||||||
description: 'PHP version in semver format'
|
description: 'PHP version in semver format'
|
||||||
runs:
|
runs:
|
||||||
using: 'node24'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
3002
dist/index.js
vendored
3002
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -1,49 +0,0 @@
|
|||||||
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
||||||
import importPlugin from 'eslint-plugin-import';
|
|
||||||
import jest from 'eslint-plugin-jest';
|
|
||||||
import prettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
||||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
||||||
import globals from 'globals';
|
|
||||||
import tsParser from '@typescript-eslint/parser';
|
|
||||||
import js from '@eslint/js';
|
|
||||||
|
|
||||||
export default [
|
|
||||||
js.configs.recommended,
|
|
||||||
...typescriptEslint.configs['flat/recommended'],
|
|
||||||
importPlugin.flatConfigs.errors,
|
|
||||||
importPlugin.flatConfigs.warnings,
|
|
||||||
importPlugin.flatConfigs.typescript,
|
|
||||||
prettierRecommended,
|
|
||||||
eslintConfigPrettier,
|
|
||||||
{
|
|
||||||
plugins: {
|
|
||||||
jest
|
|
||||||
},
|
|
||||||
|
|
||||||
languageOptions: {
|
|
||||||
globals: {
|
|
||||||
...globals.node,
|
|
||||||
...globals.jest
|
|
||||||
},
|
|
||||||
|
|
||||||
parser: tsParser,
|
|
||||||
ecmaVersion: 2021,
|
|
||||||
sourceType: 'module'
|
|
||||||
},
|
|
||||||
|
|
||||||
settings: {
|
|
||||||
'import/resolver': {
|
|
||||||
typescript: {
|
|
||||||
alwaysTryTypes: true,
|
|
||||||
project: './tsconfig.json'
|
|
||||||
},
|
|
||||||
node: {
|
|
||||||
extensions: ['.js', '.ts']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'import/parsers': {
|
|
||||||
'@typescript-eslint/parser': ['.ts']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
@ -8,31 +8,25 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.1', '7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: PHP test
|
- name: PHP test
|
||||||
run: composer test
|
run: composer test
|
||||||
@ -15,22 +15,17 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
# blackfire-player supports PHP >= 5.5
|
# blackfire-player supports PHP >= 5.5
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: blackfire
|
extensions: blackfire
|
||||||
# Setup Blackfire CLI and player
|
tools: blackfire, blackfire-player #Setup Blackfire client, agent and player
|
||||||
tools: blackfire, blackfire-player
|
|
||||||
coverage: none
|
coverage: none
|
||||||
|
|
||||||
# Refer to https://blackfire.io/docs/player/index#usage
|
|
||||||
- name: Play the scenario
|
- name: Play the scenario
|
||||||
run: blackfire-player run scenario.bkf
|
run: blackfire-player run scenario.bkf # Refer to https://blackfire.io/docs/player/index#usage
|
||||||
|
|||||||
@ -15,23 +15,17 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
# Blackfire supports PHP >= 5.3 on Ubuntu and macOS, and PHP >= 5.4 on Windows
|
# Blackfire supports PHP >= 5.3 on ubuntu and macos and PHP >= 5.4 on windows
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
# Setup Blackfire extension and CLI
|
|
||||||
extensions: blackfire
|
extensions: blackfire
|
||||||
tools: blackfire
|
tools: blackfire #Setup Blackfire client and agent
|
||||||
# Disable Xdebug and PCOV coverage drivers
|
|
||||||
coverage: none
|
coverage: none
|
||||||
|
|
||||||
# Refer to https://blackfire.io/docs/cookbooks/profiling-cli
|
|
||||||
- name: Profile
|
- name: Profile
|
||||||
run: blackfire run php my-script.php
|
run: blackfire run php my-script.php # Refer to https://blackfire.io/docs/cookbooks/profiling-cli
|
||||||
|
|||||||
@ -6,13 +6,11 @@ jobs:
|
|||||||
tests:
|
tests:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
@ -20,7 +18,6 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 3306/tcp
|
- 3306/tcp
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
@ -28,9 +25,7 @@ jobs:
|
|||||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
@ -39,30 +34,23 @@ jobs:
|
|||||||
# Install memcached if using ext-memcached
|
# Install memcached if using ext-memcached
|
||||||
extensions: mbstring, intl, redis, pdo_mysql
|
extensions: mbstring, intl, redis, pdo_mysql
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
|
- name: Start mysql service
|
||||||
# Local MySQL service in GitHub hosted environments is disabled by default.
|
run: sudo /etc/init.d/mysql start
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start mysql service
|
|
||||||
# run: sudo systemctl start mysql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
composer run-script post-install-cmd
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
# Add a step to run migrations if required
|
# Add a step to run migrations if required
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
@ -75,31 +63,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: PHP CodeSniffer
|
- name: PHP CodeSniffer
|
||||||
run: composer cs-check
|
run: composer cs-check
|
||||||
|
|
||||||
@ -108,31 +90,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Static Analysis using PHPStan
|
- name: Static Analysis using PHPStan
|
||||||
run: phpstan analyse --no-progress src/
|
run: phpstan analyse --no-progress src/
|
||||||
@ -6,13 +6,11 @@ jobs:
|
|||||||
tests:
|
tests:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:10.8
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@ -20,7 +18,6 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 5432/tcp
|
- 5432/tcp
|
||||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
@ -28,9 +25,7 @@ jobs:
|
|||||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
@ -39,30 +34,21 @@ jobs:
|
|||||||
# Install memcached if using ext-memcached
|
# Install memcached if using ext-memcached
|
||||||
extensions: mbstring, intl, redis, pdo_pgsql
|
extensions: mbstring, intl, redis, pdo_pgsql
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start postgresql service
|
|
||||||
# run: sudo systemctl start postgresql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
composer run-script post-install-cmd
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
# Add a step to run migrations if required
|
# Add a step to run migrations if required
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
@ -75,31 +61,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: PHP CodeSniffer
|
- name: PHP CodeSniffer
|
||||||
run: composer cs-check
|
run: composer cs-check
|
||||||
|
|
||||||
@ -108,31 +88,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Static Analysis using PHPStan
|
- name: Static Analysis using PHPStan
|
||||||
run: phpstan analyse --no-progress src/
|
run: phpstan analyse --no-progress src/
|
||||||
@ -7,38 +7,32 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, intl, pdo_sqlite, pdo_mysql
|
extensions: mbstring, intl, pdo_sqlite, pdo_mysql
|
||||||
coverage: pcov
|
coverage: pcov #optional
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
composer run-script post-install-cmd
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
|
|
||||||
@ -47,30 +41,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: PHP CodeSniffer
|
- name: PHP CodeSniffer
|
||||||
run: composer cs-check
|
run: composer cs-check
|
||||||
|
|
||||||
@ -79,31 +68,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '7.3'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Static Analysis using PHPStan
|
- name: Static Analysis using PHPStan
|
||||||
run: phpstan analyse --no-progress src/
|
run: phpstan analyse --no-progress src/
|
||||||
|
|||||||
@ -6,35 +6,29 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, intl, curl, dom
|
extensions: mbstring, intl, curl, dom
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
@ -13,11 +13,9 @@ jobs:
|
|||||||
CACHE_DRIVER: redis
|
CACHE_DRIVER: redis
|
||||||
QUEUE_CONNECTION: redis
|
QUEUE_CONNECTION: redis
|
||||||
SESSION_DRIVER: redis
|
SESSION_DRIVER: redis
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
@ -25,7 +23,6 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 3306/tcp
|
- 3306/tcp
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
@ -34,54 +31,42 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, dom, fileinfo, mysql
|
extensions: mbstring, dom, fileinfo, mysql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
# Local MySQL service in GitHub hosted environments is disabled by default.
|
run: sudo /etc/init.d/mysql start
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start mysql service
|
|
||||||
# run: sudo systemctl start mysql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: |
|
run: |
|
||||||
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
php artisan key:generate
|
php artisan key:generate
|
||||||
|
|
||||||
- name: Clear Config
|
- name: Clear Config
|
||||||
run: php artisan config:clear
|
run: php artisan config:clear
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: php artisan migrate -v
|
run: php artisan migrate -v
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
env:
|
env:
|
||||||
|
|||||||
@ -15,11 +15,9 @@ jobs:
|
|||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
DB_USERNAME: postgres
|
DB_USERNAME: postgres
|
||||||
DB_DATABASE: postgres
|
DB_DATABASE: postgres
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:10.8
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@ -27,7 +25,6 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 5432/tcp
|
- 5432/tcp
|
||||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
@ -36,54 +33,40 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, dom, fileinfo, pgsql
|
extensions: mbstring, dom, fileinfo, pgsql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start postgresql service
|
|
||||||
# run: sudo systemctl start postgresql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: |
|
run: |
|
||||||
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
php artisan key:generate
|
php artisan key:generate
|
||||||
|
|
||||||
- name: Clear Config
|
- name: Clear Config
|
||||||
run: php artisan config:clear
|
run: php artisan config:clear
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: php artisan migrate -v
|
run: php artisan migrate -v
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
env:
|
env:
|
||||||
|
|||||||
@ -9,42 +9,34 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, dom, fileinfo
|
extensions: mbstring, dom, fileinfo
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: |
|
run: |
|
||||||
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
php artisan key:generate
|
php artisan key:generate
|
||||||
|
|
||||||
- name: Clear Config
|
- name: Clear Config
|
||||||
run: php artisan config:clear
|
run: php artisan config:clear
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
@ -13,11 +13,9 @@ jobs:
|
|||||||
CACHE_DRIVER: redis
|
CACHE_DRIVER: redis
|
||||||
QUEUE_CONNECTION: redis
|
QUEUE_CONNECTION: redis
|
||||||
SESSION_DRIVER: redis
|
SESSION_DRIVER: redis
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
@ -25,7 +23,6 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 3306/tcp
|
- 3306/tcp
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
@ -34,54 +31,42 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, dom, fileinfo, mysql
|
extensions: mbstring, dom, fileinfo, mysql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
# Local MySQL service in GitHub hosted environments is disabled by default.
|
run: sudo /etc/init.d/mysql start
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start mysql service
|
|
||||||
# run: sudo systemctl start mysql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
composer require predis/predis illuminate/redis
|
composer require predis/predis illuminate/redis
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
|
||||||
- name: Register Redis as service provider
|
- name: Register Redis as service provider
|
||||||
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
|
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: php artisan migrate -v
|
run: php artisan migrate -v
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
env:
|
env:
|
||||||
|
|||||||
@ -15,11 +15,9 @@ jobs:
|
|||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
DB_USERNAME: postgres
|
DB_USERNAME: postgres
|
||||||
DB_DATABASE: postgres
|
DB_DATABASE: postgres
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:10.8
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@ -27,7 +25,6 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 5432/tcp
|
- 5432/tcp
|
||||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
@ -36,54 +33,40 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, dom, fileinfo, pgsql
|
extensions: mbstring, dom, fileinfo, pgsql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start postgresql service
|
|
||||||
# run: sudo systemctl start postgresql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
composer require predis/predis illuminate/redis
|
composer require predis/predis illuminate/redis
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
|
||||||
- name: Register Redis as service provider
|
- name: Register Redis as service provider
|
||||||
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
|
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: php artisan migrate -v
|
run: php artisan migrate -v
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
env:
|
env:
|
||||||
|
|||||||
@ -9,37 +9,30 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, dom, fileinfo, mysql
|
extensions: mbstring, dom, fileinfo, mysql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
@ -16,11 +16,9 @@ jobs:
|
|||||||
DB_PASSWORD: password
|
DB_PASSWORD: password
|
||||||
CODECEPTION_URL: 127.0.0.1
|
CODECEPTION_URL: 127.0.0.1
|
||||||
CODECEPTION_PORT: 8888
|
CODECEPTION_PORT: 8888
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
@ -36,41 +34,30 @@ jobs:
|
|||||||
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
# Use phalcon3 for the phalcon 3.x.
|
extensions: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
|
||||||
extensions: mbstring, dom, zip, phalcon4, mysql
|
coverage: xdebug #optional
|
||||||
coverage: xdebug
|
- name: Start mysql service
|
||||||
|
run: sudo /etc/init.d/mysql start
|
||||||
# Local MySQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start mysql service
|
|
||||||
# run: sudo systemctl start mysql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: |
|
run: |
|
||||||
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
||||||
@ -78,7 +65,6 @@ jobs:
|
|||||||
vendor/bin/phinx seed:run
|
vendor/bin/phinx seed:run
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
||||||
|
|||||||
@ -17,11 +17,9 @@ jobs:
|
|||||||
CODECEPTION_URL: 127.0.0.1
|
CODECEPTION_URL: 127.0.0.1
|
||||||
CODECEPTION_PORT: 8888
|
CODECEPTION_PORT: 8888
|
||||||
DB_CONNECTION: pgsql
|
DB_CONNECTION: pgsql
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:10.8
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@ -37,27 +35,18 @@ jobs:
|
|||||||
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
# Use phalcon3 for the phalcon 3.x
|
extensions: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
|
||||||
extensions: mbstring, dom, zip, phalcon4, pgsql
|
coverage: xdebug #optional
|
||||||
coverage: xdebug
|
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start postgresql service
|
|
||||||
# run: sudo systemctl start postgresql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
|||||||
@ -8,62 +8,50 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.1', '7.2', '7.3', '7.4']
|
||||||
node-versions: ['16']
|
node-versions: ['8', '10']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-versions }}
|
node-version: ${{ matrix.node-versions }}
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring
|
extensions: mbstring
|
||||||
|
|
||||||
- name: Check node versions
|
- name: Check node versions
|
||||||
run: node -v
|
run: node -v
|
||||||
|
|
||||||
- name: Get yarn cache
|
- name: Get yarn cache
|
||||||
id: yarn-cache
|
id: yarn-cache
|
||||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.yarn-cache.outputs.dir }}
|
path: ${{ steps.yarn-cache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-yarn-
|
restore-keys: ${{ runner.os }}-yarn-
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install yarn dependencies
|
- name: Install yarn dependencies
|
||||||
run: yarn -V
|
run: yarn -V
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Yarn test and build
|
- name: Yarn test and build
|
||||||
run: |
|
run: |
|
||||||
yarn run test
|
yarn run test
|
||||||
yarn run build
|
yarn run build
|
||||||
yarn run rmdist
|
yarn run rmdist
|
||||||
yarn run "build:production"
|
yarn run "build:production"
|
||||||
|
|
||||||
- name: PHP test
|
- name: PHP test
|
||||||
run: composer test
|
run: composer test
|
||||||
@ -6,35 +6,29 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, simplexml, dom
|
extensions: mbstring, simplexml, dom
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
@ -5,11 +5,9 @@ jobs:
|
|||||||
symfony:
|
symfony:
|
||||||
name: Symfony (PHP ${{ matrix.php-versions }})
|
name: Symfony (PHP ${{ matrix.php-versions }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
MYSQL_ROOT_PASSWORD: symfony
|
MYSQL_ROOT_PASSWORD: symfony
|
||||||
@ -20,41 +18,32 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
tools: phpunit-bridge
|
tools: phpunit-bridge
|
||||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
# Local MySQL service in GitHub hosted environments is disabled by default.
|
run: sudo /etc/init.d/mysql start
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start mysql service
|
|
||||||
# run: sudo systemctl start mysql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: |
|
run: |
|
||||||
composer require --dev symfony/orm-pack
|
composer require --dev symfony/orm-pack
|
||||||
@ -62,9 +51,7 @@ jobs:
|
|||||||
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
||||||
env:
|
env:
|
||||||
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
|
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
|
||||||
|
|
||||||
- name: Install PHPUnit
|
- name: Install PHPUnit
|
||||||
run: simple-phpunit install
|
run: simple-phpunit install
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: simple-phpunit --coverage-text
|
run: simple-phpunit --coverage-text
|
||||||
|
|||||||
@ -5,11 +5,9 @@ jobs:
|
|||||||
symfony:
|
symfony:
|
||||||
name: Symfony (PHP ${{ matrix.php-versions }})
|
name: Symfony (PHP ${{ matrix.php-versions }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:10.8
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@ -20,41 +18,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
tools: phpunit-bridge
|
tools: phpunit-bridge
|
||||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start postgresql service
|
|
||||||
# run: sudo systemctl start postgresql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: |
|
run: |
|
||||||
composer require --dev symfony/orm-pack
|
composer require --dev symfony/orm-pack
|
||||||
@ -62,9 +49,7 @@ jobs:
|
|||||||
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
||||||
env:
|
env:
|
||||||
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
|
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
|
||||||
|
|
||||||
- name: Install PHPUnit
|
- name: Install PHPUnit
|
||||||
run: simple-phpunit install
|
run: simple-phpunit install
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: simple-phpunit --coverage-text
|
run: simple-phpunit --coverage-text
|
||||||
|
|||||||
@ -9,38 +9,31 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
tools: phpunit-bridge
|
tools: phpunit-bridge
|
||||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Install PHPUnit
|
- name: Install PHPUnit
|
||||||
run: simple-phpunit install
|
run: simple-phpunit install
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: simple-phpunit --coverage-text
|
run: simple-phpunit --coverage-text
|
||||||
|
|||||||
@ -11,11 +11,9 @@ jobs:
|
|||||||
TEST_DB_USERNAME: root
|
TEST_DB_USERNAME: root
|
||||||
TEST_DB_PASSWORD: yii
|
TEST_DB_PASSWORD: yii
|
||||||
DB_CHARSET: utf8
|
DB_CHARSET: utf8
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
MYSQL_ROOT_PASSWORD: yii
|
MYSQL_ROOT_PASSWORD: yii
|
||||||
@ -26,45 +24,35 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set Node.js 10.x
|
- name: Set Node.js 10.x
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 10.x
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, intl, gd, imagick, zip, dom, mysql
|
extensions: mbstring, intl, gd, imagick, zip, dom, mysql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
# Local MySQL service in GitHub hosted environments is disabled by default.
|
run: sudo /etc/init.d/mysql start
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start mysql service
|
|
||||||
# run: sudo systemctl start mysql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: |
|
run: |
|
||||||
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
||||||
@ -74,7 +62,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
||||||
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
vendor/bin/codecept build
|
vendor/bin/codecept build
|
||||||
|
|||||||
@ -11,11 +11,9 @@ jobs:
|
|||||||
TEST_DB_USERNAME: postgres
|
TEST_DB_USERNAME: postgres
|
||||||
TEST_DB_PASSWORD: postgres
|
TEST_DB_PASSWORD: postgres
|
||||||
DB_CHARSET: utf8
|
DB_CHARSET: utf8
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:10.8
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@ -26,45 +24,33 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set Node.js 10.x
|
- name: Set Node.js 10.x
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 10.x
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
|
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
|
||||||
coverage: xdebug
|
coverage: xdebug #optional
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start postgresql service
|
|
||||||
# run: sudo systemctl start postgresql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: |
|
run: |
|
||||||
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
||||||
@ -74,7 +60,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
||||||
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
vendor/bin/codecept build
|
vendor/bin/codecept build
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# GitHub Action for Laminas framework MVC projects
|
# GitHub Action for Zend Framework
|
||||||
name: Testing Zend Framework
|
name: Testing Zend Framework
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
@ -6,34 +6,31 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
coverage: xdebug
|
extensions: mbstring, bcmath, curl, intl
|
||||||
|
coverage: xdebug #optional
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer require --dev phpunit/phpunit squizlabs/php_codesniffer zendframework/zend-test
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
14103
package-lock.json
generated
14103
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
76
package.json
76
package.json
@ -1,25 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.36.0",
|
"version": "2.12.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",
|
||||||
"types": "lib/install.d.ts",
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__",
|
|
||||||
"src": "src"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib",
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"lint": "eslint **/src/*.ts **/__tests__/*.ts --cache --fix",
|
"lint": "eslint **/*.ts --cache --fix",
|
||||||
"format": "prettier --write **/src/*.ts **/__tests__/*.ts && git add -f __tests__/ ",
|
"format": "prettier --write **/*.ts && git add .",
|
||||||
"format-check": "prettier --check **/src/*.ts **/__tests__/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"release": "ncc build -m -o dist && git add -f dist/",
|
"release": "ncc build -o dist && git add -f dist/",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -34,41 +24,33 @@
|
|||||||
"author": "shivammathur",
|
"author": "shivammathur",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/exec": "^2.0.0",
|
"@actions/core": "^1.4.0",
|
||||||
"compare-versions": "^6.1.1"
|
"@actions/exec": "^1.1.0",
|
||||||
|
"@actions/io": "^1.1.1",
|
||||||
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/compat": "^2.0.2",
|
"@types/jest": "^26.0.24",
|
||||||
"@eslint/js": "^9.39.1",
|
"@types/node": "^16.3.2",
|
||||||
"@types/jest": "^30.0.0",
|
"@typescript-eslint/eslint-plugin": "^4.28.3",
|
||||||
"@types/node": "^25.2.2",
|
"@typescript-eslint/parser": "^4.28.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
"@vercel/ncc": "^0.28.6",
|
||||||
"@typescript-eslint/parser": "^8.54.0",
|
"eslint": "^7.30.0",
|
||||||
"@vercel/ncc": "^0.38.4",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint": "^9.39.1",
|
"eslint-plugin-import": "^2.23.4",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-plugin-jest": "^24.3.6",
|
||||||
"eslint-import-resolver-typescript": "^4.4.4",
|
"eslint-plugin-prettier": "^3.4.0",
|
||||||
"eslint-plugin-import": "^2.32.0",
|
"husky": "^4.3.8",
|
||||||
"eslint-plugin-jest": "^29.12.2",
|
"jest": "^27.0.6",
|
||||||
"eslint-plugin-prettier": "^5.5.5",
|
"jest-circus": "^27.0.6",
|
||||||
"globals": "^17.3.0",
|
"prettier": "^2.3.2",
|
||||||
"jest": "^30.2.0",
|
"ts-jest": "^27.0.3",
|
||||||
"jest-circus": "^30.2.0",
|
"typescript": "^4.3.5"
|
||||||
"nock": "^14.0.10",
|
|
||||||
"prettier": "^3.8.1",
|
|
||||||
"simple-git-hooks": "^2.13.1",
|
|
||||||
"ts-jest": "^29.4.6",
|
|
||||||
"typescript": "^5.9.3"
|
|
||||||
},
|
},
|
||||||
"overrides": {
|
"husky": {
|
||||||
"test-exclude": "^7.0.1",
|
"skipCI": true,
|
||||||
"glob": "^11.1.0",
|
"hooks": {
|
||||||
"minimatch": "^10.2.1"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/shivammathur/setup-php/issues"
|
|
||||||
},
|
|
||||||
"simple-git-hooks": {
|
|
||||||
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
|
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -45,28 +45,28 @@ export async function addINIValuesWindows(
|
|||||||
* Function to add custom ini values
|
* Function to add custom ini values
|
||||||
*
|
*
|
||||||
* @param ini_values_csv
|
* @param ini_values_csv
|
||||||
* @param os
|
* @param os_version
|
||||||
* @param no_step
|
* @param no_step
|
||||||
*/
|
*/
|
||||||
export async function addINIValues(
|
export async function addINIValues(
|
||||||
ini_values_csv: string,
|
ini_values_csv: string,
|
||||||
os: string,
|
os_version: string,
|
||||||
no_step = false
|
no_step = false
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
switch (no_step) {
|
switch (no_step) {
|
||||||
case true:
|
case true:
|
||||||
script +=
|
script +=
|
||||||
(await utils.stepLog('Add php.ini values', os)) +
|
(await utils.stepLog('Add php.ini values', os_version)) +
|
||||||
(await utils.suppressOutput(os)) +
|
(await utils.suppressOutput(os_version)) +
|
||||||
'\n';
|
'\n';
|
||||||
break;
|
break;
|
||||||
case false:
|
case false:
|
||||||
default:
|
default:
|
||||||
script += (await utils.stepLog('Add php.ini values', os)) + '\n';
|
script += (await utils.stepLog('Add php.ini values', os_version)) + '\n';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (os) {
|
switch (os_version) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return script + (await addINIValuesWindows(ini_values_csv));
|
return script + (await addINIValuesWindows(ini_values_csv));
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
@ -74,8 +74,8 @@ export async function addINIValues(
|
|||||||
return script + (await addINIValuesUnix(ini_values_csv));
|
return script + (await addINIValuesUnix(ini_values_csv));
|
||||||
default:
|
default:
|
||||||
return await utils.log(
|
return await utils.log(
|
||||||
'Platform ' + os + ' is not supported',
|
'Platform ' + os_version + ' is not supported',
|
||||||
os,
|
os_version,
|
||||||
'error'
|
'error'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
amqp=amqp
|
|
||||||
apcu=apcu
|
|
||||||
ast=ast
|
|
||||||
brotli=brotli
|
|
||||||
couchbase=couchbase
|
|
||||||
ds=ds
|
|
||||||
event=event
|
|
||||||
excimer=excimer
|
|
||||||
expect=expect
|
|
||||||
gearman=gearman
|
|
||||||
gmagick=gmagick
|
|
||||||
gnupg=gnupg
|
|
||||||
grpc=grpc
|
|
||||||
igbinary=igbinary
|
|
||||||
imagick=imagick
|
|
||||||
imap=imap
|
|
||||||
interbase=interbase
|
|
||||||
lua=lua
|
|
||||||
mailparse=mailparse
|
|
||||||
maxminddb=maxminddb
|
|
||||||
mcrypt=mcrypt
|
|
||||||
memcache=memcache
|
|
||||||
memcached=memcached
|
|
||||||
mongodb=mongodb
|
|
||||||
mongodb1=mongodb1
|
|
||||||
msgpack=msgpack
|
|
||||||
newrelic=newrelic
|
|
||||||
oauth=oauth
|
|
||||||
opentelemetry=opentelemetry
|
|
||||||
pcov=pcov
|
|
||||||
pdo_firebird=pdo_firebird
|
|
||||||
pdo_sqlsrv=pdo_sqlsrv
|
|
||||||
pecl_http=http
|
|
||||||
phalcon3=phalcon
|
|
||||||
phalcon4=phalcon
|
|
||||||
phalcon5=phalcon
|
|
||||||
pinba=pinba
|
|
||||||
propro=propro
|
|
||||||
protobuf=protobuf
|
|
||||||
psr=psr
|
|
||||||
raphf=raphf
|
|
||||||
rdkafka=rdkafka
|
|
||||||
phpredis=redis
|
|
||||||
redis=redis
|
|
||||||
seaslog=seaslog
|
|
||||||
scalar_objects=scalar_objects
|
|
||||||
snmp=snmp
|
|
||||||
sqlsrv=sqlsrv
|
|
||||||
spx=spx
|
|
||||||
ssh2=ssh2
|
|
||||||
swoole=swoole
|
|
||||||
swow=swow
|
|
||||||
uopz=uopz
|
|
||||||
uploadprogress=uploadprogress
|
|
||||||
uuid=uuid
|
|
||||||
v8js=v8js
|
|
||||||
vips=vips
|
|
||||||
vld=vld
|
|
||||||
xdebug=xdebug
|
|
||||||
xdebug2=xdebug
|
|
||||||
xhprof=xhprof
|
|
||||||
xlswriter=xlswriter
|
|
||||||
yaml=yaml
|
|
||||||
zmq=zmq
|
|
||||||
zstd=zstd
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
COMPOSER_PROCESS_TIMEOUT=0
|
|
||||||
COMPOSER_NO_INTERACTION=1
|
|
||||||
COMPOSER_NO_AUDIT=1
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
amqp=rabbitmq-c
|
|
||||||
decimal=mpdecimal
|
|
||||||
ev=libev
|
|
||||||
event=libevent
|
|
||||||
geoip=geoip
|
|
||||||
gmagick=graphicsmagick
|
|
||||||
gnupg=gpgme
|
|
||||||
grpc=grpc protobuf
|
|
||||||
imagick=imagemagick
|
|
||||||
memcached=libmemcached libevent
|
|
||||||
protobuf=protobuf
|
|
||||||
rdkafka=librdkafka
|
|
||||||
snappy=snappy
|
|
||||||
sodium=libsodium
|
|
||||||
ssh2=libssh2
|
|
||||||
uv=libuv
|
|
||||||
uuid=util-linux
|
|
||||||
vips=vips
|
|
||||||
yaz=yaz
|
|
||||||
yaml=libyaml
|
|
||||||
zstd=zstd
|
|
||||||
zmq=zeromq
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
opcache.enable=1
|
|
||||||
opcache.jit_buffer_size=256M
|
|
||||||
opcache.jit=1235
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
opcache.enable=1
|
|
||||||
opcache.jit_buffer_size=128M
|
|
||||||
opcache.jit=1235
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
date.timezone=UTC
|
|
||||||
memory_limit=-1
|
|
||||||
@ -1 +0,0 @@
|
|||||||
xdebug.mode=coverage
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
amqp=librabbitmq-dev
|
|
||||||
decimal=libmpdec-dev
|
|
||||||
ev=libev-dev
|
|
||||||
event=libevent-dev
|
|
||||||
geoip=libgeoip-dev
|
|
||||||
gmagick=graphicsmagick-libmagick-dev-compat
|
|
||||||
gnupg=libgpgme-dev
|
|
||||||
grpc=libgrpc-dev libprotobuf-dev protobuf-compiler
|
|
||||||
imagick=libmagickwand-dev libmagickcore-dev
|
|
||||||
memcached=libmemcached-dev libevent-dev
|
|
||||||
protobuf=libprotobuf-dev protobuf-compiler
|
|
||||||
rdkafka=librdkafka-dev
|
|
||||||
snappy=libsnappy-dev
|
|
||||||
sodium=libsodium-dev
|
|
||||||
ssh2=libssh2-1-dev
|
|
||||||
uv=libuv1-dev
|
|
||||||
uuid=uuid-dev
|
|
||||||
vips=libvips-dev
|
|
||||||
yaz=libyaz-dev
|
|
||||||
yaml=libyaml-dev
|
|
||||||
zstd=libzstd-dev
|
|
||||||
zmq=libzmq3-dev
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
apc=25
|
|
||||||
apcu_bc=25
|
|
||||||
apcu-bc=25
|
|
||||||
blackfire=30
|
|
||||||
couchbase=30
|
|
||||||
decimal=30
|
|
||||||
ds=30
|
|
||||||
event=30
|
|
||||||
ev=30
|
|
||||||
grpc=30
|
|
||||||
http=25
|
|
||||||
pecl_http=25
|
|
||||||
pecl-http=25
|
|
||||||
inotify=30
|
|
||||||
libvirt-php=40
|
|
||||||
mailparse=25
|
|
||||||
maxminddb=30
|
|
||||||
memcached=25
|
|
||||||
mysqlnd=10
|
|
||||||
mysqlnd_ms=30
|
|
||||||
opcache=10
|
|
||||||
openswoole=25
|
|
||||||
pdo=10
|
|
||||||
phalcon=35
|
|
||||||
protobuf=30
|
|
||||||
psr=15
|
|
||||||
rdkafka=30
|
|
||||||
swoole=25
|
|
||||||
vips=30
|
|
||||||
xml=15
|
|
||||||
zstd=30
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
8,jessie
|
|
||||||
9,stretch
|
|
||||||
10,buster
|
|
||||||
11,bullseye
|
|
||||||
12,bookworm
|
|
||||||
13,trixie
|
|
||||||
16.04 LTS,xenial
|
|
||||||
16.10,yakkety
|
|
||||||
17.04,zesty
|
|
||||||
17.10,artful
|
|
||||||
18.04 LTS,bionic
|
|
||||||
18.10,cosmic
|
|
||||||
19.04,disco
|
|
||||||
19.10,eoan
|
|
||||||
20.04 LTS,focal
|
|
||||||
20.10,groovy
|
|
||||||
21.04,hirsute
|
|
||||||
21.10,impish
|
|
||||||
22.04,jammy
|
|
||||||
23.04,lunar
|
|
||||||
23.10,mantic
|
|
||||||
24.04,noble
|
|
||||||
24.10,oracular
|
|
||||||
25.10,plucky
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
{
|
{
|
||||||
"lowest": "8.1",
|
"latest": "8.0",
|
||||||
"highest": "8.5",
|
|
||||||
"latest": "8.5",
|
|
||||||
"nightly": "8.6",
|
|
||||||
"master": "8.6",
|
|
||||||
"5.x": "5.6",
|
"5.x": "5.6",
|
||||||
"7.x": "7.4",
|
"7.x": "7.4",
|
||||||
"8.x": "8.5"
|
"8.x": "8.0"
|
||||||
}
|
}
|
||||||
@ -1,11 +0,0 @@
|
|||||||
cgi
|
|
||||||
cli
|
|
||||||
curl
|
|
||||||
fpm
|
|
||||||
intl
|
|
||||||
mbstring
|
|
||||||
mysql
|
|
||||||
opcache
|
|
||||||
pgsql
|
|
||||||
xml
|
|
||||||
zip
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
cgi
|
|
||||||
cli
|
|
||||||
curl
|
|
||||||
dev
|
|
||||||
fpm
|
|
||||||
intl
|
|
||||||
mbstring
|
|
||||||
mysql
|
|
||||||
opcache
|
|
||||||
pgsql
|
|
||||||
xml
|
|
||||||
zip
|
|
||||||
@ -1,46 +1,11 @@
|
|||||||
{
|
{
|
||||||
"backward-compatibility-check": {
|
|
||||||
"type": "composer",
|
|
||||||
"repository": "roave/backward-compatibility-check",
|
|
||||||
"scope": "scoped"
|
|
||||||
},
|
|
||||||
"box": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "box-project/box",
|
|
||||||
"packagist": "humbug/box",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "",
|
|
||||||
"version_parameter": "--version"
|
|
||||||
},
|
|
||||||
"churn": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "bmitch/churn-php",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "",
|
|
||||||
"version_parameter": "-V"
|
|
||||||
},
|
|
||||||
"composer-dependency-analyser": {
|
|
||||||
"type": "composer",
|
|
||||||
"repository": "shipmonk/composer-dependency-analyser",
|
|
||||||
"scope": "scoped"
|
|
||||||
},
|
|
||||||
"composer-unused": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "composer-unused/composer-unused",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "",
|
|
||||||
"version_parameter": "-V"
|
|
||||||
},
|
|
||||||
"composer-normalize": {
|
"composer-normalize": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "ergebnis/composer-normalize",
|
"repository": "ergebnis/composer-normalize",
|
||||||
"extension": ".phar",
|
"extension": ".phar",
|
||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "diagnose"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
"cs2pr": {
|
"cs2pr": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
@ -50,12 +15,6 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
"easy-coding-standard": {
|
|
||||||
"type": "composer",
|
|
||||||
"alias": "ecs",
|
|
||||||
"repository": "symplify/easy-coding-standard",
|
|
||||||
"scope": "scoped"
|
|
||||||
},
|
|
||||||
"infection": {
|
"infection": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "infection/infection",
|
"repository": "infection/infection",
|
||||||
@ -64,11 +23,6 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
"name-collision-detector": {
|
|
||||||
"type": "composer",
|
|
||||||
"repository": "shipmonk/name-collision-detector",
|
|
||||||
"scope": "scoped"
|
|
||||||
},
|
|
||||||
"phan": {
|
"phan": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "phan/phan",
|
"repository": "phan/phan",
|
||||||
@ -77,35 +31,17 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-v"
|
"version_parameter": "-v"
|
||||||
},
|
},
|
||||||
"parallel-lint": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "php-parallel-lint/PHP-Parallel-Lint",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "v",
|
|
||||||
"version_parameter": "--version"
|
|
||||||
},
|
|
||||||
"php-cs-fixer": {
|
"php-cs-fixer": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "PHP-CS-Fixer/PHP-CS-Fixer",
|
"repository": "FriendsOfPHP/PHP-CS-Fixer",
|
||||||
"extension": ".phar",
|
"extension": ".phar",
|
||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"fetch_latest": "true",
|
|
||||||
"version_prefix": "v",
|
"version_prefix": "v",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
"php-scoper": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "humbug/php-scoper",
|
|
||||||
"packagist": "humbug/php-scoper",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "",
|
|
||||||
"version_parameter": "--version"
|
|
||||||
},
|
|
||||||
"phpcbf": {
|
"phpcbf": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "PHPCSStandards/PHP_CodeSniffer",
|
"repository": "squizlabs/PHP_CodeSniffer",
|
||||||
"extension": ".phar",
|
"extension": ".phar",
|
||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
@ -113,21 +49,12 @@
|
|||||||
},
|
},
|
||||||
"phpcs": {
|
"phpcs": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "PHPCSStandards/PHP_CodeSniffer",
|
"repository": "squizlabs/PHP_CodeSniffer",
|
||||||
"extension": ".phar",
|
"extension": ".phar",
|
||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "--version"
|
"version_parameter": "--version"
|
||||||
},
|
},
|
||||||
"phpDocumentor": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "phpDocumentor/phpDocumentor",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"alias": "phpdoc",
|
|
||||||
"version_prefix": "v",
|
|
||||||
"version_parameter": "--version"
|
|
||||||
},
|
|
||||||
"phpmd": {
|
"phpmd": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "phpmd/phpmd",
|
"repository": "phpmd/phpmd",
|
||||||
@ -136,14 +63,6 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "--version"
|
"version_parameter": "--version"
|
||||||
},
|
},
|
||||||
"phpspec": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "phpspec/phpspec",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "",
|
|
||||||
"version_parameter": "-V"
|
|
||||||
},
|
|
||||||
"phpstan": {
|
"phpstan": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "phpstan/phpstan",
|
"repository": "phpstan/phpstan",
|
||||||
@ -152,22 +71,6 @@
|
|||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
"pie": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "php/pie",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "",
|
|
||||||
"version_parameter": "-V"
|
|
||||||
},
|
|
||||||
"pint": {
|
|
||||||
"type": "phar",
|
|
||||||
"repository": "laravel/pint",
|
|
||||||
"extension": ".phar",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "v",
|
|
||||||
"version_parameter": "-V"
|
|
||||||
},
|
|
||||||
"psalm": {
|
"psalm": {
|
||||||
"type": "phar",
|
"type": "phar",
|
||||||
"repository": "vimeo/psalm",
|
"repository": "vimeo/psalm",
|
||||||
@ -178,66 +81,54 @@
|
|||||||
},
|
},
|
||||||
"behat": {
|
"behat": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"repository": "behat/behat",
|
"repository": "behat/behat"
|
||||||
"scope": "scoped"
|
|
||||||
},
|
},
|
||||||
"codeception": {
|
"codeception": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"repository": "codeception/codeception",
|
"repository": "codeception/codeception"
|
||||||
"scope": "scoped"
|
|
||||||
},
|
},
|
||||||
"automatic-composer-prefetcher": {
|
"automatic-composer-prefetcher": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"alias": "composer-prefetcher",
|
"alias": "composer-prefetcher",
|
||||||
"repository": "narrowspark/automatic-composer-prefetcher",
|
"repository": "narrowspark/automatic-composer-prefetcher"
|
||||||
"scope": "global"
|
|
||||||
},
|
},
|
||||||
"composer-require-checker": {
|
"composer-require-checker": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"repository": "maglnet/composer-require-checker",
|
"repository": "maglnet/composer-require-checker"
|
||||||
"scope": "scoped"
|
},
|
||||||
|
"composer-unused": {
|
||||||
|
"type": "composer",
|
||||||
|
"repository": "icanhazstring/composer-unused"
|
||||||
},
|
},
|
||||||
"flex": {
|
"flex": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"repository": "symfony/flex",
|
"repository": "symfony/flex"
|
||||||
"scope": "global"
|
|
||||||
},
|
},
|
||||||
"phinx": {
|
"phinx": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"repository": "robmorgan/phinx",
|
"repository": "robmorgan/phinx"
|
||||||
"scope": "scoped"
|
|
||||||
},
|
},
|
||||||
"phplint": {
|
"phplint": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"repository": "overtrue/phplint",
|
"repository": "overtrue/phplint"
|
||||||
"scope": "scoped"
|
},
|
||||||
|
"phpspec": {
|
||||||
|
"type": "composer",
|
||||||
|
"repository": "phpspec/phpspec"
|
||||||
},
|
},
|
||||||
"phpunit-bridge": {
|
"phpunit-bridge": {
|
||||||
"alias": "simple-phpunit",
|
"alias": "simple-phpunit",
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"repository": "symfony/phpunit-bridge",
|
"repository": "symfony/phpunit-bridge"
|
||||||
"scope": "global"
|
|
||||||
},
|
|
||||||
"phpunit-polyfills": {
|
|
||||||
"type": "composer",
|
|
||||||
"repository": "yoast/phpunit-polyfills",
|
|
||||||
"scope": "global"
|
|
||||||
},
|
},
|
||||||
"prestissimo": {
|
"prestissimo": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"repository": "hirak/prestissimo",
|
"repository": "hirak/prestissimo"
|
||||||
"scope": "global"
|
|
||||||
},
|
},
|
||||||
"vapor-cli": {
|
"vapor-cli": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"alias": "vapor",
|
"alias": "vapor",
|
||||||
"repository": "laravel/vapor-cli",
|
"repository": "laravel/vapor-cli"
|
||||||
"scope": "scoped"
|
|
||||||
},
|
|
||||||
"rector": {
|
|
||||||
"type": "composer",
|
|
||||||
"repository": "rector/rector",
|
|
||||||
"scope": "scoped"
|
|
||||||
},
|
},
|
||||||
"blackfire": {
|
"blackfire": {
|
||||||
"type": "custom-package",
|
"type": "custom-package",
|
||||||
@ -249,26 +140,12 @@
|
|||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "v"
|
"version_prefix": "v"
|
||||||
},
|
},
|
||||||
"mago": {
|
|
||||||
"type": "custom-package",
|
|
||||||
"repository": "carthage-software/mago",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": ""
|
|
||||||
},
|
|
||||||
"protoc": {
|
"protoc": {
|
||||||
"type": "custom-package",
|
"type": "custom-package",
|
||||||
"repository": "protocolbuffers/protobuf",
|
"repository": "protocolbuffers/protobuf",
|
||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "v"
|
"version_prefix": "v"
|
||||||
},
|
},
|
||||||
"symfony-cli": {
|
|
||||||
"alias": "symfony",
|
|
||||||
"type": "custom-package",
|
|
||||||
"repository": "symfony-cli/symfony-cli",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"version_prefix": "v",
|
|
||||||
"version_parameter": "-V"
|
|
||||||
},
|
|
||||||
"blackfire-player": {
|
"blackfire-player": {
|
||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"domain": "https://get.blackfire.io",
|
"domain": "https://get.blackfire.io",
|
||||||
@ -276,14 +153,6 @@
|
|||||||
"version_prefix": "v",
|
"version_prefix": "v",
|
||||||
"version_parameter": "-V"
|
"version_parameter": "-V"
|
||||||
},
|
},
|
||||||
"castor": {
|
|
||||||
"type": "custom-function",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"repository": "jolicode/castor",
|
|
||||||
"function": "castor",
|
|
||||||
"version_prefix": "v",
|
|
||||||
"version_parameter": "-V"
|
|
||||||
},
|
|
||||||
"composer": {
|
"composer": {
|
||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"domain": "https://getcomposer.org",
|
"domain": "https://getcomposer.org",
|
||||||
@ -314,7 +183,7 @@
|
|||||||
"phive": {
|
"phive": {
|
||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"repository": "phar-io/phive",
|
"repository": "phar-io/phive",
|
||||||
"domain": "https://github.com",
|
"domain": "https://phar.io",
|
||||||
"function": "phive",
|
"function": "phive",
|
||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "status"
|
"version_parameter": "status"
|
||||||
@ -330,9 +199,8 @@
|
|||||||
"phpunit": {
|
"phpunit": {
|
||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"repository": "sebastianbergmann/phpunit",
|
"repository": "sebastianbergmann/phpunit",
|
||||||
"packagist": "phpunit/phpunit",
|
|
||||||
"domain": "https://phar.phpunit.de",
|
"domain": "https://phar.phpunit.de",
|
||||||
"function": "phpunit",
|
"function": "phpcpd",
|
||||||
"version_prefix": "",
|
"version_prefix": "",
|
||||||
"version_parameter": "--version"
|
"version_parameter": "--version"
|
||||||
},
|
},
|
||||||
@ -345,6 +213,15 @@
|
|||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"function": "dev_tools"
|
"function": "dev_tools"
|
||||||
},
|
},
|
||||||
|
"symfony-cli": {
|
||||||
|
"type": "custom-function",
|
||||||
|
"function": "symfony",
|
||||||
|
"alias": "symfony",
|
||||||
|
"domain": "https://github.com",
|
||||||
|
"repository": "symfony/cli",
|
||||||
|
"version_prefix": "v",
|
||||||
|
"version_parameter": "version"
|
||||||
|
},
|
||||||
"wp-cli": {
|
"wp-cli": {
|
||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"function": "wp_cli",
|
"function": "wp_cli",
|
||||||
|
|||||||
@ -10,11 +10,8 @@
|
|||||||
"alias": "tool_alias",
|
"alias": "tool_alias",
|
||||||
"domain": "https://example.com",
|
"domain": "https://example.com",
|
||||||
"extension": ".ext",
|
"extension": ".ext",
|
||||||
"fetch_latest": "true",
|
|
||||||
"function": "function_name",
|
"function": "function_name",
|
||||||
"repository": "user/tool",
|
"repository": "user/tool",
|
||||||
"packagist": "user/tool",
|
|
||||||
"scope": "global, scoped",
|
|
||||||
"type": "phar, composer, custom-package or custom-function",
|
"type": "phar, composer, custom-package or custom-function",
|
||||||
"version_parameter": "--version",
|
"version_parameter": "--version",
|
||||||
"version_prefix": "v"
|
"version_prefix": "v"
|
||||||
@ -50,16 +47,6 @@
|
|||||||
".ext"
|
".ext"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"fetch_latest": {
|
|
||||||
"$id": "#/items/properties/fetch_latest",
|
|
||||||
"type": "string",
|
|
||||||
"title": "The fetch_latest schema",
|
|
||||||
"description": "Fetch the latest version from GitHub releases.",
|
|
||||||
"enum": [
|
|
||||||
"true",
|
|
||||||
"false"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"function": {
|
"function": {
|
||||||
"$id": "#/items/properties/function",
|
"$id": "#/items/properties/function",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -78,25 +65,6 @@
|
|||||||
"user/tool"
|
"user/tool"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"packagist": {
|
|
||||||
"$id": "#/items/properties/packagist",
|
|
||||||
"type": "string",
|
|
||||||
"title": "The repository schema",
|
|
||||||
"description": "Packagist repository of the tool in case different from repository.",
|
|
||||||
"examples": [
|
|
||||||
"user/tool"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"scope": {
|
|
||||||
"$id": "#/items/properties/scope",
|
|
||||||
"type": "string",
|
|
||||||
"title": "The scope schema",
|
|
||||||
"description": "Scope of tool installation: global or scoped",
|
|
||||||
"enum": [
|
|
||||||
"global",
|
|
||||||
"scoped"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"type": {
|
"type": {
|
||||||
"$id": "#/items/properties/type",
|
"$id": "#/items/properties/type",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
xdebug
|
|
||||||
pcov
|
|
||||||
112
src/core.ts
112
src/core.ts
@ -1,112 +0,0 @@
|
|||||||
import {EOL} from 'os';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Commands
|
|
||||||
*
|
|
||||||
* Command Format:
|
|
||||||
* ::name key=value,key=value::message
|
|
||||||
*
|
|
||||||
* @see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
interface CommandProperties {
|
|
||||||
[key: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sanitizes the message for use in a workflow command.
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
function toCommandValue(message: string | Error): string {
|
|
||||||
if (message instanceof Error) {
|
|
||||||
return message.toString();
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Escapes data for safe use in workflow command messages.
|
|
||||||
* @param s
|
|
||||||
*/
|
|
||||||
function escapeData(s: string | Error): string {
|
|
||||||
return toCommandValue(s)
|
|
||||||
.replace(/%/g, '%25')
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Escapes property values for safe use in workflow command properties.
|
|
||||||
* @param s
|
|
||||||
*/
|
|
||||||
function escapeProperty(s: string): string {
|
|
||||||
return s
|
|
||||||
.replace(/%/g, '%25')
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A')
|
|
||||||
.replace(/:/g, '%3A')
|
|
||||||
.replace(/,/g, '%2C');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Issues a command to the GitHub Actions runner.
|
|
||||||
*
|
|
||||||
* @param command - The command name to issue
|
|
||||||
* @param properties - Additional properties for the command (key-value pairs)
|
|
||||||
* @param message - The message to include with the command
|
|
||||||
*/
|
|
||||||
export function issueCommand(
|
|
||||||
command: string,
|
|
||||||
properties: CommandProperties,
|
|
||||||
message: string | Error
|
|
||||||
): void {
|
|
||||||
let cmdStr = `::${command}`;
|
|
||||||
|
|
||||||
if (properties && Object.keys(properties).length > 0) {
|
|
||||||
cmdStr += ' ';
|
|
||||||
const props = Object.entries(properties)
|
|
||||||
.filter(([, val]) => val)
|
|
||||||
.map(([key, val]) => `${key}=${escapeProperty(val)}`)
|
|
||||||
.join(',');
|
|
||||||
cmdStr += props;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdStr += `::${escapeData(message)}`;
|
|
||||||
process.stdout.write(cmdStr + EOL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an error issue.
|
|
||||||
* @param message - error issue message
|
|
||||||
*/
|
|
||||||
export function error(message: string | Error): void {
|
|
||||||
issueCommand('error', {}, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the action status to failed.
|
|
||||||
* When the action exits it will be with an exit code of 1.
|
|
||||||
* @param message - add error issue message
|
|
||||||
*/
|
|
||||||
export function setFailed(message: string | Error): void {
|
|
||||||
process.exitCode = 1;
|
|
||||||
error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of an input.
|
|
||||||
* The value is trimmed.
|
|
||||||
* Returns an empty string if the value is not defined.
|
|
||||||
*
|
|
||||||
* @param name - name of the input to get
|
|
||||||
* @param required - whether the input is required
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
export function getInput(name: string, required = false): string {
|
|
||||||
const val: string =
|
|
||||||
process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
|
||||||
if (required && !val) {
|
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
|
||||||
}
|
|
||||||
return val.trim();
|
|
||||||
}
|
|
||||||
105
src/coverage.ts
105
src/coverage.ts
@ -2,52 +2,32 @@ import * as utils from './utils';
|
|||||||
import * as extensions from './extensions';
|
import * as extensions from './extensions';
|
||||||
import * as config from './config';
|
import * as config from './config';
|
||||||
|
|
||||||
export async function checkXdebugError(
|
|
||||||
extension: string,
|
|
||||||
version: string
|
|
||||||
): Promise<string> {
|
|
||||||
if (
|
|
||||||
(/^5\.[3-6]$|^7\.[0-1]$/.test(version) && extension == 'xdebug3') ||
|
|
||||||
(/^8\.[0-9]$/.test(version) && extension == 'xdebug2')
|
|
||||||
) {
|
|
||||||
return extension + ' is not supported on PHP ' + version;
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to setup Xdebug
|
* Function to setup Xdebug
|
||||||
*
|
*
|
||||||
* @param extension
|
* @param extension
|
||||||
* @param version
|
* @param version
|
||||||
* @param os
|
* @param os_version
|
||||||
* @param pipe
|
* @param pipe
|
||||||
*/
|
*/
|
||||||
export async function addCoverageXdebug(
|
export async function addCoverageXdebug(
|
||||||
extension: string,
|
extension: string,
|
||||||
version: string,
|
version: string,
|
||||||
os: string,
|
os_version: string,
|
||||||
pipe: string
|
pipe: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
const error: string = await checkXdebugError(extension, version);
|
|
||||||
if (!error) {
|
|
||||||
script +=
|
script +=
|
||||||
(await extensions.addExtension(':pcov:false', version, os, true)) + pipe;
|
(await extensions.addExtension(':pcov', version, os_version, true)) + pipe;
|
||||||
extension = extension == 'xdebug3' ? 'xdebug' : extension;
|
|
||||||
script +=
|
script +=
|
||||||
(await extensions.addExtension(extension, version, os, true)) + pipe;
|
(await extensions.addExtension(extension, version, os_version, true)) +
|
||||||
script += await utils.setVariable(
|
pipe;
|
||||||
'xdebug_version',
|
script += await utils.addLog(
|
||||||
'php -r "echo phpversion(\'xdebug\');"',
|
'$tick',
|
||||||
os
|
extension,
|
||||||
|
'Xdebug enabled as coverage driver',
|
||||||
|
os_version
|
||||||
);
|
);
|
||||||
script +=
|
|
||||||
(await utils.getCommand(os, 'extension_log')) +
|
|
||||||
'xdebug "Xdebug $xdebug_version enabled as coverage driver"';
|
|
||||||
} else {
|
|
||||||
script += await utils.addLog('$cross', extension, error, os);
|
|
||||||
}
|
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,31 +35,34 @@ export async function addCoverageXdebug(
|
|||||||
* Function to setup PCOV
|
* Function to setup PCOV
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
* @param os
|
* @param os_version
|
||||||
* @param pipe
|
* @param pipe
|
||||||
*/
|
*/
|
||||||
export async function addCoveragePCOV(
|
export async function addCoveragePCOV(
|
||||||
version: string,
|
version: string,
|
||||||
os: string,
|
os_version: string,
|
||||||
pipe: string
|
pipe: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
default:
|
default:
|
||||||
script +=
|
script +=
|
||||||
(await extensions.addExtension(':xdebug:false', version, os, true)) +
|
(await extensions.addExtension(':xdebug', version, os_version, true)) +
|
||||||
pipe;
|
pipe;
|
||||||
script +=
|
script +=
|
||||||
(await extensions.addExtension('pcov', version, os, true)) + pipe;
|
(await extensions.addExtension('pcov', version, os_version, true)) +
|
||||||
script += (await config.addINIValues('pcov.enabled=1', os, true)) + '\n';
|
pipe;
|
||||||
script += await utils.setVariable(
|
|
||||||
'pcov_version',
|
|
||||||
'php -r "echo phpversion(\'pcov\');"',
|
|
||||||
os
|
|
||||||
);
|
|
||||||
script +=
|
script +=
|
||||||
(await utils.getCommand(os, 'extension_log')) +
|
(await config.addINIValues('pcov.enabled=1', os_version, true)) + '\n';
|
||||||
'pcov "PCOV $pcov_version enabled as coverage driver"';
|
|
||||||
|
// success
|
||||||
|
script += await utils.addLog(
|
||||||
|
'$tick',
|
||||||
|
'coverage: pcov',
|
||||||
|
'PCOV enabled as coverage driver',
|
||||||
|
os_version
|
||||||
|
);
|
||||||
|
// version is not supported
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case /5\.[3-6]|7\.0/.test(version):
|
case /5\.[3-6]|7\.0/.test(version):
|
||||||
@ -87,7 +70,7 @@ export async function addCoveragePCOV(
|
|||||||
'$cross',
|
'$cross',
|
||||||
'pcov',
|
'pcov',
|
||||||
'PHP 7.1 or newer is required',
|
'PHP 7.1 or newer is required',
|
||||||
os
|
os_version
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -99,20 +82,26 @@ export async function addCoveragePCOV(
|
|||||||
* Function to disable Xdebug and PCOV
|
* Function to disable Xdebug and PCOV
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
* @param os
|
* @param os_version
|
||||||
* @param pipe
|
* @param pipe
|
||||||
*/
|
*/
|
||||||
export async function disableCoverage(
|
export async function disableCoverage(
|
||||||
version: string,
|
version: string,
|
||||||
os: string,
|
os_version: string,
|
||||||
pipe: string
|
pipe: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
script +=
|
script +=
|
||||||
(await extensions.addExtension(':pcov:false', version, os, true)) + pipe;
|
(await extensions.addExtension(':pcov', version, os_version, true)) + pipe;
|
||||||
script +=
|
script +=
|
||||||
(await extensions.addExtension(':xdebug:false', version, os, true)) + pipe;
|
(await extensions.addExtension(':xdebug', version, os_version, true)) +
|
||||||
script += await utils.addLog('$tick', 'none', 'Disabled Xdebug and PCOV', os);
|
pipe;
|
||||||
|
script += await utils.addLog(
|
||||||
|
'$tick',
|
||||||
|
'none',
|
||||||
|
'Disabled Xdebug and PCOV',
|
||||||
|
os_version
|
||||||
|
);
|
||||||
|
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
@ -122,27 +111,31 @@ export async function disableCoverage(
|
|||||||
*
|
*
|
||||||
* @param coverage_driver
|
* @param coverage_driver
|
||||||
* @param version
|
* @param version
|
||||||
* @param os
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
export async function addCoverage(
|
export async function addCoverage(
|
||||||
coverage_driver: string,
|
coverage_driver: string,
|
||||||
version: string,
|
version: string,
|
||||||
os: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
coverage_driver = coverage_driver.toLowerCase();
|
coverage_driver = coverage_driver.toLowerCase();
|
||||||
const script: string = '\n' + (await utils.stepLog('Setup Coverage', os));
|
const script: string =
|
||||||
const pipe: string = (await utils.suppressOutput(os)) + '\n';
|
'\n' + (await utils.stepLog('Setup Coverage', os_version));
|
||||||
|
const pipe: string = (await utils.suppressOutput(os_version)) + '\n';
|
||||||
switch (coverage_driver) {
|
switch (coverage_driver) {
|
||||||
case 'pcov':
|
case 'pcov':
|
||||||
return script + (await addCoveragePCOV(version, os, pipe));
|
return script + (await addCoveragePCOV(version, os_version, pipe));
|
||||||
case 'xdebug':
|
case 'xdebug':
|
||||||
case 'xdebug2':
|
|
||||||
case 'xdebug3':
|
case 'xdebug3':
|
||||||
return (
|
return (
|
||||||
script + (await addCoverageXdebug(coverage_driver, version, os, pipe))
|
script + (await addCoverageXdebug('xdebug', version, os_version, pipe))
|
||||||
|
);
|
||||||
|
case 'xdebug2':
|
||||||
|
return (
|
||||||
|
script + (await addCoverageXdebug('xdebug2', version, os_version, pipe))
|
||||||
);
|
);
|
||||||
case 'none':
|
case 'none':
|
||||||
return script + (await disableCoverage(version, os, pipe));
|
return script + (await disableCoverage(version, os_version, pipe));
|
||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,43 +21,27 @@ export async function addExtensionDarwin(
|
|||||||
switch (true) {
|
switch (true) {
|
||||||
// match :extension
|
// match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\ndisable_extension' + ext_name.replace(/:/g, ' ');
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
|
||||||
// Match none
|
|
||||||
case /^none$/.test(ext_name):
|
|
||||||
add_script += '\ndisable_all_shared';
|
|
||||||
return;
|
return;
|
||||||
// match extensions for compiling from source
|
// match extensions for compiling from source
|
||||||
case /.+-.+\/.+@.+/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 7.4relay...8.5relay
|
// match 5.3blackfire...8.0blackfire
|
||||||
// match 5.3blackfire...8.5blackfire
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
// match 5.3blackfire-(semver)...8.5blackfire-(semver)
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match couchbase, event, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 5.3ioncube...8.4ioncube
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
// match 7.0zephir_parser...8.4zephir_parser
|
|
||||||
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
|
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^couchbase$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
case /^couchbase|^event|^gearman$|^geos$|^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
|
||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-4])phalcon5?/.test(
|
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
|
||||||
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
'extensions',
|
'ext',
|
||||||
extension,
|
extension,
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
@ -72,7 +56,7 @@ export async function addExtensionDarwin(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match semver
|
// match semver
|
||||||
case /.+-\d+(\.\d+\.\d+.*)?/.test(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,
|
||||||
@ -84,15 +68,15 @@ 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 brew extensions
|
// match 5.6 and newer - amqp, apcu, grpc, igbinary, imagick, imap, msgpack, protobuf, raphf, rdkafka, redis, swoole, xdebug, xdebug2, zmq
|
||||||
case /(?<!5\.[3-5])(amqp|apcu|brotli|excimer|expect|gmagick|gnupg|grpc|igbinary|imagick|imap|interbase|mailparse|maxminddb|mcrypt|memcache|memcached|mongodb|mongodb1|msgpack|newrelic|oauth|opentelemetry|pdo_firebird|pinba|protobuf|psr|raphf|rdkafka|redis|scalar_objects|seaslog|snmp|spx|ssh2|swoole|uopz|uploadprogress|uuid|vld|xdebug|xdebug2|xhprof|yaml|zmq|zstd)/.test(
|
// match 7.1 and newer - pcov
|
||||||
|
// match 5.6 to 7.4 - propro
|
||||||
|
case /(?<!5\.[3-5])(amqp|apcu|grpc|igbinary|imagick|imap|memcache|memcached|msgpack|protobuf|psr|raphf|rdkafka|redis|swoole|xdebug|xdebug2|zmq)/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
|
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-4])(propro|lua)/.test(version_extension):
|
|
||||||
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
|
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension):
|
||||||
case /^(8\.[0-5])swow$/.test(version_extension):
|
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_brew_extension',
|
'\nadd_brew_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -131,37 +115,24 @@ export async function addExtensionWindows(
|
|||||||
switch (true) {
|
switch (true) {
|
||||||
// Match :extension
|
// Match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nDisable-Extension' + ext_name.replace(/:/g, ' ');
|
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||||
break;
|
break;
|
||||||
// Match none
|
// match 5.3blackfire...8.0blackfire
|
||||||
case /^none$/.test(ext_name):
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
add_script += '\nDisable-AllShared';
|
// match pdo_oci and oci8
|
||||||
break;
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 5.3blackfire...8.5blackfire
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.3blackfire-(semver)...8.5blackfire-(semver)
|
// match 7.1pecl_http...8.0pecl_http and 7.1http...8.0http
|
||||||
// match ibm_db2, pdo_ibm, pdo_oci and oci8
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
// match 5.3ioncube...8.4ioncube
|
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
|
|
||||||
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
|
|
||||||
// match 7.0zephir_parser...8.4zephir_parser
|
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
case /^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^pdo_firebird$/.test(
|
|
||||||
extension
|
|
||||||
):
|
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
|
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
|
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
|
||||||
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
|
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
||||||
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
|
case /^(7\.[1-4]|8\.0)(pecl_)?http/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
'extensions',
|
'ext',
|
||||||
extension,
|
extension,
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
@ -182,6 +153,15 @@ export async function addExtensionWindows(
|
|||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
// match semver without state
|
||||||
|
case /.+-\d+\.\d+\.\d+$/.test(extension):
|
||||||
|
add_script += await utils.joins(
|
||||||
|
'\nAdd-Extension',
|
||||||
|
ext_name,
|
||||||
|
'stable',
|
||||||
|
ext_version
|
||||||
|
);
|
||||||
|
break;
|
||||||
// match semver with state
|
// match semver with state
|
||||||
case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(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(
|
||||||
@ -194,15 +174,6 @@ export async function addExtensionWindows(
|
|||||||
matches[1]
|
matches[1]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
// match semver without state
|
|
||||||
case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
|
|
||||||
add_script += await utils.joins(
|
|
||||||
'\nAdd-Extension',
|
|
||||||
ext_name,
|
|
||||||
'stable',
|
|
||||||
ext_version
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
// match 7.2xdebug2 to 7.4xdebug2
|
// match 7.2xdebug2 to 7.4xdebug2
|
||||||
case /7\.[2-4]xdebug2/.test(version_extension):
|
case /7\.[2-4]xdebug2/.test(version_extension):
|
||||||
add_script += '\nAdd-Extension xdebug stable 2.9.8';
|
add_script += '\nAdd-Extension xdebug stable 2.9.8';
|
||||||
@ -250,56 +221,39 @@ export async function addExtensionLinux(
|
|||||||
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
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||||
.split(/-(.+)/)
|
|
||||||
.filter(Boolean);
|
|
||||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// Match :extension
|
// Match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\ndisable_extension' + ext_name.replace(/:/g, ' ');
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
|
||||||
// Match none
|
|
||||||
case /^none$/.test(ext_name):
|
|
||||||
add_script += '\ndisable_all_shared';
|
|
||||||
return;
|
return;
|
||||||
// match extensions for compiling from source
|
// match extensions for compiling from source
|
||||||
case /.+-.+\/.+@.+/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 7.4relay...8.5relay
|
// match 5.3blackfire...8.0blackfire
|
||||||
// match 5.3blackfire...8.5blackfire
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
// match 5.3blackfire-(semver)...8.5blackfire-(semver)
|
|
||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match couchbase, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...8.4ioncube
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 7.0zephir_parser...8.4zephir_parser
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
|
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^couchbase|^event|^gearman$|^geos$|^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
case /^couchbase$|^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):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
|
||||||
case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
'extensions',
|
'ext',
|
||||||
extension,
|
extension,
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -314,7 +268,7 @@ export async function addExtensionLinux(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match semver versions
|
// match semver versions
|
||||||
case /.+-\d+(\.\d+\.\d+.*)?/.test(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,
|
||||||
@ -357,20 +311,20 @@ export async function addExtensionLinux(
|
|||||||
*
|
*
|
||||||
* @param extension_csv
|
* @param extension_csv
|
||||||
* @param version
|
* @param version
|
||||||
* @param os
|
* @param os_version
|
||||||
* @param no_step
|
* @param no_step
|
||||||
*/
|
*/
|
||||||
export async function addExtension(
|
export async function addExtension(
|
||||||
extension_csv: string,
|
extension_csv: string,
|
||||||
version: string,
|
version: string,
|
||||||
os: string,
|
os_version: string,
|
||||||
no_step = false
|
no_step = false
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const log: string = await utils.stepLog('Setup Extensions', os);
|
const log: string = await utils.stepLog('Setup Extensions', os_version);
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
switch (no_step) {
|
switch (no_step) {
|
||||||
case true:
|
case true:
|
||||||
script += log + (await utils.suppressOutput(os));
|
script += log + (await utils.suppressOutput(os_version));
|
||||||
break;
|
break;
|
||||||
case false:
|
case false:
|
||||||
default:
|
default:
|
||||||
@ -378,7 +332,7 @@ export async function addExtension(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (os) {
|
switch (os_version) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return script + (await addExtensionWindows(extension_csv, version));
|
return script + (await addExtensionWindows(extension_csv, version));
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
@ -387,8 +341,8 @@ export async function addExtension(
|
|||||||
return script + (await addExtensionLinux(extension_csv, version));
|
return script + (await addExtensionLinux(extension_csv, version));
|
||||||
default:
|
default:
|
||||||
return await utils.log(
|
return await utils.log(
|
||||||
'Platform ' + os + ' is not supported',
|
'Platform ' + os_version + ' is not supported',
|
||||||
os,
|
os_version,
|
||||||
'error'
|
'error'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
42
src/fetch.ts
42
src/fetch.ts
@ -1,42 +0,0 @@
|
|||||||
/**
|
|
||||||
* Redirect status codes set for O(1) lookup
|
|
||||||
*/
|
|
||||||
const REDIRECT_CODES = new Set([301, 302, 303, 307, 308]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to fetch a URL using native fetch API (Node 24+)
|
|
||||||
*
|
|
||||||
* @param input_url
|
|
||||||
* @param auth_token
|
|
||||||
* @param redirect_count
|
|
||||||
*/
|
|
||||||
export async function fetch(
|
|
||||||
input_url: string,
|
|
||||||
auth_token?: string,
|
|
||||||
redirect_count = 5
|
|
||||||
): Promise<Record<string, string>> {
|
|
||||||
const headers: Record<string, string> = {
|
|
||||||
'User-Agent': `Mozilla/5.0 (${process.platform} ${process.arch}) setup-php`
|
|
||||||
};
|
|
||||||
if (auth_token) {
|
|
||||||
headers['Authorization'] = 'Bearer ' + auth_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await globalThis.fetch(input_url, {
|
|
||||||
headers,
|
|
||||||
redirect: redirect_count > 0 ? 'follow' : 'manual'
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
const data = await response.text();
|
|
||||||
return {data};
|
|
||||||
} else if (REDIRECT_CODES.has(response.status) && redirect_count <= 0) {
|
|
||||||
return {error: `${response.status}: Redirect error`};
|
|
||||||
} else {
|
|
||||||
return {error: `${response.status}: ${response.statusText}`};
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
return {error: `Fetch error: ${(error as Error).message}`};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +1,6 @@
|
|||||||
import path from 'path';
|
|
||||||
import fs from 'fs';
|
|
||||||
import {exec} from '@actions/exec';
|
import {exec} from '@actions/exec';
|
||||||
|
import * as core from '@actions/core';
|
||||||
import * as config from './config';
|
import * as config from './config';
|
||||||
import * as core from './core';
|
|
||||||
import * as coverage from './coverage';
|
import * as coverage from './coverage';
|
||||||
import * as extensions from './extensions';
|
import * as extensions from './extensions';
|
||||||
import * as tools from './tools';
|
import * as tools from './tools';
|
||||||
@ -11,59 +9,69 @@ import * as utils from './utils';
|
|||||||
/**
|
/**
|
||||||
* Build the script
|
* Build the script
|
||||||
*
|
*
|
||||||
* @param os
|
* @param filename
|
||||||
|
* @param version
|
||||||
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
export async function getScript(os: string): Promise<string> {
|
export async function getScript(
|
||||||
const url = 'https://setup-php.com/sponsor';
|
filename: string,
|
||||||
const filename = os + (await utils.scriptExtension(os));
|
version: string,
|
||||||
const script_path = path.join(__dirname, '../src/scripts', filename);
|
os_version: string
|
||||||
const run_path = script_path.replace(os, 'run');
|
): Promise<string> {
|
||||||
|
const name = 'setup-php';
|
||||||
|
const url = 'https://setup-php.com/support';
|
||||||
|
// taking inputs
|
||||||
|
process.env['fail_fast'] = await utils.getInput('fail-fast', false);
|
||||||
const extension_csv: string = await utils.getInput('extensions', false);
|
const extension_csv: string = await utils.getInput('extensions', false);
|
||||||
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
||||||
const coverage_driver: string = await utils.getInput('coverage', false);
|
const coverage_driver: string = await utils.getInput('coverage', false);
|
||||||
const tools_csv: string = await utils.getInput('tools', false);
|
const tools_csv: string = await utils.getInput('tools', false);
|
||||||
const version: string = await utils.parseVersion(
|
|
||||||
await utils.readPHPVersion()
|
let script: string = await utils.readFile(filename, 'src/scripts');
|
||||||
);
|
script += await tools.addTools(tools_csv, version, os_version);
|
||||||
const ini_file: string = await utils.parseIniFile(
|
|
||||||
await utils.getInput('ini-file', false)
|
|
||||||
);
|
|
||||||
let script = await utils.joins('.', script_path, version, ini_file);
|
|
||||||
if (extension_csv) {
|
if (extension_csv) {
|
||||||
script += await extensions.addExtension(extension_csv, version, os);
|
script += await extensions.addExtension(extension_csv, version, os_version);
|
||||||
}
|
}
|
||||||
script += await tools.addTools(tools_csv, version, os);
|
|
||||||
if (coverage_driver) {
|
if (coverage_driver) {
|
||||||
script += await coverage.addCoverage(coverage_driver, version, os);
|
script += await coverage.addCoverage(coverage_driver, version, os_version);
|
||||||
}
|
}
|
||||||
if (ini_values_csv) {
|
if (ini_values_csv) {
|
||||||
script += await config.addINIValues(ini_values_csv, os);
|
script += await config.addINIValues(ini_values_csv, os_version);
|
||||||
}
|
|
||||||
script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os));
|
|
||||||
script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os));
|
|
||||||
|
|
||||||
fs.writeFileSync(run_path, script, {mode: 0o755});
|
|
||||||
|
|
||||||
return run_path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
script += '\n' + (await utils.stepLog('Support this project', os_version));
|
||||||
* Function to set environment variables based on inputs.
|
script += '\n' + (await utils.addLog('$tick', name, url, os_version));
|
||||||
*/
|
|
||||||
export async function setEnv(): Promise<void> {
|
return await utils.writeScript(filename, script);
|
||||||
process.env['fail_fast'] = await utils.getInput('fail-fast', false);
|
|
||||||
process.env['GITHUB_TOKEN'] ??= await utils.getInput('github-token', false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the script
|
* Run the script
|
||||||
*/
|
*/
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
await setEnv();
|
try {
|
||||||
const os: string = process.platform;
|
if ((await utils.readEnv('ImageOS')) == 'ubuntu16') {
|
||||||
const tool = await utils.scriptTool(os);
|
core.setFailed(
|
||||||
const run_path = await getScript(os);
|
'setup-php is not supported on Ubuntu 16.04. Please upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452'
|
||||||
await exec(tool + run_path);
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const version: string = await utils.parseVersion(
|
||||||
|
await utils.getInput('php-version', true)
|
||||||
|
);
|
||||||
|
if (version) {
|
||||||
|
const os_version: string = process.platform;
|
||||||
|
const tool = await utils.scriptTool(os_version);
|
||||||
|
const script = os_version + (await utils.scriptExtension(os_version));
|
||||||
|
const location = await getScript(script, version, os_version);
|
||||||
|
await exec(await utils.joins(tool, location, version, __dirname));
|
||||||
|
} else {
|
||||||
|
core.setFailed('Unable to get the PHP version');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
core.setFailed(error.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// call the run function
|
// call the run function
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
import * as cv from 'compare-versions';
|
|
||||||
import * as fetch from './fetch';
|
|
||||||
|
|
||||||
type RS = Record<string, string>;
|
|
||||||
type RSRS = Record<string, RS>;
|
|
||||||
|
|
||||||
export async function search(
|
|
||||||
package_name: string,
|
|
||||||
php_version: string
|
|
||||||
): Promise<string | null> {
|
|
||||||
const response = await fetch.fetch(
|
|
||||||
`https://repo.packagist.org/p2/${package_name}.json`
|
|
||||||
);
|
|
||||||
if (response.error || response.data === '[]') {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = JSON.parse(response['data']);
|
|
||||||
if (data && data.packages) {
|
|
||||||
const versions = data.packages[package_name];
|
|
||||||
versions.sort((a: RS, b: RS) => cv.compareVersions(b.version, a.version));
|
|
||||||
|
|
||||||
const result = versions.find((versionData: RSRS) => {
|
|
||||||
if (versionData?.require?.php) {
|
|
||||||
return versionData?.require?.php
|
|
||||||
.split('|')
|
|
||||||
.some(
|
|
||||||
require => require && cv.satisfies(php_version + '.0', require)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
return result ? result.version : null;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
314
src/scripts/common.sh
Normal file
314
src/scripts/common.sh
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
# Variables
|
||||||
|
export tick="✓"
|
||||||
|
export cross="✗"
|
||||||
|
export curl_opts=(-sL)
|
||||||
|
export old_versions="5.[3-5]"
|
||||||
|
export jit_versions="8.[0-9]"
|
||||||
|
export nightly_versions="8.[1-9]"
|
||||||
|
export xdebug3_versions="7.[2-4]|8.[0-9]"
|
||||||
|
export tool_path_dir="/usr/local/bin"
|
||||||
|
export composer_home="$HOME/.composer"
|
||||||
|
export composer_bin="$composer_home/vendor/bin"
|
||||||
|
export composer_json="$composer_home/composer.json"
|
||||||
|
export composer_lock="$composer_home/composer.lock"
|
||||||
|
export latest="releases/latest/download"
|
||||||
|
export github="https://github.com/shivammathur"
|
||||||
|
export jsdeliver="https://cdn.jsdelivr.net/gh/shivammathur"
|
||||||
|
|
||||||
|
# Function to log start of a operation.
|
||||||
|
step_log() {
|
||||||
|
message=$1
|
||||||
|
printf "\n\033[90;1m==> \033[0m\033[37;1m%s\033[0m\n" "$message"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to log result of a operation.
|
||||||
|
add_log() {
|
||||||
|
mark=$1
|
||||||
|
subject=$2
|
||||||
|
message=$3
|
||||||
|
if [ "$mark" = "$tick" ]; then
|
||||||
|
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||||
|
else
|
||||||
|
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||||
|
[ "$fail_fast" = "true" ] && exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to log result of installing extension.
|
||||||
|
add_extension_log() {
|
||||||
|
(
|
||||||
|
check_extension "$(echo "$1" | cut -d '-' -f 1)" && add_log "$tick" "$1" "$2"
|
||||||
|
) || add_log "$cross" "$1" "Could not install $1 on PHP ${semver:?}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to read env inputs.
|
||||||
|
read_env() {
|
||||||
|
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
||||||
|
[ "$update" = false ] && [[ -n ${UPDATE} ]] && update="${UPDATE}"
|
||||||
|
[[ -z "${runner}" ]] && runner='github' && RUNNER='github' || runner="${runner}"
|
||||||
|
[ "$runner" = false ] && [[ -n ${RUNNER} ]] && runner="${RUNNER}"
|
||||||
|
[[ -z "${fail_fast}" ]] && fail_fast='false' || fail_fast="${fail_fast}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to download a file using cURL.
|
||||||
|
# mode: -s pipe to stdout, -v save file and return status code
|
||||||
|
# execute: -e save file as executable
|
||||||
|
get() {
|
||||||
|
mode=$1
|
||||||
|
execute=$2
|
||||||
|
file_path=$3
|
||||||
|
shift 3
|
||||||
|
links=("$@")
|
||||||
|
if [ "$mode" = "-s" ]; then
|
||||||
|
sudo curl "${curl_opts[@]}" "${links[0]}"
|
||||||
|
else
|
||||||
|
for link in "${links[@]}"; do
|
||||||
|
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
|
||||||
|
[ "$status_code" = "200" ] && break
|
||||||
|
done
|
||||||
|
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
|
||||||
|
[ "$mode" = "-v" ] && echo "$status_code"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to download and run scripts from GitHub releases with jsdeliver fallback.
|
||||||
|
run_script() {
|
||||||
|
repo=$1
|
||||||
|
shift
|
||||||
|
args=("$@")
|
||||||
|
get -q -e /tmp/install.sh "$github/$repo/$latest/install.sh" "$jsdeliver/$1@main/scripts/install.sh"
|
||||||
|
bash /tmp/install.sh "${args[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install required packages on self-hosted runners.
|
||||||
|
self_hosted_setup() {
|
||||||
|
if [ "$runner" = "self-hosted" ]; then
|
||||||
|
if [[ "${version:?}" =~ $old_versions ]]; then
|
||||||
|
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
self_hosted_helper >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to test if extension is loaded.
|
||||||
|
check_extension() {
|
||||||
|
extension=$1
|
||||||
|
if [ "$extension" != "mysql" ]; then
|
||||||
|
php -m | grep -i -q -w "$extension"
|
||||||
|
else
|
||||||
|
php -m | grep -i -q "$extension"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to enable cached extensions.
|
||||||
|
enable_cache_extension() {
|
||||||
|
deps=()
|
||||||
|
for ext in /tmp/extcache/"$1"/*; do
|
||||||
|
deps+=("$(basename "$ext")")
|
||||||
|
done
|
||||||
|
if [ "x${deps[*]}" = "x" ]; then
|
||||||
|
sudo rm -rf /tmp/extcache/"$1"
|
||||||
|
enable_extension "$1" "$2"
|
||||||
|
else
|
||||||
|
deps+=("$1")
|
||||||
|
if php "${deps[@]/#/-d ${2}=}" -m 2>/dev/null | grep -i -q "$1"; then
|
||||||
|
for ext in "${deps[@]}"; do
|
||||||
|
sudo rm -rf /tmp/extcache/"$ext"
|
||||||
|
enable_extension "$ext" "$2"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to enable existing extensions.
|
||||||
|
enable_extension() {
|
||||||
|
modules_dir="/var/lib/php/modules/$version"
|
||||||
|
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
||||||
|
if [ -d /tmp/extcache/"$1" ]; then
|
||||||
|
enable_cache_extension "$1" "$2"
|
||||||
|
elif ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
|
||||||
|
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to configure PHP
|
||||||
|
configure_php() {
|
||||||
|
(
|
||||||
|
echo -e "date.timezone=UTC\nmemory_limit=-1"
|
||||||
|
[[ "$version" =~ $jit_versions ]] && echo -e "opcache.enable=1\nopcache.jit_buffer_size=256M\nopcache.jit=1235"
|
||||||
|
[[ "$version" =~ $xdebug3_versions ]] && echo -e "xdebug.mode=coverage"
|
||||||
|
) | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to configure PECL.
|
||||||
|
configure_pecl() {
|
||||||
|
if ! [ -e /tmp/pecl_config ]; then
|
||||||
|
for script in pear pecl; do
|
||||||
|
sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
|
||||||
|
sudo "$script" channel-update "$script".php.net
|
||||||
|
done
|
||||||
|
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get the PECL version of an extension.
|
||||||
|
get_pecl_version() {
|
||||||
|
extension=$1
|
||||||
|
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
|
||||||
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
|
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
||||||
|
pecl_version=$(echo "$response" | grep -m 1 -Eio "([0-9]+\.[0-9]+\.[0-9]+${stability}[0-9]+)")
|
||||||
|
if [ ! "$pecl_version" ]; then
|
||||||
|
pecl_version=$(echo "$response" | grep -m 1 -Eo "([0-9]+\.[0-9]+\.[0-9]+)")
|
||||||
|
fi
|
||||||
|
echo "$pecl_version"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install PECL extensions and accept default options
|
||||||
|
pecl_install() {
|
||||||
|
local extension=$1
|
||||||
|
add_pecl >/dev/null 2>&1
|
||||||
|
yes '' 2>/dev/null | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install a specific version of PECL extension.
|
||||||
|
add_pecl_extension() {
|
||||||
|
extension=$1
|
||||||
|
pecl_version=$2
|
||||||
|
prefix=$3
|
||||||
|
enable_extension "$extension" "$prefix"
|
||||||
|
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
||||||
|
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
||||||
|
fi
|
||||||
|
ext_version=$(php -r "echo phpversion('$extension');")
|
||||||
|
if [ "$ext_version" = "$pecl_version" ]; then
|
||||||
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
|
else
|
||||||
|
disable_extension "$extension" >/dev/null 2>&1
|
||||||
|
delete_extension "$extension" >/dev/null 2>&1
|
||||||
|
pecl_install "$extension-$pecl_version"
|
||||||
|
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to setup pre-release extensions using PECL.
|
||||||
|
add_unstable_extension() {
|
||||||
|
extension=$1
|
||||||
|
stability=$2
|
||||||
|
prefix=$3
|
||||||
|
pecl_version=$(get_pecl_version "$extension" "$stability")
|
||||||
|
add_pecl_extension "$extension" "$pecl_version" "$prefix"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to extract tool version.
|
||||||
|
get_tool_version() {
|
||||||
|
tool=$1
|
||||||
|
param=$2
|
||||||
|
alp="[a-zA-Z0-9]"
|
||||||
|
version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
|
||||||
|
if [ "$tool" = "composer" ]; then
|
||||||
|
if [ "$param" != "snapshot" ]; then
|
||||||
|
composer_version="$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
|
||||||
|
else
|
||||||
|
composer_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")+$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "[a-zA-z0-9]+" | tail -n 1)"
|
||||||
|
fi
|
||||||
|
echo "$composer_version" | sudo tee /tmp/composer_version
|
||||||
|
else
|
||||||
|
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to configure composer
|
||||||
|
configure_composer() {
|
||||||
|
tool_path=$1
|
||||||
|
sudo ln -sf "$tool_path" "$tool_path.phar"
|
||||||
|
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
add_log "$cross" "composer" "Could not download composer"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! [ -d "$composer_home" ]; then
|
||||||
|
sudo -u "$(id -un)" -g "$(id -gn)" mkdir -p -m=00755 "$composer_home"
|
||||||
|
else
|
||||||
|
sudo chown -R "$(id -un)":"$(id -gn)" "$composer_home"
|
||||||
|
fi
|
||||||
|
if ! [ -e "$composer_json" ]; then
|
||||||
|
echo '{}' | tee "$composer_json" >/dev/null
|
||||||
|
chmod 644 "$composer_json"
|
||||||
|
fi
|
||||||
|
composer -q config -g process-timeout 0
|
||||||
|
echo "$composer_bin" >>"$GITHUB_PATH"
|
||||||
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
|
composer -q config -g github-oauth.github.com "$COMPOSER_TOKEN"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to setup a remote tool.
|
||||||
|
add_tool() {
|
||||||
|
url=$1
|
||||||
|
tool=$2
|
||||||
|
ver_param=$3
|
||||||
|
tool_path="$tool_path_dir/$tool"
|
||||||
|
if ! [[ "$PATH" =~ $tool_path_dir ]]; then
|
||||||
|
export PATH=$PATH:"$tool_path_dir"
|
||||||
|
echo "export PATH=\$PATH:$tool_path_dir" | sudo tee -a "$GITHUB_ENV" >/dev/null
|
||||||
|
fi
|
||||||
|
if [ ! -e "$tool_path" ]; then
|
||||||
|
rm -rf "$tool_path"
|
||||||
|
fi
|
||||||
|
IFS="," read -r -a url <<<"$url"
|
||||||
|
status_code=$(get -v -e "$tool_path" "${url[@]}")
|
||||||
|
if [ "$status_code" != "200" ] && [[ "${url[0]}" =~ .*github.com.*releases.*latest.* ]]; then
|
||||||
|
url[0]="${url[0]//releases\/latest\/download/releases/download/$(get -s -n "" "$(echo "${url[0]}" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "${url[0]}" | sed -e "s/.*\///")" | cut -d '/' -f 1)}"
|
||||||
|
status_code=$(get -v -e "$tool_path" "${url[0]}")
|
||||||
|
fi
|
||||||
|
if [ "$status_code" = "200" ]; then
|
||||||
|
add_tools_helper "$tool"
|
||||||
|
tool_version=$(get_tool_version "$tool" "$ver_param")
|
||||||
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
|
else
|
||||||
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to setup a tool using composer.
|
||||||
|
add_composertool() {
|
||||||
|
tool=$1
|
||||||
|
release=$2
|
||||||
|
prefix=$3
|
||||||
|
if [[ "$tool" =~ prestissimo|composer-prefetcher ]]; then
|
||||||
|
composer_version=$(cat /tmp/composer_version)
|
||||||
|
if [ "$(echo "$composer_version" | cut -d'.' -f 1)" != "1" ]; then
|
||||||
|
echo "::warning:: Skipping $tool, as it does not support Composer $composer_version. Specify composer:v1 in tools to use $tool"
|
||||||
|
add_log "$cross" "$tool" "Skipped"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
(
|
||||||
|
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
||||||
|
composer global require "$prefix$release" 2>&1 | tee /tmp/composer.log >/dev/null 2>&1
|
||||||
|
log=$(grep "$prefix$tool" /tmp/composer.log) &&
|
||||||
|
tool_version=$(get_tool_version 'echo' "$log") &&
|
||||||
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
|
add_tools_helper "$tool"
|
||||||
|
if [ -e "$composer_bin/composer" ]; then
|
||||||
|
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get PHP version in semver format.
|
||||||
|
php_semver() {
|
||||||
|
php -v | grep -Eo -m 1 "[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z]+([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"
|
||||||
|
}
|
||||||
@ -1,73 +1,61 @@
|
|||||||
# Handle dependency extensions
|
# Function to setup environment for self-hosted runners.
|
||||||
handle_dependency_extensions() {
|
self_hosted_helper() {
|
||||||
local formula=$1
|
if ! command -v brew >/dev/null; then
|
||||||
local extension=$2
|
step_log "Setup Brew"
|
||||||
formula_file="${tap_dir:?}/$ext_tap/Formula/$extension@${version:?}.rb"
|
get -q -e "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/master/install.sh" && /tmp/install.sh >/dev/null 2>&1
|
||||||
[ -e "$formula_file" ] || formula_file="$tap_dir/$ext_tap/Formula/$formula@$version.rb"
|
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
||||||
if [ -e "$formula_file" ]; then
|
|
||||||
IFS=" " read -r -a dependency_extensions <<< "$(grep -Eo "shivammathur.*@" "$formula_file" | xargs -I {} -n 1 basename '{}' | cut -d '@' -f 1 | tr '\n' ' ')"
|
|
||||||
for dependency_extension in "${dependency_extensions[@]}"; do
|
|
||||||
sudo sed -Ei '' "/=(.*\/)?\"?$dependency_extension(.so)?$/d" "${ini_file:?}"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
suffix="$(get_php_formula_suffix)"
|
|
||||||
if [[ -n "$suffix" ]]; then
|
|
||||||
brew_opts=(-sf)
|
|
||||||
patch_abstract_file >/dev/null 2>&1
|
|
||||||
for dependency_extension in "${dependency_extensions[@]}"; do
|
|
||||||
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 &&
|
|
||||||
brew link --overwrite --force "$dependency_extension@$version" >/dev/null 2>&1 &&
|
|
||||||
copy_brew_extensions "$dependency_extension"
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper function to disable an extension.
|
# Function to delete extension.
|
||||||
disable_extension_helper() {
|
delete_extension() {
|
||||||
local extension=$1
|
extension=$1
|
||||||
local disable_dependents=${2:-false}
|
sudo rm -rf "${scan_dir:?}"/*"$extension"* "${ext_dir:?}"/"$extension".so >/dev/null 2>&1
|
||||||
get_extension_map
|
}
|
||||||
if [ "$disable_dependents" = "true" ]; then
|
|
||||||
disable_extension_dependents "$extension"
|
# Function to disable extension.
|
||||||
fi
|
disable_extension() {
|
||||||
|
extension=$1
|
||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
|
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
|
||||||
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get extension name from brew formula.
|
# Function to remove extensions.
|
||||||
get_extension_from_formula() {
|
remove_extension() {
|
||||||
local formula=$1
|
extension=$1
|
||||||
local extension
|
if check_extension "$extension"; then
|
||||||
extension=$(grep -E "^$formula=" "$src"/configs/brew_extensions | cut -d '=' -f 2)
|
disable_extension "$extension"
|
||||||
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|php|[0-9]//g")"
|
delete_extension "$extension"
|
||||||
echo "$extension"
|
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
||||||
}
|
add_log "${cross:?}" ":$extension" "Could not remove $extension on PHP ${semver:?}"
|
||||||
|
|
||||||
# Function to get renamed formula.
|
|
||||||
get_renamed_formula() {
|
|
||||||
local formula=$1
|
|
||||||
formula_renames_json="$tap_dir/$ext_tap/formula_renames.json"
|
|
||||||
if [ -e "$formula_renames_json" ] && grep -q "$formula@$version\":" "$formula_renames_json"; then
|
|
||||||
grep "$formula@$version\":" "$formula_renames_json" | cut -d ':' -f 2 | tr -d ' ",' | cut -d '@' -f 1
|
|
||||||
else
|
else
|
||||||
echo "$formula"
|
add_log "${tick:?}" ":$extension" "Could not find $extension on PHP $semver"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to copy extension binaries to the extension directory.
|
# Function to fetch a brew tap.
|
||||||
copy_brew_extensions() {
|
fetch_brew_tap() {
|
||||||
local formula=$1
|
tap=$1
|
||||||
formula_file="$tap_dir/$ext_tap/Formula/$formula@$version.rb"
|
tap_user=$(dirname "$tap")
|
||||||
deps="$(grep -Eo 'depends_on "shivammathur[^"]+' "$formula_file" | cut -d '/' -f 3 | tr '\n' ' ')"
|
tap_name=$(basename "$tap")
|
||||||
IFS=' ' read -r -a deps <<< "$formula@$version $deps"
|
mkdir -p "$tap_dir/$tap_user"
|
||||||
for dependency in "${deps[@]}"; do
|
get -s -n "" "https://github.com/$tap/archive/master.tar.gz" | sudo tar -xzf - -C "$tap_dir/$tap_user"
|
||||||
extension_file="${brew_prefix:?}/opt/$dependency/$(get_extension_from_formula "${dependency%@*}").so"
|
if [ -d "$tap_dir/$tap_user/$tap_name-master" ]; then
|
||||||
[ -e "$extension_file" ] && sudo cp "$extension_file" "$ext_dir"
|
sudo mv "$tap_dir/$tap_user/$tap_name-master" "$tap_dir/$tap_user/$tap_name"
|
||||||
done
|
fi
|
||||||
if [ -d "$brew_prefix"/Cellar/"$formula"@"$version" ]; then
|
}
|
||||||
sudo find -- "$brew_prefix"/Cellar/"$formula"@"$version" -name "*.dylib" -exec cp {} "$ext_dir" \;
|
|
||||||
|
# Function to add a brew tap.
|
||||||
|
add_brew_tap() {
|
||||||
|
tap=$1
|
||||||
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
|
brew tap --shallow "$tap" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
fetch_brew_tap "$tap" >/dev/null 2>&1
|
||||||
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
|
brew tap --shallow "$tap" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,38 +63,29 @@ copy_brew_extensions() {
|
|||||||
add_brew_extension() {
|
add_brew_extension() {
|
||||||
formula=$1
|
formula=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
extension="$(get_extension_from_formula "$formula")"
|
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 "$php_tap"
|
add_brew_tap shivammathur/homebrew-php
|
||||||
add_brew_tap "$ext_tap"
|
add_brew_tap shivammathur/homebrew-extensions
|
||||||
formula="$(get_renamed_formula "$formula")"
|
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$formula"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
||||||
update_dependencies >/dev/null 2>&1
|
update_dependencies >/dev/null 2>&1
|
||||||
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
|
brew install -f "$formula@$version" >/dev/null 2>&1
|
||||||
(
|
sudo cp "$brew_prefix/opt/$formula@$version/$extension.so" "$ext_dir"
|
||||||
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 &&
|
|
||||||
brew link --overwrite --force "$formula@$version" >/dev/null 2>&1 &&
|
|
||||||
copy_brew_extensions "$formula"
|
|
||||||
) || pecl_install "$extension" >/dev/null 2>&1
|
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to patch the abstract file in the extensions tap.
|
# Function to setup extensions.
|
||||||
patch_abstract_file() {
|
add_extension() {
|
||||||
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
|
extension=$1
|
||||||
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
|
|
||||||
echo '' | sudo tee /tmp/abstract_patch >/dev/null 2>&1
|
|
||||||
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Helper function to add an extension.
|
|
||||||
add_extension_helper() {
|
|
||||||
local extension=$1
|
|
||||||
prefix=$2
|
prefix=$2
|
||||||
|
enable_extension "$extension" "$prefix"
|
||||||
|
if check_extension "$extension"; then
|
||||||
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
|
else
|
||||||
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
|
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
|
||||||
run_script "php5-darwin" "${version/./}" "$extension" >/dev/null 2>&1
|
run_script "php5-darwin" "${version/./}" "$extension" >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
@ -114,6 +93,7 @@ add_extension_helper() {
|
|||||||
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
||||||
fi
|
fi
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to handle request to add phpize and php-config.
|
# Function to handle request to add phpize and php-config.
|
||||||
@ -124,51 +104,67 @@ add_devtools() {
|
|||||||
|
|
||||||
# Function to handle request to add PECL.
|
# Function to handle request to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
enable_extension xml extension >/dev/null 2>&1
|
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl >/dev/null 2>&1
|
||||||
pear_version=$(get_tool_version "pecl" "version")
|
pecl_version=$(get_tool_version "pecl" "version")
|
||||||
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
|
add_log "${tick:?}" "PECL" "Found PECL $pecl_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Link opcache extension to extensions directory.
|
# Function to link all libraries of a formula.
|
||||||
link_opcache() {
|
link_libraries() {
|
||||||
opcache_ini="$brew_prefix"/etc/php/"$version"/conf.d/ext-opcache.ini
|
formula=$1
|
||||||
if [ -e "$opcache_ini" ]; then
|
formula_prefix="$(brew --prefix "$formula")"
|
||||||
opcache_ext=$(grep -Eo "zend_extension.*opcache.*\.so" "$opcache_ini" | cut -d '"' -f 2)
|
sudo mkdir -p "$formula_prefix"/lib
|
||||||
sudo ln -sf "$opcache_ext" "$ext_dir"
|
for lib in "$formula_prefix"/lib/*.dylib; do
|
||||||
fi
|
lib_name=$(basename "$lib")
|
||||||
|
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Patch brew to overwrite packages.
|
# Patch brew to overwrite packages.
|
||||||
patch_brew() {
|
patch_brew() {
|
||||||
formula_installer="${brew_repo:?}"/Library/Homebrew/formula_installer.rb
|
formula_installer="$brew_repo"/Library/Homebrew/formula_installer.rb
|
||||||
code=" keg.link\(verbose: verbose\?"
|
code=" keg.link(verbose: verbose?"
|
||||||
sudo sed -Ei '' "s/$code.*/$code, overwrite: true\)/" "$formula_installer"
|
sudo sed -i '' "s/$code)/$code, overwrite: true)/" "$formula_installer"
|
||||||
# shellcheck disable=SC2064
|
# shellcheck disable=SC2064
|
||||||
trap "sudo sed -Ei '' 's/$code.*/$code, overwrite: overwrite?\)/' $formula_installer" exit
|
trap "sudo sed -i '' 's/$code, overwrite: true)/$code)/' $formula_installer" exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# Helper function to update the dependencies.
|
||||||
|
update_dependencies_helper() {
|
||||||
|
dependency=$1
|
||||||
|
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$dependency.rb"
|
||||||
|
link_libraries "$dependency"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update dependencies.
|
# Function to update dependencies.
|
||||||
update_dependencies() {
|
update_dependencies() {
|
||||||
|
if ! [ -e /tmp/update_dependencies ] && [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
||||||
patch_brew
|
patch_brew
|
||||||
if ! [ -e /tmp/update_dependencies ]; then
|
while read -r dependency; do
|
||||||
for repo in "$brew_repo" "${core_repo:?}"; do
|
update_dependencies_helper "$dependency" &
|
||||||
if [ -e "$repo" ]; then
|
to_wait+=($!)
|
||||||
git_retry -C "$repo" fetch origin main && git -C "$repo" reset --hard origin/main
|
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
||||||
fi
|
wait "${to_wait[@]}"
|
||||||
done
|
|
||||||
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to fix dependencies on install PHP version.
|
||||||
|
fix_dependencies() {
|
||||||
|
broken_deps_paths=$(php -v 2>&1 | grep -Eo '/opt/[a-zA-Z0-9@\.]+')
|
||||||
|
if [ "x$broken_deps_paths" != "x" ]; then
|
||||||
|
update_dependencies
|
||||||
|
IFS=" " read -r -a formulae <<< "$(echo "$broken_deps_paths" | tr '\n' ' ' | sed 's|/opt/||g' 2>&1)$php_formula"
|
||||||
|
brew reinstall "${formulae[@]}"
|
||||||
|
brew link --force --overwrite "$php_formula" || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to get PHP version if it is already installed using Homebrew.
|
# Function to get PHP version if it is already installed using Homebrew.
|
||||||
get_brewed_php() {
|
get_brewed_php() {
|
||||||
cellar="$brew_prefix"/Cellar
|
php_cellar="$brew_prefix"/Cellar/php
|
||||||
php_cellar="$cellar"/php
|
if [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
||||||
if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
php-config --version 2>/dev/null | cut -c 1-3
|
||||||
php_semver
|
|
||||||
elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
|
||||||
php_semver
|
|
||||||
else
|
else
|
||||||
echo 'false';
|
echo 'false';
|
||||||
fi
|
fi
|
||||||
@ -178,134 +174,75 @@ get_brewed_php() {
|
|||||||
add_php() {
|
add_php() {
|
||||||
action=$1
|
action=$1
|
||||||
existing_version=$2
|
existing_version=$2
|
||||||
suffix="$(get_php_formula_suffix)"
|
add_brew_tap shivammathur/homebrew-php
|
||||||
php_keg="php@$version$suffix"
|
|
||||||
php_formula="shivammathur/php/$php_keg"
|
|
||||||
if [[ "$existing_version" = "false" || -n "$suffix" || "$action" = "upgrade" ]]; then
|
|
||||||
update_dependencies
|
update_dependencies
|
||||||
add_brew_tap "$php_tap"
|
if [ "$existing_version" != "false" ]; then
|
||||||
fi
|
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
|
||||||
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
|
|
||||||
if [ "$action" = "upgrade" ]; then
|
|
||||||
safe_brew install --only-dependencies "$php_formula"
|
|
||||||
safe_brew upgrade -f --overwrite "$php_formula"
|
|
||||||
else
|
else
|
||||||
brew unlink "$php_keg"
|
brew install -f "$php_formula"
|
||||||
fi
|
fi
|
||||||
else
|
brew link --force --overwrite "$php_formula"
|
||||||
safe_brew install --only-dependencies "$php_formula"
|
|
||||||
safe_brew install --skip-link -f --overwrite "$php_formula" 2>/dev/null || safe_brew upgrade -f --overwrite "$php_formula"
|
|
||||||
fi
|
|
||||||
brew link --force --overwrite "$php_keg" || (sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix" && brew link --force --overwrite "$php_keg")
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to get formula suffix
|
|
||||||
get_php_formula_suffix() {
|
|
||||||
local suffix
|
|
||||||
[ "${debug:?}" = "debug" ] && suffix="-debug"
|
|
||||||
[ "${ts:?}" = "zts" ] && suffix="$suffix-zts"
|
|
||||||
echo "$suffix"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get extra version.
|
# Function to get extra version.
|
||||||
php_extra_version() {
|
php_extra_version() {
|
||||||
php_formula_file="$tap_dir"/"$php_tap"/Formula/php@"$version".rb
|
if [[ ${version:?} =~ ${nightly_versions:?} ]]; then
|
||||||
if [ -e "$php_formula_file" ] && ! grep -q "deprecate!" "$php_formula_file" && grep -Eq "archive/[0-9a-zA-Z]+" "$php_formula_file"; then
|
echo " ($(brew cat "$php_formula" | grep -Eo "commit=[0-9a-zA-Z]+" | cut -d'=' -f 2))"
|
||||||
echo " ($(grep -Eo "archive/[0-9a-zA-Z]+" "$php_formula_file" | cut -d'/' -f 2))"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to set php.ini
|
|
||||||
add_php_config() {
|
|
||||||
if ! [ -e "$ini_dir"/php.ini-development ]; then
|
|
||||||
sudo cp "$ini_dir"/php.ini "$ini_dir"/php.ini-development
|
|
||||||
fi
|
|
||||||
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
|
|
||||||
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
|
|
||||||
elif [ "$ini" = "none" ]; then
|
|
||||||
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to get scan directory.
|
|
||||||
get_scan_dir() {
|
|
||||||
if [[ "$version" =~ ${old_versions:?} ]]; then
|
|
||||||
php --ini | grep additional | sed -e "s|.*: s*||"
|
|
||||||
else
|
|
||||||
echo "$ini_dir"/conf.d
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to handle self-hosted runner setup.
|
|
||||||
self_hosted_helper() {
|
|
||||||
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to Setup PHP.
|
# Function to Setup PHP.
|
||||||
setup_php() {
|
setup_php() {
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
php_config="$(command -v php-config 2>/dev/null)"
|
|
||||||
update=true
|
|
||||||
check_pre_installed
|
|
||||||
existing_version=$(get_brewed_php)
|
existing_version=$(get_brewed_php)
|
||||||
status="Found"
|
|
||||||
if [[ "$version" =~ ${old_versions:?} ]]; then
|
if [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
|
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
|
||||||
status="Installed"
|
status="Installed"
|
||||||
elif [ "${existing_version:0:3}" != "$version" ]; then
|
elif [ "$existing_version" != "$version" ]; then
|
||||||
add_php "install" "$existing_version" >/dev/null 2>&1
|
add_php "install" "$existing_version" >/dev/null 2>&1
|
||||||
status="Installed"
|
status="Installed"
|
||||||
elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then
|
elif [ "$existing_version" = "$version" ] && [ "${update:?}" = "true" ]; then
|
||||||
brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')"
|
|
||||||
if [ "$brew_php_version" != "$existing_version" ]; then
|
|
||||||
add_php "upgrade" "$existing_version" >/dev/null 2>&1
|
add_php "upgrade" "$existing_version" >/dev/null 2>&1
|
||||||
status="Upgraded"
|
status="Updated to"
|
||||||
|
else
|
||||||
|
status="Found"
|
||||||
|
fix_dependencies >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
php_config="$(command -v php-config)"
|
|
||||||
ext_dir="$(sed -n "s/.*extension_dir=['\"]\(.*\)['\"].*/\1/p" "$php_config")"
|
|
||||||
ini_dir="$(php_ini_path)"
|
|
||||||
scan_dir="$(get_scan_dir)"
|
|
||||||
ini_file="$ini_dir"/php.ini
|
|
||||||
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
|
||||||
sudo chmod 777 "$ini_file" "${tool_path_dir:?}"
|
sudo chmod 777 "$ini_file" "${tool_path_dir:?}"
|
||||||
semver="$(php_semver)"
|
|
||||||
extra_version="$(php_extra_version)"
|
|
||||||
configure_php
|
configure_php
|
||||||
link_opcache
|
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
set_output "php-version" "$semver"
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
|
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
||||||
|
semver=$(php_semver)
|
||||||
|
extra_version=$(php_extra_version)
|
||||||
if [ "${semver%.*}" != "$version" ]; then
|
if [ "${semver%.*}" != "$version" ]; then
|
||||||
add_log "${cross:?}" "PHP" "Could not setup PHP $version"
|
add_log "$cross" "PHP" "Could not setup PHP $version"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
|
echo "::set-output name=php-version::$semver"
|
||||||
add_log "$tick" "PHP" "$status PHP $semver$extra_version"
|
add_log "$tick" "PHP" "$status PHP $semver$extra_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
version=${1:-'8.5'}
|
version=$1
|
||||||
ini=${2:-'production'}
|
dist=$2
|
||||||
src=${0%/*}/..
|
|
||||||
php_formula=shivammathur/php/php@"$version"
|
php_formula=shivammathur/php/php@"$version"
|
||||||
scripts="$src"/scripts
|
brew_prefix="$(brew --prefix)"
|
||||||
ext_tap=shivammathur/homebrew-extensions
|
brew_repo="$(brew --repository)"
|
||||||
php_tap=shivammathur/homebrew-php
|
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_AUTO_UPDATE=1
|
|
||||||
export HOMEBREW_NO_ENV_HINTS=1
|
|
||||||
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||||
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||||
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
||||||
export HOMEBREW_NO_INSTALL_FROM_API=1
|
|
||||||
|
|
||||||
# shellcheck source=.
|
# shellcheck source=.
|
||||||
. "${scripts:?}"/unix.sh
|
. "${scripts:?}"/ext/source.sh
|
||||||
. "${scripts:?}"/tools/brew.sh
|
|
||||||
. "${scripts:?}"/tools/retry.sh
|
|
||||||
. "${scripts:?}"/tools/add_tools.sh
|
. "${scripts:?}"/tools/add_tools.sh
|
||||||
. "${scripts:?}"/extensions/source.sh
|
. "${scripts:?}"/common.sh
|
||||||
. "${scripts:?}"/extensions/add_extensions.sh
|
|
||||||
configure_brew
|
|
||||||
read_env
|
read_env
|
||||||
self_hosted_setup
|
self_hosted_setup
|
||||||
setup_php
|
setup_php
|
||||||
|
|||||||
@ -21,9 +21,7 @@ Function Add-Blackfire() {
|
|||||||
$status="Enabled"
|
$status="Enabled"
|
||||||
} else {
|
} else {
|
||||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||||
Get-File -Url "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
Invoke-WebRequest -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
||||||
Disable-Extension xdebug > $null 2>&1
|
|
||||||
Disable-Extension pcov > $null 2>&1
|
|
||||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||||
$status="Installed and enabled"
|
$status="Installed and enabled"
|
||||||
}
|
}
|
||||||
21
src/scripts/ext/blackfire.sh
Normal file
21
src/scripts/ext/blackfire.sh
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Function to install blackfire extension.
|
||||||
|
add_blackfire() {
|
||||||
|
extension=$1
|
||||||
|
version=${version:?}
|
||||||
|
no_dot_version=${version/./}
|
||||||
|
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
|
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
||||||
|
blackfire_ini_file="${pecl_file:-${ini_file[@]}}"
|
||||||
|
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
||||||
|
if [ "$extension_version" = "blackfire" ]; then
|
||||||
|
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
||||||
|
extension_version='1.50.0'
|
||||||
|
else
|
||||||
|
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
echo "extension=blackfire.so" | sudo tee -a "$blackfire_ini_file" >/dev/null 2>&1
|
||||||
|
add_extension_log "$extension-$extension_version" "Installed and enabled"
|
||||||
|
}
|
||||||
43
src/scripts/ext/couchbase.sh
Normal file
43
src/scripts/ext/couchbase.sh
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Function to install libraries required by couchbase
|
||||||
|
add_couchbase_libs() {
|
||||||
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
|
trunk="https://github.com/couchbase/libcouchbase/releases"
|
||||||
|
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
||||||
|
release="2.10.9"
|
||||||
|
else
|
||||||
|
release="$(curl -sL $trunk/latest | grep -Eo "libcouchbase-[0-9]+\.[0-9]+\.[0-9]+" | head -n 1 | cut -d'-' -f 2)"
|
||||||
|
fi
|
||||||
|
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${DISTRIB_RELEASE/./}_${DISTRIB_CODENAME}_amd64.tar"
|
||||||
|
get -q -n /tmp/libcouchbase.tar "$deb_url"
|
||||||
|
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
|
||||||
|
install_packages libev4 libevent-dev
|
||||||
|
sudo dpkg -i /tmp/libcouchbase-*/*.deb
|
||||||
|
else
|
||||||
|
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
||||||
|
brew install libcouchbase@2
|
||||||
|
brew link --overwrite --force libcouchbase@2
|
||||||
|
else
|
||||||
|
brew install libcouchbase
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to add couchbase.
|
||||||
|
add_couchbase() {
|
||||||
|
add_couchbase_libs >/dev/null 2>&1
|
||||||
|
enable_extension "couchbase" "extension"
|
||||||
|
if check_extension "couchbase"; then
|
||||||
|
add_log "${tick:?}" "couchbase" "Enabled"
|
||||||
|
else
|
||||||
|
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
|
||||||
|
elif [[ "${version:?}" =~ 7.2 ]]; then
|
||||||
|
pecl_install couchbase-3.0.4 >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
pecl_install couchbase >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
add_extension_log "couchbase" "Installed and enabled"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@ -1,10 +1,19 @@
|
|||||||
# Function to log license details.
|
# Function to log license details.
|
||||||
add_license_log() {
|
add_license_log() {
|
||||||
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
||||||
printf "Cubrid CCI package is required for %s extension.\n" "$ext"
|
printf "Cubrid CCI package is required for %s extension.\n" "$ext"
|
||||||
printf "The extension %s and Cubrid CCI are provided under the license linked below.\n" "$ext"
|
printf "The extension %s and Cubrid CCI are provided under the license linked below.\n" "$ext"
|
||||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://github.com/CUBRID/cubrid-cci/blob/develop/COPYING"
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://github.com/CUBRID/cubrid-cci/blob/develop/COPYING"
|
||||||
echo "$END_GROUP"
|
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.
|
||||||
@ -48,4 +57,4 @@ add_cubrid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# shellcheck source=.
|
# shellcheck source=.
|
||||||
. "${scripts:?}"/extensions/patches/phpize.sh
|
. "${scripts:?}"/ext/patches/phpize.sh
|
||||||
@ -4,7 +4,7 @@ Function Add-Choco() {
|
|||||||
# Source: https://docs.chocolatey.org/en-us/choco/setup
|
# Source: https://docs.chocolatey.org/en-us/choco/setup
|
||||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||||
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
35
src/scripts/ext/firebird.sh
Normal file
35
src/scripts/ext/firebird.sh
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
add_firebird_client_darwin() {
|
||||||
|
firebird_tag='R3_0_7'
|
||||||
|
pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/tag/"$firebird_tag" | grep -Eo "Firebird-.*.pkg" | head -n 1)
|
||||||
|
get -q -e "/tmp/firebird.pkg" https://github.com/FirebirdSQL/firebird/releases/download/"$firebird_tag"/"$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)"
|
||||||
|
export PDO_FIREBIRD_CONFIGURE_OPTS="--with-pdo-firebird=$firebird_dir"
|
||||||
|
export PDO_FIREBIRD_LINUX_LIBS="firebird-dev"
|
||||||
|
export PDO_FIREBIRD_PATH="ext/pdo_firebird"
|
||||||
|
add_extension_from_source pdo_firebird https://github.com php php-src "$tag" extension get
|
||||||
|
}
|
||||||
|
|
||||||
|
add_firebird() {
|
||||||
|
enable_extension pdo_firebird
|
||||||
|
if ! check_extension pdo_firebird; then
|
||||||
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
|
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
|
||||||
|
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,13 +1,12 @@
|
|||||||
# Helper function to add gearman extension.
|
# Helper function to add gearman extension.
|
||||||
add_gearman_helper() {
|
add_gearman_helper() {
|
||||||
|
add_ppa ondrej/pkg-gearman
|
||||||
install_packages libgearman-dev
|
install_packages libgearman-dev
|
||||||
enable_extension gearman extension
|
enable_extension gearman extension
|
||||||
if ! check_extension gearman; then
|
if ! check_extension gearman; then
|
||||||
status="Installed and enabled"
|
status="Installed and enabled"
|
||||||
if [[ "${version:?}" =~ 5.[3-6] ]]; then
|
if [[ "${version:?}" =~ 5.[3-5] ]]; then
|
||||||
pecl_install gearman-1.1.2
|
pecl_install gearman-1.1.2
|
||||||
elif [[ "${version:?}" =~ 7.0 ]]; then
|
|
||||||
pecl_install gearman-2.1.3
|
|
||||||
else
|
else
|
||||||
install_packages php"${version:?}"-gearman || pecl_install gearman
|
install_packages php"${version:?}"-gearman || pecl_install gearman
|
||||||
fi
|
fi
|
||||||
@ -18,10 +17,6 @@ add_gearman_helper() {
|
|||||||
# Function to add gearman extension.
|
# Function to add gearman extension.
|
||||||
add_gearman() {
|
add_gearman() {
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
if [ "$(uname -s)" = 'Linux' ]; then
|
|
||||||
add_gearman_helper >/dev/null 2>&1
|
add_gearman_helper >/dev/null 2>&1
|
||||||
add_extension_log "gearman" "$status"
|
add_extension_log "gearman" "$status"
|
||||||
else
|
|
||||||
add_brew_extension gearman extension
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
@ -13,7 +13,7 @@ Function Get-ICUUrl() {
|
|||||||
$trunk = "https://windows.php.net"
|
$trunk = "https://windows.php.net"
|
||||||
$urls=@("${trunk}/downloads/php-sdk/deps/${vs_version}/${arch}", "${trunk}/downloads/php-sdk/deps/archives/${vs_version}/${arch}")
|
$urls=@("${trunk}/downloads/php-sdk/deps/${vs_version}/${arch}", "${trunk}/downloads/php-sdk/deps/archives/${vs_version}/${arch}")
|
||||||
foreach ($url in $urls) {
|
foreach ($url in $urls) {
|
||||||
$web_content = Get-File -Url $url
|
$web_content = Invoke-WebRequest -Uri $url
|
||||||
foreach ($link in $web_content.Links) {
|
foreach ($link in $web_content.Links) {
|
||||||
if ($link -match "/.*ICU-${icu_version}.*/") {
|
if ($link -match "/.*ICU-${icu_version}.*/") {
|
||||||
return $trunk + $link.HREF
|
return $trunk + $link.HREF
|
||||||
@ -31,8 +31,8 @@ Function Repair-ICU() {
|
|||||||
}
|
}
|
||||||
$zip_url = Get-ICUUrl $icu.Groups[1].Value $installed.Architecture $vs
|
$zip_url = Get-ICUUrl $icu.Groups[1].Value $installed.Architecture $vs
|
||||||
if ($zip_url -ne '') {
|
if ($zip_url -ne '') {
|
||||||
New-Item -Path "$php_dir" -Name "icu" -ItemType "directory" -Force > $null 2>&1
|
New-Item -Path "$php_dir" -Name "icu" -ItemType "directory" | Out-Null
|
||||||
Get-File -Url $zip_url -OutFile "$php_dir\icu\icu.zip"
|
Invoke-WebRequest -Uri $zip_url -OutFile "$php_dir\icu\icu.zip"
|
||||||
Expand-Archive -Path $php_dir\icu\icu.zip -DestinationPath $php_dir\icu -Force
|
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
|
Get-ChildItem $php_dir\icu\bin -Filter *.dll | Copy-Item -Destination $php_dir -Force
|
||||||
}
|
}
|
||||||
@ -40,12 +40,16 @@ Function Repair-ICU() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Http() {
|
Function Add-Http() {
|
||||||
Add-Extension iconv >$null 2>&1
|
|
||||||
Add-Extension raphf >$null 2>&1
|
Add-Extension raphf >$null 2>&1
|
||||||
if($version -lt '8.0') {
|
if($version -lt '8.0') {
|
||||||
Add-Extension propro >$null 2>&1
|
Add-Extension propro >$null 2>&1
|
||||||
}
|
}
|
||||||
Add-Extension pecl_http >$null 2>&1
|
Add-Extension pecl_http >$null 2>&1
|
||||||
Repair-ICU
|
Repair-ICU
|
||||||
Add-ExtensionLog http "Installed and enabled"
|
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 )"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -11,27 +11,33 @@ get_http_version() {
|
|||||||
|
|
||||||
# Function to enable http extension.
|
# Function to enable http extension.
|
||||||
enable_http() {
|
enable_http() {
|
||||||
enable_extension iconv extension
|
|
||||||
enable_extension propro extension
|
enable_extension propro extension
|
||||||
enable_extension raphf extension
|
enable_extension raphf extension
|
||||||
if (! [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension iconv && check_extension propro && check_extension raphf) ||
|
if (! [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension propro && check_extension raphf) ||
|
||||||
( [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension iconv && check_extension raphf); then
|
( [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension raphf); then
|
||||||
enable_extension http extension
|
enable_extension http extension
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to install extensions.
|
||||||
|
add_extension_helper() {
|
||||||
|
if [ "$os" = "Linux" ]; then
|
||||||
|
add_extension "$1" extension
|
||||||
|
else
|
||||||
|
add_brew_extension "$1" extension
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to install http dependencies.
|
# Function to install http dependencies.
|
||||||
add_http_dependencies() {
|
add_http_dependencies() {
|
||||||
if [[ ${version:?} =~ ${old_versions:?} ]]; then
|
if [[ ${version:?} =~ ${old_versions:?} ]]; then
|
||||||
add_pecl_extension raphf 1.1.2 extension
|
add_pecl_extension raphf 1.1.2 extension
|
||||||
add_pecl_extension propro 1.0.2 extension
|
add_pecl_extension propro 1.0.2 extension
|
||||||
elif [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
elif [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
||||||
add_extension iconv extension
|
add_extension_helper propro
|
||||||
add_extension propro extension
|
add_extension_helper raphf
|
||||||
add_extension raphf extension
|
|
||||||
else
|
else
|
||||||
add_extension iconv extension
|
add_extension_helper raphf
|
||||||
add_extension raphf extension
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +67,7 @@ add_http_helper() {
|
|||||||
export HTTP_CONFIGURE_OPTS="$http_configure_opts"
|
export HTTP_CONFIGURE_OPTS="$http_configure_opts"
|
||||||
export HTTP_LINUX_LIBS="zlib1g libbrotli-dev libcurl4-openssl-dev libevent-dev libicu-dev libidn2-dev"
|
export HTTP_LINUX_LIBS="zlib1g libbrotli-dev libcurl4-openssl-dev libevent-dev libicu-dev libidn2-dev"
|
||||||
export HTTP_DARWIN_LIBS="brotli curl icu4c libevent libidn2"
|
export HTTP_DARWIN_LIBS="brotli curl icu4c libevent libidn2"
|
||||||
if ! [[ ${version:?} =~ 5.[3-6]|7.[0-4] ]]; then
|
if [[ "${version:?}" =~ ${nightly_versions:?} ]]; then
|
||||||
add_extension_from_source http https://github.com m6w6 ext-http master extension
|
add_extension_from_source http https://github.com m6w6 ext-http master extension
|
||||||
else
|
else
|
||||||
add_extension_from_source pecl_http https://pecl.php.net http http "${ext##*-}" extension pecl
|
add_extension_from_source pecl_http https://pecl.php.net http http "${ext##*-}" extension pecl
|
||||||
@ -72,11 +78,13 @@ add_http_helper() {
|
|||||||
add_http_latest() {
|
add_http_latest() {
|
||||||
enable_http
|
enable_http
|
||||||
if ! check_extension http; then
|
if ! check_extension http; then
|
||||||
if [ "$os" = "Linux" ]; then
|
|
||||||
add_http_dependencies
|
add_http_dependencies
|
||||||
package="php$version-http"
|
if [ "$os" = "Linux" ]; then
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
if ! [[ "${version:?}" =~ ${old_versions:?}|${nightly_versions:?} ]]; then
|
||||||
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
|
install_packages "php$version-http"
|
||||||
|
else
|
||||||
|
add_http_helper "$(get_http_version)" "$os"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
||||||
add_brew_extension pecl_http extension
|
add_brew_extension pecl_http extension
|
||||||
@ -91,8 +99,7 @@ add_http_version() {
|
|||||||
ext=$1
|
ext=$1
|
||||||
enable_http
|
enable_http
|
||||||
if [ "x$(php -r "echo phpversion('http');")" != "x${ext##*-}" ]; then
|
if [ "x$(php -r "echo phpversion('http');")" != "x${ext##*-}" ]; then
|
||||||
add_http_dependencies
|
remove_extension http >/dev/null
|
||||||
disable_extension_helper http >/dev/null
|
|
||||||
add_http_helper pecl_http-"${ext##*-}" "$os"
|
add_http_helper pecl_http-"${ext##*-}" "$os"
|
||||||
status="Installed and enabled"
|
status="Installed and enabled"
|
||||||
fi
|
fi
|
||||||
23
src/scripts/ext/intl.sh
Normal file
23
src/scripts/ext/intl.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Function to install ICU
|
||||||
|
install_icu() {
|
||||||
|
icu=$1
|
||||||
|
if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
|
||||||
|
get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu.tar.zst"
|
||||||
|
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
|
||||||
|
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to add ext-intl with the given version of ICU
|
||||||
|
add_intl() {
|
||||||
|
icu=$(echo "$1" | cut -d'-' -f 2)
|
||||||
|
supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases | grep -Po "${icu//./\\.}" | head -n 1)
|
||||||
|
if [ "$icu" != "$supported_version" ]; then
|
||||||
|
add_log "${cross:?}" "intl" "ICU $icu is not supported"
|
||||||
|
else
|
||||||
|
install_icu "$icu" >/dev/null 2>&1
|
||||||
|
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu.so"
|
||||||
|
enable_extension intl extension
|
||||||
|
add_extension_log intl "Installed and enabled with ICU $icu"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@ -1,14 +1,13 @@
|
|||||||
# Function to log result of a operation.
|
# Function to log result of a operation.
|
||||||
Function Add-LicenseLog() {
|
Function Add-LicenseLog() {
|
||||||
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
||||||
Get-Content $ext_dir\ioncube\LICENSE.txt
|
Get-Content $ext_dir\ioncube\LICENSE.txt
|
||||||
Write-Output "$env:END_GROUP"
|
Write-Output "::endgroup::"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add ioncube extension.
|
# Function to add ioncube extension.
|
||||||
Function Add-Ioncube() {
|
Function Add-Ioncube() {
|
||||||
try {
|
try {
|
||||||
$status = 'Enabled'
|
|
||||||
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
|
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
$arch_part = $arch
|
$arch_part = $arch
|
||||||
@ -20,7 +19,7 @@ Function Add-Ioncube() {
|
|||||||
if (-not($installed.ThreadSafe)) {
|
if (-not($installed.ThreadSafe)) {
|
||||||
$ts_part = "_nonts"
|
$ts_part = "_nonts"
|
||||||
}
|
}
|
||||||
Get-File -Url "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
|
Invoke-WebRequest -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
|
||||||
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
||||||
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
||||||
}
|
}
|
||||||
19
src/scripts/ext/ioncube.sh
Normal file
19
src/scripts/ext/ioncube.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Function to log result of a operation.
|
||||||
|
add_license_log() {
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
||||||
|
cat /tmp/ioncube/LICENSE.txt
|
||||||
|
echo "::endgroup::"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install ioncube.
|
||||||
|
add_ioncube() {
|
||||||
|
if [ ! -e "${ext_dir:?}/ioncube.so" ]; then
|
||||||
|
status='Installed and enabled'
|
||||||
|
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
|
||||||
|
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
|
||||||
|
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "$ext_dir/ioncube.so"
|
||||||
|
fi
|
||||||
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
||||||
|
add_extension_log "ioncube" "$status"
|
||||||
|
check_extension "ioncube" && add_license_log
|
||||||
|
}
|
||||||
60
src/scripts/ext/oci.ps1
Normal file
60
src/scripts/ext/oci.ps1
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# Function to log license information.
|
||||||
|
Function Add-LicenseLog() {
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
|
||||||
|
printf "Oracle Instant Client package is required for %s extension.\n" $extension
|
||||||
|
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||||
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||||
|
Write-Output "::endgroup::"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to get instantclinet.
|
||||||
|
Function Add-InstantClient() {
|
||||||
|
if (-not(Test-Path $php_dir\oci.dll)) {
|
||||||
|
$suffix = 'windows'
|
||||||
|
if ($arch -eq 'x86') {
|
||||||
|
$suffix = 'nt'
|
||||||
|
}
|
||||||
|
Invoke-WebRequest -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
||||||
|
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
||||||
|
Copy-Item $php_dir\instantclient*\* $php_dir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install oci8 and pdo_oci.
|
||||||
|
Function Add-Oci() {
|
||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[ValidateSet('oci8', 'pdo_oci')]
|
||||||
|
[string]
|
||||||
|
$extension
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
$status = 'Enabled'
|
||||||
|
Add-InstantClient
|
||||||
|
if ($extension -eq "pdo_oci") {
|
||||||
|
Enable-PhpExtension pdo_oci -Path $php_dir
|
||||||
|
} else {
|
||||||
|
if(-not(Test-Path $ext_dir\php_oci8.dll)) {
|
||||||
|
$status = 'Installed and enabled'
|
||||||
|
$ociVersion = Get-PeclPackageVersion oci8 -MinimumStability stable -MaximumStability stable | Select-Object -First 1
|
||||||
|
if ($version -eq '7.0') {
|
||||||
|
$ociVersion = '2.1.8'
|
||||||
|
} elseif ($version -lt '7.0') {
|
||||||
|
$ociVersion = '2.0.12'
|
||||||
|
} elseif ($version -lt '8.0') {
|
||||||
|
$ociVersion = '2.2.0'
|
||||||
|
}
|
||||||
|
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
||||||
|
Invoke-WebRequest -Uri $ociUrl -OutFile $php_dir\oci8.zip
|
||||||
|
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
|
||||||
|
|
||||||
|
}
|
||||||
|
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
|
||||||
|
}
|
||||||
|
Add-Log $tick $extension $status
|
||||||
|
Add-LicenseLog
|
||||||
|
} catch {
|
||||||
|
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
|
||||||
|
}
|
||||||
|
}
|
||||||
63
src/scripts/ext/oci.sh
Normal file
63
src/scripts/ext/oci.sh
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# Function to log result of a operation.
|
||||||
|
add_license_log() {
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
||||||
|
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
|
||||||
|
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||||
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||||
|
echo "::endgroup::"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install instantclient and SDK.
|
||||||
|
add_client() {
|
||||||
|
if [ ! -e "$oracle_client" ]; then
|
||||||
|
sudo mkdir -p -m 777 "$oracle_home" "$oracle_client"
|
||||||
|
for package in basiclite sdk; do
|
||||||
|
if [ "$os" = 'Linux' ]; then
|
||||||
|
libs='/usr/lib/'
|
||||||
|
os_name='linux'
|
||||||
|
arch='linuxx64'
|
||||||
|
lib_ext='so'
|
||||||
|
elif [ "$os" = 'Darwin' ]; then
|
||||||
|
libs='/usr/local/lib/'
|
||||||
|
os_name='mac'
|
||||||
|
arch='macos'
|
||||||
|
lib_ext='dylib'
|
||||||
|
fi
|
||||||
|
get -q -n "/opt/oracle/$package.zip" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
|
||||||
|
unzip -o "/opt/oracle/$package.zip" -d "$oracle_home"
|
||||||
|
done
|
||||||
|
for icdir in /opt/oracle/instantclient_*; do
|
||||||
|
sudo mv "$icdir"/* "$oracle_client"/
|
||||||
|
done
|
||||||
|
sudo ln -sf /opt/oracle/instantclient/*.$lib_ext* $libs
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install oci8 and pdo_oci.
|
||||||
|
add_oci_helper() {
|
||||||
|
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
||||||
|
status='Installed and enabled'
|
||||||
|
read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
|
||||||
|
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
|
||||||
|
read -r "${ext}_PATH" <<< "ext/$ext"
|
||||||
|
patch_phpize
|
||||||
|
add_extension_from_source "$ext" https://github.com php php-src "$(php_src_tag)" extension get
|
||||||
|
restore_phpize
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to add oci extension oci8 and pdo_oci.
|
||||||
|
add_oci() {
|
||||||
|
ext=$1
|
||||||
|
status='Enabled'
|
||||||
|
oracle_home='/opt/oracle'
|
||||||
|
oracle_client=$oracle_home/instantclient
|
||||||
|
os=$(uname -s)
|
||||||
|
add_client >/dev/null 2>&1
|
||||||
|
add_oci_helper >/dev/null 2>&1
|
||||||
|
add_extension_log "$ext" "$status"
|
||||||
|
check_extension "$ext" && add_license_log
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck source=.
|
||||||
|
. "${scripts:?}"/ext/patches/phpize.sh
|
||||||
@ -1,9 +1,7 @@
|
|||||||
patch_geos() {
|
patch_geos() {
|
||||||
if [[ $(printf '%s\n%s\n' "${version:?}" "7.0" | sort -V | head -n1) == "7.0" ]]; then
|
if [ "$(php -r "echo PHP_VERSION_ID;")" -ge 70000 ]; then
|
||||||
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
|
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
|
||||||
fi
|
fi
|
||||||
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
|
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
|
||||||
get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch
|
|
||||||
patch -p1 < /tmp/php8.patch 2>/dev/null || true
|
patch -p1 < /tmp/php8.patch 2>/dev/null || true
|
||||||
patch -p1 < /tmp/toString.patch 2>/dev/null || true
|
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user