mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-02 05:03:17 +07:00
Compare commits
343 Commits
Author | SHA1 | Date | |
---|---|---|---|
454626ac7a | |||
005bae6857 | |||
446bccb14d | |||
29d99c6866 | |||
1444e002ab | |||
03b97e24e9 | |||
f7fb800623 | |||
5593bd4bd3 | |||
3160874a27 | |||
db0bbd209b | |||
d920044a54 | |||
818ca89f55 | |||
8876ac788f | |||
0390a48770 | |||
274e348895 | |||
37d7b37f43 | |||
d058d52012 | |||
17983e66e5 | |||
33a005dd90 | |||
1870ffc08c | |||
70fd71ab48 | |||
2f1900f7bc | |||
19497a0597 | |||
5b2e081bc0 | |||
66fa82fbca | |||
4aa42214b1 | |||
1e2c96a4b4 | |||
3e8d887b0d | |||
a3d5500a6a | |||
e763fddf01 | |||
3cd5c7fd3a | |||
988cef62da | |||
be3ee05178 | |||
a74c3369c5 | |||
b9ef39c812 | |||
782615d572 | |||
31411b0d4d | |||
6b93e48d83 | |||
fe504c5e23 | |||
61d755bd59 | |||
3455b4ca37 | |||
35c24a7d2f | |||
da7361cc8f | |||
3f4c1842a0 | |||
062567eeb1 | |||
00b0d694d0 | |||
54afb29ef6 | |||
41329810ef | |||
90a6d88c24 | |||
8e6968c49e | |||
4ce413f558 | |||
533e0949a8 | |||
0ffe535b8e | |||
55fe8db60d | |||
5af5f992ec | |||
e9e024e600 | |||
a7ea0636d7 | |||
c471c0a458 | |||
277239149a | |||
9385896f2a | |||
9cabd8564d | |||
fdfa901941 | |||
527cd148c8 | |||
59b6e2b54a | |||
5ad0888329 | |||
3cfc409e14 | |||
ebc671081f | |||
efae663c0f | |||
fa8a671e6f | |||
6a4159ba98 | |||
0da52b1327 | |||
3579c7ef28 | |||
d9cf6f5ad6 | |||
ea50c7c0a2 | |||
6ca549dcaa | |||
d3760be2cc | |||
3454287b87 | |||
88c7757dc8 | |||
48cfea3f3e | |||
43cfa2b1a8 | |||
76cecacc5e | |||
d6e173ffc6 | |||
26701f2ec8 | |||
e934fe28b8 | |||
d384d9fe7e | |||
4eeaf5f99e | |||
fd2392db56 | |||
494dde7189 | |||
706dfca1e6 | |||
d613c975f6 | |||
fbe1419ce4 | |||
c844c7b6e4 | |||
8e5cc09df9 | |||
f4f8aec1f2 | |||
b44b7344e0 | |||
e01b2f0bf7 | |||
f7f8ecb931 | |||
4f0d810cbc | |||
47335179aa | |||
63c4aea452 | |||
898b6fa1f9 | |||
747c8838bc | |||
9d6b61c5af | |||
5108c81610 | |||
e58c704985 | |||
e9c783eef0 | |||
b44e5e009f | |||
8489dbf4de | |||
f23ae2e6f7 | |||
d2b233e45f | |||
320474a245 | |||
65ccfb36dc | |||
88fb99b592 | |||
9e7bc5c91f | |||
ca2f547a35 | |||
9f21c80d24 | |||
c4317135df | |||
a2dd688679 | |||
bd214a2dca | |||
2ee4653d1c | |||
0b3e0f451d | |||
0bfa897634 | |||
71db1e2cf1 | |||
16d1cd4766 | |||
1193cd100b | |||
e839a77d8c | |||
552df3f2b0 | |||
3109c941eb | |||
aa8706a5bf | |||
9afdee42e8 | |||
aa0e9403d8 | |||
5b00f068f3 | |||
8f39d3eddd | |||
9d87d1fd14 | |||
07ae2343d0 | |||
7b8bf7af6a | |||
0ac6f76d36 | |||
6c6203b683 | |||
0c9f8a8e7e | |||
1705daea72 | |||
58fbc33c3a | |||
3f42b7d5fb | |||
dd4f0db7bf | |||
7d026bfa6b | |||
6a70f864ec | |||
8e1cde2d0a | |||
de32d8b95f | |||
273096b82f | |||
4c045616f4 | |||
935e74fb40 | |||
a507be73b5 | |||
673dcaff6d | |||
2cbfd4fb41 | |||
0969980399 | |||
1fa2905bc6 | |||
790a48c30d | |||
4b69160eff | |||
7f805f22af | |||
f2972dcf18 | |||
2d488f53fd | |||
421187c870 | |||
1798f4d615 | |||
8039546df3 | |||
c6ad3d1a70 | |||
922f1e27b8 | |||
2d3750b36e | |||
51c7527bd8 | |||
2bf7ab0207 | |||
b3a84fc51e | |||
1330950cd5 | |||
afb57fca4e | |||
50344f4883 | |||
2b027bd9bc | |||
8f8207a1ca | |||
87e6c70743 | |||
e3d18718a9 | |||
cfa7bc51cd | |||
ade633f0da | |||
2cabcf2941 | |||
9ce4bd6f1b | |||
190ae49ac1 | |||
032bc86056 | |||
704c5180a4 | |||
e4fc767f9c | |||
1cf6a369bb | |||
14acb26bdc | |||
3ff7f9cedc | |||
98e937751c | |||
31b338b199 | |||
9e32964a24 | |||
4dcf2b117f | |||
6d8250310d | |||
3164116a42 | |||
747d45cb52 | |||
4b7ad1ca81 | |||
31ef16e586 | |||
dd1def7620 | |||
693a73d8da | |||
965eb91efd | |||
db9f610623 | |||
24fb306a50 | |||
919fe77b43 | |||
914c51cfb6 | |||
8d8c2bd524 | |||
7ef437ee9d | |||
0871fbb11b | |||
3039a720ed | |||
7f32ab318e | |||
ddcacf4760 | |||
2f951ef5cd | |||
5a081357b4 | |||
c4a64dff61 | |||
aad33a8e35 | |||
eae890b1b2 | |||
8fbd2ea6bb | |||
46161660dc | |||
de68427afb | |||
4ba36c5432 | |||
99e2d8d309 | |||
929f9cd52d | |||
4dba50d3af | |||
1c258f399f | |||
e05bc317ec | |||
44815f1f73 | |||
22f5ad47d2 | |||
a29956826a | |||
c11d023c03 | |||
cade5f7157 | |||
7964656607 | |||
970e2d5ebb | |||
5b09e1195e | |||
6fdecd40be | |||
159a09794e | |||
0be846de83 | |||
981c662f5d | |||
71c631cffb | |||
47387dd6e9 | |||
fec9df11d6 | |||
03f36220f4 | |||
1db0b0651d | |||
3f6c88dec7 | |||
2b938d931a | |||
71bd88f604 | |||
242082a22f | |||
b9db11a072 | |||
f381d2384c | |||
63d8fa1a9e | |||
dd1c34be39 | |||
1eb8e8f5cd | |||
0000679cbb | |||
7c5f2ab8e9 | |||
9d5e8ddc70 | |||
77bc79bd22 | |||
02c5ec11cc | |||
d2e09be6ce | |||
013ddc75a3 | |||
25abc4c776 | |||
4000f65b59 | |||
e14155415a | |||
9f16995a6f | |||
24ecbee4ea | |||
c71102b8a0 | |||
0815f5a8bb | |||
e5076cee70 | |||
bd85a2a227 | |||
976fb6996a | |||
06e916db9d | |||
46ac6f2211 | |||
47d1da0476 | |||
dfabf8ce29 | |||
9304663cff | |||
878561f9a8 | |||
9550c7aa45 | |||
ebeb82f894 | |||
aa2af38672 | |||
d27b4a7bc7 | |||
aeb5831c32 | |||
cb5e07baff | |||
9469267fb3 | |||
1d6dab3cd1 | |||
20d1b1c6f1 | |||
0d8d5d2f2c | |||
16267e1982 | |||
91d14c7068 | |||
340ab0b95f | |||
75c0e130e8 | |||
57a0907a18 | |||
3315fa09dc | |||
b132b4eb7c | |||
9145972d5c | |||
0ac43c03b2 | |||
46f009cce1 | |||
8d9a12ba84 | |||
76e0150bb5 | |||
ffc5b0249d | |||
a6aaa1db78 | |||
62beed29e3 | |||
fce9311522 | |||
b2e7a49dd5 | |||
99bbaa2a58 | |||
f7f5b1a7e1 | |||
e755fb7a69 | |||
3087ceb811 | |||
05e2b0d1e9 | |||
dd5c977988 | |||
c1c0acc338 | |||
409e055931 | |||
46a875ad7e | |||
7e81c058fb | |||
754ab9515b | |||
f866c880c2 | |||
eb21cb8fb3 | |||
aee6b953c3 | |||
21c3c8db47 | |||
c0e0d9d98e | |||
5ab8ec4a99 | |||
ec3c220bb2 | |||
17d90ace86 | |||
ba5306eea9 | |||
06929bdf4c | |||
e97e822eff | |||
0f97f445fb | |||
507cc5e95d | |||
2a30f9d208 | |||
eaf140ca8b | |||
dcd432d918 | |||
91a03a2865 | |||
ca33947c62 | |||
932b66f3fc | |||
651d2619bb | |||
16f13a69eb | |||
9134867822 | |||
36104f0983 | |||
a0b0e58cb3 | |||
c6f956927a | |||
83cc9a4bcf | |||
e63fd8e122 | |||
d33e2e06e4 | |||
7fcf39f8e9 | |||
43a64813f3 | |||
ba83ab2e67 | |||
9cfe4e665e | |||
585f7a1fd2 |
16
.eslintrc.json
Normal file
16
.eslintrc.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"env": { "node": true, "jest": true },
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": { "ecmaVersion": 2019, "sourceType": "module" },
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:import/errors",
|
||||||
|
"plugin:import/warnings",
|
||||||
|
"plugin:import/typescript",
|
||||||
|
"plugin:prettier/recommended",
|
||||||
|
"prettier/@typescript-eslint"
|
||||||
|
],
|
||||||
|
"plugins": ["@typescript-eslint", "jest"]
|
||||||
|
}
|
@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported by contacting the project team at hello@codecov.io. All
|
reported by contacting the project team at contact@shivammathur.com. All
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
is deemed necessary and appropriate to the circumstances. The project team is
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
@ -73,4 +73,4 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht
|
|||||||
[homepage]: https://www.contributor-covenant.org
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see
|
For answers to common questions about this code of conduct, see
|
||||||
https://www.contributor-covenant.org/faq
|
https://www.contributor-covenant.org/faq
|
63
.github/CONTRIBUTING.md
vendored
Normal file
63
.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# Contributing to setup-php
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
* Fork the project.
|
||||||
|
* Make your bug fix or feature addition.
|
||||||
|
* Add tests for it. This is important so we don't break it in a future version unintentionally.
|
||||||
|
* Send a pull request to the develop branch.
|
||||||
|
|
||||||
|
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 personal and feel free to remind.
|
||||||
|
|
||||||
|
## Coding Guidelines
|
||||||
|
|
||||||
|
This project comes with `.prettierrc.json` and `eslintrc.json` configuration files. Please run the following commands to format the code before committing it.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm run format
|
||||||
|
$ npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Creating a release
|
||||||
|
|
||||||
|
Create a release before you push your changes.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm run release
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reporting issues
|
||||||
|
|
||||||
|
Please submit the issue using the appropriate template provided for a bug report or a feature request:
|
||||||
|
|
||||||
|
* [Issues](https://github.com/shivammathur/setup-php/issues)
|
7
.github/FUNDING.yml
vendored
Normal file
7
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
open_collective: setup-php
|
||||||
|
tidelift: "npm/setup-php"
|
||||||
|
community_bridge: setup-php
|
||||||
|
patreon: shivammathur
|
||||||
|
custom: https://www.paypal.me/shivammathur
|
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -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.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -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.
|
33
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
33
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
name: 🐞 Bug Fix, ⚙ Improvement or 🎉 New Feature
|
||||||
|
about: You found a bug, want to improve something or add a new feature
|
||||||
|
labels: bug or 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.
|
||||||
|
-->
|
30
.github/SECURITY.md
vendored
Normal file
30
.github/SECURITY.md
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
The following versions of this project are supported for security updates.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 1.9.x | :white_check_mark: |
|
||||||
|
| 2.5.x | :white_check_mark: |
|
||||||
|
|
||||||
|
## Supported PHP Versions
|
||||||
|
|
||||||
|
This security policy only applies to the latest patches of the following PHP versions.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 7.2 | :white_check_mark: |
|
||||||
|
| 7.3 | :white_check_mark: |
|
||||||
|
| 7.4 | :white_check_mark: |
|
||||||
|
| 8.0 | :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@shivammathur.com](mailto:contact@shivammathur.com).
|
||||||
|
Do not report security reports publicly.
|
||||||
|
|
||||||
|
## Tidelift
|
||||||
|
|
||||||
|
If you use this GitHub Action through a Tidelift subscription, please refer to [https://tidelift.com/security](https://tidelift.com/security).
|
56
.github/workflows/main-workflow.yml
vendored
Normal file
56
.github/workflows/main-workflow.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: Main workflow
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
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-20.04, ubuntu-18.04, ubuntu-16.04, windows-latest, macos-latest]
|
||||||
|
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- 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('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');}"
|
47
.github/workflows/node-workflow.yml
vendored
Normal file
47
.github/workflows/node-workflow.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: Node 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]
|
||||||
|
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 }}
|
46
.github/workflows/workflow.yml
vendored
46
.github/workflows/workflow.yml
vendored
@ -1,46 +0,0 @@
|
|||||||
name: Main workflow
|
|
||||||
on: [push]
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
name: Run
|
|
||||||
runs-on: ${{ matrix.operating-system }}
|
|
||||||
strategy:
|
|
||||||
max-parallel: 6
|
|
||||||
matrix:
|
|
||||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
|
||||||
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3']
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
|
|
||||||
- name: Set Node.js 10.x
|
|
||||||
uses: actions/setup-node@master
|
|
||||||
with:
|
|
||||||
version: 10.x
|
|
||||||
|
|
||||||
- name: Installing NPM
|
|
||||||
run: npm install
|
|
||||||
|
|
||||||
- name: Run tests and send coverage
|
|
||||||
run: |
|
|
||||||
npm test
|
|
||||||
curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov
|
|
||||||
|
|
||||||
- name: Installing PHP with extensions and custom config
|
|
||||||
run: node lib/install.js
|
|
||||||
env:
|
|
||||||
php-version: ${{ matrix.php-versions }}
|
|
||||||
extension-csv: "mbstring, xdebug, pcov" #optional
|
|
||||||
ini-values-csv: "post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata" #optional
|
|
||||||
|
|
||||||
- name: Testing PHP version
|
|
||||||
run: php -v
|
|
||||||
- name: Testing Composer version
|
|
||||||
run: composer -V
|
|
||||||
- name: Testing Extensions
|
|
||||||
run: php -m
|
|
||||||
- name: Testing ini values
|
|
||||||
run: |
|
|
||||||
php -r "echo \"post_max_size: \" . ini_get('post_max_size') . \"\n\";"
|
|
||||||
php -r "echo \"short_open_tag: \" . ini_get('short_open_tag') . \"\n\";"
|
|
||||||
php -r "echo \"date.timezone: \" . ini_get('date.timezone') . \"\n\";"
|
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
|
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
|
||||||
!node_modules/
|
node_modules/
|
||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
|
lib/
|
||||||
|
|
||||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||||
# Logs
|
# Logs
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
"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",
|
||||||
"bracketSpacing": false,
|
"useTabs": false
|
||||||
"arrowParens": "avoid",
|
}
|
||||||
"parser": "typescript"
|
|
||||||
}
|
|
2
LICENSE
2
LICENSE
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2019 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
|
||||||
|
421
README.md
421
README.md
@ -1,117 +1,388 @@
|
|||||||
# Setup PHP in GitHub Actions
|
<p align="center">
|
||||||
|
<a href="https://github.com/marketplace/actions/setup-php-action" target="_blank">
|
||||||
<p align="left">
|
<img src="https://repository-images.githubusercontent.com/206578964/e0a18480-dc65-11e9-8dd3-b9ffbf5575fe" alt="Setup PHP in GitHub Actions" width="400">
|
||||||
<a href="https://github.com/shivammathur/setup-php"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
|
</a>
|
||||||
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[GitHub Action](https://github.com/features/actions) to install PHP with required extensions, php.ini configuration and composer. This action can be added as a step in your action workflow and it will setup the PHP environment you need to test your application. Refer to [Usage](#usage) section to see how to use this.
|
<h1 align="center">Setup PHP in GitHub Actions</h1>
|
||||||
|
|
||||||
## PHP Versions Support
|
<p align="center">
|
||||||
- 5.6
|
<a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
|
||||||
- 7.0
|
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://codecov.io/gh/shivammathur/setup-php/branch/master/graph/badge.svg"></a>
|
||||||
- 7.1
|
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
|
||||||
- 7.2
|
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg"></a>
|
||||||
- 7.3
|
</p>
|
||||||
- 7.4 `7.4.0beta4` on `ubuntu`, and `7.4.0RC2` on `windows` and `macOS`
|
|
||||||
|
|
||||||
**Note:** PHP 7.4 is currently in development, do not use in production.
|
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
|
||||||
|
|
||||||
## OS Support
|
## Contents
|
||||||
|
|
||||||
|Virtual environment|matrix.operating-system|
|
- [PHP Support](#tada-php-support)
|
||||||
|--- |--- |
|
- [GitHub-Hosted Runner Support](#cloud-github-hosted-runner-support)
|
||||||
|Windows Server 2019|`windows-latest` or `windows-2019`|
|
- [PHP Extension Support](#heavy_plus_sign-php-extension-support)
|
||||||
|Windows Server 2016 R2|`windows-2016`|
|
- [Tools Support](#wrench-tools-support)
|
||||||
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|
|
- [Coverage Support](#signal_strength-coverage-support)
|
||||||
|Ubuntu 16.04|`ubuntu-16.04`|
|
- [Xdebug](#xdebug)
|
||||||
|macOS X Mojave 10.14|`macOS-latest` or `macOS-10.14`|
|
- [PCOV](#pcov)
|
||||||
|
- [Disable coverage](#disable-coverage)
|
||||||
|
- [Usage](#memo-usage)
|
||||||
|
- [Basic Setup](#basic-setup)
|
||||||
|
- [Matrix Setup](#matrix-setup)
|
||||||
|
- [Nightly Build Setup](#nightly-build-setup)
|
||||||
|
- [Thread Safe Setup](#thread-safe-setup)
|
||||||
|
- [Cache Dependencies](#cache-dependencies)
|
||||||
|
- [Composer GitHub OAuth](#composer-github-oauth)
|
||||||
|
- [Problem Matchers](#problem-matchers)
|
||||||
|
- [Examples](#examples)
|
||||||
|
- [License](#scroll-license)
|
||||||
|
- [Contributions](#1-contributions)
|
||||||
|
- [Support This project](#sparkling_heart-support-this-project)
|
||||||
|
- [Dependencies](#bookmark-dependencies)
|
||||||
|
- [Further Reading](#bookmark_tabs-further-reading)
|
||||||
|
|
||||||
|
## :tada: PHP Support
|
||||||
|
|
||||||
## PHP Extension Support
|
|PHP Version|Stability|Release Support|
|
||||||
- On `ubuntu` extensions which have the package in apt are installed.
|
|--- |--- |--- |
|
||||||
- On `windows` and `macOS` PECL extensions are installed.
|
|5.6|`Stable`|`End of life`|
|
||||||
|
|7.0|`Stable`|`End of life`|
|
||||||
|
|7.1|`Stable`|`End of life`|
|
||||||
|
|7.2|`Stable`|`Security fixes only`|
|
||||||
|
|7.3|`Stable`|`Active`|
|
||||||
|
|7.4|`Stable`|`Active`|
|
||||||
|
|8.0|`Nightly`|`In development`|
|
||||||
|
|
||||||
|
**Note:** Specifying `8.0` in `php-version` input installs a nightly build of `PHP 8.0.0-dev` with `PHP JIT`, `Union Types v2` and other [new features](https://wiki.php.net/rfc#php_80 "New features implemented in PHP 8"). See [nightly build setup](#nightly-build-setup) for more information.
|
||||||
|
|
||||||
|
## :cloud: GitHub-Hosted Runner Support
|
||||||
|
|
||||||
|
|Virtual environment|YAML workflow label|Pre-installed PHP|
|
||||||
|
|--- |--- |--- |
|
||||||
|
|Ubuntu 16.04|`ubuntu-16.04`|`PHP 5.6` to `PHP 7.4`|
|
||||||
|
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|`PHP 7.1` to `PHP 7.4`|
|
||||||
|
|Ubuntu 20.04|`ubuntu-20.04`|`PHP 7.4`|
|
||||||
|
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 7.4`|
|
||||||
|
|macOS 10.15 Catalina|`macos-latest` or `macos-10.15`|`PHP 7.4`|
|
||||||
|
|
||||||
|
## :heavy_plus_sign: PHP Extension Support
|
||||||
|
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
||||||
|
- On `windows` extensions which have `windows` binary on `PECL` can be installed.
|
||||||
|
- On `macOS` extensions which are on `PECL` can be installed.
|
||||||
- Extensions which are installed along with PHP if specified are enabled.
|
- Extensions which are installed along with PHP if specified are enabled.
|
||||||
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interruped.
|
- Extensions on `PECL` which do not have a latest stable version, their pre-release versions can be installed by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot` separated by a `-` like `msgpack-beta`.
|
||||||
|
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
|
||||||
|
|
||||||
## Usage
|
## :wrench: Tools Support
|
||||||
|
|
||||||
|
These tools can be setup globally using the `tools` input.
|
||||||
|
|
||||||
|
`codeception`, `composer`, `composer-prefetcher`, `cs2pr`, `deployer`, `pecl`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
tools: php-cs-fixer, phpunit
|
||||||
|
```
|
||||||
|
|
||||||
|
To setup a particular version of a tool, specify it in the form `tool:version`.
|
||||||
|
Latest stable version of `composer` is setup by default and accepts `v1`, `v2`, `snapshot` and `preview` as versions.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
tools: composer:v2
|
||||||
|
```
|
||||||
|
|
||||||
|
Version for other tools should be in `semver` format and a valid release of the tool.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
tools: php-cs-fixer:2.16.2, phpunit:8.5.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Tools which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
|
||||||
|
|
||||||
|
## :signal_strength: Coverage Support
|
||||||
|
|
||||||
|
### Xdebug
|
||||||
|
|
||||||
|
Specify `coverage: xdebug` to use `Xdebug`.
|
||||||
|
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
coverage: xdebug
|
||||||
|
```
|
||||||
|
|
||||||
|
### PCOV
|
||||||
|
|
||||||
|
Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`.
|
||||||
|
It is much faster than `Xdebug`.
|
||||||
|
`PCOV` needs `PHP >= 7.1`.
|
||||||
|
If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
|
||||||
|
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
ini-values: pcov.directory=api #optional, see above for usage.
|
||||||
|
coverage: pcov
|
||||||
|
```
|
||||||
|
|
||||||
|
### Disable Coverage
|
||||||
|
|
||||||
|
Specify `coverage: none` to disable both `Xdebug` and `PCOV`.
|
||||||
|
Consider disabling the coverage using this PHP action for these reasons.
|
||||||
|
|
||||||
|
- You are not generating coverage reports while testing.
|
||||||
|
- It will remove `Xdebug`, which will have a positive impact on PHP performance.
|
||||||
|
- You are using `phpdbg` for running your tests.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
coverage: none
|
||||||
|
```
|
||||||
|
|
||||||
|
## :memo: Usage
|
||||||
|
|
||||||
Inputs supported by this GitHub Action.
|
Inputs supported by this GitHub Action.
|
||||||
|
|
||||||
- php-version
|
- php-version `required`
|
||||||
- extension-csv (optional)
|
- extensions `optional`
|
||||||
- ini-values-csv (optional)
|
- ini-values `optional`
|
||||||
|
- coverage `optional`
|
||||||
|
- tools `optional`
|
||||||
|
|
||||||
See [action.yml](action.yml) for more info
|
See [action.yml](action.yml "Metadata for this GitHub Action") and usage below for more info.
|
||||||
|
|
||||||
### Basic Usage
|
### Basic Setup
|
||||||
|
|
||||||
|
> Setup a particular PHP version.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
- name: Installing PHP
|
|
||||||
uses: shivammathur/setup-php@master
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
with:
|
with:
|
||||||
php-version: 7.3
|
php-version: '7.4'
|
||||||
extension-csv: mbstring, xdebug #optional
|
extensions: mbstring, intl #optional, setup extensions
|
||||||
ini-values-csv: "post_max_size=256M, short_open_tag=On" #optional
|
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
|
||||||
- name: Check PHP Version
|
coverage: xdebug #optional, setup coverage driver
|
||||||
run: php -v
|
tools: php-cs-fixer, phpunit #optional, setup tools globally
|
||||||
- name: Check Composer Version
|
|
||||||
run: composer -V
|
|
||||||
- name: Check PHP Extensions
|
|
||||||
run: php -m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Matrix Testing
|
### Matrix Setup
|
||||||
|
|
||||||
|
> Setup multiple PHP versions on multiple operating systems.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 15
|
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3']
|
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
|
||||||
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
|
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
- name: Install PHP
|
|
||||||
uses: shivammathur/setup-php@master
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extension-csv: mbstring, xdebug #optional
|
extensions: mbstring, intl #optional, setup extensions
|
||||||
ini-values-csv: "post_max_size=256M, short_open_tag=On" #optional
|
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
|
||||||
- name: Check PHP Version
|
coverage: xdebug #optional, setup coverage driver
|
||||||
run: php -v
|
tools: php-cs-fixer, phpunit #optional, setup tools globally
|
||||||
- name: Check Composer Version
|
|
||||||
run: composer -V
|
|
||||||
- name: Check PHP Extensions
|
|
||||||
run: php -m
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
### Nightly Build Setup
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
> Setup a nightly build of `PHP 8.0.0-dev` from the [master branch](https://github.com/php/php-src/tree/master "Master branch on PHP source repository") of PHP.
|
||||||
|
|
||||||
## Contributions
|
- `PECL` is installed by default with this version on `Ubuntu` and `macOS`.
|
||||||
|
- Some extensions might not support this version currently.
|
||||||
|
- Refer to this [RFC](https://wiki.php.net/rfc/jit "PHP JIT RFC configuration") for configuring `PHP JIT` on this version.
|
||||||
|
- Refer to this [list of RFCs](https://wiki.php.net/rfc#php_80 "List of RFCs implemented in PHP8") implemented in this version.
|
||||||
|
|
||||||
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
## This action uses the following works
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '8.0'
|
||||||
|
extensions: mbstring #optional, setup extensions
|
||||||
|
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 #optional, setup php.ini configuration
|
||||||
|
coverage: pcov #optional, setup PCOV, Xdebug does not support this version yet.
|
||||||
|
tools: php-cs-fixer, phpunit #optional, setup tools globally
|
||||||
|
```
|
||||||
|
|
||||||
- [powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager)
|
### Thread Safe Setup
|
||||||
- [Homebrew](https://brew.sh/)
|
|
||||||
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php)
|
|
||||||
- [exolnet/homebrew-deprecated](https://github.com/eXolnet/homebrew-deprecated)
|
|
||||||
- [phpbrew](https://github.com/phpbrew/phpbrew)
|
|
||||||
|
|
||||||
## Further Reading
|
- `NTS` versions are setup by default.
|
||||||
|
- On `ubuntu` and `macOS` only NTS versions are supported.
|
||||||
|
- On `windows` both `TS` and `NTS` versions are supported.
|
||||||
|
|
||||||
- [About GitHub Actions](https://github.com/features/actions)
|
```yaml
|
||||||
- [GitHub Actions Syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions)
|
jobs:
|
||||||
- [Other Awesome Actions](https://github.com/sdras/awesome-actions)
|
run:
|
||||||
|
runs-on: windows-latest
|
||||||
|
name: Setup PHP TS on Windows
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
env:
|
||||||
|
phpts: ts # specify ts or nts
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cache Dependencies
|
||||||
|
|
||||||
|
You can persist composer's internal cache directory using the [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Action. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.
|
||||||
|
|
||||||
|
**Note:** Please do not cache `vendor` directory using `action/cache` as that will have side-effects.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
|
||||||
|
- name: Cache dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: composer install --prefer-dist
|
||||||
|
```
|
||||||
|
|
||||||
|
In the above example, if you support a range of `composer` dependencies and do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Composer GitHub OAuth
|
||||||
|
|
||||||
|
If you have a number of workflows which setup multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. To avoid that you can add a `OAuth` token to the composer's config by setting `COMPOSER_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
env:
|
||||||
|
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Problem Matchers
|
||||||
|
|
||||||
|
#### PHPUnit
|
||||||
|
|
||||||
|
You can setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step. This will scan the logs for failing tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup Problem Matchers for PHPUnit
|
||||||
|
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Other Tools
|
||||||
|
|
||||||
|
For tools that support `checkstyle` reporting like `phpstan`, `psalm`, `php-cs-fixer` and `phpcs` you can use `cs2pr` to annotate your code.
|
||||||
|
For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-pull-request-from-checkstyle).
|
||||||
|
|
||||||
|
> Here is an example with `phpstan`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
tools: cs2pr, phpstan
|
||||||
|
|
||||||
|
- name: PHPStan
|
||||||
|
run: phpstan analyse src --error-format=checkstyle | cs2pr
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
Examples for setting up this GitHub Action with different PHP Frameworks/Packages.
|
||||||
|
|
||||||
|
|Framework/Package|Runs on|Workflow|
|
||||||
|
|--- |--- |--- |
|
||||||
|
|CakePHP with `MySQL` and `Redis`|`ubuntu`|[cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis")|
|
||||||
|
|CakePHP with `PostgreSQL` and `Redis`|`ubuntu`|[cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis")|
|
||||||
|
|CakePHP without services|`macOS`, `ubuntu` and `windows`|[cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services")|
|
||||||
|
|CodeIgniter|`macOS`, `ubuntu` and `windows`|[codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter")|
|
||||||
|
|Laravel with `MySQL` and `Redis`|`ubuntu`|[laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis")|
|
||||||
|
|Laravel with `PostgreSQL` and `Redis`|`ubuntu`|[laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis")|
|
||||||
|
|Laravel without services|`macOS`, `ubuntu` and `windows`|[laravel.yml](./examples/laravel.yml "GitHub Action for Laravel without services")|
|
||||||
|
|Lumen with `MySQL` and `Redis`|`ubuntu`|[lumen-mysql.yml](./examples/lumen-mysql.yml "GitHub Action for Lumen with MySQL and Redis")|
|
||||||
|
|Lumen with `PostgreSQL` and `Redis`|`ubuntu`|[lumen-postgres.yml](./examples/lumen-postgres.yml "GitHub Action for Lumen with PostgreSQL and Redis")|
|
||||||
|
|Lumen without services|`macOS`, `ubuntu` and `windows`|[lumen.yml](./examples/lumen.yml "GitHub Action for Lumen without services")|
|
||||||
|
|Phalcon with `MySQL`|`ubuntu`|[phalcon-mysql.yml](./examples/phalcon-mysql.yml "GitHub Action for Phalcon with MySQL")|
|
||||||
|
|Phalcon with `PostgreSQL`|`ubuntu`|[phalcon-postgres.yml](./examples/phalcon-postgres.yml "GitHub Action for Phalcon with PostgreSQL")|
|
||||||
|
|Roots/bedrock|`ubuntu`|[bedrock.yml](./examples/bedrock.yml "GitHub Action for Wordpress Development using @roots/bedrock")|
|
||||||
|
|Roots/sage|`ubuntu`|[sage.yml](./examples/sage.yml "GitHub Action for Wordpress Development using @roots/sage")|
|
||||||
|
|Slim Framework|`macOS`, `ubuntu` and `windows`|[slim-framework.yml](./examples/slim-framework.yml "GitHub Action for Slim Framework")|
|
||||||
|
|Symfony with `MySQL`|`ubuntu`|[symfony-mysql.yml](./examples/symfony-mysql.yml "GitHub Action for Symfony with MySQL")|
|
||||||
|
|Symfony with `PostgreSQL`|`ubuntu`|[symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL")|
|
||||||
|
|Symfony without services|`macOS`, `ubuntu` and `windows`|[symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services")|
|
||||||
|
|Yii2 Starter Kit with `MySQL`|`ubuntu`|[yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL")|
|
||||||
|
|Yii2 Starter Kit with `PostgreSQL`|`ubuntu`|[yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL")|
|
||||||
|
|Zend Framework|`macOS`, `ubuntu` and `windows`|[zend-framework.yml](./examples/zend-framework.yml "GitHub Action for Zend Framework")|
|
||||||
|
|
||||||
|
## :scroll: License
|
||||||
|
|
||||||
|
- The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php").
|
||||||
|
- This project has multiple [dependencies](#bookmark-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
|
||||||
|
- The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License").
|
||||||
|
|
||||||
|
## :+1: Contributions
|
||||||
|
|
||||||
|
Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide"). If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/setup-php/issues "Issues reported").
|
||||||
|
|
||||||
|
## :sparkling_heart: Support This Project
|
||||||
|
|
||||||
|
If this action helped you.
|
||||||
|
|
||||||
|
- Sponsor the project by subscribing on [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") or by contributing using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal"). This project is also available as part of the [Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-setup-php?utm_source=npm-setup-php&utm_medium=referral&utm_campaign=enterprise&utm_term=repo "Tidelift Subscription for setup-php") to support delivering enterprise-level maintenance.
|
||||||
|
- Please star the project and dependencies. If you blog, please share your experience of using this action with the community.
|
||||||
|
|
||||||
|
## :bookmark: Dependencies
|
||||||
|
|
||||||
|
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
|
||||||
|
- [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
|
||||||
|
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Packaging active PHP packages")
|
||||||
|
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds for MacOS")
|
||||||
|
- [shivammathur/homebrew-extensions](https://github.com/shivammathur/homebrew-extensions "Tap for PHP extensions for MacOS")
|
||||||
|
- [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package")
|
||||||
|
|
||||||
|
## :bookmark_tabs: Further Reading
|
||||||
|
|
||||||
|
- [About GitHub Actions](https://github.com/features/actions "GitHub Actions")
|
||||||
|
- [GitHub Actions Syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions "GitHub Actions Syntax")
|
||||||
|
- [Other Awesome Actions](https://github.com/sdras/awesome-actions "List of Awesome GitHub Actions")
|
52
__tests__/config.test.ts
Normal file
52
__tests__/config.test.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import * as config from '../src/config';
|
||||||
|
|
||||||
|
describe('Config tests', () => {
|
||||||
|
it('checking addINIValuesOnWindows', async () => {
|
||||||
|
let win32: string = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
expect(win32).toContain(
|
||||||
|
'Add-Content C:\\tools\\php\\php.ini "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
|
||||||
|
);
|
||||||
|
|
||||||
|
win32 = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'openbsd'
|
||||||
|
);
|
||||||
|
expect(win32).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addINIValuesOnLinux', async () => {
|
||||||
|
let linux: string = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'linux',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
expect(linux).toContain(
|
||||||
|
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
|
||||||
|
);
|
||||||
|
|
||||||
|
linux = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'openbsd'
|
||||||
|
);
|
||||||
|
expect(linux).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addINIValuesOnDarwin', async () => {
|
||||||
|
let darwin: string = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain(
|
||||||
|
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
|
||||||
|
);
|
||||||
|
|
||||||
|
darwin = await config.addINIValues(
|
||||||
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
'openbsd'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
});
|
84
__tests__/coverage.test.ts
Normal file
84
__tests__/coverage.test.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import * as coverage from '../src/coverage';
|
||||||
|
|
||||||
|
jest.mock('../src/extensions', () => ({
|
||||||
|
addExtension: jest.fn().mockImplementation(extension => {
|
||||||
|
return 'add_extension ' + extension + '\n';
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('Config tests', () => {
|
||||||
|
it('checking addCoverage with PCOV on windows', async () => {
|
||||||
|
let win32: string = await coverage.addCoverage('PCOV', '7.4', 'win32');
|
||||||
|
expect(win32).toContain('add_extension pcov');
|
||||||
|
expect(win32).toContain('Remove-Extension xdebug');
|
||||||
|
|
||||||
|
win32 = await coverage.addCoverage('pcov', '7.0', 'win32');
|
||||||
|
expect(win32).toContain('PHP 7.1 or newer is required');
|
||||||
|
|
||||||
|
win32 = await coverage.addCoverage('pcov', '5.6', 'win32');
|
||||||
|
expect(win32).toContain('PHP 7.1 or newer is required');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with PCOV on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('pcov', '7.4', 'linux');
|
||||||
|
expect(linux).toContain('add_extension pcov');
|
||||||
|
expect(linux).toContain('remove_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with PCOV on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage('pcov', '7.4', 'darwin');
|
||||||
|
expect(darwin).toContain('add_extension pcov');
|
||||||
|
expect(darwin).toContain('remove_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on windows', async () => {
|
||||||
|
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
|
||||||
|
expect(win32).toContain('add_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux');
|
||||||
|
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('add_extension xdebug');
|
||||||
|
expect(linux).toContain('echo "xdebug.mode=coverage"');
|
||||||
|
});
|
||||||
|
|
||||||
|
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 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('');
|
||||||
|
});
|
||||||
|
});
|
139
__tests__/extensions.test.ts
Normal file
139
__tests__/extensions.test.ts
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
import * as extensions from '../src/extensions';
|
||||||
|
|
||||||
|
describe('Extension tests', () => {
|
||||||
|
it('checking addExtensionOnWindows', async () => {
|
||||||
|
let win32: string = await extensions.addExtension(
|
||||||
|
'Xdebug, pcov, sqlite, phalcon4, ast-beta',
|
||||||
|
'7.4',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
|
expect(win32).toContain('Add-Extension pcov');
|
||||||
|
expect(win32).toContain('Add-Extension sqlite3');
|
||||||
|
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||||
|
expect(win32).toContain('Add-Extension ast beta');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
||||||
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension('mysql', '8.0', 'win32');
|
||||||
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension('mysql', '5.6', 'win32');
|
||||||
|
expect(win32).toContain('Add-Extension mysql');
|
||||||
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension(
|
||||||
|
'phalcon3, does_not_exist',
|
||||||
|
'7.2',
|
||||||
|
'win32',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
expect(win32).toContain('phalcon.ps1 phalcon3');
|
||||||
|
expect(win32).toContain('Add-Extension does_not_exist');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||||
|
expect(win32).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addExtensionOnLinux', async () => {
|
||||||
|
let linux: string = await extensions.addExtension(
|
||||||
|
'Xdebug, pcov, sqlite, ast-beta, xdebug-alpha',
|
||||||
|
'7.4',
|
||||||
|
'linux'
|
||||||
|
);
|
||||||
|
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', 'openbsd');
|
||||||
|
expect(linux).toContain('Platform openbsd 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, grpc, protobuf, swoole, sqlite, ast-beta',
|
||||||
|
'7.2',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
|
expect(darwin).toContain('add_brew_extension grpc');
|
||||||
|
expect(darwin).toContain('add_brew_extension protobuf');
|
||||||
|
expect(darwin).toContain('add_brew_extension swoole');
|
||||||
|
expect(darwin).toContain('pecl_install 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('pecl_install pcov');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('pecl_install redis-2.2.8');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
||||||
|
expect(darwin).toContain('pecl_install redis');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||||
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
|
expect(darwin).toContain('pecl_install imagick');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
||||||
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
|
expect(darwin).toContain('pecl_install 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', 'openbsd');
|
||||||
|
expect(darwin).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
});
|
@ -1,97 +0,0 @@
|
|||||||
import * as features from '../src/features';
|
|
||||||
|
|
||||||
let valid_extensions = ['xdebug', 'pcov'];
|
|
||||||
jest.mock('../src/pecl', () => ({
|
|
||||||
checkPECLExtension: jest.fn().mockImplementation(extension => {
|
|
||||||
return valid_extensions.indexOf(extension) !== -1;
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('Features tests', () => {
|
|
||||||
it('checking addExtensionOnWindows', async () => {
|
|
||||||
let win32: string = await features.addExtension(
|
|
||||||
'xdebug, pcov',
|
|
||||||
'7.2',
|
|
||||||
'win32'
|
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Install-PhpExtension xdebug -MinimumStability stable'
|
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Install-PhpExtension pcov -MinimumStability stable'
|
|
||||||
);
|
|
||||||
win32 = await features.addExtension('xdebug, pcov', '7.4', 'win32');
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Install-PhpExtension xdebug -MinimumStability alpha'
|
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Install-PhpExtension pcov -MinimumStability alpha'
|
|
||||||
);
|
|
||||||
|
|
||||||
win32 = await features.addExtension('DoesNotExist', '7.2', 'win32');
|
|
||||||
expect(win32).not.toContain(
|
|
||||||
'Install-PhpExtension DoesNotExist -MinimumStability stable'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
|
||||||
let linux: string = await features.addExtension(
|
|
||||||
'xdebug, pcov',
|
|
||||||
'7.2',
|
|
||||||
'linux'
|
|
||||||
);
|
|
||||||
expect(linux).toContain(
|
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-xdebug'
|
|
||||||
);
|
|
||||||
expect(linux).toContain(
|
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-pcov'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
|
||||||
let darwin: string = await features.addExtension(
|
|
||||||
'xdebug, pcov',
|
|
||||||
'7.2',
|
|
||||||
'darwin'
|
|
||||||
);
|
|
||||||
expect(darwin).toContain('sudo pecl install xdebug');
|
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
|
||||||
|
|
||||||
darwin = await features.addExtension('DoesNotExist', '7.2', 'darwin');
|
|
||||||
expect(darwin).not.toContain('sudo pecl install DoesNotExist');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addINIValuesOnWindows', async () => {
|
|
||||||
let win32: string = await features.addINIValues(
|
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
|
||||||
'win32'
|
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Add-Content C:\\tools\\php$version\\php.ini "post_max_size=256M"'
|
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Add-Content C:\\tools\\php$version\\php.ini "short_open_tag=On"'
|
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Add-Content C:\\tools\\php$version\\php.ini "date.timezone=Asia/Kolkata"'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addINIValuesOnLinux', async () => {
|
|
||||||
let linux: string = await features.addINIValues(
|
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
|
||||||
'linux'
|
|
||||||
);
|
|
||||||
expect(linux).toContain('echo "post_max_size=256M" >> $ini_file');
|
|
||||||
expect(linux).toContain('echo "short_open_tag=On" >> $ini_file');
|
|
||||||
expect(linux).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addINIValuesOnDarwin', async () => {
|
|
||||||
let darwin: string = await features.addINIValues(
|
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
|
||||||
'darwin'
|
|
||||||
);
|
|
||||||
expect(darwin).toContain('echo "post_max_size=256M" >> $ini_file');
|
|
||||||
expect(darwin).toContain('echo "short_open_tag=On" >> $ini_file');
|
|
||||||
expect(darwin).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file');
|
|
||||||
});
|
|
||||||
});
|
|
181
__tests__/install.test.ts
Normal file
181
__tests__/install.test.ts
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
import * as install from '../src/install';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mock install.ts
|
||||||
|
*/
|
||||||
|
jest.mock('../src/install', () => ({
|
||||||
|
build: jest.fn().mockImplementation(
|
||||||
|
async (
|
||||||
|
filename: string,
|
||||||
|
version: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> => {
|
||||||
|
const extension_csv: string = process.env['extensions'] || '';
|
||||||
|
const ini_values_csv: string = process.env['ini-values'] || '';
|
||||||
|
const coverage_driver: string = process.env['coverage'] || '';
|
||||||
|
let tools_csv: string = process.env['tools'] || '';
|
||||||
|
const pecl: string = process.env['pecl'] || '';
|
||||||
|
if (pecl == 'true') {
|
||||||
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
|
}
|
||||||
|
|
||||||
|
let script = 'initial script ' + filename + version + os_version;
|
||||||
|
if (tools_csv) {
|
||||||
|
script += 'add_tool';
|
||||||
|
}
|
||||||
|
if (extension_csv) {
|
||||||
|
script += 'install extensions';
|
||||||
|
}
|
||||||
|
if (coverage_driver) {
|
||||||
|
script += 'set coverage driver';
|
||||||
|
}
|
||||||
|
if (ini_values_csv) {
|
||||||
|
script += 'edit php.ini';
|
||||||
|
}
|
||||||
|
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
run: jest.fn().mockImplementation(
|
||||||
|
async (): Promise<string> => {
|
||||||
|
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 += 'bash 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;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to set the process.env
|
||||||
|
*
|
||||||
|
* @param version
|
||||||
|
* @param os
|
||||||
|
* @param extension_csv
|
||||||
|
* @param ini_values_csv
|
||||||
|
* @param coverage_driver
|
||||||
|
* @param tools
|
||||||
|
* @param pecl
|
||||||
|
*/
|
||||||
|
function setEnv(
|
||||||
|
version: string | number,
|
||||||
|
os: string,
|
||||||
|
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', () => {
|
||||||
|
it('Test install on windows', async () => {
|
||||||
|
setEnv('7.0', 'win32', '', '', '', '', '');
|
||||||
|
|
||||||
|
let script: string = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('pwsh script.ps1 7.0 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv('7.3', 'win32', '', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('install extensions');
|
||||||
|
expect(script).toContain('edit php.ini');
|
||||||
|
expect(script).toContain('set coverage driver');
|
||||||
|
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test install on linux', async () => {
|
||||||
|
setEnv('7.3', 'linux', '', '', '', '', '');
|
||||||
|
|
||||||
|
let script: string = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash script.sh 7.3 ');
|
||||||
|
|
||||||
|
setEnv('7.4', 'linux', 'a, b', 'a=b', 'x', 'phpunit', 'true');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('install extensions');
|
||||||
|
expect(script).toContain('edit php.ini');
|
||||||
|
expect(script).toContain('set coverage driver');
|
||||||
|
expect(script).toContain('bash script.sh 7.4');
|
||||||
|
expect(script).toContain('add_tool');
|
||||||
|
|
||||||
|
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('install extensions');
|
||||||
|
expect(script).toContain('edit php.ini');
|
||||||
|
expect(script).toContain('set coverage driver');
|
||||||
|
expect(script).toContain('bash script.sh 7.3');
|
||||||
|
expect(script).toContain('add_tool');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test install on darwin', async () => {
|
||||||
|
setEnv('7.3', 'darwin', '', '', '', '', '');
|
||||||
|
|
||||||
|
let script: string = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash script.sh 7.3 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('install extensions');
|
||||||
|
expect(script).toContain('edit php.ini');
|
||||||
|
expect(script).toContain('set coverage driver');
|
||||||
|
expect(script).toContain('bash script.sh 7.3 ' + __dirname);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test malformed version inputs', async () => {
|
||||||
|
setEnv('7.4.1', 'darwin', '', '', '', '', '');
|
||||||
|
|
||||||
|
let script: string = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash script.sh 7.4 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv(8.0, 'darwin', '', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash script.sh 8.0 ' + __dirname);
|
||||||
|
|
||||||
|
setEnv(8, 'darwin', '', '', '', '', '');
|
||||||
|
|
||||||
|
script = '' + (await install.run());
|
||||||
|
expect(script).toContain('initial script');
|
||||||
|
expect(script).toContain('bash script.sh 8.0 ' + __dirname);
|
||||||
|
});
|
||||||
|
});
|
24
__tests__/matchers.test.ts
Normal file
24
__tests__/matchers.test.ts
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
});
|
545
__tests__/tools.test.ts
Normal file
545
__tests__/tools.test.ts
Normal file
@ -0,0 +1,545 @@
|
|||||||
|
import * as tools from '../src/tools';
|
||||||
|
|
||||||
|
describe('Tools tests', () => {
|
||||||
|
it('checking getCommand', async () => {
|
||||||
|
expect(await tools.getCommand('linux', 'tool')).toBe('add_tool ');
|
||||||
|
expect(await tools.getCommand('darwin', 'tool')).toBe('add_tool ');
|
||||||
|
expect(await tools.getCommand('win32', 'tool')).toBe('Add-Tool ');
|
||||||
|
expect(await tools.getCommand('openbsd', 'tool')).toContain(
|
||||||
|
'Platform openbsd is not supported'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getCommand', async () => {
|
||||||
|
expect(await tools.getCommand('linux', 'composertool')).toBe(
|
||||||
|
'add_composertool '
|
||||||
|
);
|
||||||
|
expect(await tools.getCommand('darwin', 'composertool')).toBe(
|
||||||
|
'add_composertool '
|
||||||
|
);
|
||||||
|
expect(await tools.getCommand('win32', 'composertool')).toBe(
|
||||||
|
'Add-Composertool '
|
||||||
|
);
|
||||||
|
expect(await tools.getCommand('openbsd', 'composertool')).toContain(
|
||||||
|
'Platform openbsd is not supported'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getCommand', async () => {
|
||||||
|
expect(await tools.getCommand('linux', 'pecl')).toBe('add_pecl ');
|
||||||
|
expect(await tools.getCommand('darwin', 'pecl')).toBe('add_pecl ');
|
||||||
|
expect(await tools.getCommand('win32', 'pecl')).toBe('Add-Pecl ');
|
||||||
|
expect(await tools.getCommand('openbsd', 'pecl')).toContain(
|
||||||
|
'Platform openbsd is not supported'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking parseToolVersion', async () => {
|
||||||
|
expect(await tools.getToolVersion('latest')).toBe('latest');
|
||||||
|
expect(await tools.getToolVersion('1.2.3')).toBe('1.2.3');
|
||||||
|
expect(await tools.getToolVersion('^1.2.3')).toBe('1.2.3');
|
||||||
|
expect(await tools.getToolVersion('>=1.2.3')).toBe('1.2.3');
|
||||||
|
expect(await tools.getToolVersion('>1.2.3')).toBe('1.2.3');
|
||||||
|
expect(await tools.getToolVersion('1.2.3-ALPHA')).toBe('1.2.3-ALPHA');
|
||||||
|
expect(await tools.getToolVersion('1.2.3-alpha')).toBe('1.2.3-alpha');
|
||||||
|
expect(await tools.getToolVersion('1.2.3-beta')).toBe('1.2.3-beta');
|
||||||
|
expect(await tools.getToolVersion('1.2.3-rc')).toBe('1.2.3-rc');
|
||||||
|
expect(await tools.getToolVersion('1.2.3-dev')).toBe('1.2.3-dev');
|
||||||
|
expect(await tools.getToolVersion('1.2.3-alpha1')).toBe('1.2.3-alpha1');
|
||||||
|
expect(await tools.getToolVersion('1.2.3-alpha.1')).toBe('1.2.3-alpha.1');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking parseToolVersion', async () => {
|
||||||
|
expect(await tools.parseTool('phpunit')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: 'latest'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:1.2.3')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:^1.2.3')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:>=1.2.3')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:>1.2.3')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:1.2.3-ALPHA')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3-ALPHA'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:1.2.3-alpha')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3-alpha'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:1.2.3-beta')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3-beta'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:1.2.3-rc')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3-rc'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:1.2.3-dev')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3-dev'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:1.2.3-alpha1')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3-alpha1'
|
||||||
|
});
|
||||||
|
expect(await tools.parseTool('phpunit:1.2.3-alpha.1')).toStrictEqual({
|
||||||
|
name: 'phpunit',
|
||||||
|
version: '1.2.3-alpha.1'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getUri', async () => {
|
||||||
|
expect(
|
||||||
|
await tools.getUri('tool', '.phar', 'latest', 'releases', '', 'download')
|
||||||
|
).toBe('releases/latest/download/tool.phar');
|
||||||
|
expect(
|
||||||
|
await tools.getUri('tool', '.phar', '1.2.3', 'releases', '', 'download')
|
||||||
|
).toBe('releases/download/1.2.3/tool.phar');
|
||||||
|
expect(
|
||||||
|
await tools.getUri('tool', '.phar', '1.2.3', 'releases', 'v', 'download')
|
||||||
|
).toBe('releases/download/v1.2.3/tool.phar');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getCodeceptionUriBuilder', async () => {
|
||||||
|
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php56')).toBe(
|
||||||
|
'releases/3.2.1/php56/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php54')).toBe(
|
||||||
|
'releases/3.2.1/php54/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUriBuilder('3.2.1', '')).toBe(
|
||||||
|
'releases/3.2.1/codecept.phar'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getCodeceptionUri', async () => {
|
||||||
|
expect(await tools.getCodeceptionUri('latest', '5.6')).toBe(
|
||||||
|
'php56/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('latest', '7.0')).toBe(
|
||||||
|
'php56/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('latest', '7.1')).toBe(
|
||||||
|
'php56/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('latest', '7.2')).toBe(
|
||||||
|
'codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('latest', '7.3')).toBe(
|
||||||
|
'codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('latest', '7.4')).toBe(
|
||||||
|
'codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('4.0.0', '7.4')).toBe(
|
||||||
|
'releases/4.0.0/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('4.0.0', '5.6')).toBe(
|
||||||
|
'releases/4.0.0/php56/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('4.0.0', '7.1')).toBe(
|
||||||
|
'releases/4.0.0/php56/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('3.1.0', '7.4')).toBe(
|
||||||
|
'releases/3.1.0/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('3.1.0', '5.6')).toBe(
|
||||||
|
'releases/3.1.0/php54/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.5.4', '7.4')).toBe(
|
||||||
|
'releases/2.5.4/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.5.4', '5.6')).toBe(
|
||||||
|
'releases/2.5.4/php54/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.3.4', '7.4')).toBe(
|
||||||
|
'releases/2.3.4/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.3.4', '5.4')).toBe(
|
||||||
|
'releases/2.3.4/php54/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.2.4', '5.6')).toBe(
|
||||||
|
'releases/2.2.4/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.2.4', '7.4')).toBe(
|
||||||
|
'releases/2.2.4/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.2.4', '5.4')).toBe(
|
||||||
|
'releases/2.2.4/php54/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.1.7', '5.6')).toBe(
|
||||||
|
'releases/2.1.7/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.1.7', '5.4')).toBe(
|
||||||
|
'releases/2.1.7/php54/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.1.5', '5.4')).toBe(
|
||||||
|
'releases/2.1.5/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('2.1.5', '7.4')).toBe(
|
||||||
|
'releases/2.1.5/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('1.6.9', '7.4')).toBe(
|
||||||
|
'releases/1.6.9/codecept.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getCodeceptionUri('1.5.0', '7.4')).toBe(
|
||||||
|
'releases/1.5.0/codecept.phar'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addPhive', async () => {
|
||||||
|
let script: string = await tools.addPhive('1.2.3', 'linux');
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addPhive('latest', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://phar.io/releases/phive.phar phive'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getPhpunitUri', async () => {
|
||||||
|
expect(await tools.getPharUrl('domain', 'tool', '', 'latest')).toBe(
|
||||||
|
'domain/tool.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getPharUrl('domain', 'tool', 'v', '1.2.3')).toBe(
|
||||||
|
'domain/tool-v1.2.3.phar'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getDeployerUri', async () => {
|
||||||
|
expect(await tools.getDeployerUrl('latest')).toBe(
|
||||||
|
'https://deployer.org/deployer.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getDeployerUrl('1.2.3')).toBe(
|
||||||
|
'https://deployer.org/releases/v1.2.3/deployer.phar'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addComposer', async () => {
|
||||||
|
expect(await tools.addComposer(['a', 'b'])).toStrictEqual([
|
||||||
|
'composer',
|
||||||
|
'a',
|
||||||
|
'b'
|
||||||
|
]);
|
||||||
|
expect(await tools.addComposer(['a', 'b', 'composer'])).toStrictEqual([
|
||||||
|
'composer',
|
||||||
|
'a',
|
||||||
|
'b'
|
||||||
|
]);
|
||||||
|
expect(
|
||||||
|
await tools.addComposer(['a', 'b', 'composer:1.2.3'])
|
||||||
|
).toStrictEqual(['composer', 'a', 'b']);
|
||||||
|
expect(
|
||||||
|
await tools.addComposer(['a', 'b', 'composer:snapshot'])
|
||||||
|
).toStrictEqual(['composer:snapshot', 'a', 'b']);
|
||||||
|
expect(
|
||||||
|
await tools.addComposer(['a', 'b', 'composer:preview'])
|
||||||
|
).toStrictEqual(['composer:preview', 'a', 'b']);
|
||||||
|
expect(
|
||||||
|
await tools.addComposer(['a', 'b', 'c', 'composer:1'])
|
||||||
|
).toStrictEqual(['composer:1', 'a', 'b', 'c']);
|
||||||
|
expect(
|
||||||
|
await tools.addComposer(['a', 'b', 'c', 'composer:2'])
|
||||||
|
).toStrictEqual(['composer:2', 'a', 'b', 'c']);
|
||||||
|
expect(
|
||||||
|
await tools.addComposer(['a', 'b', 'c', 'composer:v1'])
|
||||||
|
).toStrictEqual(['composer:1', 'a', 'b', 'c']);
|
||||||
|
expect(
|
||||||
|
await tools.addComposer(['a', 'b', 'c', 'composer:v2'])
|
||||||
|
).toStrictEqual(['composer:2', 'a', 'b', 'c']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getComposerUrl', async () => {
|
||||||
|
expect(await tools.getComposerUrl('latest')).toContain(
|
||||||
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getComposerUrl('stable')).toContain(
|
||||||
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getComposerUrl('snapshot')).toContain(
|
||||||
|
'https://getcomposer.org/composer.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getComposerUrl('preview')).toContain(
|
||||||
|
'https://getcomposer.org/composer-preview.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getComposerUrl('1')).toContain(
|
||||||
|
'https://getcomposer.org/composer-1.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getComposerUrl('2')).toContain(
|
||||||
|
'https://getcomposer.org/composer-2.phar'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getSymfonyUri', async () => {
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'linux')).toContain(
|
||||||
|
'releases/latest/download/symfony_linux_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'linux')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_linux_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'darwin')).toContain(
|
||||||
|
'releases/latest/download/symfony_darwin_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'darwin')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_darwin_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'win32')).toContain(
|
||||||
|
'releases/latest/download/symfony_windows_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'win32')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_windows_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'openbsd')).toContain(
|
||||||
|
'Platform openbsd is not supported'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getCleanedToolsList', async () => {
|
||||||
|
const tools_list: string[] = await tools.getCleanedToolsList(
|
||||||
|
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
|
||||||
|
);
|
||||||
|
expect(tools_list).toStrictEqual([
|
||||||
|
'composer',
|
||||||
|
'tool',
|
||||||
|
'phinx',
|
||||||
|
'prestissimo',
|
||||||
|
'composer-prefetcher'
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addArchive', async () => {
|
||||||
|
let script: string = await tools.addArchive(
|
||||||
|
'tool',
|
||||||
|
'https://tool.com/tool.phar',
|
||||||
|
'linux'
|
||||||
|
);
|
||||||
|
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
||||||
|
script = await tools.addArchive(
|
||||||
|
'tool',
|
||||||
|
'https://tool.com/tool.phar',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
||||||
|
script = await tools.addArchive(
|
||||||
|
'tool',
|
||||||
|
'https://tool.com/tool.phar',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
expect(script).toContain('Add-Tool https://tool.com/tool.phar tool');
|
||||||
|
|
||||||
|
script = await tools.addArchive(
|
||||||
|
'tool',
|
||||||
|
'https://tool.com/tool.phar',
|
||||||
|
'openbsd'
|
||||||
|
);
|
||||||
|
expect(script).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addDevTools', async () => {
|
||||||
|
let script: string = await tools.addDevTools('phpize', 'linux');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'linux');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('phpize', 'darwin');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'darwin');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('phpize', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Log "$cross" "phpize" "phpize is not a windows tool"'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Log "$cross" "php-config" "php-config is not a windows tool"'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addDevTools('tool', 'openbsd');
|
||||||
|
expect(script).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addPackage', async () => {
|
||||||
|
let script: string = await tools.addPackage(
|
||||||
|
'tool',
|
||||||
|
'tool:1.2.3',
|
||||||
|
'user/',
|
||||||
|
'linux'
|
||||||
|
);
|
||||||
|
expect(script).toContain('add_composertool tool tool:1.2.3 user/');
|
||||||
|
|
||||||
|
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'darwin');
|
||||||
|
expect(script).toContain('add_composertool tool tool:1.2.3 user/');
|
||||||
|
|
||||||
|
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'win32');
|
||||||
|
expect(script).toContain('Add-Composertool tool tool:1.2.3 user/');
|
||||||
|
|
||||||
|
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'openbsd');
|
||||||
|
expect(script).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addTools on linux', async () => {
|
||||||
|
const script: string = await tools.addTools(
|
||||||
|
'cs2pr, php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony',
|
||||||
|
'7.4',
|
||||||
|
'linux'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar php-cs-fixer'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://phar.io/releases/phive.phar phive'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
|
||||||
|
);
|
||||||
|
expect(script).toContain('add_pecl');
|
||||||
|
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
||||||
|
expect(script).toContain('add_composertool phinx phinx:1.2.3 robmorgan/');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
});
|
||||||
|
it('checking addTools on darwin', async () => {
|
||||||
|
const script: string = await tools.addTools(
|
||||||
|
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3',
|
||||||
|
'7.4',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
|
||||||
|
);
|
||||||
|
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony'
|
||||||
|
);
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
});
|
||||||
|
it('checking addTools on windows', async () => {
|
||||||
|
const script: string = await tools.addTools(
|
||||||
|
'codeception, cs2pr, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, does_not_exist',
|
||||||
|
'7.4',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://deployer.org/deployer.phar deployer'
|
||||||
|
);
|
||||||
|
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
|
||||||
|
);
|
||||||
|
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony'
|
||||||
|
);
|
||||||
|
expect(script).toContain('phpize is not a windows tool');
|
||||||
|
expect(script).toContain('php-config is not a windows tool');
|
||||||
|
expect(script).toContain('Tool does_not_exist is not supported');
|
||||||
|
});
|
||||||
|
it('checking addTools with composer tool using user/tool as input', async () => {
|
||||||
|
const script: string = await tools.addTools(
|
||||||
|
'hirak/prestissimo, narrowspark/automatic-composer-prefetcher, robmorgan/phinx',
|
||||||
|
'7.4',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
|
);
|
||||||
|
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
||||||
|
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Composertool composer-prefetcher composer-prefetcher narrowspark/automatic-'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('checking composer setup', async () => {
|
||||||
|
let script: string = await tools.addTools(
|
||||||
|
'composer, composer:v1',
|
||||||
|
'7.4',
|
||||||
|
'linux'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addTools('composer:preview', '7.4', 'linux');
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer'
|
||||||
|
);
|
||||||
|
script = await tools.addTools(
|
||||||
|
'composer:v1, composer:preview, composer:snapshot',
|
||||||
|
'7.4',
|
||||||
|
'linux'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
@ -1,12 +1,10 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as utils from '../src/utils';
|
import * as utils from '../src/utils';
|
||||||
import * as pecl from '../src/pecl';
|
|
||||||
|
|
||||||
let valid_extensions = ['xdebug', 'pcov'];
|
jest.mock('@actions/core', () => ({
|
||||||
jest.mock('../src/pecl', () => ({
|
getInput: jest.fn().mockImplementation(key => {
|
||||||
checkPECLExtension: jest.fn().mockImplementation(extension => {
|
return ['setup-php'].indexOf(key) !== -1 ? key : '';
|
||||||
return valid_extensions.indexOf(extension) !== -1;
|
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -21,52 +19,64 @@ async function cleanup(path: string): Promise<void> {
|
|||||||
describe('Utils tests', () => {
|
describe('Utils tests', () => {
|
||||||
it('checking getInput', async () => {
|
it('checking getInput', async () => {
|
||||||
process.env['test'] = 'setup-php';
|
process.env['test'] = '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('DoesNotExist', false)).toBe('');
|
expect(await utils.getInput('DoesNotExist', false)).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking asyncForEach', async () => {
|
it('checking asyncForEach', async () => {
|
||||||
let array: Array<number> = [1, 2, 3, 4];
|
const array: Array<string> = ['a', 'b', 'c'];
|
||||||
let sum: number = 0;
|
let concat = '';
|
||||||
await utils.asyncForEach(array, function(num: number): void {
|
await utils.asyncForEach(array, async function (
|
||||||
sum += num;
|
str: string
|
||||||
|
): Promise<void> {
|
||||||
|
concat += str;
|
||||||
});
|
});
|
||||||
expect(sum).toBe(10);
|
expect(concat).toBe('abc');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking asyncForEach', async () => {
|
||||||
|
expect(await utils.color('error')).toBe('31');
|
||||||
|
expect(await utils.color('success')).toBe('32');
|
||||||
|
expect(await utils.color('any')).toBe('32');
|
||||||
|
expect(await utils.color('warning')).toBe('33');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking readScripts', async () => {
|
it('checking readScripts', async () => {
|
||||||
let rc: string = fs.readFileSync(
|
const darwin: string = fs.readFileSync(
|
||||||
path.join(__dirname, '../src/7.4.sh'),
|
path.join(__dirname, '../src/scripts/darwin.sh'),
|
||||||
'utf8'
|
'utf8'
|
||||||
);
|
);
|
||||||
let darwin: string = fs.readFileSync(
|
const linux: string = fs.readFileSync(
|
||||||
path.join(__dirname, '../src/darwin.sh'),
|
path.join(__dirname, '../src/scripts/linux.sh'),
|
||||||
'utf8'
|
'utf8'
|
||||||
);
|
);
|
||||||
let linux: string = fs.readFileSync(
|
const win32: string = fs.readFileSync(
|
||||||
path.join(__dirname, '../src/linux.sh'),
|
path.join(__dirname, '../src/scripts/win32.ps1'),
|
||||||
'utf8'
|
'utf8'
|
||||||
);
|
);
|
||||||
let win32: string = fs.readFileSync(
|
expect(await utils.readScript('darwin.sh')).toBe(darwin);
|
||||||
path.join(__dirname, '../src/win32.ps1'),
|
expect(await utils.readScript('darwin.sh')).toBe(darwin);
|
||||||
'utf8'
|
expect(await utils.readScript('linux.sh')).toBe(linux);
|
||||||
);
|
expect(await utils.readScript('linux.sh')).toBe(linux);
|
||||||
expect(rc).toBe(await utils.readScript('darwin.sh', '7.4', 'darwin'));
|
expect(await utils.readScript('win32.ps1')).toBe(win32);
|
||||||
expect(darwin).toBe(await utils.readScript('darwin.sh', '7.3', 'darwin'));
|
expect(await utils.readScript('win32.ps1')).toBe(win32);
|
||||||
expect(linux).toBe(await utils.readScript('linux.sh', '7.3', 'linux'));
|
|
||||||
expect(win32).toBe(await utils.readScript('win32.ps1', '7.3', 'win32'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking writeScripts', async () => {
|
it('checking writeScripts', async () => {
|
||||||
let testString: string = 'sudo apt-get install php';
|
const testString = 'sudo apt-get install php';
|
||||||
await utils.writeScript('test.sh', '10', testString);
|
const runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || '';
|
||||||
await fs.readFile(path.join(__dirname, '../10test.sh'), function(
|
const script_path: string = path.join(runner_dir, 'test.sh');
|
||||||
error: any,
|
await utils.writeScript('test.sh', testString);
|
||||||
|
await fs.readFile(script_path, function (
|
||||||
|
error: Error | null,
|
||||||
data: Buffer
|
data: Buffer
|
||||||
) {
|
) {
|
||||||
expect(testString).toBe(data.toString());
|
expect(testString).toBe(data.toString());
|
||||||
});
|
});
|
||||||
await cleanup('./10test.sh');
|
await cleanup(script_path);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking extensionArray', async () => {
|
it('checking extensionArray', async () => {
|
||||||
@ -76,18 +86,84 @@ describe('Utils tests', () => {
|
|||||||
'c',
|
'c',
|
||||||
'd'
|
'd'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
expect(await utils.extensionArray('')).toEqual([]);
|
||||||
|
expect(await utils.extensionArray(' ')).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking INIArray', async () => {
|
it('checking INIArray', async () => {
|
||||||
expect(await utils.INIArray('a=1, b=2, c=3')).toEqual([
|
expect(await utils.CSVArray('a=1, b=2, c=3')).toEqual([
|
||||||
'a=1',
|
'a=1',
|
||||||
'b=2',
|
'b=2',
|
||||||
'c=3'
|
'c=3'
|
||||||
]);
|
]);
|
||||||
|
expect(await utils.CSVArray('')).toEqual([]);
|
||||||
|
expect(await utils.CSVArray(' ')).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking checkPECLExtension', async () => {
|
it('checking log', async () => {
|
||||||
expect(await pecl.checkPECLExtension('extensionDoesNotExist')).toBe(false);
|
const message = 'Test message';
|
||||||
expect(await pecl.checkPECLExtension('xdebug')).toBe(true);
|
|
||||||
|
let warning_log: string = await utils.log(message, 'win32', 'warning');
|
||||||
|
expect(warning_log).toEqual('printf "\\033[33;1m' + message + ' \\033[0m"');
|
||||||
|
warning_log = await utils.log(message, 'linux', 'warning');
|
||||||
|
expect(warning_log).toEqual('echo "\\033[33;1m' + message + '\\033[0m"');
|
||||||
|
warning_log = await utils.log(message, 'darwin', 'warning');
|
||||||
|
expect(warning_log).toEqual('echo "\\033[33;1m' + message + '\\033[0m"');
|
||||||
|
|
||||||
|
let error_log: string = await utils.log(message, 'win32', 'error');
|
||||||
|
expect(error_log).toEqual('printf "\\033[31;1m' + message + ' \\033[0m"');
|
||||||
|
error_log = await utils.log(message, 'linux', 'error');
|
||||||
|
expect(error_log).toEqual('echo "\\033[31;1m' + message + '\\033[0m"');
|
||||||
|
error_log = await utils.log(message, 'darwin', 'error');
|
||||||
|
expect(error_log).toEqual('echo "\\033[31;1m' + message + '\\033[0m"');
|
||||||
|
|
||||||
|
let success_log: string = await utils.log(message, 'win32', 'success');
|
||||||
|
expect(success_log).toEqual('printf "\\033[32;1m' + message + ' \\033[0m"');
|
||||||
|
success_log = await utils.log(message, 'linux', 'success');
|
||||||
|
expect(success_log).toEqual('echo "\\033[32;1m' + message + '\\033[0m"');
|
||||||
|
success_log = await utils.log(message, 'darwin', 'success');
|
||||||
|
expect(success_log).toEqual('echo "\\033[32;1m' + message + '\\033[0m"');
|
||||||
|
|
||||||
|
let step_log: string = await utils.stepLog(message, 'win32');
|
||||||
|
expect(step_log).toEqual('Step-Log "Test message"');
|
||||||
|
step_log = await utils.stepLog(message, 'linux');
|
||||||
|
expect(step_log).toEqual('step_log "Test message"');
|
||||||
|
step_log = await utils.stepLog(message, 'darwin');
|
||||||
|
expect(step_log).toEqual('step_log "Test message"');
|
||||||
|
step_log = await utils.stepLog(message, 'openbsd');
|
||||||
|
expect(step_log).toContain('Platform openbsd is not supported');
|
||||||
|
|
||||||
|
let add_log: string = await utils.addLog(
|
||||||
|
'tick',
|
||||||
|
'xdebug',
|
||||||
|
'enabled',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
expect(add_log).toEqual('Add-Log "tick" "xdebug" "enabled"');
|
||||||
|
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'linux');
|
||||||
|
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
||||||
|
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'darwin');
|
||||||
|
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
||||||
|
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'openbsd');
|
||||||
|
expect(add_log).toContain('Platform openbsd is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking getExtensionPrefix', async () => {
|
||||||
|
expect(await utils.getExtensionPrefix('extensionDoesNotExist')).toEqual(
|
||||||
|
'extension'
|
||||||
|
);
|
||||||
|
expect(await utils.getExtensionPrefix('xsl')).toEqual('extension');
|
||||||
|
expect(await utils.getExtensionPrefix('xdebug')).toEqual('zend_extension');
|
||||||
|
expect(await utils.getExtensionPrefix('opcache')).toEqual('zend_extension');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking suppressOutput', async () => {
|
||||||
|
expect(await utils.suppressOutput('win32')).toEqual(' >$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('openbsd')).toContain(
|
||||||
|
'Platform openbsd is not supported'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
35
action.yml
35
action.yml
@ -1,19 +1,38 @@
|
|||||||
name: 'Setup PHP Action'
|
name: 'Setup PHP Action'
|
||||||
author: shivammathur
|
author: shivammathur
|
||||||
description: 'Setup a PHP environment with composer and add it to the PATH'
|
description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer'
|
||||||
branding:
|
branding:
|
||||||
icon: 'activity'
|
|
||||||
color: 'purple'
|
color: 'purple'
|
||||||
|
icon: 'play-circle'
|
||||||
inputs:
|
inputs:
|
||||||
php-version:
|
php-version:
|
||||||
description: 'PHP version to be installed.'
|
description: 'Setup PHP version.'
|
||||||
|
default: '7.4'
|
||||||
required: true
|
required: true
|
||||||
extension-csv:
|
extensions:
|
||||||
description: '(Optional) Comma seperated list of PHP extensions to be installed.'
|
description: 'Setup PHP extensions.'
|
||||||
required: false
|
required: false
|
||||||
ini-values-csv:
|
ini-values:
|
||||||
description: '(Optional) Custom values you want to set in php.ini'
|
description: 'Add values to php.ini.'
|
||||||
|
required: false
|
||||||
|
coverage:
|
||||||
|
description: 'Setup code coverage driver.'
|
||||||
|
required: false
|
||||||
|
tools:
|
||||||
|
description: 'Setup popular tools globally.'
|
||||||
|
required: false
|
||||||
|
extension-csv:
|
||||||
|
description: 'Deprecated! Use extensions instead.'
|
||||||
|
deprecationMessage: 'The extension-csv property is deprecated. Use extensions instead.'
|
||||||
|
required: false
|
||||||
|
ini-values-csv:
|
||||||
|
description: 'Deprecated! Use ini-values instead.'
|
||||||
|
deprecationMessage: 'The ini-values-csv property is deprecated. Use ini-values instead.'
|
||||||
|
required: false
|
||||||
|
pecl:
|
||||||
|
description: 'Deprecated! Use tools instead to setup PECL.'
|
||||||
|
deprecationMessage: 'The pecl property is deprecated. Specify pecl in tools instead.'
|
||||||
required: false
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/install.js'
|
main: 'dist/index.js'
|
||||||
|
2940
dist/index.js
vendored
Normal file
2940
dist/index.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
|||||||
# Contributors
|
|
||||||
|
|
||||||
Please submit a Pull Request to the develop branch
|
|
32
examples/bedrock.yml
Normal file
32
examples/bedrock.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# GitHub Action for roots/bedrock
|
||||||
|
name: Testing Bedrock
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
bedrock:
|
||||||
|
name: Bedrock (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.1', '7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: PHP test
|
||||||
|
run: composer test
|
114
examples/cakephp-mysql.yml
Normal file
114
examples/cakephp-mysql.yml
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
# GitHub Action for CakePHP with MySQL and Redis
|
||||||
|
# Tested with https://github.com/cakephp/app
|
||||||
|
name: Testing CakePHP with MySQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
MYSQL_DATABASE: cakephp
|
||||||
|
ports:
|
||||||
|
- 3306/tcp
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- 6379/tcp
|
||||||
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
# You can also use ext-apcu or ext-memcached instead of ext-redis
|
||||||
|
# Install memcached if using ext-memcached
|
||||||
|
extensions: mbstring, intl, redis, pdo_mysql
|
||||||
|
coverage: pcov
|
||||||
|
- name: Start mysql service
|
||||||
|
run: sudo /etc/init.d/mysql start
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
# Add a step to run migrations if required
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
||||||
|
env:
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
DB_DSN: "mysql://root:password@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/cakephp?init[]=SET sql_mode = \"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\""
|
||||||
|
|
||||||
|
coding-standard:
|
||||||
|
name: Coding Standard
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.3'
|
||||||
|
extensions: mbstring, intl
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: PHP CodeSniffer
|
||||||
|
run: composer cs-check
|
||||||
|
|
||||||
|
static-analysis:
|
||||||
|
name: Static Analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.3'
|
||||||
|
extensions: mbstring, intl
|
||||||
|
tools: phpstan
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Static Analysis using PHPStan
|
||||||
|
run: phpstan analyse --no-progress src/
|
112
examples/cakephp-postgres.yml
Normal file
112
examples/cakephp-postgres.yml
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# GitHub Action for CakePHP with PostgreSQL and Redis
|
||||||
|
# Tested with https://github.com/cakephp/app
|
||||||
|
name: Testing CakePHP with PostgreSQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:10.8
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
ports:
|
||||||
|
- 5432/tcp
|
||||||
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- 6379/tcp
|
||||||
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
# You can also use ext-apcu or ext-memcached instead of ext-redis
|
||||||
|
# Install memcached if using ext-memcached
|
||||||
|
extensions: mbstring, intl, redis, pdo_pgsql
|
||||||
|
coverage: pcov
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
# Add a step to run migrations if required
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
||||||
|
env:
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
DB_DSN: postgres://postgres@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/postgres
|
||||||
|
|
||||||
|
coding-standard:
|
||||||
|
name: Coding Standard
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.3'
|
||||||
|
extensions: mbstring, intl
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: PHP CodeSniffer
|
||||||
|
run: composer cs-check
|
||||||
|
|
||||||
|
static-analysis:
|
||||||
|
name: Static Analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.3'
|
||||||
|
extensions: mbstring, intl
|
||||||
|
tools: phpstan
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Static Analysis using PHPStan
|
||||||
|
run: phpstan analyse --no-progress src/
|
92
examples/cakephp.yml
Normal file
92
examples/cakephp.yml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
# GitHub Action for CakePHP
|
||||||
|
# Tested with https://github.com/cakephp/app
|
||||||
|
name: Testing CakePHP
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, intl, pdo_sqlite, pdo_mysql
|
||||||
|
coverage: pcov #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
||||||
|
|
||||||
|
coding-standard:
|
||||||
|
name: Coding Standard
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.3'
|
||||||
|
extensions: mbstring, intl
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: PHP CodeSniffer
|
||||||
|
run: composer cs-check
|
||||||
|
|
||||||
|
static-analysis:
|
||||||
|
name: Static Analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '7.3'
|
||||||
|
extensions: mbstring, intl
|
||||||
|
tools: phpstan
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Static Analysis using PHPStan
|
||||||
|
run: phpstan analyse --no-progress src/
|
34
examples/codeigniter.yml
Normal file
34
examples/codeigniter.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# GitHub Action for CodeIgniter
|
||||||
|
name: Testing CodeIgniter
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, intl, curl, dom
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
74
examples/laravel-mysql.yml
Normal file
74
examples/laravel-mysql.yml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# GitHub Action for Laravel with MySQL and Redis
|
||||||
|
name: Testing Laravel with MySQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
laravel:
|
||||||
|
name: Laravel (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DB_DATABASE: laravel
|
||||||
|
DB_USERNAME: root
|
||||||
|
DB_PASSWORD: password
|
||||||
|
BROADCAST_DRIVER: log
|
||||||
|
CACHE_DRIVER: redis
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
SESSION_DRIVER: redis
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
MYSQL_DATABASE: laravel
|
||||||
|
ports:
|
||||||
|
- 3306/tcp
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- 6379/tcp
|
||||||
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, dom, fileinfo, mysql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
|
run: sudo /etc/init.d/mysql start
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Prepare the application
|
||||||
|
run: |
|
||||||
|
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
php artisan key:generate
|
||||||
|
- name: Clear Config
|
||||||
|
run: php artisan config:clear
|
||||||
|
- name: Run Migration
|
||||||
|
run: php artisan migrate -v
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
74
examples/laravel-postgres.yml
Normal file
74
examples/laravel-postgres.yml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# GitHub Action for Laravel with PostgreSQL and Redis
|
||||||
|
name: Testing Laravel with PostgreSQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
laravel:
|
||||||
|
name: Laravel (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
BROADCAST_DRIVER: log
|
||||||
|
CACHE_DRIVER: redis
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
SESSION_DRIVER: redis
|
||||||
|
DB_CONNECTION: pgsql
|
||||||
|
DB_HOST: localhost
|
||||||
|
DB_PASSWORD: postgres
|
||||||
|
DB_USERNAME: postgres
|
||||||
|
DB_DATABASE: postgres
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:10.8
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
ports:
|
||||||
|
- 5432/tcp
|
||||||
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- 6379/tcp
|
||||||
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, dom, fileinfo, pgsql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Prepare the application
|
||||||
|
run: |
|
||||||
|
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
php artisan key:generate
|
||||||
|
- name: Clear Config
|
||||||
|
run: php artisan config:clear
|
||||||
|
- name: Run Migration
|
||||||
|
run: php artisan migrate -v
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
42
examples/laravel.yml
Normal file
42
examples/laravel.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# GitHub Action for Laravel
|
||||||
|
name: Testing Laravel
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
laravel:
|
||||||
|
name: Laravel (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, dom, fileinfo
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Prepare the application
|
||||||
|
run: |
|
||||||
|
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
php artisan key:generate
|
||||||
|
- name: Clear Config
|
||||||
|
run: php artisan config:clear
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
74
examples/lumen-mysql.yml
Normal file
74
examples/lumen-mysql.yml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# GitHub Action for Lumen with MySQL and Redis
|
||||||
|
name: Testing Lumen with MySQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
lumen:
|
||||||
|
name: Lumen (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DB_DATABASE: lumen
|
||||||
|
DB_USERNAME: root
|
||||||
|
DB_PASSWORD: password
|
||||||
|
BROADCAST_DRIVER: log
|
||||||
|
CACHE_DRIVER: redis
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
SESSION_DRIVER: redis
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
MYSQL_DATABASE: lumen
|
||||||
|
ports:
|
||||||
|
- 3306/tcp
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- 6379/tcp
|
||||||
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, dom, fileinfo, mysql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
|
run: sudo /etc/init.d/mysql start
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer require predis/predis illuminate/redis
|
||||||
|
- name: Prepare the application
|
||||||
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
- name: Register Redis as service provider
|
||||||
|
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
|
||||||
|
- name: Run Migration
|
||||||
|
run: php artisan migrate -v
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
74
examples/lumen-postgres.yml
Normal file
74
examples/lumen-postgres.yml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# GitHub Action for Lumen with PostgreSQL and Redis
|
||||||
|
name: Testing Lumen with PostgreSQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
laravel:
|
||||||
|
name: Lumen (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
BROADCAST_DRIVER: log
|
||||||
|
CACHE_DRIVER: redis
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
SESSION_DRIVER: redis
|
||||||
|
DB_CONNECTION: pgsql
|
||||||
|
DB_HOST: localhost
|
||||||
|
DB_PASSWORD: postgres
|
||||||
|
DB_USERNAME: postgres
|
||||||
|
DB_DATABASE: postgres
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:10.8
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
ports:
|
||||||
|
- 5432/tcp
|
||||||
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- 6379/tcp
|
||||||
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, dom, fileinfo, pgsql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer require predis/predis illuminate/redis
|
||||||
|
- name: Prepare the application
|
||||||
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
- name: Register Redis as service provider
|
||||||
|
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
|
||||||
|
- name: Run Migration
|
||||||
|
run: php artisan migrate -v
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||||
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
38
examples/lumen.yml
Normal file
38
examples/lumen.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# GitHub Action for Lumen
|
||||||
|
name: Unit Testing Lumen
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
lumen:
|
||||||
|
name: Lumen (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, dom, fileinfo, mysql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Prepare the application
|
||||||
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
74
examples/phalcon-mysql.yml
Normal file
74
examples/phalcon-mysql.yml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# GitHub Action for Phalcon with MySQL
|
||||||
|
## Notes
|
||||||
|
## Make sure you have .env.example or .env file in your project
|
||||||
|
## and you have loaded Dotenv (https://github.com/vlucas/phpdotenv)
|
||||||
|
name: Testing Phalcon with MySQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
phalcon:
|
||||||
|
name: Phalcon (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DB_ADAPTER: mysql
|
||||||
|
DB_HOST: 127.0.0.1
|
||||||
|
DB_NAME: phalcon
|
||||||
|
DB_USERNAME: root
|
||||||
|
DB_PASSWORD: password
|
||||||
|
CODECEPTION_URL: 127.0.0.1
|
||||||
|
CODECEPTION_PORT: 8888
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
MYSQL_DATABASE: phalcon
|
||||||
|
ports:
|
||||||
|
- 3306/tcp
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
# For phalcon 3.x, use
|
||||||
|
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
|
run: sudo /etc/init.d/mysql start
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Prepare the application
|
||||||
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
- name: Run Migration
|
||||||
|
run: |
|
||||||
|
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
||||||
|
vendor/bin/phinx migrate
|
||||||
|
vendor/bin/phinx seed:run
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
||||||
|
vendor/bin/codecept build
|
||||||
|
vendor/bin/codecept run
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
73
examples/phalcon-postgres.yml
Normal file
73
examples/phalcon-postgres.yml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# GitHub Action for Phalcon with PostgreSQL
|
||||||
|
## Notes
|
||||||
|
## Make sure you have .env.example or .env file in your project
|
||||||
|
## and you have loaded Dotenv (https://github.com/vlucas/phpdotenv)
|
||||||
|
name: Testing Phalcon with PostgreSQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
phalcon:
|
||||||
|
name: Phalcon (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DB_ADAPTER: pgsql
|
||||||
|
DB_HOST: 127.0.0.1
|
||||||
|
DB_NAME: postgres
|
||||||
|
DB_USERNAME: postgres
|
||||||
|
DB_PASSWORD: postgres
|
||||||
|
CODECEPTION_URL: 127.0.0.1
|
||||||
|
CODECEPTION_PORT: 8888
|
||||||
|
DB_CONNECTION: pgsql
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:10.8
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
ports:
|
||||||
|
- 5432/tcp
|
||||||
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
# For phalcon 3.x, use
|
||||||
|
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Prepare the application
|
||||||
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
- name: Run Migration
|
||||||
|
run: |
|
||||||
|
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
||||||
|
vendor/bin/phinx migrate
|
||||||
|
vendor/bin/phinx seed:run
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
||||||
|
vendor/bin/codecept build
|
||||||
|
vendor/bin/codecept run
|
||||||
|
env:
|
||||||
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
57
examples/sage.yml
Normal file
57
examples/sage.yml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# GitHub Action for roots/sage
|
||||||
|
name: Testing Sage
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
sage:
|
||||||
|
name: Sage (PHP ${{ matrix.php-versions }} & Node ${{ matrix.node-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.1', '7.2', '7.3', '7.4']
|
||||||
|
node-versions: ['8', '10']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-versions }}
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring
|
||||||
|
- name: Check node versions
|
||||||
|
run: node -v
|
||||||
|
- name: Get yarn cache
|
||||||
|
id: yarn-cache
|
||||||
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-yarn-
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install yarn dependencies
|
||||||
|
run: yarn -V
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Yarn test and build
|
||||||
|
run: |
|
||||||
|
yarn run test
|
||||||
|
yarn run build
|
||||||
|
yarn run rmdist
|
||||||
|
yarn run "build:production"
|
||||||
|
- name: PHP test
|
||||||
|
run: composer test
|
34
examples/slim-framework.yml
Normal file
34
examples/slim-framework.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# GitHub Action for Slim Framework
|
||||||
|
name: Testing Slim Framework
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, simplexml, dom
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
55
examples/symfony-mysql.yml
Normal file
55
examples/symfony-mysql.yml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# GitHub Action for Symfony with MySQL
|
||||||
|
name: Testing Symfony with MySQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
symfony:
|
||||||
|
name: Symfony (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
|
MYSQL_ROOT_PASSWORD: symfony
|
||||||
|
MYSQL_DATABASE: symfony
|
||||||
|
ports:
|
||||||
|
- 3306/tcp
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
|
run: sudo /etc/init.d/mysql start
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Run Migration
|
||||||
|
run: |
|
||||||
|
composer require symfony/orm-pack
|
||||||
|
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
||||||
|
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
||||||
|
env:
|
||||||
|
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
|
||||||
|
- name: Run Tests
|
||||||
|
run: php bin/phpunit --coverage-text
|
53
examples/symfony-postgres.yml
Normal file
53
examples/symfony-postgres.yml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# GitHub Action for Symfony with PostgreSQL
|
||||||
|
name: Testing Symfony with PostgreSQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
symfony:
|
||||||
|
name: Symfony (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:10.8
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
ports:
|
||||||
|
- 5432/tcp
|
||||||
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Run Migration
|
||||||
|
run: |
|
||||||
|
composer require symfony/orm-pack
|
||||||
|
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
||||||
|
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
||||||
|
env:
|
||||||
|
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
|
||||||
|
- name: Run Tests
|
||||||
|
run: php bin/phpunit --coverage-text
|
38
examples/symfony.yml
Normal file
38
examples/symfony.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# GitHub Action for Symfony
|
||||||
|
name: Testing Symfony
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
symfony:
|
||||||
|
name: Symfony (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: |
|
||||||
|
composer require symfony/orm-pack
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Run Tests
|
||||||
|
run: php bin/phpunit --coverage-text
|
73
examples/yii2-mysql.yml
Normal file
73
examples/yii2-mysql.yml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# GitHub Action for Yii Framework with MySQL
|
||||||
|
name: Testing Yii2 with MySQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
yii:
|
||||||
|
name: Yii2 (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DB_USERNAME: root
|
||||||
|
DB_PASSWORD: yii
|
||||||
|
TEST_DB_USERNAME: root
|
||||||
|
TEST_DB_PASSWORD: yii
|
||||||
|
DB_CHARSET: utf8
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
|
MYSQL_ROOT_PASSWORD: yii
|
||||||
|
MYSQL_DATABASE: yii
|
||||||
|
ports:
|
||||||
|
- 3306/tcp
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set Node.js 10.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 10.x
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, intl, gd, imagick, zip, dom, mysql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Start mysql service
|
||||||
|
run: sudo /etc/init.d/mysql start
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Prepare the application
|
||||||
|
run: |
|
||||||
|
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
||||||
|
php console/yii app/setup
|
||||||
|
npm install --development
|
||||||
|
npm run build
|
||||||
|
env:
|
||||||
|
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
||||||
|
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
vendor/bin/codecept build
|
||||||
|
php tests/bin/yii app/setup --interactive=0
|
||||||
|
nohup php -S localhost:8080 > yii.log 2>&1 &
|
||||||
|
vendor/bin/codecept run
|
||||||
|
env:
|
||||||
|
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
||||||
|
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
71
examples/yii2-postgres.yml
Normal file
71
examples/yii2-postgres.yml
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
# GitHub Action for Yii Framework with PostgreSQL
|
||||||
|
name: Testing Yii2 with PostgreSQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
yii:
|
||||||
|
name: Yii2 (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DB_USERNAME: postgres
|
||||||
|
DB_PASSWORD: postgres
|
||||||
|
TEST_DB_USERNAME: postgres
|
||||||
|
TEST_DB_PASSWORD: postgres
|
||||||
|
DB_CHARSET: utf8
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:10.8
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
ports:
|
||||||
|
- 5432/tcp
|
||||||
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set Node.js 10.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 10.x
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
- name: Prepare the application
|
||||||
|
run: |
|
||||||
|
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
||||||
|
php console/yii app/setup
|
||||||
|
npm install --development
|
||||||
|
npm run build
|
||||||
|
env:
|
||||||
|
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
||||||
|
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
vendor/bin/codecept build
|
||||||
|
php tests/bin/yii app/setup --interactive=0
|
||||||
|
nohup php -S localhost:8080 > yii.log 2>&1 &
|
||||||
|
vendor/bin/codecept run
|
||||||
|
env:
|
||||||
|
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
||||||
|
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
36
examples/zend-framework.yml
Normal file
36
examples/zend-framework.yml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# GitHub Action for Zend Framework
|
||||||
|
name: Testing Zend Framework
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP, with composer and extensions
|
||||||
|
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, bcmath, curl, intl
|
||||||
|
coverage: xdebug #optional
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composercache
|
||||||
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composercache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer require --dev phpunit/phpunit squizlabs/php_codesniffer zendframework/zend-test
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --coverage-text
|
@ -9,4 +9,4 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
verbose: true,
|
verbose: true,
|
||||||
collectCoverage: true
|
collectCoverage: true
|
||||||
};
|
};
|
||||||
|
217
lib/features.js
217
lib/features.js
@ -1,217 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const utils = __importStar(require("./utils"));
|
|
||||||
const pecl = __importStar(require("./pecl"));
|
|
||||||
function addExtension(extensions, version, os_version) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (os_version === 'win32') {
|
|
||||||
return yield addExtensionWindows(extensions, version);
|
|
||||||
}
|
|
||||||
else if (os_version === 'linux') {
|
|
||||||
return yield addExtensionLinux(extensions, version);
|
|
||||||
}
|
|
||||||
return yield addExtensionDarwin(extensions);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.addExtension = addExtension;
|
|
||||||
function addINIValues(ini_values_csv, os_version) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (os_version === 'win32') {
|
|
||||||
return yield addINIValuesWindows(ini_values_csv);
|
|
||||||
}
|
|
||||||
return yield addINIValuesUnix(ini_values_csv);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.addINIValues = addINIValues;
|
|
||||||
/**
|
|
||||||
* Enable extensions which are installed but not enabled on windows
|
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
*/
|
|
||||||
function enableExtensionWindows(extension) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return `try {
|
|
||||||
$${extension}_found = 0
|
|
||||||
$ext_dir = Get-PhpIniKey extension_dir
|
|
||||||
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
|
||||||
$enabled = php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}"
|
|
||||||
if($enabled -eq 'no' -and $exist) {
|
|
||||||
Enable-PhpExtension ${extension} C:\\tools\\php$version
|
|
||||||
$${extension}_found = 1
|
|
||||||
}
|
|
||||||
} catch [Exception] {
|
|
||||||
echo $_
|
|
||||||
}\n`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.enableExtensionWindows = enableExtensionWindows;
|
|
||||||
/**
|
|
||||||
* Enable extensions which are installed but not enabled on unix
|
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
*/
|
|
||||||
function enableExtensionUnix(extension) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return `${extension}_found=0
|
|
||||||
enabled=$(php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}")
|
|
||||||
if [ "$enabled" = "no" ] && [ -e "$ext_dir/${extension}.so" ]; then
|
|
||||||
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'
|
|
||||||
echo "${extension} enabled"
|
|
||||||
${extension}_found=1
|
|
||||||
fi\n`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.enableExtensionUnix = enableExtensionUnix;
|
|
||||||
/**
|
|
||||||
* Install and enable extensions for darwin
|
|
||||||
*
|
|
||||||
* @param extension_csv
|
|
||||||
*/
|
|
||||||
function addExtensionDarwin(extension_csv) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let extensions = yield utils.extensionArray(extension_csv);
|
|
||||||
let script = '\n';
|
|
||||||
yield utils.asyncForEach(extensions, function (extension) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
script += yield enableExtensionUnix(extension);
|
|
||||||
if (yield pecl.checkPECLExtension(extension)) {
|
|
||||||
script +=
|
|
||||||
'if [ $' +
|
|
||||||
extension +
|
|
||||||
'_found -eq 0 ]; then sudo pecl install ' +
|
|
||||||
extension +
|
|
||||||
' || echo "Couldn\'t find extension: ' +
|
|
||||||
extension +
|
|
||||||
'"; fi\n';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return script;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.addExtensionDarwin = addExtensionDarwin;
|
|
||||||
/**
|
|
||||||
* Install and enable extensions for windows
|
|
||||||
*
|
|
||||||
* @param extension_csv
|
|
||||||
* @param version
|
|
||||||
*/
|
|
||||||
function addExtensionWindows(extension_csv, version) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let extensions = yield utils.extensionArray(extension_csv);
|
|
||||||
let script = '\n';
|
|
||||||
yield utils.asyncForEach(extensions, function (extension) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
script += yield enableExtensionWindows(extension);
|
|
||||||
let extension_version = 'stable';
|
|
||||||
if (version == '7.4') {
|
|
||||||
extension_version = 'alpha';
|
|
||||||
}
|
|
||||||
if (yield pecl.checkPECLExtension(extension)) {
|
|
||||||
script +=
|
|
||||||
'if($' +
|
|
||||||
extension +
|
|
||||||
'_found -eq 0) { ' +
|
|
||||||
'try { Install-PhpExtension ' +
|
|
||||||
extension +
|
|
||||||
' -MinimumStability ' +
|
|
||||||
extension_version +
|
|
||||||
' } catch [Exception] { echo $_; echo "Could not install extension: "' +
|
|
||||||
extension +
|
|
||||||
' } }\n';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return script;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.addExtensionWindows = addExtensionWindows;
|
|
||||||
/**
|
|
||||||
* Install and enable extensions for linux
|
|
||||||
*
|
|
||||||
* @param extension_csv
|
|
||||||
* @param version
|
|
||||||
*/
|
|
||||||
function addExtensionLinux(extension_csv, version) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let extensions = yield utils.extensionArray(extension_csv);
|
|
||||||
let script = '\n';
|
|
||||||
yield utils.asyncForEach(extensions, function (extension) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
script += yield enableExtensionUnix(extension);
|
|
||||||
script +=
|
|
||||||
'if [ $' +
|
|
||||||
extension +
|
|
||||||
'_found -eq 0 ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
|
|
||||||
version +
|
|
||||||
'-' +
|
|
||||||
extension +
|
|
||||||
' || echo "Couldn\'t find extension php' +
|
|
||||||
version +
|
|
||||||
'-' +
|
|
||||||
extension +
|
|
||||||
'"; fi\n';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return script;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.addExtensionLinux = addExtensionLinux;
|
|
||||||
/**
|
|
||||||
* Add script to set custom ini values for unix
|
|
||||||
*
|
|
||||||
* @param ini_values_csv
|
|
||||||
*/
|
|
||||||
function addINIValuesUnix(ini_values_csv) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let script = '\n';
|
|
||||||
let ini_values = yield utils.INIArray(ini_values_csv);
|
|
||||||
yield utils.asyncForEach(ini_values, function (ini_value) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// add script to set ini value
|
|
||||||
script += 'echo "' + ini_value + '" >> $ini_file\n';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return script;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.addINIValuesUnix = addINIValuesUnix;
|
|
||||||
/**
|
|
||||||
* Add script to set custom ini values for windows
|
|
||||||
*
|
|
||||||
* @param ini_values_csv
|
|
||||||
*/
|
|
||||||
function addINIValuesWindows(ini_values_csv) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let script = '\n';
|
|
||||||
let ini_values = yield utils.INIArray(ini_values_csv);
|
|
||||||
yield utils.asyncForEach(ini_values, function (ini_value) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// add script to set ini value
|
|
||||||
script +=
|
|
||||||
'Add-Content C:\\tools\\php$version\\php.ini "' + ini_value + '"\n';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return script;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.addINIValuesWindows = addINIValuesWindows;
|
|
@ -1,65 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const exec_1 = require("@actions/exec/lib/exec");
|
|
||||||
const core = __importStar(require("@actions/core"));
|
|
||||||
const utils = __importStar(require("./utils"));
|
|
||||||
const features = __importStar(require("./features"));
|
|
||||||
/**
|
|
||||||
* Run the script
|
|
||||||
*/
|
|
||||||
function run() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
// taking inputs
|
|
||||||
let version = yield utils.getInput('php-version', true);
|
|
||||||
let extension_csv = yield utils.getInput('extension-csv', false);
|
|
||||||
let ini_values_csv = yield utils.getInput('ini-values-csv', false);
|
|
||||||
let os_version = process.platform;
|
|
||||||
// check the os version and run the respective script
|
|
||||||
if (os_version == 'darwin') {
|
|
||||||
let darwin = yield utils.readScript('darwin.sh', version, os_version);
|
|
||||||
darwin += yield features.addExtension(extension_csv, version, os_version);
|
|
||||||
darwin += yield features.addINIValues(ini_values_csv, os_version);
|
|
||||||
yield utils.writeScript('darwin.sh', version, darwin);
|
|
||||||
yield exec_1.exec('sh -x ./' + version + 'darwin.sh ' + version);
|
|
||||||
}
|
|
||||||
else if (os_version == 'win32') {
|
|
||||||
let windows = yield utils.readScript('win32.ps1', version, os_version);
|
|
||||||
windows += yield features.addExtension(extension_csv, version, os_version);
|
|
||||||
windows += yield features.addINIValues(ini_values_csv, os_version);
|
|
||||||
yield utils.writeScript('win32.ps1', version, windows);
|
|
||||||
yield exec_1.exec('powershell .\\' + version + 'win32.ps1 -version ' + version);
|
|
||||||
}
|
|
||||||
else if (os_version == 'linux') {
|
|
||||||
let linux = yield utils.readScript('linux.sh', version, os_version);
|
|
||||||
linux += yield features.addExtension(extension_csv, version, os_version);
|
|
||||||
linux += yield features.addINIValues(ini_values_csv, os_version);
|
|
||||||
yield utils.writeScript('linux.sh', version, linux);
|
|
||||||
yield exec_1.exec('./' + version + 'linux.sh ' + version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
core.setFailed(err.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// call the run function
|
|
||||||
run().then(function () {
|
|
||||||
console.log('done');
|
|
||||||
});
|
|
35
lib/pecl.js
35
lib/pecl.js
@ -1,35 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const hc = __importStar(require("typed-rest-client/HttpClient"));
|
|
||||||
/**
|
|
||||||
* Function to check if PECL extension exists
|
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
*/
|
|
||||||
function checkPECLExtension(extension) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const http = new hc.HttpClient('shivammathur/php-setup', [], {
|
|
||||||
allowRetries: true,
|
|
||||||
maxRetries: 2
|
|
||||||
});
|
|
||||||
const response = yield http.get('https://pecl.php.net/package/' + extension);
|
|
||||||
return response.message.statusCode === 200;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.checkPECLExtension = checkPECLExtension;
|
|
104
lib/utils.js
104
lib/utils.js
@ -1,104 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const core = __importStar(require("@actions/core"));
|
|
||||||
function getInput(name, mandatory) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let input = process.env[name];
|
|
||||||
if (!input) {
|
|
||||||
input = core.getInput(name, { required: mandatory });
|
|
||||||
}
|
|
||||||
return input;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.getInput = getInput;
|
|
||||||
/**
|
|
||||||
* Async foreach loop
|
|
||||||
*
|
|
||||||
* @author https://github.com/Atinux
|
|
||||||
* @param array
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
function asyncForEach(array, callback) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
for (let index = 0; index < array.length; index++) {
|
|
||||||
yield callback(array[index], index, array);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.asyncForEach = asyncForEach;
|
|
||||||
/**
|
|
||||||
* Read the scripts
|
|
||||||
*
|
|
||||||
* @param filename
|
|
||||||
* @param version
|
|
||||||
* @param os_version
|
|
||||||
*/
|
|
||||||
function readScript(filename, version, os_version) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (version === '7.4' && os_version === 'darwin') {
|
|
||||||
return fs.readFileSync(path.join(__dirname, '../src/7.4.sh'), 'utf8');
|
|
||||||
}
|
|
||||||
return fs.readFileSync(path.join(__dirname, '../src/' + filename), 'utf8');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.readScript = readScript;
|
|
||||||
/**
|
|
||||||
* Write final script which runs
|
|
||||||
*
|
|
||||||
* @param filename
|
|
||||||
* @param version
|
|
||||||
* @param script
|
|
||||||
*/
|
|
||||||
function writeScript(filename, version, script) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
fs.writeFileSync(version + filename, script, { mode: 0o755 });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.writeScript = writeScript;
|
|
||||||
/**
|
|
||||||
* Function to break extension csv into an array
|
|
||||||
* @param extension_csv
|
|
||||||
*/
|
|
||||||
function extensionArray(extension_csv) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return extension_csv.split(',').map(function (extension) {
|
|
||||||
return extension
|
|
||||||
.trim()
|
|
||||||
.replace('php-', '')
|
|
||||||
.replace('php_', '');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.extensionArray = extensionArray;
|
|
||||||
/**
|
|
||||||
* Function to break ini values csv into an array
|
|
||||||
*
|
|
||||||
* @param ini_values_csv
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
function INIArray(ini_values_csv) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return ini_values_csv.split(',').map(function (ini_value) {
|
|
||||||
return ini_value.trim();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.INIArray = INIArray;
|
|
15
node_modules/.bin/browserslist
generated
vendored
15
node_modules/.bin/browserslist
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../browserslist/cli.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../browserslist/cli.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/browserslist.cmd
generated
vendored
7
node_modules/.bin/browserslist.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\browserslist\cli.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\browserslist\cli.js" %*
|
|
||||||
)
|
|
15
node_modules/.bin/codecov
generated
vendored
15
node_modules/.bin/codecov
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../codecov/bin/codecov" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../codecov/bin/codecov" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/codecov.cmd
generated
vendored
7
node_modules/.bin/codecov.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\codecov\bin\codecov" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\codecov\bin\codecov" %*
|
|
||||||
)
|
|
15
node_modules/.bin/esparse
generated
vendored
15
node_modules/.bin/esparse
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../esprima/bin/esparse.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../esprima/bin/esparse.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/esparse.cmd
generated
vendored
7
node_modules/.bin/esparse.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\esprima\bin\esparse.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\esprima\bin\esparse.js" %*
|
|
||||||
)
|
|
15
node_modules/.bin/esvalidate
generated
vendored
15
node_modules/.bin/esvalidate
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../esprima/bin/esvalidate.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../esprima/bin/esvalidate.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/esvalidate.cmd
generated
vendored
7
node_modules/.bin/esvalidate.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\esprima\bin\esvalidate.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\esprima\bin\esvalidate.js" %*
|
|
||||||
)
|
|
15
node_modules/.bin/js-yaml
generated
vendored
15
node_modules/.bin/js-yaml
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/js-yaml.cmd
generated
vendored
7
node_modules/.bin/js-yaml.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\js-yaml\bin\js-yaml.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\js-yaml\bin\js-yaml.js" %*
|
|
||||||
)
|
|
15
node_modules/.bin/jsesc
generated
vendored
15
node_modules/.bin/jsesc
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../jsesc/bin/jsesc" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../jsesc/bin/jsesc" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/jsesc.cmd
generated
vendored
7
node_modules/.bin/jsesc.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\jsesc\bin\jsesc" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\jsesc\bin\jsesc" %*
|
|
||||||
)
|
|
15
node_modules/.bin/loose-envify
generated
vendored
15
node_modules/.bin/loose-envify
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../loose-envify/cli.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../loose-envify/cli.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/loose-envify.cmd
generated
vendored
7
node_modules/.bin/loose-envify.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\loose-envify\cli.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\loose-envify\cli.js" %*
|
|
||||||
)
|
|
15
node_modules/.bin/parser
generated
vendored
15
node_modules/.bin/parser
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../@babel/parser/bin/babel-parser.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../@babel/parser/bin/babel-parser.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/parser.cmd
generated
vendored
7
node_modules/.bin/parser.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\@babel\parser\bin\babel-parser.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\@babel\parser\bin\babel-parser.js" %*
|
|
||||||
)
|
|
15
node_modules/.bin/regexp-tree
generated
vendored
15
node_modules/.bin/regexp-tree
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../regexp-tree/bin/regexp-tree" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../regexp-tree/bin/regexp-tree" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/regexp-tree.cmd
generated
vendored
7
node_modules/.bin/regexp-tree.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\regexp-tree\bin\regexp-tree" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\regexp-tree\bin\regexp-tree" %*
|
|
||||||
)
|
|
15
node_modules/.bin/regjsparser
generated
vendored
15
node_modules/.bin/regjsparser
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../regjsparser/bin/parser" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../regjsparser/bin/parser" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/regjsparser.cmd
generated
vendored
7
node_modules/.bin/regjsparser.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\regjsparser\bin\parser" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\regjsparser\bin\parser" %*
|
|
||||||
)
|
|
15
node_modules/.bin/semver
generated
vendored
15
node_modules/.bin/semver
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../semver/bin/semver.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/semver.cmd
generated
vendored
7
node_modules/.bin/semver.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\semver\bin\semver.js" %*
|
|
||||||
)
|
|
15
node_modules/.bin/uuid
generated
vendored
15
node_modules/.bin/uuid
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../uuid/bin/uuid" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
7
node_modules/.bin/uuid.cmd
generated
vendored
7
node_modules/.bin/uuid.cmd
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\uuid\bin\uuid" %*
|
|
||||||
)
|
|
7
node_modules/@actions/core/LICENSE.md
generated
vendored
7
node_modules/@actions/core/LICENSE.md
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
97
node_modules/@actions/core/README.md
generated
vendored
97
node_modules/@actions/core/README.md
generated
vendored
@ -1,97 +0,0 @@
|
|||||||
# `@actions/core`
|
|
||||||
|
|
||||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
#### Inputs/Outputs
|
|
||||||
|
|
||||||
You can use this library to get inputs or set outputs:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
const myInput = core.getInput('inputName', { required: true });
|
|
||||||
|
|
||||||
// Do stuff
|
|
||||||
|
|
||||||
core.setOutput('outputKey', 'outputVal');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Exporting variables
|
|
||||||
|
|
||||||
You can also export variables for future steps. Variables get set in the environment.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
// Do stuff
|
|
||||||
|
|
||||||
core.exportVariable('envVar', 'Val');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### PATH Manipulation
|
|
||||||
|
|
||||||
You can explicitly add items to the path for all remaining steps in a workflow:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
core.addPath('pathToTool');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Exit codes
|
|
||||||
|
|
||||||
You should use this library to set the failing exit code for your action:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Do stuff
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// setFailed logs the message and sets a failing exit code
|
|
||||||
core.setFailed(`Action failed with error ${err}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Logging
|
|
||||||
|
|
||||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
const myInput = core.getInput('input');
|
|
||||||
try {
|
|
||||||
core.debug('Inside try block');
|
|
||||||
|
|
||||||
if (!myInput) {
|
|
||||||
core.warning('myInput was not set');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do stuff
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
core.error(`Error ${err}, action may still succeed though`);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This library can also wrap chunks of output in foldable groups.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core')
|
|
||||||
|
|
||||||
// Manually wrap output
|
|
||||||
core.startGroup('Do some function')
|
|
||||||
doSomeFunction()
|
|
||||||
core.endGroup()
|
|
||||||
|
|
||||||
// Wrap an asynchronous function call
|
|
||||||
const result = await core.group('Do something async', async () => {
|
|
||||||
const response = await doSomeHTTPRequest()
|
|
||||||
return response
|
|
||||||
})
|
|
||||||
```
|
|
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@ -1,16 +0,0 @@
|
|||||||
interface CommandProperties {
|
|
||||||
[key: string]: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Commands
|
|
||||||
*
|
|
||||||
* Command Format:
|
|
||||||
* ##[name key=value;key=value]message
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* ##[warning]This is the user warning message
|
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
|
||||||
*/
|
|
||||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
|
||||||
export declare function issue(name: string, message?: string): void;
|
|
||||||
export {};
|
|
66
node_modules/@actions/core/lib/command.js
generated
vendored
66
node_modules/@actions/core/lib/command.js
generated
vendored
@ -1,66 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const os = require("os");
|
|
||||||
/**
|
|
||||||
* Commands
|
|
||||||
*
|
|
||||||
* Command Format:
|
|
||||||
* ##[name key=value;key=value]message
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* ##[warning]This is the user warning message
|
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
|
||||||
*/
|
|
||||||
function issueCommand(command, properties, message) {
|
|
||||||
const cmd = new Command(command, properties, message);
|
|
||||||
process.stdout.write(cmd.toString() + os.EOL);
|
|
||||||
}
|
|
||||||
exports.issueCommand = issueCommand;
|
|
||||||
function issue(name, message = '') {
|
|
||||||
issueCommand(name, {}, message);
|
|
||||||
}
|
|
||||||
exports.issue = issue;
|
|
||||||
const CMD_PREFIX = '##[';
|
|
||||||
class Command {
|
|
||||||
constructor(command, properties, message) {
|
|
||||||
if (!command) {
|
|
||||||
command = 'missing.command';
|
|
||||||
}
|
|
||||||
this.command = command;
|
|
||||||
this.properties = properties;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
let cmdStr = CMD_PREFIX + this.command;
|
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
|
||||||
cmdStr += ' ';
|
|
||||||
for (const key in this.properties) {
|
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
|
||||||
const val = this.properties[key];
|
|
||||||
if (val) {
|
|
||||||
// safely append the val - avoid blowing up when attempting to
|
|
||||||
// call .replace() if message is not a string for some reason
|
|
||||||
cmdStr += `${key}=${escape(`${val || ''}`)};`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cmdStr += ']';
|
|
||||||
// safely append the message - avoid blowing up when attempting to
|
|
||||||
// call .replace() if message is not a string for some reason
|
|
||||||
const message = `${this.message || ''}`;
|
|
||||||
cmdStr += escapeData(message);
|
|
||||||
return cmdStr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function escapeData(s) {
|
|
||||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
|
||||||
}
|
|
||||||
function escape(s) {
|
|
||||||
return s
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A')
|
|
||||||
.replace(/]/g, '%5D')
|
|
||||||
.replace(/;/g, '%3B');
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=command.js.map
|
|
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,KAAK,CAAA;AAExB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,8DAA8D;wBAC9D,6DAA6D;wBAC7D,MAAM,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAA;qBAC9C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,CAAA;QAEb,kEAAkE;QAClE,6DAA6D;QAC7D,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,CAAA;QACvC,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,CAAA;QAE7B,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,CAAC;SACL,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
|
94
node_modules/@actions/core/lib/core.d.ts
generated
vendored
94
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@ -1,94 +0,0 @@
|
|||||||
/**
|
|
||||||
* Interface for getInput options
|
|
||||||
*/
|
|
||||||
export interface InputOptions {
|
|
||||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
|
||||||
required?: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
export declare enum ExitCode {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
Success = 0,
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
Failure = 1
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* sets env variable for this action and future actions in the job
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val the value of the variable
|
|
||||||
*/
|
|
||||||
export declare function exportVariable(name: string, val: string): void;
|
|
||||||
/**
|
|
||||||
* exports the variable and registers a secret which will get masked from logs
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val value of the secret
|
|
||||||
*/
|
|
||||||
export declare function exportSecret(name: string, val: string): void;
|
|
||||||
/**
|
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
|
||||||
* @param inputPath
|
|
||||||
*/
|
|
||||||
export declare function addPath(inputPath: string): void;
|
|
||||||
/**
|
|
||||||
* Gets the value of an input. The value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
export declare function getInput(name: string, options?: InputOptions): string;
|
|
||||||
/**
|
|
||||||
* Sets the value of an output.
|
|
||||||
*
|
|
||||||
* @param name name of the output to set
|
|
||||||
* @param value value to store
|
|
||||||
*/
|
|
||||||
export declare function setOutput(name: string, value: string): void;
|
|
||||||
/**
|
|
||||||
* Sets the action status to failed.
|
|
||||||
* When the action exits it will be with an exit code of 1
|
|
||||||
* @param message add error issue message
|
|
||||||
*/
|
|
||||||
export declare function setFailed(message: string): void;
|
|
||||||
/**
|
|
||||||
* Writes debug message to user log
|
|
||||||
* @param message debug message
|
|
||||||
*/
|
|
||||||
export declare function debug(message: string): void;
|
|
||||||
/**
|
|
||||||
* Adds an error issue
|
|
||||||
* @param message error issue message
|
|
||||||
*/
|
|
||||||
export declare function error(message: string): void;
|
|
||||||
/**
|
|
||||||
* Adds an warning issue
|
|
||||||
* @param message warning issue message
|
|
||||||
*/
|
|
||||||
export declare function warning(message: string): void;
|
|
||||||
/**
|
|
||||||
* Begin an output group.
|
|
||||||
*
|
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
|
||||||
*
|
|
||||||
* @param name The name of the output group
|
|
||||||
*/
|
|
||||||
export declare function startGroup(name: string): void;
|
|
||||||
/**
|
|
||||||
* End an output group.
|
|
||||||
*/
|
|
||||||
export declare function endGroup(): void;
|
|
||||||
/**
|
|
||||||
* Wrap an asynchronous function call in a group.
|
|
||||||
*
|
|
||||||
* Returns the same type as the function itself.
|
|
||||||
*
|
|
||||||
* @param name The name of the group
|
|
||||||
* @param fn The function to wrap in the group
|
|
||||||
*/
|
|
||||||
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
168
node_modules/@actions/core/lib/core.js
generated
vendored
168
node_modules/@actions/core/lib/core.js
generated
vendored
@ -1,168 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const command_1 = require("./command");
|
|
||||||
const path = require("path");
|
|
||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
var ExitCode;
|
|
||||||
(function (ExitCode) {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
|
||||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Variables
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* sets env variable for this action and future actions in the job
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val the value of the variable
|
|
||||||
*/
|
|
||||||
function exportVariable(name, val) {
|
|
||||||
process.env[name] = val;
|
|
||||||
command_1.issueCommand('set-env', { name }, val);
|
|
||||||
}
|
|
||||||
exports.exportVariable = exportVariable;
|
|
||||||
/**
|
|
||||||
* exports the variable and registers a secret which will get masked from logs
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val value of the secret
|
|
||||||
*/
|
|
||||||
function exportSecret(name, val) {
|
|
||||||
exportVariable(name, val);
|
|
||||||
// the runner will error with not implemented
|
|
||||||
// leaving the function but raising the error earlier
|
|
||||||
command_1.issueCommand('set-secret', {}, val);
|
|
||||||
throw new Error('Not implemented.');
|
|
||||||
}
|
|
||||||
exports.exportSecret = exportSecret;
|
|
||||||
/**
|
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
|
||||||
* @param inputPath
|
|
||||||
*/
|
|
||||||
function addPath(inputPath) {
|
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
|
||||||
}
|
|
||||||
exports.addPath = addPath;
|
|
||||||
/**
|
|
||||||
* Gets the value of an input. The value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
function getInput(name, options) {
|
|
||||||
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
|
|
||||||
if (options && options.required && !val) {
|
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
|
||||||
}
|
|
||||||
return val.trim();
|
|
||||||
}
|
|
||||||
exports.getInput = getInput;
|
|
||||||
/**
|
|
||||||
* Sets the value of an output.
|
|
||||||
*
|
|
||||||
* @param name name of the output to set
|
|
||||||
* @param value value to store
|
|
||||||
*/
|
|
||||||
function setOutput(name, value) {
|
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
|
||||||
}
|
|
||||||
exports.setOutput = setOutput;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Results
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Sets the action status to failed.
|
|
||||||
* When the action exits it will be with an exit code of 1
|
|
||||||
* @param message add error issue message
|
|
||||||
*/
|
|
||||||
function setFailed(message) {
|
|
||||||
process.exitCode = ExitCode.Failure;
|
|
||||||
error(message);
|
|
||||||
}
|
|
||||||
exports.setFailed = setFailed;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Logging Commands
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Writes debug message to user log
|
|
||||||
* @param message debug message
|
|
||||||
*/
|
|
||||||
function debug(message) {
|
|
||||||
command_1.issueCommand('debug', {}, message);
|
|
||||||
}
|
|
||||||
exports.debug = debug;
|
|
||||||
/**
|
|
||||||
* Adds an error issue
|
|
||||||
* @param message error issue message
|
|
||||||
*/
|
|
||||||
function error(message) {
|
|
||||||
command_1.issue('error', message);
|
|
||||||
}
|
|
||||||
exports.error = error;
|
|
||||||
/**
|
|
||||||
* Adds an warning issue
|
|
||||||
* @param message warning issue message
|
|
||||||
*/
|
|
||||||
function warning(message) {
|
|
||||||
command_1.issue('warning', message);
|
|
||||||
}
|
|
||||||
exports.warning = warning;
|
|
||||||
/**
|
|
||||||
* Begin an output group.
|
|
||||||
*
|
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
|
||||||
*
|
|
||||||
* @param name The name of the output group
|
|
||||||
*/
|
|
||||||
function startGroup(name) {
|
|
||||||
command_1.issue('group', name);
|
|
||||||
}
|
|
||||||
exports.startGroup = startGroup;
|
|
||||||
/**
|
|
||||||
* End an output group.
|
|
||||||
*/
|
|
||||||
function endGroup() {
|
|
||||||
command_1.issue('endgroup');
|
|
||||||
}
|
|
||||||
exports.endGroup = endGroup;
|
|
||||||
/**
|
|
||||||
* Wrap an asynchronous function call in a group.
|
|
||||||
*
|
|
||||||
* Returns the same type as the function itself.
|
|
||||||
*
|
|
||||||
* @param name The name of the group
|
|
||||||
* @param fn The function to wrap in the group
|
|
||||||
*/
|
|
||||||
function group(name, fn) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
startGroup(name);
|
|
||||||
let result;
|
|
||||||
try {
|
|
||||||
result = yield fn();
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
endGroup();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.group = group;
|
|
||||||
//# sourceMappingURL=core.js.map
|
|
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAEzB,6CAA6C;IAC7C,qDAAqD;IACrD,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;AACrC,CAAC;AAPD,oCAOC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACpE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC"}
|
|
68
node_modules/@actions/core/package.json
generated
vendored
68
node_modules/@actions/core/package.json
generated
vendored
@ -1,68 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"@actions/core@1.1.0",
|
|
||||||
"E:\\python\\setup-php"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "@actions/core@1.1.0",
|
|
||||||
"_id": "@actions/core@1.1.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-KKpo3xzo0Zsikni9tbOsEQkxZBGDsYSJZNkTvmo0gPSXrc98TBOcdTvKwwjitjkjHkreTggWdB1ACiAFVgsuzA==",
|
|
||||||
"_location": "/@actions/core",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@actions/core@1.1.0",
|
|
||||||
"name": "@actions/core",
|
|
||||||
"escapedName": "@actions%2fcore",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "1.1.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.1.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/",
|
|
||||||
"/@actions/tool-cache"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.0.tgz",
|
|
||||||
"_spec": "1.1.0",
|
|
||||||
"_where": "E:\\python\\setup-php",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"description": "Actions core lib",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^12.0.2"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
|
||||||
"keywords": [
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"core"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/core.js",
|
|
||||||
"name": "@actions/core",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"version": "1.1.0"
|
|
||||||
}
|
|
7
node_modules/@actions/exec/LICENSE.md
generated
vendored
7
node_modules/@actions/exec/LICENSE.md
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
60
node_modules/@actions/exec/README.md
generated
vendored
60
node_modules/@actions/exec/README.md
generated
vendored
@ -1,60 +0,0 @@
|
|||||||
# `@actions/exec`
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
#### Basic
|
|
||||||
|
|
||||||
You can use this package to execute your tools on the command line in a cross platform way:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
|
|
||||||
await exec.exec('node index.js');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Args
|
|
||||||
|
|
||||||
You can also pass in arg arrays:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
|
|
||||||
await exec.exec('node', ['index.js', 'foo=bar']);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Output/options
|
|
||||||
|
|
||||||
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
|
|
||||||
let myOutput = '';
|
|
||||||
let myError = '';
|
|
||||||
|
|
||||||
const options = {};
|
|
||||||
options.listeners = {
|
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
myOutput += data.toString();
|
|
||||||
},
|
|
||||||
stderr: (data: Buffer) => {
|
|
||||||
myError += data.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
options.cwd = './lib';
|
|
||||||
|
|
||||||
await exec.exec('node', ['index.js', 'foo=bar'], options);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Exec tools not in the PATH
|
|
||||||
|
|
||||||
You can use it in conjunction with the `which` function from `@actions/io` to execute tools that are not in the PATH:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
const io = require('@actions/io');
|
|
||||||
|
|
||||||
const pythonPath: string = await io.which('python', true)
|
|
||||||
|
|
||||||
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
|
||||||
```
|
|
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
@ -1,12 +0,0 @@
|
|||||||
import * as im from './interfaces';
|
|
||||||
/**
|
|
||||||
* Exec a command.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns Promise<number> exit code
|
|
||||||
*/
|
|
||||||
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
|
37
node_modules/@actions/exec/lib/exec.js
generated
vendored
37
node_modules/@actions/exec/lib/exec.js
generated
vendored
@ -1,37 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const tr = require("./toolrunner");
|
|
||||||
/**
|
|
||||||
* Exec a command.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns Promise<number> exit code
|
|
||||||
*/
|
|
||||||
function exec(commandLine, args, options) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const commandArgs = tr.argStringToArray(commandLine);
|
|
||||||
if (commandArgs.length === 0) {
|
|
||||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
|
||||||
}
|
|
||||||
// Path to tool to execute should be first arg
|
|
||||||
const toolPath = commandArgs[0];
|
|
||||||
args = commandArgs.slice(1).concat(args || []);
|
|
||||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
|
||||||
return runner.exec();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.exec = exec;
|
|
||||||
//# sourceMappingURL=exec.js.map
|
|
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,mCAAkC;AAElC;;;;;;;;;GASG;AACH,SAAsB,IAAI,CACxB,WAAmB,EACnB,IAAe,EACf,OAAwB;;QAExB,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACpE;QACD,8CAA8C;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CAAA;AAdD,oBAcC"}
|
|
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
@ -1,35 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import * as stream from 'stream';
|
|
||||||
/**
|
|
||||||
* Interface for exec options
|
|
||||||
*/
|
|
||||||
export interface ExecOptions {
|
|
||||||
/** optional working directory. defaults to current */
|
|
||||||
cwd?: string;
|
|
||||||
/** optional envvar dictionary. defaults to current process's env */
|
|
||||||
env?: {
|
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
/** optional. defaults to false */
|
|
||||||
silent?: boolean;
|
|
||||||
/** optional out stream to use. Defaults to process.stdout */
|
|
||||||
outStream?: stream.Writable;
|
|
||||||
/** optional err stream to use. Defaults to process.stderr */
|
|
||||||
errStream?: stream.Writable;
|
|
||||||
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
|
||||||
windowsVerbatimArguments?: boolean;
|
|
||||||
/** optional. whether to fail if output to stderr. defaults to false */
|
|
||||||
failOnStdErr?: boolean;
|
|
||||||
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
|
||||||
ignoreReturnCode?: boolean;
|
|
||||||
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
|
||||||
delay?: number;
|
|
||||||
/** optional. Listeners for output. Callback functions that will be called on these events */
|
|
||||||
listeners?: {
|
|
||||||
stdout?: (data: Buffer) => void;
|
|
||||||
stderr?: (data: Buffer) => void;
|
|
||||||
stdline?: (data: string) => void;
|
|
||||||
errline?: (data: string) => void;
|
|
||||||
debug?: (data: string) => void;
|
|
||||||
};
|
|
||||||
}
|
|
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
//# sourceMappingURL=interfaces.js.map
|
|
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
|
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
@ -1,37 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import * as events from 'events';
|
|
||||||
import * as im from './interfaces';
|
|
||||||
export declare class ToolRunner extends events.EventEmitter {
|
|
||||||
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
|
||||||
private toolPath;
|
|
||||||
private args;
|
|
||||||
private options;
|
|
||||||
private _debug;
|
|
||||||
private _getCommandString;
|
|
||||||
private _processLineBuffer;
|
|
||||||
private _getSpawnFileName;
|
|
||||||
private _getSpawnArgs;
|
|
||||||
private _endsWith;
|
|
||||||
private _isCmdFile;
|
|
||||||
private _windowsQuoteCmdArg;
|
|
||||||
private _uvQuoteCmdArg;
|
|
||||||
private _cloneExecOptions;
|
|
||||||
private _getSpawnOptions;
|
|
||||||
/**
|
|
||||||
* Exec a tool.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param tool path to tool to exec
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns number
|
|
||||||
*/
|
|
||||||
exec(): Promise<number>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Convert an arg string to an array of args. Handles escaping
|
|
||||||
*
|
|
||||||
* @param argString string of arguments
|
|
||||||
* @returns string[] array of arguments
|
|
||||||
*/
|
|
||||||
export declare function argStringToArray(argString: string): string[];
|
|
574
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
574
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
@ -1,574 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const os = require("os");
|
|
||||||
const events = require("events");
|
|
||||||
const child = require("child_process");
|
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
/*
|
|
||||||
* Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
|
|
||||||
*/
|
|
||||||
class ToolRunner extends events.EventEmitter {
|
|
||||||
constructor(toolPath, args, options) {
|
|
||||||
super();
|
|
||||||
if (!toolPath) {
|
|
||||||
throw new Error("Parameter 'toolPath' cannot be null or empty.");
|
|
||||||
}
|
|
||||||
this.toolPath = toolPath;
|
|
||||||
this.args = args || [];
|
|
||||||
this.options = options || {};
|
|
||||||
}
|
|
||||||
_debug(message) {
|
|
||||||
if (this.options.listeners && this.options.listeners.debug) {
|
|
||||||
this.options.listeners.debug(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_getCommandString(options, noPrefix) {
|
|
||||||
const toolPath = this._getSpawnFileName();
|
|
||||||
const args = this._getSpawnArgs(options);
|
|
||||||
let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
// Windows + cmd file
|
|
||||||
if (this._isCmdFile()) {
|
|
||||||
cmd += toolPath;
|
|
||||||
for (const a of args) {
|
|
||||||
cmd += ` ${a}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Windows + verbatim
|
|
||||||
else if (options.windowsVerbatimArguments) {
|
|
||||||
cmd += `"${toolPath}"`;
|
|
||||||
for (const a of args) {
|
|
||||||
cmd += ` ${a}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Windows (regular)
|
|
||||||
else {
|
|
||||||
cmd += this._windowsQuoteCmdArg(toolPath);
|
|
||||||
for (const a of args) {
|
|
||||||
cmd += ` ${this._windowsQuoteCmdArg(a)}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// OSX/Linux - this can likely be improved with some form of quoting.
|
|
||||||
// creating processes on Unix is fundamentally different than Windows.
|
|
||||||
// on Unix, execvp() takes an arg array.
|
|
||||||
cmd += toolPath;
|
|
||||||
for (const a of args) {
|
|
||||||
cmd += ` ${a}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cmd;
|
|
||||||
}
|
|
||||||
_processLineBuffer(data, strBuffer, onLine) {
|
|
||||||
try {
|
|
||||||
let s = strBuffer + data.toString();
|
|
||||||
let n = s.indexOf(os.EOL);
|
|
||||||
while (n > -1) {
|
|
||||||
const line = s.substring(0, n);
|
|
||||||
onLine(line);
|
|
||||||
// the rest of the string ...
|
|
||||||
s = s.substring(n + os.EOL.length);
|
|
||||||
n = s.indexOf(os.EOL);
|
|
||||||
}
|
|
||||||
strBuffer = s;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// streaming lines to console is best effort. Don't fail a build.
|
|
||||||
this._debug(`error processing line. Failed with error ${err}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_getSpawnFileName() {
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
if (this._isCmdFile()) {
|
|
||||||
return process.env['COMSPEC'] || 'cmd.exe';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.toolPath;
|
|
||||||
}
|
|
||||||
_getSpawnArgs(options) {
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
if (this._isCmdFile()) {
|
|
||||||
let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
|
|
||||||
for (const a of this.args) {
|
|
||||||
argline += ' ';
|
|
||||||
argline += options.windowsVerbatimArguments
|
|
||||||
? a
|
|
||||||
: this._windowsQuoteCmdArg(a);
|
|
||||||
}
|
|
||||||
argline += '"';
|
|
||||||
return [argline];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.args;
|
|
||||||
}
|
|
||||||
_endsWith(str, end) {
|
|
||||||
return str.endsWith(end);
|
|
||||||
}
|
|
||||||
_isCmdFile() {
|
|
||||||
const upperToolPath = this.toolPath.toUpperCase();
|
|
||||||
return (this._endsWith(upperToolPath, '.CMD') ||
|
|
||||||
this._endsWith(upperToolPath, '.BAT'));
|
|
||||||
}
|
|
||||||
_windowsQuoteCmdArg(arg) {
|
|
||||||
// for .exe, apply the normal quoting rules that libuv applies
|
|
||||||
if (!this._isCmdFile()) {
|
|
||||||
return this._uvQuoteCmdArg(arg);
|
|
||||||
}
|
|
||||||
// otherwise apply quoting rules specific to the cmd.exe command line parser.
|
|
||||||
// the libuv rules are generic and are not designed specifically for cmd.exe
|
|
||||||
// command line parser.
|
|
||||||
//
|
|
||||||
// for a detailed description of the cmd.exe command line parser, refer to
|
|
||||||
// http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
|
|
||||||
// need quotes for empty arg
|
|
||||||
if (!arg) {
|
|
||||||
return '""';
|
|
||||||
}
|
|
||||||
// determine whether the arg needs to be quoted
|
|
||||||
const cmdSpecialChars = [
|
|
||||||
' ',
|
|
||||||
'\t',
|
|
||||||
'&',
|
|
||||||
'(',
|
|
||||||
')',
|
|
||||||
'[',
|
|
||||||
']',
|
|
||||||
'{',
|
|
||||||
'}',
|
|
||||||
'^',
|
|
||||||
'=',
|
|
||||||
';',
|
|
||||||
'!',
|
|
||||||
"'",
|
|
||||||
'+',
|
|
||||||
',',
|
|
||||||
'`',
|
|
||||||
'~',
|
|
||||||
'|',
|
|
||||||
'<',
|
|
||||||
'>',
|
|
||||||
'"'
|
|
||||||
];
|
|
||||||
let needsQuotes = false;
|
|
||||||
for (const char of arg) {
|
|
||||||
if (cmdSpecialChars.some(x => x === char)) {
|
|
||||||
needsQuotes = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// short-circuit if quotes not needed
|
|
||||||
if (!needsQuotes) {
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
// the following quoting rules are very similar to the rules that by libuv applies.
|
|
||||||
//
|
|
||||||
// 1) wrap the string in quotes
|
|
||||||
//
|
|
||||||
// 2) double-up quotes - i.e. " => ""
|
|
||||||
//
|
|
||||||
// this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
|
|
||||||
// doesn't work well with a cmd.exe command line.
|
|
||||||
//
|
|
||||||
// note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
|
|
||||||
// for example, the command line:
|
|
||||||
// foo.exe "myarg:""my val"""
|
|
||||||
// is parsed by a .NET console app into an arg array:
|
|
||||||
// [ "myarg:\"my val\"" ]
|
|
||||||
// which is the same end result when applying libuv quoting rules. although the actual
|
|
||||||
// command line from libuv quoting rules would look like:
|
|
||||||
// foo.exe "myarg:\"my val\""
|
|
||||||
//
|
|
||||||
// 3) double-up slashes that precede a quote,
|
|
||||||
// e.g. hello \world => "hello \world"
|
|
||||||
// hello\"world => "hello\\""world"
|
|
||||||
// hello\\"world => "hello\\\\""world"
|
|
||||||
// hello world\ => "hello world\\"
|
|
||||||
//
|
|
||||||
// technically this is not required for a cmd.exe command line, or the batch argument parser.
|
|
||||||
// the reasons for including this as a .cmd quoting rule are:
|
|
||||||
//
|
|
||||||
// a) this is optimized for the scenario where the argument is passed from the .cmd file to an
|
|
||||||
// external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
|
|
||||||
//
|
|
||||||
// b) it's what we've been doing previously (by deferring to node default behavior) and we
|
|
||||||
// haven't heard any complaints about that aspect.
|
|
||||||
//
|
|
||||||
// note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
|
|
||||||
// escaped when used on the command line directly - even though within a .cmd file % can be escaped
|
|
||||||
// by using %%.
|
|
||||||
//
|
|
||||||
// the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
|
|
||||||
// the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
|
|
||||||
//
|
|
||||||
// one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
|
|
||||||
// often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
|
|
||||||
// variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
|
|
||||||
// to an external program.
|
|
||||||
//
|
|
||||||
// an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
|
|
||||||
// % can be escaped within a .cmd file.
|
|
||||||
let reverse = '"';
|
|
||||||
let quoteHit = true;
|
|
||||||
for (let i = arg.length; i > 0; i--) {
|
|
||||||
// walk the string in reverse
|
|
||||||
reverse += arg[i - 1];
|
|
||||||
if (quoteHit && arg[i - 1] === '\\') {
|
|
||||||
reverse += '\\'; // double the slash
|
|
||||||
}
|
|
||||||
else if (arg[i - 1] === '"') {
|
|
||||||
quoteHit = true;
|
|
||||||
reverse += '"'; // double the quote
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
quoteHit = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reverse += '"';
|
|
||||||
return reverse
|
|
||||||
.split('')
|
|
||||||
.reverse()
|
|
||||||
.join('');
|
|
||||||
}
|
|
||||||
_uvQuoteCmdArg(arg) {
|
|
||||||
// Tool runner wraps child_process.spawn() and needs to apply the same quoting as
|
|
||||||
// Node in certain cases where the undocumented spawn option windowsVerbatimArguments
|
|
||||||
// is used.
|
|
||||||
//
|
|
||||||
// Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
|
|
||||||
// see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
|
|
||||||
// pasting copyright notice from Node within this function:
|
|
||||||
//
|
|
||||||
// Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to
|
|
||||||
// deal in the Software without restriction, including without limitation the
|
|
||||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
||||||
// sell copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
||||||
// IN THE SOFTWARE.
|
|
||||||
if (!arg) {
|
|
||||||
// Need double quotation for empty argument
|
|
||||||
return '""';
|
|
||||||
}
|
|
||||||
if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
|
|
||||||
// No quotation needed
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
if (!arg.includes('"') && !arg.includes('\\')) {
|
|
||||||
// No embedded double quotes or backslashes, so I can just wrap
|
|
||||||
// quote marks around the whole thing.
|
|
||||||
return `"${arg}"`;
|
|
||||||
}
|
|
||||||
// Expected input/output:
|
|
||||||
// input : hello"world
|
|
||||||
// output: "hello\"world"
|
|
||||||
// input : hello""world
|
|
||||||
// output: "hello\"\"world"
|
|
||||||
// input : hello\world
|
|
||||||
// output: hello\world
|
|
||||||
// input : hello\\world
|
|
||||||
// output: hello\\world
|
|
||||||
// input : hello\"world
|
|
||||||
// output: "hello\\\"world"
|
|
||||||
// input : hello\\"world
|
|
||||||
// output: "hello\\\\\"world"
|
|
||||||
// input : hello world\
|
|
||||||
// output: "hello world\\" - note the comment in libuv actually reads "hello world\"
|
|
||||||
// but it appears the comment is wrong, it should be "hello world\\"
|
|
||||||
let reverse = '"';
|
|
||||||
let quoteHit = true;
|
|
||||||
for (let i = arg.length; i > 0; i--) {
|
|
||||||
// walk the string in reverse
|
|
||||||
reverse += arg[i - 1];
|
|
||||||
if (quoteHit && arg[i - 1] === '\\') {
|
|
||||||
reverse += '\\';
|
|
||||||
}
|
|
||||||
else if (arg[i - 1] === '"') {
|
|
||||||
quoteHit = true;
|
|
||||||
reverse += '\\';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
quoteHit = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reverse += '"';
|
|
||||||
return reverse
|
|
||||||
.split('')
|
|
||||||
.reverse()
|
|
||||||
.join('');
|
|
||||||
}
|
|
||||||
_cloneExecOptions(options) {
|
|
||||||
options = options || {};
|
|
||||||
const result = {
|
|
||||||
cwd: options.cwd || process.cwd(),
|
|
||||||
env: options.env || process.env,
|
|
||||||
silent: options.silent || false,
|
|
||||||
windowsVerbatimArguments: options.windowsVerbatimArguments || false,
|
|
||||||
failOnStdErr: options.failOnStdErr || false,
|
|
||||||
ignoreReturnCode: options.ignoreReturnCode || false,
|
|
||||||
delay: options.delay || 10000
|
|
||||||
};
|
|
||||||
result.outStream = options.outStream || process.stdout;
|
|
||||||
result.errStream = options.errStream || process.stderr;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
_getSpawnOptions(options, toolPath) {
|
|
||||||
options = options || {};
|
|
||||||
const result = {};
|
|
||||||
result.cwd = options.cwd;
|
|
||||||
result.env = options.env;
|
|
||||||
result['windowsVerbatimArguments'] =
|
|
||||||
options.windowsVerbatimArguments || this._isCmdFile();
|
|
||||||
if (options.windowsVerbatimArguments) {
|
|
||||||
result.argv0 = `"${toolPath}"`;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Exec a tool.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param tool path to tool to exec
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns number
|
|
||||||
*/
|
|
||||||
exec() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this._debug(`exec tool: ${this.toolPath}`);
|
|
||||||
this._debug('arguments:');
|
|
||||||
for (const arg of this.args) {
|
|
||||||
this._debug(` ${arg}`);
|
|
||||||
}
|
|
||||||
const optionsNonNull = this._cloneExecOptions(this.options);
|
|
||||||
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
|
||||||
optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
|
|
||||||
}
|
|
||||||
const state = new ExecState(optionsNonNull, this.toolPath);
|
|
||||||
state.on('debug', (message) => {
|
|
||||||
this._debug(message);
|
|
||||||
});
|
|
||||||
const fileName = this._getSpawnFileName();
|
|
||||||
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
|
|
||||||
const stdbuffer = '';
|
|
||||||
if (cp.stdout) {
|
|
||||||
cp.stdout.on('data', (data) => {
|
|
||||||
if (this.options.listeners && this.options.listeners.stdout) {
|
|
||||||
this.options.listeners.stdout(data);
|
|
||||||
}
|
|
||||||
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
|
||||||
optionsNonNull.outStream.write(data);
|
|
||||||
}
|
|
||||||
this._processLineBuffer(data, stdbuffer, (line) => {
|
|
||||||
if (this.options.listeners && this.options.listeners.stdline) {
|
|
||||||
this.options.listeners.stdline(line);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const errbuffer = '';
|
|
||||||
if (cp.stderr) {
|
|
||||||
cp.stderr.on('data', (data) => {
|
|
||||||
state.processStderr = true;
|
|
||||||
if (this.options.listeners && this.options.listeners.stderr) {
|
|
||||||
this.options.listeners.stderr(data);
|
|
||||||
}
|
|
||||||
if (!optionsNonNull.silent &&
|
|
||||||
optionsNonNull.errStream &&
|
|
||||||
optionsNonNull.outStream) {
|
|
||||||
const s = optionsNonNull.failOnStdErr
|
|
||||||
? optionsNonNull.errStream
|
|
||||||
: optionsNonNull.outStream;
|
|
||||||
s.write(data);
|
|
||||||
}
|
|
||||||
this._processLineBuffer(data, errbuffer, (line) => {
|
|
||||||
if (this.options.listeners && this.options.listeners.errline) {
|
|
||||||
this.options.listeners.errline(line);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
cp.on('error', (err) => {
|
|
||||||
state.processError = err.message;
|
|
||||||
state.processExited = true;
|
|
||||||
state.processClosed = true;
|
|
||||||
state.CheckComplete();
|
|
||||||
});
|
|
||||||
cp.on('exit', (code) => {
|
|
||||||
state.processExitCode = code;
|
|
||||||
state.processExited = true;
|
|
||||||
this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
|
|
||||||
state.CheckComplete();
|
|
||||||
});
|
|
||||||
cp.on('close', (code) => {
|
|
||||||
state.processExitCode = code;
|
|
||||||
state.processExited = true;
|
|
||||||
state.processClosed = true;
|
|
||||||
this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
|
|
||||||
state.CheckComplete();
|
|
||||||
});
|
|
||||||
state.on('done', (error, exitCode) => {
|
|
||||||
if (stdbuffer.length > 0) {
|
|
||||||
this.emit('stdline', stdbuffer);
|
|
||||||
}
|
|
||||||
if (errbuffer.length > 0) {
|
|
||||||
this.emit('errline', errbuffer);
|
|
||||||
}
|
|
||||||
cp.removeAllListeners();
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolve(exitCode);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.ToolRunner = ToolRunner;
|
|
||||||
/**
|
|
||||||
* Convert an arg string to an array of args. Handles escaping
|
|
||||||
*
|
|
||||||
* @param argString string of arguments
|
|
||||||
* @returns string[] array of arguments
|
|
||||||
*/
|
|
||||||
function argStringToArray(argString) {
|
|
||||||
const args = [];
|
|
||||||
let inQuotes = false;
|
|
||||||
let escaped = false;
|
|
||||||
let arg = '';
|
|
||||||
function append(c) {
|
|
||||||
// we only escape double quotes.
|
|
||||||
if (escaped && c !== '"') {
|
|
||||||
arg += '\\';
|
|
||||||
}
|
|
||||||
arg += c;
|
|
||||||
escaped = false;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < argString.length; i++) {
|
|
||||||
const c = argString.charAt(i);
|
|
||||||
if (c === '"') {
|
|
||||||
if (!escaped) {
|
|
||||||
inQuotes = !inQuotes;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
append(c);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c === '\\' && escaped) {
|
|
||||||
append(c);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c === '\\' && inQuotes) {
|
|
||||||
escaped = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c === ' ' && !inQuotes) {
|
|
||||||
if (arg.length > 0) {
|
|
||||||
args.push(arg);
|
|
||||||
arg = '';
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
append(c);
|
|
||||||
}
|
|
||||||
if (arg.length > 0) {
|
|
||||||
args.push(arg.trim());
|
|
||||||
}
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
exports.argStringToArray = argStringToArray;
|
|
||||||
class ExecState extends events.EventEmitter {
|
|
||||||
constructor(options, toolPath) {
|
|
||||||
super();
|
|
||||||
this.processClosed = false; // tracks whether the process has exited and stdio is closed
|
|
||||||
this.processError = '';
|
|
||||||
this.processExitCode = 0;
|
|
||||||
this.processExited = false; // tracks whether the process has exited
|
|
||||||
this.processStderr = false; // tracks whether stderr was written to
|
|
||||||
this.delay = 10000; // 10 seconds
|
|
||||||
this.done = false;
|
|
||||||
this.timeout = null;
|
|
||||||
if (!toolPath) {
|
|
||||||
throw new Error('toolPath must not be empty');
|
|
||||||
}
|
|
||||||
this.options = options;
|
|
||||||
this.toolPath = toolPath;
|
|
||||||
if (options.delay) {
|
|
||||||
this.delay = options.delay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CheckComplete() {
|
|
||||||
if (this.done) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.processClosed) {
|
|
||||||
this._setResult();
|
|
||||||
}
|
|
||||||
else if (this.processExited) {
|
|
||||||
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_debug(message) {
|
|
||||||
this.emit('debug', message);
|
|
||||||
}
|
|
||||||
_setResult() {
|
|
||||||
// determine whether there is an error
|
|
||||||
let error;
|
|
||||||
if (this.processExited) {
|
|
||||||
if (this.processError) {
|
|
||||||
error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
|
|
||||||
}
|
|
||||||
else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
|
|
||||||
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
|
|
||||||
}
|
|
||||||
else if (this.processStderr && this.options.failOnStdErr) {
|
|
||||||
error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// clear the timeout
|
|
||||||
if (this.timeout) {
|
|
||||||
clearTimeout(this.timeout);
|
|
||||||
this.timeout = null;
|
|
||||||
}
|
|
||||||
this.done = true;
|
|
||||||
this.emit('done', error, this.processExitCode);
|
|
||||||
}
|
|
||||||
static HandleTimeout(state) {
|
|
||||||
if (state.done) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!state.processClosed && state.processExited) {
|
|
||||||
const message = `The STDIO streams did not close within ${state.delay /
|
|
||||||
1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
|
|
||||||
state._debug(message);
|
|
||||||
}
|
|
||||||
state._setResult();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=toolrunner.js.map
|
|
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
File diff suppressed because one or more lines are too long
67
node_modules/@actions/exec/package.json
generated
vendored
67
node_modules/@actions/exec/package.json
generated
vendored
@ -1,67 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"@actions/exec@1.0.1",
|
|
||||||
"E:\\python\\setup-php"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "@actions/exec@1.0.1",
|
|
||||||
"_id": "@actions/exec@1.0.1",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ==",
|
|
||||||
"_location": "/@actions/exec",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@actions/exec@1.0.1",
|
|
||||||
"name": "@actions/exec",
|
|
||||||
"escapedName": "@actions%2fexec",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "1.0.1",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.0.1"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/@actions/tool-cache"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.1.tgz",
|
|
||||||
"_spec": "1.0.1",
|
|
||||||
"_where": "E:\\python\\setup-php",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"description": "Actions exec lib",
|
|
||||||
"devDependencies": {
|
|
||||||
"@actions/io": "^1.0.1"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
|
||||||
"keywords": [
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"exec"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/exec.js",
|
|
||||||
"name": "@actions/exec",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"version": "1.0.1"
|
|
||||||
}
|
|
7
node_modules/@actions/io/LICENSE.md
generated
vendored
7
node_modules/@actions/io/LICENSE.md
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
53
node_modules/@actions/io/README.md
generated
vendored
53
node_modules/@actions/io/README.md
generated
vendored
@ -1,53 +0,0 @@
|
|||||||
# `@actions/io`
|
|
||||||
|
|
||||||
> Core functions for cli filesystem scenarios
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
#### mkdir -p
|
|
||||||
|
|
||||||
Recursively make a directory. Follows rules specified in [man mkdir](https://linux.die.net/man/1/mkdir) with the `-p` option specified:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const io = require('@actions/io');
|
|
||||||
|
|
||||||
await io.mkdirP('path/to/make');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### cp/mv
|
|
||||||
|
|
||||||
Copy or move files or folders. Follows rules specified in [man cp](https://linux.die.net/man/1/cp) and [man mv](https://linux.die.net/man/1/mv):
|
|
||||||
|
|
||||||
```js
|
|
||||||
const io = require('@actions/io');
|
|
||||||
|
|
||||||
// Recursive must be true for directories
|
|
||||||
const options = { recursive: true, force: false }
|
|
||||||
|
|
||||||
await io.cp('path/to/directory', 'path/to/dest', options);
|
|
||||||
await io.mv('path/to/file', 'path/to/dest');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### rm -rf
|
|
||||||
|
|
||||||
Remove a file or folder recursively. Follows rules specified in [man rm](https://linux.die.net/man/1/rm) with the `-r` and `-f` rules specified.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const io = require('@actions/io');
|
|
||||||
|
|
||||||
await io.rmRF('path/to/directory');
|
|
||||||
await io.rmRF('path/to/file');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### which
|
|
||||||
|
|
||||||
Get the path to a tool and resolves via paths. Follows the rules specified in [man which](https://linux.die.net/man/1/which).
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
const io = require('@actions/io');
|
|
||||||
|
|
||||||
const pythonPath: string = await io.which('python', true)
|
|
||||||
|
|
||||||
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
|
||||||
```
|
|
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
@ -1,29 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import * as fs from 'fs';
|
|
||||||
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
|
|
||||||
export declare const IS_WINDOWS: boolean;
|
|
||||||
export declare function exists(fsPath: string): Promise<boolean>;
|
|
||||||
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
|
||||||
/**
|
|
||||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
|
||||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
|
||||||
*/
|
|
||||||
export declare function isRooted(p: string): boolean;
|
|
||||||
/**
|
|
||||||
* Recursively create a directory at `fsPath`.
|
|
||||||
*
|
|
||||||
* This implementation is optimistic, meaning it attempts to create the full
|
|
||||||
* path first, and backs up the path stack from there.
|
|
||||||
*
|
|
||||||
* @param fsPath The path to create
|
|
||||||
* @param maxDepth The maximum recursion depth
|
|
||||||
* @param depth The current recursion depth
|
|
||||||
*/
|
|
||||||
export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Best effort attempt to determine whether a file exists and is executable.
|
|
||||||
* @param filePath file path to check
|
|
||||||
* @param extensions additional file extensions to try
|
|
||||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
|
||||||
*/
|
|
||||||
export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user