mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-09-25 11:17:05 +07:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ad0888329 | |||
| 3cfc409e14 | |||
| ebc671081f | |||
| efae663c0f | |||
| fa8a671e6f | |||
| 6a4159ba98 | |||
| 0da52b1327 | |||
| 3579c7ef28 |
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"env": { "node": true, "jest": true },
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": { "ecmaVersion": 2020, "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/@typescript-eslint"
|
||||||
|
],
|
||||||
|
"plugins": ["@typescript-eslint", "jest"],
|
||||||
|
"rules": {
|
||||||
|
"camelcase": "off",
|
||||||
|
"require-atomic-updates": "off",
|
||||||
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
|
"@typescript-eslint/camelcase": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
* @shivammathur
|
|
||||||
+32
-52
@@ -1,83 +1,63 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/<your-username>/setup-php.git
|
|
||||||
|
|
||||||
cd setup-php
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using `Windows` configure `git` to handle line endings.
|
|
||||||
|
|
||||||
```cmd
|
|
||||||
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.
|
* Make your bug fix or feature addition.
|
||||||
* Add tests for it, so we don't break it in a future version unintentionally.
|
* Add tests for it. This is important 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.
|
||||||
* 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.
|
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.
|
Due to time constraints, you may not always get a quick response. Please do not take delays personal and feel free to remind.
|
||||||
|
|
||||||
## Coding Guidelines
|
## 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 format the code before committing it.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run format
|
$ npm run format
|
||||||
npm run lint
|
$ npm run lint
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running the test suite
|
## Using setup-php from a Git checkout
|
||||||
|
|
||||||
|
The following commands can be used to perform the initial checkout of setup-php:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git clone https://github.com/shivammathur/setup-php.git
|
||||||
|
|
||||||
|
$ cd setup-php
|
||||||
|
```
|
||||||
|
|
||||||
|
Install setup-php dependencies using [npm](https://www.npmjs.com/):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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)
|
|
||||||
+5
-1
@@ -1,4 +1,8 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: shivammathur
|
github: shivammathur
|
||||||
open_collective: setup-php
|
community_bridge: setup-php
|
||||||
|
issuehunt: shivammathur
|
||||||
|
patreon: shivammathur
|
||||||
|
liberapay: shivammathur
|
||||||
|
custom: https://www.paypal.me/shivammathur
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Please provide the GitHub Action `.yml` file.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
@@ -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
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I want to improve [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
@@ -5,15 +5,16 @@ labels: bug or enhancement
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## A Pull Request should be associated with a Discussion.
|
## A Pull Request should be associated with an Issue.
|
||||||
|
|
||||||
> If you're fixing a bug, adding a new feature or improving something please provide the details in discussions,
|
> We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
|
||||||
> so that the development can be pointed in the intended direction.
|
> If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
|
||||||
|
> and potentially we'll be able to point development in a particular direction.
|
||||||
|
|
||||||
Related discussion: <!-- Please link the related discussion -->
|
Related issue:
|
||||||
|
|
||||||
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
|
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
|
||||||
> Thank you for your contribution.
|
> Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -25,12 +26,7 @@ This PR [briefly explain what it does]
|
|||||||
- [ ] I have run `npm run format` before the commit.
|
- [ ] I have run `npm run format` before the commit.
|
||||||
- [ ] I have run `npm run lint` before the commit.
|
- [ ] I have run `npm run lint` before the commit.
|
||||||
- [ ] I have run `npm run release` before the commit.
|
- [ ] I have run `npm run release` before the commit.
|
||||||
- [ ] `npm test` returns with no unit test errors and all code covered.
|
- [ ] `npm test` returns with no unit test errors.
|
||||||
|
|
||||||
> In case this PR edits any scripts:
|
|
||||||
|
|
||||||
- [ ] I have checked the edited scripts for syntax.
|
|
||||||
- [ ] I have tested the changes in an integration test (If yes, provide workflow YAML and link).
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
- Please target the develop branch when submitting the pull request.
|
- Please target the develop branch when submitting the pull request.
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
name: 🐞 Bug Fix
|
||||||
|
about: You have a fix for a bug?
|
||||||
|
labels: bug
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## A Pull Request should be associated with an Issue.
|
||||||
|
|
||||||
|
> We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
|
||||||
|
> If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
|
||||||
|
> and potentially we'll be able to point development in a particular direction.
|
||||||
|
|
||||||
|
Related issue:
|
||||||
|
|
||||||
|
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
|
||||||
|
> Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
This PR [briefly explain what it does]
|
||||||
|
|
||||||
|
> In case this PR introduced TypeScript/JavaScript code changes:
|
||||||
|
|
||||||
|
- [ ] I have written test cases for the changes in this pull request.
|
||||||
|
- [ ] I have run `npm run format` before the commit.
|
||||||
|
- [ ] I have run `npm run lint` before the commit.
|
||||||
|
- [ ] I have run `npm run release` before the commit.
|
||||||
|
- [ ] `npm test` returns with no unit test errors.
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- Please target the develop branch when submitting the pull request.
|
||||||
|
-->
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
name: ⚙ Improvement
|
||||||
|
about: You have some improvement to make setup-php better?
|
||||||
|
labels: enhancement
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## A Pull Request should be associated with an Issue.
|
||||||
|
|
||||||
|
> We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
|
||||||
|
> If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
|
||||||
|
> and potentially we'll be able to point development in a particular direction.
|
||||||
|
|
||||||
|
Related issue:
|
||||||
|
|
||||||
|
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
|
||||||
|
> Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
This PR [briefly explain what it does]
|
||||||
|
|
||||||
|
> In case this PR introduced TypeScript/JavaScript code changes:
|
||||||
|
|
||||||
|
- [ ] I have written test cases for the changes in this pull request.
|
||||||
|
- [ ] I have run `npm run format` before the commit.
|
||||||
|
- [ ] I have run `npm run lint` before the commit.
|
||||||
|
- [ ] I have run `npm run release` before the commit.
|
||||||
|
- [ ] `npm test` returns with no unit test errors.
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- Please target the develop branch when submitting the pull request.
|
||||||
|
-->
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
name: 🎉 New Feature
|
||||||
|
about: You have implemented some neat idea that you want to make part of setup-php?
|
||||||
|
labels: enhancement
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## A Pull Request should be associated with an Issue.
|
||||||
|
|
||||||
|
> We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
|
||||||
|
> If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
|
||||||
|
> and potentially we'll be able to point development in a particular direction.
|
||||||
|
|
||||||
|
Related issue:
|
||||||
|
|
||||||
|
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
|
||||||
|
> Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
This PR [briefly explain what it does]
|
||||||
|
|
||||||
|
> In case this PR introduced TypeScript/JavaScript code changes:
|
||||||
|
|
||||||
|
- [ ] I have written test cases for the changes in this pull request.
|
||||||
|
- [ ] I have run `npm run format` before the commit.
|
||||||
|
- [ ] I have run `npm run lint` before the commit.
|
||||||
|
- [ ] I have run `npm run release` before the commit.
|
||||||
|
- [ ] `npm test` returns with no unit test errors.
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- Please target the develop branch when submitting the pull request.
|
||||||
|
-->
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Supported Versions
|
|
||||||
|
|
||||||
The latest patch version of `v2` release of this project is supported for security updates.
|
|
||||||
|
|
||||||
## Supported PHP Versions
|
|
||||||
|
|
||||||
This security policy only applies to the latest patch releases of the following PHP versions.
|
|
||||||
|
|
||||||
| Version | Supported |
|
|
||||||
|---------|--------------------|
|
|
||||||
| 8.2 | :white_check_mark: |
|
|
||||||
| 8.3 | :white_check_mark: |
|
|
||||||
| 8.4 | :white_check_mark: |
|
|
||||||
| 8.5 | :white_check_mark: |
|
|
||||||
|
|
||||||
## 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).
|
|
||||||
Do not report security reports publicly.
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
name : CodeQL Configuration
|
|
||||||
|
|
||||||
paths:
|
|
||||||
- './src'
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: 'github-actions'
|
|
||||||
directory: '/'
|
|
||||||
target-branch: 'develop'
|
|
||||||
schedule:
|
|
||||||
interval: 'weekly'
|
|
||||||
groups:
|
|
||||||
github-actions:
|
|
||||||
patterns:
|
|
||||||
- '*'
|
|
||||||
cooldown:
|
|
||||||
default-days: 7
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
name: CodeQL Workflow
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 15 * * 6'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
codeql:
|
|
||||||
name: CodeQL Analysis
|
|
||||||
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4
|
|
||||||
with:
|
|
||||||
config-file: ./.github/codeql/codeql-configuration.yml
|
|
||||||
languages: javascript
|
|
||||||
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
name: Docs workflow
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 15 * * 6'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
create:
|
|
||||||
if: github.event.repository.fork == false
|
|
||||||
permissions:
|
|
||||||
contents: none # this job only prepares artifacts and uploads them, no repository writes
|
|
||||||
name: Create
|
|
||||||
runs-on: ${{ matrix.operating-system }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-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', '8.7']
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php-versions }}
|
|
||||||
tools: none
|
|
||||||
- name: Create file with all extensions 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: |
|
|
||||||
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@f3e473d116dcccaddc5834248c87452386958240 # 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: |
|
|
||||||
echo "## PHP $version" >> "$file"
|
|
||||||
printf "\n" >> "$file"
|
|
||||||
echo "\`\`\`" >> "$file"
|
|
||||||
php -m >> "$file.builtin"
|
|
||||||
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"
|
|
||||||
printf "\n" >> "$file"
|
|
||||||
rm "$file.all" "$file.builtin"
|
|
||||||
- name: Create final file for Windows
|
|
||||||
env:
|
|
||||||
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
|
||||||
version: ${{ matrix.php-versions }}
|
|
||||||
if: matrix.operating-system == 'windows-2022'
|
|
||||||
run: |
|
|
||||||
Write-Output "## PHP $env:version`n" | Out-File -FilePath "$env:file"
|
|
||||||
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
|
|
||||||
php -m | Out-File -FilePath "$env:file.builtin" -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
|
|
||||||
Remove-Item "$env:file.all" -Force
|
|
||||||
Remove-Item "$env:file.builtin" -Force
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
||||||
with:
|
|
||||||
name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
|
||||||
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
|
||||||
update:
|
|
||||||
if: github.event.repository.fork == false
|
|
||||||
permissions:
|
|
||||||
contents: write # for Git to git push
|
|
||||||
name: Update
|
|
||||||
needs: create
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
repository: ${{ github.repository }}.wiki
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Download artifacts
|
|
||||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
||||||
with:
|
|
||||||
path: ${{ github.workspace }}/lists
|
|
||||||
pattern: lists-*
|
|
||||||
merge-multiple: true
|
|
||||||
- name: Configure Git
|
|
||||||
env:
|
|
||||||
GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
|
|
||||||
GIT_USER_NAME: github-actions[bot]
|
|
||||||
run : |
|
|
||||||
git config --local user.email "$GIT_USER_EMAIL"
|
|
||||||
git config --local user.name "$GIT_USER_NAME"
|
|
||||||
- name: Combine
|
|
||||||
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
|
|
||||||
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 8.7; do
|
|
||||||
if [[ "${os%-*}" = "macos" ]]; then
|
|
||||||
cat lists/php"$version"-macos-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
|
|
||||||
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
rm -rf ./lists
|
|
||||||
- name: Update
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
WIKI_REPOSITORY: ${{ github.repository }}
|
|
||||||
run: |
|
|
||||||
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
|
|
||||||
git add .
|
|
||||||
git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')"
|
|
||||||
git push -f https://x-access-token:${GITHUB_TOKEN}@github.com/${WIKI_REPOSITORY}.wiki.git master || true
|
|
||||||
fi
|
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
name: Experimental workflow
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- releases/v1
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'examples/**'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- releases/v1
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'examples/**'
|
||||||
|
jobs:
|
||||||
|
run:
|
||||||
|
name: Run
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['8.0']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node.js 12.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Prettier Format Check
|
||||||
|
run: npm run format-check
|
||||||
|
|
||||||
|
- name: ESLint Check
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: npm test
|
||||||
|
|
||||||
|
- name: Send Coverage
|
||||||
|
continue-on-error: true
|
||||||
|
timeout-minutes: 1
|
||||||
|
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
|
||||||
|
|
||||||
|
- name: Setup PHP with extensions and custom config
|
||||||
|
run: node dist/index.js
|
||||||
|
env:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: xml, opcache, xdebug, pcov #optional
|
||||||
|
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional
|
||||||
|
coverage: pcov
|
||||||
|
|
||||||
|
- name: Testing PHP version
|
||||||
|
run: |
|
||||||
|
php -v
|
||||||
|
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}"
|
||||||
|
|
||||||
|
- name: Testing Composer version
|
||||||
|
run: |
|
||||||
|
composer -V
|
||||||
|
php -r "if(strpos(@exec('composer -V'), 'Composer version') === false) {throw new Exception('Composer not found');}"
|
||||||
|
- name: Testing Extensions
|
||||||
|
run: |
|
||||||
|
php -m
|
||||||
|
php -r "if(! extension_loaded('mbstring')) {throw new Exception('mbstring not found');}"
|
||||||
|
php -r "if(! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
|
||||||
|
- name: Testing ini values
|
||||||
|
run: |
|
||||||
|
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
|
||||||
|
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
|
||||||
|
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
|
||||||
|
- name: Test JIT
|
||||||
|
run: |
|
||||||
|
php -r "if(! extension_loaded('Zend OPcache')) {throw new Exception('Zend OPcache not found');}"
|
||||||
|
php -r "if(ini_get('opcache.jit_buffer_size')!='256M') {throw new Exception('opcache.jit_buffer_size not set');}"
|
||||||
|
php -r "if(ini_get('opcache.jit')!=1235) {throw new Exception('opcache.jit not set');}"
|
||||||
|
php -r "if(ini_get('pcre.jit')!=1) {throw new Exception('pcre.jit not set');}"
|
||||||
|
- name: Benchmark JIT
|
||||||
|
run: |
|
||||||
|
curl -o bench.php https://raw.githubusercontent.com/php/php-src/master/Zend/bench.php
|
||||||
|
php bench.php
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
name: Node workflow
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
- verbose
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
- 'examples/**'
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
- verbose
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
- 'examples/**'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
name: Run
|
|
||||||
environment: codecov
|
|
||||||
runs-on: ${{ matrix.operating-system }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Setup Node.js 24.x
|
|
||||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
|
||||||
with:
|
|
||||||
node-version: 24.x
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm install
|
|
||||||
|
|
||||||
- name: Prettier Format Check
|
|
||||||
run: npm run format-check
|
|
||||||
|
|
||||||
- name: ESLint Check
|
|
||||||
run: npm run lint
|
|
||||||
|
|
||||||
- name: TypeScript Check
|
|
||||||
run: npm run typecheck
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: npm test
|
|
||||||
|
|
||||||
- name: Run npm audit
|
|
||||||
run: npm audit
|
|
||||||
|
|
||||||
- name: Send Coverage
|
|
||||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
files: coverage/lcov.info
|
|
||||||
name: github-actions-codecov-${{ matrix.operating-system }}
|
|
||||||
fail_ci_if_error: false
|
|
||||||
verbose: true
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
name: Main workflow
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
- verbose
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
- 'examples/**'
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
- verbose
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
- 'examples/**'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
env:
|
|
||||||
default-php-version: '8.5'
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
name: Run
|
|
||||||
runs-on: ${{ matrix.operating-system }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
operating-system: [ubuntu-24.04, ubuntu-22.04, windows-2022, macos-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', '8.7']
|
|
||||||
include:
|
|
||||||
- operating-system: ubuntu-24.04
|
|
||||||
php-versions: ''
|
|
||||||
php-version-file: 'php-version-file'
|
|
||||||
env:
|
|
||||||
extensions: xml, opcache, xdebug, pcov, gd
|
|
||||||
key: cache-v5
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Setup cache environment
|
|
||||||
id: cache-env
|
|
||||||
uses: shivammathur/cache-extensions@de3c642a5fce0ef91581a1c9831e229f525196d6 # v1
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php-versions || env.default-php-version }}
|
|
||||||
extensions: ${{ env.extensions }}
|
|
||||||
key: ${{ env.key }}
|
|
||||||
|
|
||||||
- name: Cache extensions
|
|
||||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
|
|
||||||
with:
|
|
||||||
path: ${{ steps.cache-env.outputs.dir }}
|
|
||||||
key: ${{ 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' }}
|
|
||||||
env:
|
|
||||||
DEFAULT_PHP_VERSION: ${{ env.default-php-version }}
|
|
||||||
run: |
|
|
||||||
echo "$DEFAULT_PHP_VERSION" > php-version-file
|
|
||||||
|
|
||||||
- name: Setup PHP with extensions and custom config
|
|
||||||
run: node dist/index.js
|
|
||||||
env:
|
|
||||||
php-version: ${{ matrix.php-versions }}
|
|
||||||
php-version-file: ${{ matrix.php-version-file }}
|
|
||||||
extensions: ${{ env.extensions }}
|
|
||||||
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata
|
|
||||||
|
|
||||||
- name: Testing PHP version
|
|
||||||
env:
|
|
||||||
EXPECTED_PHP_VERSION: ${{ matrix.php-versions || env.default-php-version }}
|
|
||||||
run: |
|
|
||||||
php -v
|
|
||||||
php -r '$expected = getenv("EXPECTED_PHP_VERSION"); if(strpos(phpversion(), $expected) === false) {throw new Exception("Wrong PHP version Installed");}'
|
|
||||||
|
|
||||||
- name: Testing Composer version
|
|
||||||
run: |
|
|
||||||
composer -V
|
|
||||||
php -r "if(strpos(@exec('composer -V'), 'Composer version') === false) {throw new Exception('Composer not found');}"
|
|
||||||
- name: Testing Extensions
|
|
||||||
run: |
|
|
||||||
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('Xdebug')) {throw new Exception('Xdebug not found');}"
|
|
||||||
php -r "if(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
|
|
||||||
- name: Testing ini values
|
|
||||||
run: |
|
|
||||||
php -r "if(ini_get('memory_limit')!='-1') {throw new Exception('memory_limit not disabled');}"
|
|
||||||
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
|
|
||||||
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
|
|
||||||
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
|
|
||||||
@@ -1,77 +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
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: false
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build and Publish
|
|
||||||
permissions:
|
|
||||||
contents: read # for actions/checkout
|
|
||||||
packages: write # For publishing to GitHub Packages
|
|
||||||
id-token: write # For authentication with npm registry
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout release
|
|
||||||
if: github.event_name != 'workflow_dispatch'
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Checkout tag
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
if: github.event_name == 'workflow_dispatch'
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.inputs.tag }}
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
|
||||||
with:
|
|
||||||
node-version: '24.x'
|
|
||||||
registry-url: https://registry.npmjs.org
|
|
||||||
package-manager-cache: false
|
|
||||||
|
|
||||||
- name: Install dependencies and add lib
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
sed -i -e '/lib\//d' .gitignore
|
|
||||||
|
|
||||||
- name: Select npm distribution tag
|
|
||||||
id: publish-tag
|
|
||||||
run: |
|
|
||||||
jq -r '.version | if test("alpha|beta|rc"; "i") then "tag=next" else "tag=latest" end' package.json >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Publish to NPM
|
|
||||||
if: "!contains(github.event.inputs.skip, 'skip-npm')"
|
|
||||||
run: npm publish --access public --tag "${{ steps.publish-tag.outputs.tag }}"
|
|
||||||
|
|
||||||
- name: Change to GitHub Packages registry
|
|
||||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
|
||||||
with:
|
|
||||||
registry-url: https://npm.pkg.github.com
|
|
||||||
package-manager-cache: false
|
|
||||||
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 --tag "${{ steps.publish-tag.outputs.tag }}"
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
name: Main workflow
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- releases/v1
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'examples/**'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- releases/v1
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'examples/**'
|
||||||
|
jobs:
|
||||||
|
run:
|
||||||
|
name: Run
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node.js 12.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Prettier Format Check
|
||||||
|
run: npm run format-check
|
||||||
|
|
||||||
|
- name: ESLint Check
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: npm test
|
||||||
|
|
||||||
|
- name: Send Coverage
|
||||||
|
continue-on-error: true
|
||||||
|
timeout-minutes: 1
|
||||||
|
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
|
||||||
|
|
||||||
|
- name: Setup PHP with extensions and custom config
|
||||||
|
run: node dist/index.js
|
||||||
|
env:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: xml, opcache, xdebug, pcov #optional
|
||||||
|
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional
|
||||||
|
|
||||||
|
- name: Testing PHP version
|
||||||
|
run: |
|
||||||
|
php -v
|
||||||
|
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}"
|
||||||
|
|
||||||
|
- name: Testing Composer version
|
||||||
|
run: |
|
||||||
|
composer -V
|
||||||
|
php -r "if(strpos(@exec('composer -V'), 'Composer version') === false) {throw new Exception('Composer not found');}"
|
||||||
|
- name: Testing Extensions
|
||||||
|
run: |
|
||||||
|
php -m
|
||||||
|
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(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
|
||||||
|
- name: Testing ini values
|
||||||
|
run: |
|
||||||
|
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
|
||||||
|
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
|
||||||
|
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
|
||||||
+1
-1
@@ -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
|
|
||||||
+6
-7
@@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
"arrowParens": "avoid",
|
|
||||||
"bracketSpacing": false,
|
|
||||||
"endOfLine": "auto",
|
|
||||||
"parser": "typescript",
|
|
||||||
"printWidth": 80,
|
"printWidth": 80,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"tabWidth": 2,
|
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"useTabs": false
|
"bracketSpacing": false,
|
||||||
}
|
"arrowParens": "avoid",
|
||||||
|
"parser": "typescript"
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) shivammathur and contributors
|
Copyright (c) 2019-2020 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
|
||||||
|
|||||||
+47
-15
@@ -1,20 +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 C:\\tools\\php\\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"'}
|
);
|
||||||
${'disable_functions="exec,system"'} | ${'linux'} | ${'echo "disable_functions=exec,system" | sudo tee -a'}
|
|
||||||
${'disable_functions="exec,system"'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "disable_functions=exec,system"'}
|
win32 = await config.addINIValues(
|
||||||
${'a=$(id)'} | ${'linux'} | ${'echo "a=\'\\$(id)\'"'}
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
${'a=$(id)'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=\'`$(id)\'"'}
|
'fedora'
|
||||||
${'a=b, c=d'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
);
|
||||||
`('checking addINIValues on $os', async ({ini_values, os, output}) => {
|
expect(win32).toContain('Platform fedora is not supported');
|
||||||
expect(await config.addINIValues(ini_values, os)).toContain(output);
|
});
|
||||||
|
|
||||||
|
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"'
|
||||||
|
);
|
||||||
|
|
||||||
|
linux = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'fedora'
|
||||||
|
);
|
||||||
|
expect(linux).toContain('Platform fedora 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"'
|
||||||
|
);
|
||||||
|
|
||||||
|
darwin = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'fedora'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('Platform fedora 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');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
+93
-40
@@ -1,44 +1,97 @@
|
|||||||
import * as coverage from '../src/coverage';
|
import * as coverage from '../src/coverage';
|
||||||
|
|
||||||
|
jest.mock('../src/extensions', () => ({
|
||||||
|
addExtension: jest.fn().mockImplementation(extension => {
|
||||||
|
return 'add_extension ' + extension + '\n';
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
|
||||||
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'}
|
it('checking addCoverage with PCOV on linux', async () => {
|
||||||
${'xdebug'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'}
|
const linux: string = await coverage.addCoverage('pcov', '7.4', 'linux');
|
||||||
${'xdebug3'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'}
|
expect(linux).toContain('add_extension pcov');
|
||||||
${'xdebug2'} | ${'7.4'} | ${'linux'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
|
expect(linux).toContain('remove_extension xdebug');
|
||||||
${'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'}
|
it('checking addCoverage with PCOV on darwin', async () => {
|
||||||
${'xdebug3'} | ${'7.1'} | ${'darwin'} | ${'xdebug3 is not supported on PHP 7.1'}
|
const darwin: string = await coverage.addCoverage('pcov', '7.4', 'darwin');
|
||||||
${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2 zend_extension 2.9.8'}
|
expect(darwin).toContain('add_extension pcov');
|
||||||
${'xdebug2'} | ${'8.0'} | ${'darwin'} | ${'xdebug2 is not supported on PHP 8.0'}
|
expect(darwin).toContain('remove_extension xdebug');
|
||||||
${'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'}
|
it('checking addCoverage with Xdebug on windows', async () => {
|
||||||
${'nocov'} | ${'7.x'} | ${'any'} | ${''}
|
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
|
||||||
${''} | ${'7.x'} | ${'any'} | ${''}
|
expect(win32).toContain('add_extension xdebug');
|
||||||
`(
|
});
|
||||||
'checking addCoverage with $driver on $os',
|
|
||||||
async ({driver, php, os, output}) => {
|
it('checking addCoverage with Xdebug on windows', async () => {
|
||||||
const script: string = await coverage.addCoverage(driver, php, os);
|
const win32: string = await coverage.addCoverage('xdebug', '8.0', 'win32');
|
||||||
if (output) {
|
expect(win32).toContain('Xdebug currently only supports PHP 7.4 or lower');
|
||||||
output.split(',').forEach((command: string) => {
|
});
|
||||||
expect(script).toContain(command);
|
|
||||||
});
|
it('checking addCoverage with Xdebug on linux', async () => {
|
||||||
} else {
|
const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux');
|
||||||
expect(script).toEqual(output);
|
expect(linux).toContain('add_extension xdebug');
|
||||||
}
|
});
|
||||||
}
|
|
||||||
);
|
it('checking addCoverage with Xdebug on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
||||||
|
expect(linux).toContain('Xdebug currently only supports PHP 7.4 or lower');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage(
|
||||||
|
'xdebug',
|
||||||
|
'7.4',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('add_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage(
|
||||||
|
'xdebug',
|
||||||
|
'8.0',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('Xdebug currently only supports PHP 7.4 or lower');
|
||||||
|
});
|
||||||
|
|
||||||
|
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,62 +0,0 @@
|
|||||||
import {execFileSync} from 'node:child_process';
|
|
||||||
import * as fs from 'node:fs';
|
|
||||||
|
|
||||||
describe('macOS installed PHP version comparison', () => {
|
|
||||||
const functions = fs
|
|
||||||
.readFileSync('src/scripts/darwin.sh', 'utf8')
|
|
||||||
.split('# Variables')[0];
|
|
||||||
|
|
||||||
it.each([
|
|
||||||
['8.7.0-dev', '8.7.0', 'Found'],
|
|
||||||
['8.6.0-dev', '8.6.0', 'Found'],
|
|
||||||
['8.7.0-dev', '8.7.0-dev', 'Found'],
|
|
||||||
['8.5.9', '8.5.9', 'Found'],
|
|
||||||
['8.5.9', '8.5.11', 'Upgraded'],
|
|
||||||
['8.6.0RC1', '8.6.0', 'Upgraded'],
|
|
||||||
['8.7.0-dev', '8.7.1', 'Upgraded']
|
|
||||||
])('handles runtime %s with formula %s', (runtime, formula, expected) => {
|
|
||||||
// Exercise setup_php's real selection path while isolating system writes
|
|
||||||
// and the configuration stage from this version-comparison regression.
|
|
||||||
const output = execFileSync(
|
|
||||||
'bash',
|
|
||||||
[
|
|
||||||
'-c',
|
|
||||||
`${functions}
|
|
||||||
version="$REQUESTED"
|
|
||||||
debug=release ts=nts old_versions='^5\\.[3-5]$'
|
|
||||||
src=/unused RUNNER_TOOL_CACHE=/unused tool_path_dir=/unused tick=ok cross=error
|
|
||||||
step_log() { :; }
|
|
||||||
check_pre_installed() { :; }
|
|
||||||
get_brewed_php() { echo "$RUNTIME"; }
|
|
||||||
php_semver() { echo "$RUNTIME"; }
|
|
||||||
brew() { test "$1" = info || exit 2; echo "$FORMULA"; }
|
|
||||||
jq() { cat; }
|
|
||||||
add_php() { printf '%s\n' "$1" >&3; }
|
|
||||||
php-config() { :; }
|
|
||||||
sed() { echo /unused; }
|
|
||||||
sudo() { :; }
|
|
||||||
php_ini_path() { echo /unused; }
|
|
||||||
get_scan_dir() { echo /unused; }
|
|
||||||
php_extra_version() { :; }
|
|
||||||
configure_php() { :; }
|
|
||||||
link_opcache() { :; }
|
|
||||||
set_output() { :; }
|
|
||||||
add_log() { printf '%s\n' "$*"; }
|
|
||||||
setup_php 3>&1
|
|
||||||
`
|
|
||||||
],
|
|
||||||
{
|
|
||||||
encoding: 'utf8',
|
|
||||||
env: {
|
|
||||||
...process.env,
|
|
||||||
REQUESTED: runtime.split('.').slice(0, 2).join('.'),
|
|
||||||
RUNTIME: runtime,
|
|
||||||
FORMULA: formula
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
expect(output).toContain(`${expected} PHP ${runtime}`);
|
|
||||||
if (expected === 'Upgraded') expect(output).toContain('upgrade\n');
|
|
||||||
else expect(output).not.toContain('upgrade\n');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
import {extensionPacks} from '../src/extensions';
|
|
||||||
import {execFileSync} from 'node:child_process';
|
|
||||||
import * as fs from 'node:fs';
|
|
||||||
import * as os from 'node:os';
|
|
||||||
import * as path from 'node:path';
|
|
||||||
|
|
||||||
describe('Optional macOS extension archives', () => {
|
|
||||||
it('installs packs concurrently and preserves successful packs when another fails', () => {
|
|
||||||
const directory = fs.mkdtempSync(
|
|
||||||
path.join(os.tmpdir(), 'setup-php-packs-')
|
|
||||||
);
|
|
||||||
const cache = path.join(directory, 'cache');
|
|
||||||
fs.mkdirSync(cache);
|
|
||||||
try {
|
|
||||||
for (const name of ['imagick', 'mongodb', 'memcached']) {
|
|
||||||
fs.writeFileSync(path.join(cache, name + '.json'), '{}');
|
|
||||||
}
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.join(cache, 'install-extensions.cjs'),
|
|
||||||
`const fs=require('node:fs'), path=require('node:path');
|
|
||||||
const [,directory,name]=process.argv.slice(2);
|
|
||||||
fs.writeFileSync(path.join(directory,name+'.started'),'yes');
|
|
||||||
setTimeout(()=>process.exit(2),1500);
|
|
||||||
setInterval(()=>{
|
|
||||||
if (fs.readdirSync(directory).filter(file=>file.endsWith('.started')).length!==3) return;
|
|
||||||
fs.writeFileSync(path.join(directory,name+'.env'),'SASL_PATH=/cache/'+name+'\\n');
|
|
||||||
console.log('completed '+name);
|
|
||||||
process.exit(name==='mongodb'?1:0);
|
|
||||||
},10);
|
|
||||||
`
|
|
||||||
);
|
|
||||||
const output = execFileSync(
|
|
||||||
'bash',
|
|
||||||
[
|
|
||||||
'-c',
|
|
||||||
'. "$CACHE_SCRIPT"; add_env() { printf "env %s %s\\n" "$1" "$2"; }; enable_extensions() { printf "enable batch %s\\n" "$*"; }; enable_extension() { printf "enable module %s\\n" "$1"; }; php() { echo refreshed; }; (exit 0) & extension_cache_pid=$!; finish_extension_cache_downloads; test "$extension_cache_memcached_dependencies" = "igbinary msgpack"; test "$(cat /tmp/php${version}_extensions)" = refreshed; rm /tmp/php${version}_extensions'
|
|
||||||
],
|
|
||||||
{
|
|
||||||
encoding: 'utf8',
|
|
||||||
env: {
|
|
||||||
...process.env,
|
|
||||||
CACHE_SCRIPT: path.resolve(
|
|
||||||
'src/scripts/extensions/darwin_cache.sh'
|
|
||||||
),
|
|
||||||
SETUP_PHP_NODE: process.execPath,
|
|
||||||
SETUP_PHP_EXTENSION_PACKS: 'imagick mongodb memcached',
|
|
||||||
extension_cache_dir: cache,
|
|
||||||
version: 'cache-test-' + path.basename(directory),
|
|
||||||
verbose: ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
expect(output).toContain('completed imagick');
|
|
||||||
expect(output).toContain('completed memcached');
|
|
||||||
expect(output).toContain('mongodb cache unavailable');
|
|
||||||
expect(output).toContain('env SASL_PATH /cache/imagick');
|
|
||||||
expect(output).not.toContain('env SASL_PATH /cache/mongodb');
|
|
||||||
expect(output).toContain('enable batch imagick igbinary msgpack');
|
|
||||||
expect(output).toContain('enable module memcached');
|
|
||||||
expect(output).not.toContain('enable batch mongodb');
|
|
||||||
expect(output.indexOf('enable batch')).toBeLessThan(
|
|
||||||
output.indexOf('enable module memcached')
|
|
||||||
);
|
|
||||||
expect(fs.existsSync(cache)).toBe(false);
|
|
||||||
} finally {
|
|
||||||
fs.rmSync(directory, {recursive: true, force: true});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
it('selects each requested pack once', async () => {
|
|
||||||
expect(
|
|
||||||
await extensionPacks(
|
|
||||||
'imagick, mongodb, memcached, imagick, redis',
|
|
||||||
'8.4',
|
|
||||||
'darwin'
|
|
||||||
)
|
|
||||||
).toEqual(['imagick', 'mongodb', 'memcached']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each(['', 'redis, yaml', ':imagick', 'imagick, :imagick'])(
|
|
||||||
'does not download unused or disabled packs: %s',
|
|
||||||
async input => {
|
|
||||||
expect(await extensionPacks(input, '8.4', 'darwin')).toEqual([]);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it.each(['imagick-3.8.1', 'mongodb-beta', 'memcached-github.com/a/b@main'])(
|
|
||||||
'preserves explicit version/source installation: %s',
|
|
||||||
async input => {
|
|
||||||
expect(await extensionPacks(input, '8.4', 'darwin')).toEqual([]);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it('selects optional packs for PHP 5.6 through 8.7', async () => {
|
|
||||||
for (const version of [
|
|
||||||
'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',
|
|
||||||
'8.7'
|
|
||||||
]) {
|
|
||||||
expect(
|
|
||||||
await extensionPacks('imagick, mongodb, memcached', version, 'darwin')
|
|
||||||
).toEqual(['imagick', 'mongodb', 'memcached']);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('keeps unsupported PHP and other platforms on their existing paths', async () => {
|
|
||||||
for (const version of ['5.4', '5.5', '7.5', '8.8', '9.0']) {
|
|
||||||
expect(await extensionPacks('imagick', version, 'darwin')).toEqual([]);
|
|
||||||
}
|
|
||||||
for (const os of ['linux', 'win32']) {
|
|
||||||
expect(await extensionPacks('imagick', '8.4', os)).toEqual([]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
+128
-154
@@ -1,163 +1,137 @@
|
|||||||
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, phalcon4, ast-beta',
|
||||||
${':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('phalcon.ps1 phalcon4');
|
||||||
${'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-Extension ast beta');
|
||||||
${'mysql'} | ${'7.4'} | ${'Add-Extension mysqli\nAdd-Extension mysqlnd'}
|
|
||||||
${'mysql'} | ${'5.5'} | ${'Add-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd'}
|
|
||||||
${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
|
|
||||||
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
|
||||||
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
|
|
||||||
${'ibm_db2'} | ${'7.4'} | ${'Add-Ibm ibm_db2'}
|
|
||||||
${'pdo_ibm'} | ${'7.4'} | ${'Add-Ibm pdo_ibm'}
|
|
||||||
${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
|
|
||||||
${'http'} | ${'8.5'} | ${'Add-Http'}
|
|
||||||
${'pdo_sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv pdo_sqlsrv'}
|
|
||||||
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
|
|
||||||
${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'}
|
|
||||||
${'sqlite'} | ${'7.4'} | ${'Add-Extension sqlite3'}
|
|
||||||
${'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('mysql', '7.4', 'win32');
|
||||||
extension | version | output
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
${'none'} | ${'7.4'} | ${'disable_all_shared'}
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
${':intl'} | ${'7.4'} | ${'disable_extension intl'}
|
|
||||||
${'ast-beta'} | ${'7.4'} | ${'add_unstable_extension ast beta extension'}
|
|
||||||
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
|
||||||
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
|
||||||
${'couchbase'} | ${'7.4'} | ${'add_couchbase'}
|
|
||||||
${'gearman'} | ${'5.6'} | ${'add_gearman'}
|
|
||||||
${'geos'} | ${'7.3'} | ${'add_geos'}
|
|
||||||
${'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'}
|
|
||||||
${'intl-65.1'} | ${'5.6'} | ${'add_intl intl-65.1'}
|
|
||||||
${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
|
|
||||||
${'memcache-8.2'} | ${'8.2'} | ${'add_pecl_extension memcache 8.2 extension'}
|
|
||||||
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
|
||||||
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
|
||||||
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
|
|
||||||
${'ibm_db2'} | ${'7.3'} | ${'add_ibm ibm_db2'}
|
|
||||||
${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
|
|
||||||
${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
|
|
||||||
${'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);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it.each`
|
win32 = await extensions.addExtension('mysql', '8.0', 'win32');
|
||||||
extension | version | output
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
${'none'} | ${'7.2'} | ${'disable_all_shared'}
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
${':intl'} | ${'7.2'} | ${'disable_extension intl'}
|
|
||||||
${'ast-beta'} | ${'7.2'} | ${'add_unstable_extension ast beta extension'}
|
|
||||||
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
|
||||||
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
|
||||||
${'couchbase'} | ${'5.6'} | ${'add_couchbase'}
|
|
||||||
${'does_not_exist'} | ${'7.2'} | ${'add_extension does_not_exist'}
|
|
||||||
${'geos'} | ${'7.3'} | ${'add_geos'}
|
|
||||||
${'grpc-1.2.3'} | ${'7.2'} | ${'add_pecl_extension grpc 1.2.3 extension'}
|
|
||||||
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
|
|
||||||
${'imagick'} | ${'5.5'} | ${'add_extension imagick'}
|
|
||||||
${'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'}
|
|
||||||
${'xdebug2'} | ${'7.4'} | ${'add_brew_extension xdebug2 zend_extension 2.9.8'}
|
|
||||||
${'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);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const data: string[][] = fs
|
win32 = await extensions.addExtension('mysql', '5.6', 'win32');
|
||||||
.readFileSync('src/configs/brew_extensions')
|
expect(win32).toContain('Add-Extension mysql');
|
||||||
.toString()
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
.split(/\r?\n/)
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
.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)(
|
win32 = await extensions.addExtension(
|
||||||
'checking addExtensionOnDarwin for brew extension %s',
|
'phalcon3, does_not_exist',
|
||||||
async (extension, version, output) => {
|
'7.2',
|
||||||
expect(
|
'win32',
|
||||||
await extensions.addExtension(extension, version, 'darwin')
|
true
|
||||||
).toContain(output);
|
);
|
||||||
}
|
expect(win32).toContain('phalcon.ps1 phalcon3');
|
||||||
);
|
expect(win32).toContain('Add-Extension does_not_exist');
|
||||||
|
|
||||||
it.each`
|
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
extension | version | output
|
expect(win32).toContain('Platform fedora is not supported');
|
||||||
${'xdebug'} | ${'7.2'} | ${'Platform openbsd is not supported'}
|
});
|
||||||
`(
|
|
||||||
'checking addExtension on openbsd for extension $extension on version $version',
|
it('checking addExtensionOnLinux', async () => {
|
||||||
async ({extension, version, output}) => {
|
let linux: string = await extensions.addExtension(
|
||||||
expect(
|
'Xdebug, pcov, sqlite, ast-beta, xdebug-alpha',
|
||||||
await extensions.addExtension(extension, version, 'openbsd')
|
'7.4',
|
||||||
).toContain(output);
|
'linux'
|
||||||
}
|
);
|
||||||
);
|
expect(linux).toContain('update_extension xdebug 2.9.2');
|
||||||
|
expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-pcov');
|
||||||
|
expect(linux).toContain(
|
||||||
|
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
|
||||||
|
);
|
||||||
|
expect(linux).toContain('add_unstable_extension ast beta extension');
|
||||||
|
expect(linux).toContain(
|
||||||
|
'add_unstable_extension xdebug alpha zend_extension'
|
||||||
|
);
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||||
|
expect(linux).toContain('gearman.sh 7.0');
|
||||||
|
linux = await extensions.addExtension('gearman', '7.1', 'linux');
|
||||||
|
expect(linux).toContain('gearman.sh 7.1');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('gearman', '7.2', 'linux');
|
||||||
|
expect(linux).toContain('gearman.sh 7.2');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('gearman', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('gearman.sh 7.3');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
||||||
|
expect(linux).toContain('gearman.sh 7.4');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
|
expect(linux).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
||||||
|
expect(linux).toContain('phalcon.sh phalcon3 7.3');
|
||||||
|
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
|
let darwin: string = await extensions.addExtension(
|
||||||
|
'Xdebug, pcov, sqlite, ast-beta',
|
||||||
|
'7.2',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('sudo pecl install -f xdebug');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f sqlite3');
|
||||||
|
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
||||||
|
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('phalcon4', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f xdebug-2.9.0');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f xdebug');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f redis');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
||||||
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||||
|
|
||||||
|
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', 'fedora');
|
||||||
|
expect(darwin).toContain('Platform fedora is not supported');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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);
|
|
||||||
});
|
|
||||||
+164
-70
@@ -1,87 +1,181 @@
|
|||||||
import * as install from '../src/install';
|
import * as install from '../src/install';
|
||||||
import * as utils from '../src/utils';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock install.ts
|
* Mock install.ts
|
||||||
*/
|
*/
|
||||||
jest.mock('../src/install', () => ({
|
jest.mock('../src/install', () => ({
|
||||||
getScript: jest
|
build: jest.fn().mockImplementation(
|
||||||
.fn()
|
async (
|
||||||
.mockImplementation(async (os: string): Promise<string> => {
|
filename: string,
|
||||||
const filename = os + (await utils.scriptExtension(os));
|
version: string,
|
||||||
const version: string = await utils.parseVersion(
|
os_version: string
|
||||||
await utils.readPHPVersion()
|
): Promise<string> => {
|
||||||
);
|
|
||||||
const ini_file: string = await utils.parseIniFile(
|
|
||||||
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 (ini_values_csv) {
|
||||||
|
script += 'edit php.ini';
|
||||||
|
}
|
||||||
|
if (coverage_driver) {
|
||||||
|
script += 'set coverage driver';
|
||||||
|
}
|
||||||
|
|
||||||
return script;
|
return script;
|
||||||
}),
|
}
|
||||||
run: jest.fn().mockImplementation(async (): Promise<string> => {
|
),
|
||||||
const os: string = process.env['RUNNER_OS'] || '';
|
run: jest.fn().mockImplementation(
|
||||||
const tool = await utils.scriptTool(os);
|
async (): Promise<string> => {
|
||||||
return tool + (await install.getScript(os));
|
const os_version: string = process.env['RUNNER_OS'] || '';
|
||||||
})
|
let version: string = process.env['php-version'] || '';
|
||||||
|
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
||||||
|
let script = '';
|
||||||
|
switch (os_version) {
|
||||||
|
case 'darwin':
|
||||||
|
case 'linux':
|
||||||
|
script = await install.build(os_version + '.sh', version, os_version);
|
||||||
|
script += 'sh script.sh ' + version + ' ' + __dirname;
|
||||||
|
break;
|
||||||
|
case 'win32':
|
||||||
|
script = await install.build(os_version + '.sh', version, os_version);
|
||||||
|
script += 'pwsh script.ps1 ' + version + ' ' + __dirname;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
script += os_version + ' is not supported';
|
||||||
|
}
|
||||||
|
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
* @param pecl
|
||||||
*/
|
*/
|
||||||
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,
|
||||||
|
pecl: string
|
||||||
|
): void {
|
||||||
|
process.env['php-version'] = version.toString();
|
||||||
|
process.env['RUNNER_OS'] = os;
|
||||||
|
process.env['extensions'] = extension_csv;
|
||||||
|
process.env['ini-values'] = ini_values_csv;
|
||||||
|
process.env['coverage'] = coverage_driver;
|
||||||
|
process.env['tools'] = tools;
|
||||||
|
process.env['pecl'] = pecl;
|
||||||
|
}
|
||||||
|
|
||||||
describe('Install', () => {
|
describe('Install', () => {
|
||||||
it.each`
|
it('Test install on windows', async () => {
|
||||||
version | os | extension_csv | ini_file | ini_values_csv | coverage_driver | tools | output
|
setEnv('7.0', 'win32', '', '', '', '', '');
|
||||||
${'7.3'} | ${'darwin'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.3 production'}
|
// @ts-ignore
|
||||||
${'7.3'} | ${'darwin'} | ${'a, b'} | ${'development'} | ${'a=b'} | ${'x'} | ${''} | ${'bash darwin.sh 7.3 development install extensions set coverage driver edit php.ini'}
|
let script: string = await install.run();
|
||||||
${'7.4.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 7.4 none'}
|
expect(script).toContain('initial script');
|
||||||
${'8'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 production'}
|
expect(script).toContain('pwsh script.ps1 7.0 ' + __dirname);
|
||||||
${'8.0'} | ${'darwin'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.0 development'}
|
|
||||||
${'8.1'} | ${'darwin'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash darwin.sh 8.1 none'}
|
setEnv('7.3', 'win32', '', '', '', '', '');
|
||||||
${'7.3'} | ${'linux'} | ${''} | ${'invalid'} | ${''} | ${''} | ${''} | ${'bash linux.sh 7.3 production'}
|
// @ts-ignore
|
||||||
${'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'}
|
script = await install.run();
|
||||||
${'latest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.3 none'}
|
expect(script).toContain('initial script');
|
||||||
${'lowest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.1 none'}
|
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
|
||||||
${'highest'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.3 none'}
|
|
||||||
${'nightly'} | ${'linux'} | ${''} | ${'none'} | ${''} | ${''} | ${''} | ${'bash linux.sh 8.4 none'}
|
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '', '');
|
||||||
${'7.0'} | ${'win32'} | ${''} | ${'production'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.0 production'}
|
// @ts-ignore
|
||||||
${'7.3'} | ${'win32'} | ${''} | ${'development'} | ${''} | ${''} | ${''} | ${'pwsh win32.ps1 7.3 development'}
|
script = await install.run();
|
||||||
${'7.3'} | ${'win32'} | ${'a, b'} | ${'none'} | ${'a=b'} | ${'x'} | ${''} | ${'pwsh win32.ps1 7.3 none install extensions set coverage driver edit php.ini'}
|
expect(script).toContain('initial script');
|
||||||
`(
|
expect(script).toContain('install extensions');
|
||||||
'Test install on $os for $version with extensions=$extension_csv, ini_values=$ini_values_csv, coverage_driver=$coverage_driver, tools=$tools',
|
expect(script).toContain('edit php.ini');
|
||||||
async ({
|
expect(script).toContain('set coverage driver');
|
||||||
version,
|
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
|
||||||
os,
|
});
|
||||||
extension_csv,
|
|
||||||
ini_file,
|
it('Test install on linux', async () => {
|
||||||
ini_values_csv,
|
setEnv('7.3', 'linux', '', '', '', '', '');
|
||||||
coverage_driver,
|
// @ts-ignore
|
||||||
tools,
|
let script: string = await install.run();
|
||||||
output
|
expect(script).toContain('initial script');
|
||||||
}) => {
|
expect(script).toContain('sh script.sh 7.3 ');
|
||||||
process.env['php-version'] = version.toString();
|
|
||||||
process.env['RUNNER_OS'] = os;
|
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit', 'true');
|
||||||
process.env['extensions'] = extension_csv;
|
// @ts-ignore
|
||||||
process.env['ini-file'] = ini_file;
|
script = await install.run();
|
||||||
process.env['ini-values'] = ini_values_csv;
|
expect(script).toContain('initial script');
|
||||||
process.env['coverage'] = coverage_driver;
|
expect(script).toContain('install extensions');
|
||||||
process.env['tools'] = tools;
|
expect(script).toContain('edit php.ini');
|
||||||
expect(await install.run()).toBe(output);
|
expect(script).toContain('set coverage driver');
|
||||||
}
|
expect(script).toContain('sh script.sh 7.3');
|
||||||
);
|
expect(script).toContain('add_tool');
|
||||||
|
|
||||||
|
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit', '');
|
||||||
|
// @ts-ignore
|
||||||
|
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('sh script.sh 7.3');
|
||||||
|
expect(script).toContain('add_tool');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test install on darwin', async () => {
|
||||||
|
setEnv('7.3', 'darwin', '', '', '', '', '');
|
||||||
|
// @ts-ignore
|
||||||
|
let script: string = await install.run();
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '', '');
|
||||||
|
// @ts-ignore
|
||||||
|
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('sh script.sh 7.3 ' + __dirname);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test malformed version inputs', async () => {
|
||||||
|
setEnv('7.4.1', 'darwin', '', '', '', '', '');
|
||||||
|
// @ts-ignore
|
||||||
|
let script: string = await install.run();
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('sh script.sh 7.4 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv(8.0, 'darwin', '', '', '', '', '');
|
||||||
|
// @ts-ignore
|
||||||
|
script = await install.run();
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('sh script.sh 8.0 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv(8, 'darwin', '', '', '', '', '');
|
||||||
|
// @ts-ignore
|
||||||
|
script = await install.run();
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('sh script.sh 8.0 ' + __dirname);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import * as io from '@actions/io';
|
||||||
|
import * as matchers from '../src/matchers';
|
||||||
|
|
||||||
|
jest.mock('@actions/io');
|
||||||
|
|
||||||
|
describe('Matchers', () => {
|
||||||
|
it('Add matchers', async () => {
|
||||||
|
process.env['RUNNER_TOOL_CACHE'] = __dirname;
|
||||||
|
await matchers.addMatchers();
|
||||||
|
const spy = jest.spyOn(io, 'cp');
|
||||||
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test Regex', async () => {
|
||||||
|
const regex1 = /^\d+\)\s.*$/;
|
||||||
|
const regex2 = /^(.*Failed\sasserting\sthat.*)$/;
|
||||||
|
const regex3 = /^\s*$/;
|
||||||
|
const regex4 = /^(.*):(\d+)$/;
|
||||||
|
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);
|
||||||
|
expect(regex2.test('Failed asserting that false is true')).toBe(true);
|
||||||
|
expect(regex3.test('\n')).toBe(true);
|
||||||
|
expect(regex4.test('/path/to/file.php:42')).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
+469
-975
File diff suppressed because it is too large
Load Diff
+64
-790
@@ -1,111 +1,37 @@
|
|||||||
import fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import os from 'os';
|
|
||||||
import {spawnSync} from 'child_process';
|
|
||||||
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 () => {
|
|
||||||
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_hyphen')).toBe('setup-php');
|
|
||||||
expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php');
|
|
||||||
expect(await utils.readEnv('test invalid')).toBe('');
|
|
||||||
process.env['conflict_hyphen'] = 'setup-php';
|
|
||||||
process.env['conflict-hyphen'] = 'wrong';
|
|
||||||
expect(await utils.readEnv('conflict_hyphen')).toBe('setup-php');
|
|
||||||
delete process.env['conflict_hyphen'];
|
|
||||||
delete process.env['conflict-hyphen'];
|
|
||||||
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';
|
process.env['undefined'] = '';
|
||||||
expect(await utils.getInput('test', false)).toBe('setup-php');
|
expect(await utils.getInput('test', false)).toBe('setup-php');
|
||||||
|
expect(await utils.getInput('undefined', false)).toBe('');
|
||||||
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 utils.getInput('DoesNotExist', true);
|
|
||||||
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
|
|
||||||
delete process.env['INPUT_SETUP-PHP'];
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getManifestURL', async () => {
|
|
||||||
for (const url of await utils.getManifestURLS()) {
|
|
||||||
expect(url).toContain('php-versions.json');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking parseVersion', async () => {
|
|
||||||
const fetchSpy = jest.spyOn(fetchModule, 'fetch').mockResolvedValue({
|
|
||||||
data: fs.readFileSync(
|
|
||||||
path.join(__dirname, '../src/configs/php-versions.json'),
|
|
||||||
'utf8'
|
|
||||||
)
|
|
||||||
});
|
|
||||||
expect(await utils.parseVersion('latest')).toBe('8.5');
|
|
||||||
expect(await utils.parseVersion('nightly')).toBe('8.6');
|
|
||||||
expect(await utils.parseVersion('master')).toBe('8.7');
|
|
||||||
expect(await utils.parseVersion('8.7')).toBe('8.7');
|
|
||||||
expect(await utils.parseVersion('8.7.0')).toBe('8.7');
|
|
||||||
expect(await utils.parseVersion('7')).toBe('7.0');
|
|
||||||
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
|
||||||
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
|
||||||
expect(await utils.parseVersion('pre')).toBe('pre');
|
|
||||||
expect(await utils.parseVersion('pre-installed')).toBe('pre');
|
|
||||||
await expect(utils.parseVersion('4.x')).rejects.toThrow(
|
|
||||||
'Invalid PHP version: 4.x'
|
|
||||||
);
|
|
||||||
await expect(utils.parseVersion('foo')).rejects.toThrow(
|
|
||||||
'Invalid PHP version:'
|
|
||||||
);
|
|
||||||
await expect(utils.parseVersion('8.4\n$(id)')).rejects.toThrow(
|
|
||||||
'Invalid PHP version:'
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const latest of ['8.1.0', 'pre', 8.4, ['8.4']]) {
|
|
||||||
fetchSpy.mockResolvedValue({data: JSON.stringify({latest})});
|
|
||||||
await expect(utils.parseVersion('latest')).rejects.toThrow(
|
|
||||||
'Invalid PHP version in manifest:'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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('/etc/php.ini-production')).toBe(
|
|
||||||
'production'
|
|
||||||
);
|
|
||||||
expect(await utils.parseIniFile('/a-b/php.ini-development')).toBe(
|
|
||||||
'development'
|
|
||||||
);
|
|
||||||
expect(await utils.parseIniFile('invalid')).toBe('production');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking asyncForEach', async () => {
|
it('checking asyncForEach', async () => {
|
||||||
const array: Array<string> = ['a', 'b', 'c'];
|
const array: Array<string> = ['a', 'b', 'c'];
|
||||||
let concat = '';
|
let concat = '';
|
||||||
await utils.asyncForEach(
|
await utils.asyncForEach(array, async function(str: string): Promise<void> {
|
||||||
array,
|
concat += str;
|
||||||
async function (str: string): Promise<void> {
|
});
|
||||||
concat += str;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
expect(concat).toBe('abc');
|
expect(concat).toBe('abc');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -116,33 +42,48 @@ describe('Utils tests', () => {
|
|||||||
expect(await utils.color('warning')).toBe('33');
|
expect(await utils.color('warning')).toBe('33');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking readScripts', 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.readScript('darwin.sh')).toBe(darwin);
|
||||||
|
expect(await utils.readScript('darwin.sh')).toBe(darwin);
|
||||||
|
expect(await utils.readScript('linux.sh')).toBe(linux);
|
||||||
|
expect(await utils.readScript('linux.sh')).toBe(linux);
|
||||||
|
expect(await utils.readScript('win32.ps1')).toBe(win32);
|
||||||
|
expect(await utils.readScript('win32.ps1')).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([]);
|
||||||
|
|
||||||
expect(
|
|
||||||
await utils.extensionArray('apcu, mbstring, \\ pdo_pgsql, posix, session')
|
|
||||||
).toEqual(['apcu', 'mbstring', 'pdo_pgsql', 'posix', 'session']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking shell helpers', () => {
|
|
||||||
expect(utils.escapeForShell('a$b`c\\d"e', 'linux')).toBe(
|
|
||||||
'a\\$b\\`c\\\\d\\"e'
|
|
||||||
);
|
|
||||||
expect(utils.escapeForShell('a$b`c"d', 'win32')).toBe('a`$b``c`"d');
|
|
||||||
expect(utils.safeArg('vendor-pkg/repo@v1.0.0', 'linux')).toBe(
|
|
||||||
'vendor-pkg/repo@v1.0.0'
|
|
||||||
);
|
|
||||||
expect(utils.safeArg('phpcs:>=3.0', 'linux')).toBe('"phpcs:>=3.0"');
|
|
||||||
expect(utils.safeArg('foo$bar', 'win32')).toBe('"foo`$bar"');
|
|
||||||
expect(utils.sanitizeShellInput('foo;$(`ls`)bar')).toBe('foolsbar');
|
|
||||||
expect(utils.sanitizeShellInput('vendor/foo:1.*', true)).toBe(
|
|
||||||
'vendor/foo:1.'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking INIArray', async () => {
|
it('checking INIArray', async () => {
|
||||||
@@ -151,23 +92,6 @@ describe('Utils tests', () => {
|
|||||||
'b=2',
|
'b=2',
|
||||||
'c=3'
|
'c=3'
|
||||||
]);
|
]);
|
||||||
expect(await utils.CSVArray('\'a=1,2\', "b=3, 4", c=5, d=~e~')).toEqual([
|
|
||||||
'a=1,2',
|
|
||||||
'b=3, 4',
|
|
||||||
'c=5',
|
|
||||||
"d='~e~'"
|
|
||||||
]);
|
|
||||||
expect(await utils.CSVArray('a=\'1,2\', b="3, 4", c=5')).toEqual([
|
|
||||||
'a=1,2',
|
|
||||||
'b=3, 4',
|
|
||||||
'c=5'
|
|
||||||
]);
|
|
||||||
expect(
|
|
||||||
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']);
|
|
||||||
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([]);
|
||||||
});
|
});
|
||||||
@@ -202,8 +126,8 @@ describe('Utils tests', () => {
|
|||||||
expect(step_log).toEqual('step_log "Test message"');
|
expect(step_log).toEqual('step_log "Test message"');
|
||||||
step_log = await utils.stepLog(message, 'darwin');
|
step_log = await utils.stepLog(message, 'darwin');
|
||||||
expect(step_log).toEqual('step_log "Test message"');
|
expect(step_log).toEqual('step_log "Test message"');
|
||||||
step_log = await utils.stepLog(message, 'openbsd');
|
step_log = await utils.stepLog(message, 'fedora');
|
||||||
expect(step_log).toContain('Platform openbsd is not supported');
|
expect(step_log).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
let add_log: string = await utils.addLog(
|
let add_log: string = await utils.addLog(
|
||||||
'tick',
|
'tick',
|
||||||
@@ -216,8 +140,8 @@ describe('Utils tests', () => {
|
|||||||
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
||||||
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'darwin');
|
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'darwin');
|
||||||
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
||||||
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'openbsd');
|
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'fedora');
|
||||||
expect(add_log).toContain('Platform openbsd is not supported');
|
expect(add_log).toContain('Platform fedora is not supported');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getExtensionPrefix', async () => {
|
it('checking getExtensionPrefix', async () => {
|
||||||
@@ -226,7 +150,6 @@ describe('Utils tests', () => {
|
|||||||
);
|
);
|
||||||
expect(await utils.getExtensionPrefix('xsl')).toEqual('extension');
|
expect(await utils.getExtensionPrefix('xsl')).toEqual('extension');
|
||||||
expect(await utils.getExtensionPrefix('xdebug')).toEqual('zend_extension');
|
expect(await utils.getExtensionPrefix('xdebug')).toEqual('zend_extension');
|
||||||
expect(await utils.getExtensionPrefix('xdebug3')).toEqual('zend_extension');
|
|
||||||
expect(await utils.getExtensionPrefix('opcache')).toEqual('zend_extension');
|
expect(await utils.getExtensionPrefix('opcache')).toEqual('zend_extension');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -234,657 +157,8 @@ describe('Utils tests', () => {
|
|||||||
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
||||||
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
||||||
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
||||||
expect(await utils.suppressOutput('openbsd')).toContain(
|
expect(await utils.suppressOutput('fedora')).toContain(
|
||||||
'Platform openbsd is not supported'
|
'Platform fedora is not supported'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getUnsupportedLog', async () => {
|
|
||||||
expect(await utils.getUnsupportedLog('ext', '5.6', 'linux')).toContain(
|
|
||||||
'add_log "$cross" "ext" "ext is not supported on PHP 5.6"'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getCommand', async () => {
|
|
||||||
expect(await utils.getCommand('linux', '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_name')).toBe('Add-ToolName ');
|
|
||||||
expect(await utils.getCommand('openbsd', 'tool')).toContain(
|
|
||||||
'Platform openbsd is not supported'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking joins', async () => {
|
|
||||||
expect(await utils.joins('a', 'b', 'c')).toBe('a b c');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking scriptExtension', async () => {
|
|
||||||
expect(await utils.scriptExtension('linux')).toBe('.sh');
|
|
||||||
expect(await utils.scriptExtension('darwin')).toBe('.sh');
|
|
||||||
expect(await utils.scriptExtension('win32')).toBe('.ps1');
|
|
||||||
expect(await utils.scriptExtension('openbsd')).toContain(
|
|
||||||
'Platform openbsd is not supported'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking scriptTool', async () => {
|
|
||||||
expect(await utils.scriptTool('linux')).toBe('bash ');
|
|
||||||
expect(await utils.scriptTool('darwin')).toBe('bash ');
|
|
||||||
expect(await utils.scriptTool('win32')).toBe('pwsh ');
|
|
||||||
expect(await utils.scriptTool('openbsd')).toContain(
|
|
||||||
'Platform openbsd is not supported'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking customPackage', async () => {
|
|
||||||
const script_path: string = path.join('ext', 'pkg.sh');
|
|
||||||
expect(await utils.customPackage('pkg', 'ext', '1.2.3', 'linux')).toContain(
|
|
||||||
script_path + '\nadd_pkg 1.2.3'
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
await utils.customPackage('pdo_pkg', 'ext', '1.2.3', 'linux')
|
|
||||||
).toContain(script_path + '\nadd_pkg 1.2.3');
|
|
||||||
expect(
|
|
||||||
await utils.customPackage('pkg8', 'ext', '1.2.3', 'linux')
|
|
||||||
).toContain(script_path + '\nadd_pkg 1.2.3');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking parseExtensionSource', async () => {
|
|
||||||
expect(
|
|
||||||
await utils.parseExtensionSource(
|
|
||||||
'ext-org-name/repo-name@release',
|
|
||||||
'extension'
|
|
||||||
)
|
|
||||||
).toContain(
|
|
||||||
'\nadd_extension_from_source ext https://github.com org-name repo-name release extension'
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
await utils.parseExtensionSource(
|
|
||||||
'ext-https://sub.domain.tld/org/repo@release',
|
|
||||||
'extension'
|
|
||||||
)
|
|
||||||
).toContain(
|
|
||||||
'\nadd_extension_from_source ext https://sub.domain.tld org repo release extension'
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
await utils.parseExtensionSource(
|
|
||||||
'ext-https://sub.domain.XN--tld/org/repo@release',
|
|
||||||
'extension'
|
|
||||||
)
|
|
||||||
).toContain(
|
|
||||||
'\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';
|
|
||||||