Compare commits

...

351 Commits
1.5.3 ... 2.4.0

Author SHA1 Message Date
7961bc11b1 Merge pull request #260 from shivammathur/develop
2.4.0
2020-07-21 12:17:40 +05:30
87f807365d Bump version to 2.4.0 2020-07-21 06:29:35 +05:30
25d9bbc737 Update README and licensing information 2020-07-21 06:29:25 +05:30
d2f865c91a Remove phpbrew config 2020-07-20 00:36:06 +05:30
a13373a271 Merge pull request #259 from localheinz/fix/sort
Fix: Keep extensions and options sorted
2020-07-20 00:33:31 +05:30
a764546381 Fix: Keep extensions and options sorted 2020-07-19 20:51:42 +02:00
380b68048b Merge pull request #258 from localheinz/fix/typo
Fix: Typo
2020-07-20 00:15:05 +05:30
4dcf9cd2ab Fix: Typo 2020-07-19 20:41:16 +02:00
f3641e0c33 Merge pull request #257 from localheinz/feature/composer-unused
Enhancement: Add composer-unused/composer-unused as tool
2020-07-19 17:32:23 +05:30
d35633ec7a Merge branch 'develop' into feature/composer-unused 2020-07-19 17:32:00 +05:30
7eea3d82f6 Merge pull request #256 from localheinz/fix/sort
Fix: Keep list of tools sorted
2020-07-19 17:25:22 +05:30
57ecdba082 Fix: Keep list of tools sorted 2020-07-19 13:32:31 +02:00
db03758c66 Enhancement: Add composer-unused/composer-unused as tool 2020-07-19 13:13:08 +02:00
82837572d4 Add ionCube Loader support 2020-07-19 13:53:35 +05:30
8efcf46b31 Add support for oci8 and pdo_oci 2020-07-19 13:53:28 +05:30
4391cf8a4c Fix warning in add_pdo_extension 2020-07-19 13:53:26 +05:30
87a69f94d9 Merge pull request #255 from localheinz/feature/composer-require-checker
Enhancement: Add maglnet/ComposerRequireChecker as tool
2020-07-19 01:26:18 +05:30
c12fad850b Enhancement: Add maglnet/ComposerRequireChecker as tool 2020-07-19 01:26:18 +05:30
47b8d68850 Enhancement: Add ergebnis/composer-normalize as tool 2020-07-18 21:44:21 +05:30
530929f741 Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-18 21:44:19 +05:30
a965723128 Set memory_limit=-1 on Windows and macOS 2020-07-18 06:01:48 +05:30
9845a63f5c Merge pull request #249 from lolautruche/fix-blackfire
Remove sudo for Blackfire config when it's not needed
2020-07-16 02:28:34 +05:30
4af7e96d03 Remove sudo for Blackfire config when it's not needed 2020-07-15 17:01:29 +02:00
13a3d9d0a9 Fix support for pre-release extensions 2020-07-15 06:24:45 +05:30
9d042b2683 Patch OpenSSL binaries for PHP 5.3 and 5.4 on Windows 2020-07-14 06:27:29 +05:30
7a59874419 Improve updating lists 2020-07-12 05:20:08 +05:30
8dee767b82 Install only cli on linux 2020-07-11 23:00:50 +05:30
5fc5a95363 Fix coverage 2020-07-11 18:35:28 +05:30
8ba779d78e Merge pull request #244 from GrahamCampbell/patch-1
Fixed Xdebug version for PHP 5.6 and 7.0
2020-07-11 18:28:59 +05:30
04376074d2 Update extensions.test.ts 2020-07-11 12:57:07 +01:00
262202d43f Fixed xdebug version for PHP 5.6 and 7.0 2020-07-11 12:43:32 +01:00
f64dddeeb4 Show xdebug.mode=coverage log for Xdebug 3.0 2020-07-08 08:01:26 +05:30
1d50c4a8cd Set ini values after coverage setup 2020-07-08 07:45:11 +05:30
d313593fee Bump cache key 2020-07-08 06:44:18 +05:30
5753a00ef5 Improve composer setup 2020-07-08 05:20:52 +05:30
38731c6386 Merge pull request #242 from shivammathur/develop
Remove update_formulae in darwin.sh
2020-07-07 01:05:02 +05:30
9f400a0dfd Update dependencies 2020-07-07 00:52:10 +05:30
ba020e3463 Remove update_formulae in darwin.sh 2020-07-07 00:33:30 +05:30
c0d425d939 Merge pull request #240 from shivammathur/develop
2.3.2
2020-07-04 02:49:52 +05:30
4752a51595 Bump version to 2.3.2 2020-07-04 00:31:45 +05:30
10608f5908 Add ondrej's PPA on focal (actions/virtual-environments#1104) 2020-07-02 21:29:52 +05:30
d01ec214f2 Use shivammathur/extensions tap for grpc, swoole, protobuf on macos 2020-07-01 13:56:05 +05:30
6158538131 Add support for phplint 2020-06-24 04:30:50 +05:30
dd27d4eb81 Merge pull request #235 from shivammathur/develop
2.3.1
2020-06-22 07:33:24 +05:30
248d04f73c Bump version to 2.3.1 2020-06-22 07:33:18 +05:30
c5e40d9067 Fix Xdebug coverage 2020-06-22 07:33:17 +05:30
e0ed1ad0ef Remove --no-suggest flag in examples 2020-06-22 07:33:16 +05:30
2907f8a584 Remove dashes from step ids 2020-06-22 07:33:15 +05:30
52691651dc Add support for Xdebug3 on stable PHP 2020-06-22 07:33:14 +05:30
b9404683e1 Improve extension support 2020-06-22 07:33:08 +05:30
70954fb6f8 Merge pull request #232 from shivammathur/develop
2.3.0
2020-06-11 16:10:15 +05:30
65e65163cd Bump version to 2.3.0 2020-06-11 16:10:14 +05:30
41397ce45e Update docs 2020-06-11 16:10:09 +05:30
c09954033f Fix exit log on self-hosted 2020-06-09 08:46:21 +05:30
7cec1987ac Improve setup on self-hosted windows 2020-06-09 08:46:16 +05:30
739e40fb5e Add support for updating composer 2020-06-05 12:25:02 +05:30
9dec5892e7 Specify runner to the PHP 8.0 script 2020-06-05 12:24:51 +05:30
94616818f0 Fix blackfire-agent setup 2020-06-04 08:40:46 +05:30
4f0d9003dc Add Ubuntu 20.04 to CI 2020-06-04 08:40:45 +05:30
b2edfc47dd Move WA for sudo to self_hosted_setup in linux.sh 2020-06-04 08:40:39 +05:30
6bd872ad2c Fix composer peer fingerprint error for old PHP 2020-06-03 01:56:43 +05:30
03eb8cc744 Update actions/cache uses to v2 2020-06-03 01:56:43 +05:30
9687dd1d8a Fetch scripts for old PHP and nightly 2020-06-03 01:56:42 +05:30
2df0d2b443 Refactor scripts and improve comments 2020-06-03 01:56:37 +05:30
0e56c0b653 Add WA for setrlimit warning with sudo in focal 2020-05-27 09:29:35 +05:30
0469a6f681 Fix setup on self-hosted linux 2020-05-27 08:57:17 +05:30
325413a824 Use Invoke-RestMethod to get tag 2020-05-27 08:02:21 +05:30
b84dd3ce25 Remove empty line in logs 2020-05-26 06:41:18 +05:30
190220c10d Create ini file using tee instead of touch 2020-05-22 15:46:30 +05:30
4fb049a68b Merge pull request #225 from shivammathur/develop
2.2.2
2020-05-22 03:46:01 +05:30
3e0678b50f Bump version to 2.2.2 2020-05-22 02:50:45 +05:30
5b06192e7c Improve install.ts tests 2020-05-22 02:50:38 +05:30
b419442896 Remove extra newline 2020-05-21 23:33:27 +05:30
49b8b7e301 Update README 2020-05-21 20:43:35 +05:30
b1776b79c8 Add support for phan/phan 2020-05-21 11:28:38 +05:30
a48ff666f8 Bump version to 2.2.1 2020-05-19 01:18:32 +05:30
3bffbad95a Update libs for PHP 8.0 on self-hosted runners 2020-05-18 23:50:49 +05:30
18041fdab5 Setup libwebp-dev with PHP8 on linux 2020-05-18 22:44:26 +05:30
b36d2222e6 Update PPA before phalcon setup 2020-05-18 17:55:48 +05:30
50ffa593bb Update PPA in add_devtools in linux.sh 2020-05-18 17:25:38 +05:30
6cbc46fdb6 Fix sqlite logs 2020-05-17 11:37:27 +05:30
08c60fceea Fix to use correct $php_dir 2020-05-17 04:16:39 +05:30
c30a9630bb Housekeeping 2020-05-16 11:28:01 +05:30
0158fe2782 Fix enabling pdo extension 2020-05-16 00:04:19 +05:30
3a8557bcc6 Merge pull request #219 from shivammathur/develop
2.2.0
2020-05-13 23:15:10 +05:30
d10d1e249b Bump version to 2.2.0 2020-05-13 07:12:42 +05:30
3ec1728de8 Update README 2020-05-13 05:39:40 +05:30
9c266d4158 Fix username hardcode in composer PATH 2020-05-12 19:32:10 +05:30
0135ee2ed1 Fix support for phalcon and gearman 2020-05-12 19:32:07 +05:30
5c2618165a Fetch blackfire latest versions 2020-05-12 19:32:03 +05:30
8123132b99 Add support for removing extensions 2020-05-12 19:32:01 +05:30
f5863fd356 Add support for vapor-cli and infection tools 2020-05-12 19:31:58 +05:30
cf0fdf35f2 Add composer global bin directory to PATH 2020-05-12 19:31:53 +05:30
8830cdd08c Add support for self-hosted darwin runners 2020-05-12 19:31:50 +05:30
4960e3179f Add support for self-hosted windows runners 2020-05-12 19:31:39 +05:30
0f3f604249 Add support for self-hosted ubuntu runners 2020-05-10 04:40:21 +05:30
5915f05b06 Suppress php-config error 2020-05-05 15:26:16 +05:30
dccdb5ab67 Fix loading PECL extensions 2020-05-05 14:44:56 +05:30
9a01fd28ca Fix icu4c version for PHP 5.6 and PHP 7.0 on darwin 2020-04-30 17:02:17 +05:30
d5cd6a4bd1 Fix libzip-dev error in PHP 8.0 on ubuntu 2020-04-30 07:31:41 +05:30
006301e81d Fetch formulae before setup 2020-04-23 16:29:33 +05:30
4a38014043 Merge pull request #212 from shivammathur/develop
2.1.4
2020-04-09 23:54:04 +05:30
a0ac655b06 Bump version to 2.1.4 2020-04-09 23:19:56 +05:30
41e56c42c7 Update README 2020-04-09 23:19:55 +05:30
4e8a0cfe8b Update workflow 2020-04-09 21:58:34 +05:30
ee72f2f8ad Recompile PCOV for PHP8.0 2020-04-09 21:48:22 +05:30
ed557fd2c3 Add support for ast and uopz ubuntu packages 2020-03-30 13:50:20 +05:30
d90cd153ee Refactor PHP setup on linux 2020-03-28 12:49:55 +05:30
3376371dd8 Bump minimum Xdebug version 2020-03-28 09:42:02 +05:30
a2b261d79a Add support to configure GitHub OAuth token in composer 2020-03-25 07:44:38 +05:30
6c93dbd391 cleanup 2020-03-25 07:31:36 +05:30
f58dc6eca1 Update all lists 2020-03-20 19:09:27 +05:30
5326f2302f Merge pull request #203 from shivammathur/develop
2.1.3
2020-03-18 16:26:15 +05:30
b9a78a31fb Bump version to 2.1.3 2020-03-18 16:26:11 +05:30
ba69b25cab Install PhpManager from GitHub repo 2020-03-18 16:26:01 +05:30
a6533acdd4 Update FUNDING.yml 2020-03-18 13:09:15 +05:30
d3b37e3d0d Add SECURITY.md 2020-03-18 13:09:07 +05:30
f3a1262ff6 Fix db extensions 2020-03-16 08:13:25 +05:30
933abd531a Merge pull request #201 from shivammathur/develop
2.1.2
2020-03-14 15:29:33 +05:30
67ed7f234b Bump version to 2.1.2 2020-03-14 15:04:10 +05:30
f90accffb3 Change case in README 2020-03-14 14:58:34 +05:30
93441b70bf [Security] Bump acorn from 6.4.0 to 6.4.1
Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1. **This update includes a security fix.**
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-14 14:58:18 +05:30
67f23b6380 Improve code quality 2020-03-14 14:57:21 +05:30
2937ad6e7a Improve extension support 2020-03-14 14:55:28 +05:30
a5e5d07fcb Merge pull request #199 from shivammathur/develop
2.1.1
2020-03-14 14:48:42 +05:30
30d8b321f4 Bump version to 2.1.1 2020-03-14 14:48:27 +05:30
405e57e429 Switch to macports based builds for old PHP on darwin 2020-03-08 08:10:10 +05:30
58f376b118 Fix caching PDO extensions on linux 2020-03-07 17:00:39 +05:30
b7d68d8225 Merge pull request #196 from shivammathur/develop
Hotfix 2.1.0
2020-03-02 20:11:17 +05:30
9252820289 Fix logs of blackfire setup 2020-03-02 19:56:53 +05:30
a5cc9fab25 Merge pull request #195 from shivammathur/develop
2.1.0
2020-02-29 22:30:50 +05:30
4e5685a75d Bump version to 2.1.0 2020-02-29 21:38:22 +05:30
d475227ba5 Improve README 2020-02-29 21:38:22 +05:30
38cb8b924d Use shivammathur/php5-darwin for PHP5 on darwin 2020-02-29 01:17:20 +05:30
fdd83e94df Update tools in README 2020-02-29 00:26:00 +05:30
ad112b7981 Fix support for symfony/flex 2020-02-28 16:51:00 +05:30
2b0d6e221f Improve blackfire examples 2020-02-28 15:42:17 +05:30
acee5b203f Add support for blackfire client, agent and player 2020-02-28 14:43:57 +05:30
84e88e382f Fix and refactor ext-blackfire 2020-02-27 19:27:11 +05:30
bbdc4e3b67 Merge pull request #193 from jaapio/feature/ext-blackfire
🎉 Add blackfire extenstion
2020-02-27 15:50:29 +05:30
311eb9f3ba Add example 2020-02-27 11:12:57 +01:00
3dfd7a648b Add blackfire support on windows 2020-02-27 11:12:56 +01:00
943f491830 Add blackfire on OSX 2020-02-27 11:12:52 +01:00
dc9461a053 Add blackfire to linux install
Add logging about install process

Fix formating of semversion blackfire

Only add version when needed

Pass phpversion
2020-02-27 10:38:52 +01:00
f2720d7b82 Update examples to start mysql service 2020-02-26 22:15:27 +05:30
99161b7790 Add perimission for composer self-update 2020-02-25 23:01:49 +05:30
5de6285e1f Fix composer version 2020-02-25 22:05:48 +05:30
14d702e830 Fix test name 2020-02-25 17:58:15 +05:30
9539b27b4a Add symfony/flex to supported tools 2020-02-25 10:00:07 +05:30
a4f7326577 Move dependency setup to cache-extensions 2020-02-25 09:38:53 +05:30
9b297384e1 Fix versioned extensions 2020-02-24 21:14:54 +05:30
9d77946f60 Switch to liip for old PHP on darwin 2020-02-24 20:24:08 +05:30
6d21e6dc05 Revert instllaing libicu64 2020-02-23 01:46:35 +05:30
68c827cfcf Fix wp-cli support 2020-02-23 01:19:07 +05:30
d95ca49e8d WP-CLI tool support added 2020-02-23 01:18:24 +05:30
03fd0b8719 Merge pull request #190 from shivammathur/develop
Hotfix: Force install libicu64 for PHP 8.0
2020-02-23 00:43:53 +05:30
ebe1c12c21 Hotfix: Force install libicu64 for PHP 8.0 2020-02-23 00:28:35 +05:30
b46021d870 Merge pull request #186 from shivammathur/develop
Update ppa before installing PHP
2020-02-22 00:30:07 +05:30
64ba54fc1b Hotfix: Force update ppa 2020-02-22 00:16:22 +05:30
71571f685a Merge pull request #185 from shivammathur/develop
2.0.2
2020-02-21 14:19:53 +05:30
10f86cb1a1 Bump version to 2.0.2 2020-02-21 14:06:08 +05:30
0f694c5087 Update README 2020-02-21 14:06:08 +05:30
9dfebd1adb Refactor scripts 2020-02-21 11:33:58 +05:30
3781acab4b Fix link in README 2020-02-20 04:15:24 +05:30
cdfbf6d0f0 Merge pull request #184 from shivammathur/develop
2.0.1
2020-02-19 09:08:04 +05:30
0ccb02802f Bump version to 2.0.1 2020-02-19 08:50:15 +05:30
a4572586dc Fix linux.sh 2020-02-19 07:22:01 +05:30
cb3c752d1f Remove update input, it is env 2020-02-17 15:50:44 +05:30
383a511d0e Merge pull request #177 from shivammathur/develop
2.0.0
2020-02-17 04:40:05 +05:30
cc55dbcaa8 Remove support for deprecated inputs 2020-02-17 02:35:18 +05:30
e644692ccf Update test workflow 2020-02-17 01:15:15 +05:30
96d5358317 Bump version to 2.0.0 2020-02-17 01:14:18 +05:30
3a473c9a22 Add support for unstable versions 2020-02-16 07:04:15 +05:30
40944de129 Fix phalcon caching on darwin 2020-02-15 23:46:26 +05:30
f9202d6b64 Support existing PHP on darwin 2020-02-14 16:52:33 +05:30
d99c8732ba Fix extension_version on windows 2020-02-14 15:48:43 +05:30
2c559eae3d Update documentation for v2 2020-02-14 13:35:04 +05:30
3a2ca44a8a Add problem matcher for PHP native errors 2020-02-14 12:55:54 +05:30
17241e2689 Add support for update and extension versions 2020-02-14 12:55:04 +05:30
ca33d01e9f Add support for old PHP versions on linux 2020-02-13 10:31:48 +05:30
3c6644f237 Add support for old PHP versions on windows 2020-02-06 05:54:20 +05:30
326dfd1e76 Add support for old PHP versions on darwin 2020-02-06 05:53:28 +05:30
d9cf6f5ad6 Merge pull request #173 from shivammathur/develop
1.8.2
2020-02-03 04:26:49 +05:30
ea50c7c0a2 Bump version to 1.8.2 2020-02-03 04:07:28 +05:30
6ca549dcaa Update readme 2020-02-03 03:48:07 +05:30
d3760be2cc Add support for cs2pr and refactor tools code 2020-02-03 02:28:00 +05:30
3454287b87 Improve phalcon scripts 2020-02-02 18:29:12 +05:30
88c7757dc8 Add dependencies when enabling extensions in linux 2020-02-02 12:58:32 +05:30
48cfea3f3e Add script to help cache extensions 2020-02-02 04:30:01 +05:30
43cfa2b1a8 Refactor scripts 2020-02-02 03:26:15 +05:30
76cecacc5e Merge pull request #168 from shivammathur/develop
1.8.1
2020-01-27 22:39:10 +05:30
d6e173ffc6 Fix pecl command in linux 2020-01-27 21:32:49 +05:30
26701f2ec8 Bump version to 1.8.1 2020-01-27 21:24:08 +05:30
e934fe28b8 Fix PECL config 2020-01-27 21:09:51 +05:30
d384d9fe7e Merge pull request #167 from shivammathur/develop
1.8.0
2020-01-26 18:21:58 +05:30
4eeaf5f99e Handle extensions input typo 2020-01-26 18:05:27 +05:30
fd2392db56 Fix check for testing tools setup 2020-01-26 17:21:04 +05:30
494dde7189 Bump version to 1.8.0 2020-01-26 16:25:58 +05:30
706dfca1e6 Add lint to pre-commit hook 2020-01-26 16:21:25 +05:30
d613c975f6 Fix lowercasing of coverage driver 2020-01-26 16:15:39 +05:30
fbe1419ce4 Update Readme for 1.8.0 2020-01-26 16:04:18 +05:30
c844c7b6e4 Add support for symfony in tools input 2020-01-26 12:06:55 +05:30
8e5cc09df9 Fix PHPUnit problem matchers 2020-01-26 04:59:20 +05:30
f4f8aec1f2 Fix php.ini permissions after extension setup 2020-01-26 03:23:41 +05:30
b44b7344e0 Add support for pre-release pecl extensions 2020-01-26 02:27:40 +05:30
e01b2f0bf7 Merge pull request #157 from shivammathur/develop
Fix description in actions.yml
2020-01-22 02:20:27 +05:30
f7f8ecb931 Fix description in actions.yml 2020-01-22 01:54:16 +05:30
4f0d810cbc Merge pull request #156 from shivammathur/develop
1.7.4
2020-01-22 01:48:36 +05:30
47335179aa Bump version to 1.7.4 2020-01-22 01:13:19 +05:30
63c4aea452 Refactor scripts to enable pre-existing ext-phalcon 2020-01-21 19:53:17 +05:30
898b6fa1f9 macOS-latest -> macos-latest 2020-01-21 08:25:14 +05:30
747c8838bc Add phive and ts support to readme 2020-01-21 08:24:33 +05:30
9d6b61c5af Add support for phive 2020-01-21 07:21:36 +05:30
5108c81610 Add support for ext-imagick on darwin 2020-01-21 01:06:31 +05:30
e58c704985 Use ppa:ondrej/php for phalcon4 on PHP7.4 2020-01-21 00:50:38 +05:30
e9c783eef0 Add support for specifying nts/ts builds on windows 2020-01-21 00:44:53 +05:30
b44e5e009f Use ppa:ondrej/php for phalcon except for PHP7.4 2020-01-20 21:07:51 +05:30
8489dbf4de Merge pull request #152 from shivammathur/develop
1.7.3
2020-01-17 17:16:16 +05:30
f23ae2e6f7 Fix xdebug and phalcon logs on linux 2020-01-17 16:53:12 +05:30
d2b233e45f Bump version to 1.7.3 2020-01-17 13:45:04 +05:30
320474a245 Add support for phpize and php-config 2020-01-17 13:21:39 +05:30
65ccfb36dc Fix extensions.ts 2020-01-17 06:07:33 +05:30
88fb99b592 Fix logs on windows for pre-installed version 2020-01-16 10:16:44 +05:30
9e7bc5c91f Fix phalcon.ps1 2020-01-16 09:23:04 +05:30
ca2f547a35 Fix log for composer on darwin 2020-01-16 09:06:55 +05:30
9f21c80d24 Install phalcon v4 from PECL on windows 2020-01-16 09:04:43 +05:30
c4317135df Disable composer process-timeout 2020-01-14 12:06:52 +05:30
a2dd688679 Improve test workflows 2020-01-14 11:42:08 +05:30
bd214a2dca Update old Xdebug version for coverage: xdebug 2020-01-14 11:02:17 +05:30
2ee4653d1c Merge pull request #145 from shivammathur/develop
Improve remove_extensions in linux
2020-01-10 07:10:05 +05:30
0b3e0f451d Bump version to 1.7.2 2020-01-10 06:50:19 +05:30
0bfa897634 Improve remove_extensions in linux 2020-01-10 06:30:41 +05:30
71db1e2cf1 Merge pull request #144 from shivammathur/develop
1.7.1
2020-01-09 03:56:18 +05:30
16d1cd4766 Sort tools in README 2020-01-09 03:45:19 +05:30
1193cd100b Bump version to 1.7.1 2020-01-09 03:28:45 +05:30
e839a77d8c Update default packages in linux 2020-01-08 22:07:21 +05:30
552df3f2b0 Add CakePHP examples with services 2020-01-08 12:58:21 +05:30
3109c941eb Update examples 2020-01-08 11:35:32 +05:30
aa8706a5bf Update warnings in actions.yml 2020-01-08 11:12:36 +05:30
9afdee42e8 Add support to specify version of tools 2020-01-08 10:45:30 +05:30
aa0e9403d8 Merge pull request #138 from PrisisForks/feature/automatic-composer-prefetcher
narrowspark/automatic-composer-prefetcher as a alternative to prestissimo
2020-01-04 13:04:02 +05:30
5b00f068f3 feat : narrowspark/automatic-composer-prefetcher as a alternative to prestissimo 2020-01-04 07:39:39 +01:00
8f39d3eddd Add CakePHP example 2020-01-03 08:25:42 +05:30
9d87d1fd14 Update LICENSE 2020-01-01 22:38:51 +05:30
07ae2343d0 Update actions/checkout to v2 2020-01-01 22:36:25 +05:30
7b8bf7af6a Merge pull request #134 from shivammathur/develop
1.7.0 Hotfix
2020-01-01 16:22:07 +05:30
0ac6f76d36 Fix setup order 2020-01-01 16:05:01 +05:30
6c6203b683 Improve ext-phalcon linux script and readme 2019-12-31 13:47:06 +05:30
0c9f8a8e7e Merge pull request #133 from shivammathur/develop
1.7.0
2019-12-31 06:54:06 +05:30
1705daea72 Bump version to 1.7.0 2019-12-31 06:30:11 +05:30
58fbc33c3a Use tap shivammathur/homebrew-phalcon on darwin 2019-12-31 05:49:48 +05:30
3f42b7d5fb Link tools installed using composer 2019-12-31 05:20:47 +05:30
dd4f0db7bf Update to latest version on windows. Fixes #132 2019-12-29 00:38:06 +05:30
7d026bfa6b Update symfony examples 2019-12-28 02:18:01 +05:30
6a70f864ec Improve tools support 2019-12-28 01:03:57 +05:30
8e1cde2d0a Improve examples and documentation 2019-12-28 00:23:51 +05:30
de32d8b95f Add tools support 2019-12-27 13:11:17 +05:30
273096b82f Refactor coverage and extension code 2019-12-26 20:21:39 +05:30
4c045616f4 Improve support for ext-phalcon and refactor extensions.ts 2019-12-25 03:47:26 +05:30
935e74fb40 Refactor scripts and fix reading php-version 2019-12-22 10:19:53 +05:30
a507be73b5 Merge pull request #127 from shivammathur/develop
Hotfix to support phalcon after v4 release
2019-12-22 10:02:11 +05:30
673dcaff6d Hotfix after phalcon4 release 2019-12-22 09:30:28 +05:30
2cbfd4fb41 Update extensions.ts
Phalcon 4.0.0 is released and now in the master.
2019-12-22 07:47:17 +05:30
0969980399 Merge pull request #125 from shivammathur/develop
Remove coverage drivers completely if requested
2019-12-20 15:04:11 +05:30
1fa2905bc6 Remove coverage drivers completely if requested 2019-12-20 14:32:47 +05:30
790a48c30d Merge pull request #124 from shivammathur/develop
1.6.2
2019-12-20 11:29:34 +05:30
4b69160eff Merge pull request #122 from svenluijten/patch-1
Fix year in comment above deprecated options
2019-12-19 15:55:35 +05:30
7f805f22af Fix year in comment above deprecated options 2019-12-19 10:40:58 +01:00
f2972dcf18 Fix enabling zend extensions 2019-12-19 11:33:35 +05:30
2d488f53fd Bump version to 1.6.2 2019-12-19 10:45:29 +05:30
421187c870 Fix experimental workflow 2019-12-19 10:45:08 +05:30
1798f4d615 Fix matchers and add tests 2019-12-19 10:44:43 +05:30
8039546df3 Merge pull request #84 from decnorton/develop
Add problem matcher for PHPUnit
2019-12-19 02:18:02 +05:30
c6ad3d1a70 Add 8.0 support on windows 2019-12-19 00:23:32 +05:30
922f1e27b8 Set ProgressPreference to Silent in win32.ps1 2019-12-18 18:52:46 +05:30
2d3750b36e Install 64bit version of PHP on windows 2019-12-18 18:42:55 +05:30
51c7527bd8 Merge pull request #121 from shivammathur/develop
Fix add_extension on linux and macOS
2019-12-17 04:28:05 +05:30
2bf7ab0207 Fix add_extension on linux and macOS 2019-12-16 19:40:50 +05:30
b3a84fc51e Merge pull request #119 from shivammathur/develop
1.6.1
2019-12-15 02:28:01 +05:30
1330950cd5 Bump version to 1.6.1 2019-12-15 02:09:03 +05:30
afb57fca4e Merge pull request #118 from svenluijten/patch-1
Fix typo in available options
2019-12-15 01:27:07 +05:30
50344f4883 Fix typo in available options
`extension` should actually be `extensions`.
2019-12-14 14:53:04 +01:00
2b027bd9bc Fix reading unquoted versions 2019-12-14 10:13:01 +05:30
8f8207a1ca Add support for ext-gearman. Closes #116 2019-12-14 09:21:11 +05:30
87e6c70743 Update PEAR channel after installation 2019-12-10 05:34:26 +05:30
e3d18718a9 Update dependencies 2019-12-10 05:22:33 +05:30
cfa7bc51cd Merge pull request #106 from shivammathur/develop
Fix coverage log for Xdebug on PHP 8.0
2019-12-09 15:30:42 +05:30
ade633f0da Fix coverage log for Xdebug on PHP 8.0 2019-12-09 14:58:42 +05:30
2cabcf2941 Merge pull request #105 from shivammathur/develop
1.6.0
2019-12-09 14:00:34 +05:30
9ce4bd6f1b Fix logs on linux 2019-12-09 13:17:02 +05:30
190ae49ac1 Improve README 2019-12-09 12:45:26 +05:30
032bc86056 Fix actions.yml 2019-12-09 12:32:55 +05:30
704c5180a4 Update examples 2019-12-09 12:20:03 +05:30
e4fc767f9c Deprecate extension-csv and ini-values-csv inputs 2019-12-09 11:14:07 +05:30
1cf6a369bb Add support for PHP 8.0.0-dev #104 2019-12-09 10:31:11 +05:30
14acb26bdc Merge pull request #103 from shivammathur/develop
1.5.8
2019-12-06 09:30:32 +05:30
3ff7f9cedc Bump version to 1.5.8 2019-12-06 09:13:56 +05:30
98e937751c Merge branch 'develop' of https://github.com/shivammathur/setup-php into develop 2019-12-06 09:11:34 +05:30
31b338b199 Install PCOV from pecl for PHP7.4 on windows 2019-12-06 09:10:20 +05:30
9e32964a24 Merge pull request #102 from shivammathur/dependabot/npm_and_yarn/develop/typescript-3.7.3
Bump typescript from 3.7.2 to 3.7.3
2019-12-05 04:57:13 +05:30
4dcf2b117f Bump typescript from 3.7.2 to 3.7.3
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.7.2 to 3.7.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.7.2...v3.7.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-04 23:19:02 +00:00
6d8250310d Update PHP release support 2019-12-05 02:07:21 +05:30
3164116a42 Merge pull request #101 from shivammathur/develop
1.5.7
2019-12-03 01:17:20 +05:30
747d45cb52 Bump version to 1.5.7 2019-12-03 00:53:35 +05:30
4b7ad1ca81 Merge pull request #100 from shivammathur/dependabot/npm_and_yarn/develop/typescript-eslint/parser-2.10.0
Bump @typescript-eslint/parser from 2.9.0 to 2.10.0
2019-12-03 00:43:15 +05:30
31ef16e586 Merge pull request #99 from shivammathur/dependabot/npm_and_yarn/develop/typescript-eslint/eslint-plugin-2.10.0
Bump @typescript-eslint/eslint-plugin from 2.9.0 to 2.10.0
2019-12-03 00:43:02 +05:30
dd1def7620 Merge pull request #97 from shivammathur/dependabot/npm_and_yarn/develop/eslint-6.7.2
Bump eslint from 6.7.1 to 6.7.2
2019-12-03 00:34:52 +05:30
693a73d8da Merge pull request #98 from shivammathur/dependabot/npm_and_yarn/develop/eslint-plugin-jest-23.1.1
Bump eslint-plugin-jest from 23.1.0 to 23.1.1
2019-12-03 00:34:43 +05:30
965eb91efd Bump @typescript-eslint/parser from 2.9.0 to 2.10.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.10.0/packages/parser)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 18:56:07 +00:00
db9f610623 Bump @typescript-eslint/eslint-plugin from 2.9.0 to 2.10.0
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.10.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 18:55:28 +00:00
24fb306a50 Bump eslint-plugin-jest from 23.1.0 to 23.1.1
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.1.0 to 23.1.1.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.1.0...v23.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 18:54:52 +00:00
919fe77b43 Bump eslint from 6.7.1 to 6.7.2
Bumps [eslint](https://github.com/eslint/eslint) from 6.7.1 to 6.7.2.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.7.1...v6.7.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 18:54:44 +00:00
914c51cfb6 Fix ext-redis 2019-12-03 00:12:29 +05:30
8d8c2bd524 Use shivammathur/homebrew-php for macOS 2019-12-02 17:24:50 +05:30
7ef437ee9d Update pre-commit hook 2019-12-02 07:00:41 +05:30
0871fbb11b Update action.yml 2019-11-30 23:30:48 +05:30
3039a720ed Merge pull request #95 from shivammathur/develop
1.5.6
2019-11-30 07:11:14 +05:30
7f32ab318e Show semantic versions on PHP install and correct logs 2019-11-30 06:57:39 +05:30
ddcacf4760 Improve readme and workflow 2019-11-30 05:30:17 +05:30
2f951ef5cd Use Homebrew for PHP 7.4 on macOS 2019-11-30 04:59:05 +05:30
5a081357b4 Merge pull request #94 from shivammathur/develop
Fix phpdbg and improve windows script.
2019-11-29 12:10:41 +05:30
c4a64dff61 Install phpdbg with PHP7.4 2019-11-29 11:41:25 +05:30
aad33a8e35 Update Update-PhpCAInfo command in win32.ps1 2019-11-29 10:52:07 +05:30
eae890b1b2 Fix phpdbg version 2019-11-29 10:14:53 +05:30
8fbd2ea6bb Merge pull request #92 from shivammathur/develop
Switch to v1 tag and stable PHP 7.4.0
2019-11-28 16:47:42 +05:30
46161660dc Bump to 7.4.0 stable on linux 2019-11-28 15:58:33 +05:30
de68427afb Bump to 7.4.0 stable on windows and macOS 2019-11-28 15:54:15 +05:30
4ba36c5432 Shift to rotating stable tags 2019-11-28 05:17:56 +05:30
99e2d8d309 Merge pull request #90 from shivammathur/develop
Fix PHP-FPM in PHP and add a flag to skip checksum check if it fails
2019-11-27 23:56:05 +05:30
929f9cd52d Add flag to skip checksum if it fails 2019-11-27 23:43:04 +05:30
4dba50d3af Fix php-fpm on linux in PHP 5.6 and 7.0 2019-11-27 21:56:29 +05:30
1c258f399f Merge pull request #89 from shivammathur/develop
1.5.5
2019-11-27 21:05:36 +05:30
e05bc317ec Fix README 2019-11-27 20:55:51 +05:30
44815f1f73 Fix workflow and bump version 2019-11-27 20:44:27 +05:30
22f5ad47d2 Handle exception in Update-PhpCAInfo in win32.ps1 2019-11-27 20:36:58 +05:30
a29956826a Edit README and workflow 2019-11-27 20:26:36 +05:30
c11d023c03 Add sage and bedrock example, add cache to examples 2019-11-27 06:00:34 +05:30
cade5f7157 Merge pull request #87 from shivammathur/develop
1.5.4
2019-11-26 12:24:58 +05:30
7964656607 Improve templates 2019-11-25 22:06:40 +05:30
970e2d5ebb Add pre-commit hook to create release 2019-11-25 21:58:24 +05:30
5b09e1195e Change log message 2019-11-25 21:55:52 +05:30
6fdecd40be Disable es-lint check @typescript-eslint/no-unused-vars 2019-11-25 21:41:39 +05:30
159a09794e Merge pull request #86 from mlocati/improve-win32
Simplify win32 script
2019-11-25 21:35:52 +05:30
0be846de83 Install the stable release of xdebug even on PHP 7.4RC 2019-11-25 16:35:11 +01:00
981c662f5d Minor change to trigger build 2019-11-25 14:56:31 +01:00
71c631cffb Fix installing xdebug with PHP 7.4 on Windows 2019-11-25 14:03:28 +01:00
47387dd6e9 Use the curl CA list if PKI Powershell Module is not available 2019-11-25 12:33:52 +01:00
fec9df11d6 Simplify win32 script
- Always specify the PHP install dir
- Use default PhpManager functions
- Fix CA Authorities (so that HTTPS calls work)
- Don't handle the special xdebug case (it's bundled in PhpManager)
2019-11-25 12:19:22 +01:00
03f36220f4 Add PHPUnit problem matcher 2019-11-24 16:35:21 +00:00
1db0b0651d Ship with @zeit/ncc 2019-11-24 05:17:35 +05:30
3f6c88dec7 Improve workflow and lint the code 2019-11-24 02:38:52 +05:30
110 changed files with 13659 additions and 5833 deletions

16
.eslintrc.json Normal file
View 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"]
}

View File

@ -9,18 +9,20 @@ Please note that this project is released with a [Contributor Code of Conduct](C
* 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.
* If editing the scripts, create a demo integration test.
* Send a pull request to the develop branch with all the details.
Please make sure that you have [set up your user name and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git. Strings such as `silly nick name <root@localhost>` look really stupid in the commit history of a project.
Due to time constraints, you may not always get a quick response. Please do not take delays personal and feel free to remind.
Due to time constraints, you may not always get a quick response. Please do not take delays personally and feel free to remind.
## Coding Guidelines
This project comes with a `.prettierrc.json` configuration file. Please run the following command to format the code before committing it.
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
@ -47,8 +49,16 @@ After following the steps shown above, The `setup-php` tests in the `__tests__`
$ 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)
* [Issues](https://github.com/shivammathur/setup-php/issues)

4
.github/FUNDING.yml vendored
View File

@ -1,8 +1,6 @@
# These are supported funding model platforms
github: shivammathur
tidelift: "npm/setup-php"
community_bridge: setup-php
issuehunt: shivammathur
patreon: shivammathur
liberapay: shivammathur
custom: https://www.paypal.me/shivammathur

View File

@ -1,23 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
about: Nice, you found a bug!
title: ''
labels: ''
assignees: ''
labels: 'bug'
assignees: 'shivammathur'
---
**Describe the bug**
A clear and concise description of what the bug is.
<!-- Please describe the bug concisely. -->
**Version**
- [ ] I have checked releases and the bug exists in the latest patch version of `v1` or `v2`.
- [ ] `v2`
- [ ] `v1`
**Runners**
<!-- Please mark the GitHub Action runner your workflow uses. -->
- [ ] GitHub Hosted
- [ ] Self Hosted
**Operating systems**
<!-- Please mention the operating systems your workflow uses. -->
**PHP versions**
<!-- Please mention the PHP versions your workflow uses. -->
**To Reproduce**
Please provide the GitHub Action `.yml` file.
<!-- Please provide the relevant steps of your workflow `.yml` file. -->
**Expected behavior**
A clear and concise description of what you expected to happen.
<!-- A clear and concise description of what you expected to happen. -->
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Screenshots/Logs**
<!-- If applicable, add screenshots or logs to help explain your problem. -->
**Additional context**
Add any other context about the problem here.
<!-- Add any other context about the problem here. -->
**Are you willing to submit a PR?**
<!-- We accept pull requests targeting the develop branch. -->

View File

@ -1,20 +1,26 @@
---
name: Feature request
about: Suggest an idea for this project
about: Suggest a new feature
title: ''
labels: ''
assignees: ''
labels: 'enhancement'
assignees: 'shivammathur'
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the feature**
<!-- Please describe concisely the feature you want to add. -->
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Version**
- [ ] I have checked releases and the feature is missing in the latest patch version of `v2`.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Underlying issue**
<!-- Please describe the issue this would solve. -->
**Describe alternatives**
<!-- Please mention any alternative solutions you've considered. -->
**Additional context**
Add any other context or screenshots about the feature request here.
<!-- Add any other context or screenshots about the feature request here. -->
**Are you willing to submit a PR?**
<!-- We accept pull requests targeting the develop branch. -->

View File

@ -7,14 +7,13 @@ 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.
> If you're fixing a bug, adding a new feature or improving something please provide the details in Issues,
> so that the development can be pointed in the intended direction.
Related issue:
Related issue: <!-- Please link the 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
> Thank you for your contribution.
### Description
@ -24,7 +23,14 @@ This PR [briefly explain what it does]
- [ ] I have written test cases for the changes in this pull request
- [ ] I have run `npm run format` before the commit.
- [ ] `npm test` returns with no unit test errors.
- [ ] 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 and all code covered.
> In case this PR edits any scripts:
- [ ] I have checked the edited scripts for syntax.
- [ ] I have tested the changes in an integration test (If yes, provide workflow link).
<!--
- Please target the develop branch when submitting the pull request.

View File

@ -1,31 +0,0 @@
---
name: 🐞 Bug Fix
about: You have a fix for a bug?
labels: bug
---
## A Pull Request should be associated with an Issue.
> We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
> If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
> and potentially we'll be able to point development in a particular direction.
Related issue:
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
> Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR
### Description
This PR [briefly explain what it does]
> In case this PR introduced TypeScript/JavaScript code changes:
- [ ] I have written test cases for the changes in this pull request
- [ ] I have run `npm run format` before the commit.
- [ ] `npm test` returns with no unit test errors.
<!--
- Please target the develop branch when submitting the pull request.
-->

View File

@ -1,31 +0,0 @@
---
name: ⚙ Improvement
about: You have some improvement to make setup-php better?
labels: enhancement
---
## A Pull Request should be associated with an Issue.
> We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
> If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
> and potentially we'll be able to point development in a particular direction.
Related issue:
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
> Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR
### Description
This PR [briefly explain what it does]
> In case this PR introduced TypeScript/JavaScript code changes:
- [ ] I have written test cases for the changes in this pull request
- [ ] I have run `npm run format` before the commit.
- [ ] `npm test` returns with no unit test errors.
<!--
- Please target the develop branch when submitting the pull request.
-->

View File

@ -1,31 +0,0 @@
---
name: 🎉 New Feature
about: You have implemented some neat idea that you want to make part of setup-php?
labels: enhancement
---
## A Pull Request should be associated with an Issue.
> We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
> If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
> and potentially we'll be able to point development in a particular direction.
Related issue:
> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md)
> Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR
### Description
This PR [briefly explain what it does]
> In case this PR introduced TypeScript/JavaScript code changes:
- [ ] I have written test cases for the changes in this pull request
- [ ] I have run `npm run format` before the commit.
- [ ] `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
View 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.3.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).

51
.github/workflows/node-workflow.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Node workflow
on:
pull_request:
branches:
- master
- develop
- verbose
paths-ignore:
- '**.md'
- 'examples/**'
push:
branches:
- master
- develop
- verbose
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 }}-php${{ matrix.php-versions }}

View File

@ -1,5 +1,22 @@
name: Main workflow
on: [push, pull_request]
on:
workflow_dispatch:
pull_request:
branches:
- master
- develop
- verbose
paths-ignore:
- '**.md'
- 'examples/**'
push:
branches:
- master
- develop
- verbose
paths-ignore:
- '**.md'
- 'examples/**'
jobs:
run:
name: Run
@ -7,55 +24,55 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3']
operating-system: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, windows-latest, macos-latest]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
env:
extensions: xml, opcache, xdebug, pcov
key: cache-v3
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@develop
with:
fetch-depth: 1
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Setup Node.js 12.x
uses: actions/setup-node@master
- name: Cache extensions
uses: actions/cache@v2
with:
node-version: 12.x
- name: Cache node modules
uses: actions/cache@preview
id: cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Installing NPM packages
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
- name: Run tests
run: npm test
- name: Send Coverage
continue-on-error: true
timeout-minutes: 2
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Setup PHP with extensions and custom config
run: node lib/install.js
run: node dist/index.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
extensions: ${{ env.extensions }}
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata
- name: Testing PHP version
run: php -v
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
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
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: |
printf "post_max_size: %s\n" $(php -r "echo ini_get('post_max_size');")
printf "short_open_tag: %s\n" $(php -r "echo ini_get('short_open_tag');")
printf "date.timezone: %s\n" $(php -r "echo ini_get('date.timezone');")
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');}"

3
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
!node_modules/
node_modules/
__tests__/runner/*
lib/
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs

View File

@ -1,11 +1,12 @@
{
"arrowParens": "avoid",
"bracketSpacing": false,
"endOfLine": "auto",
"parser": "typescript",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
"useTabs": false
}

View File

@ -1,7 +1,7 @@
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
of this software and associated documentation files (the "Software"), to deal

644
README.md
View File

@ -10,206 +10,600 @@
<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>
<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>
<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>
<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>
<a href="https://www.patreon.com/shivammathur" title="Support Shivam Mathur on Patreon"><img alt="Support me on Patreon" src="https://shivammathur.com/badges/patreon.svg"></a> <a href="https://www.paypal.me/shivammathur"><img alt="Support me on PayPal" src="https://shivammathur.com/badges/paypal.svg"></a>
<a href="https://www.codementor.io/shivammathur?utm_source=github&utm_medium=button&utm_term=shivammathur&utm_campaign=github" title="Contact Shivam Mathur on Codementor"><img alt="Contact me on Codementor" src="https://cdn.codementor.io/badges/contact_me_github.svg"></a>
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.3-8892BF.svg"></a>
</p>
Setup PHP with required extensions, php.ini configuration and composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). 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](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
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.
## Contents
- [PHP Support](#tada-php-support)
- [OS/Platform Support](#cloud-osplatform-support)
- [PHP Extension Support](#wrench-php-extension-support)
- [Coverage support](#signal_strength-coverage-support)
- [GitHub-Hosted Runners](#github-hosted-runners)
- [Self-Hosted Runners](#self-hosted-runners)
- [PHP Extension Support](#heavy_plus_sign-php-extension-support)
- [Tools Support](#wrench-tools-support)
- [Coverage Support](#signal_strength-coverage-support)
- [Xdebug](#xdebug)
- [PCOV](#pcov)
- [Disable coverage](#disable-coverage)
- [Disable Coverage](#disable-coverage)
- [Usage](#memo-usage)
- [Basic Usage](#basic-usage)
- [Matrix Testing](#matrix-testing)
- [Cache dependencies](#cache-dependencies)
- [Inputs](#inputs)
- [Basic Setup](#basic-setup)
- [Matrix Setup](#matrix-setup)
- [Nightly Build Setup](#nightly-build-setup)
- [Self Hosted Setup](#self-hosted-setup)
- [Local Testing Setup](#local-testing-setup)
- [Thread Safe Setup](#thread-safe-setup)
- [Force Update](#force-update)
- [Verbose Setup](#verbose-setup)
- [Cache Extensions](#cache-extensions)
- [Cache Composer Dependencies](#cache-composer-dependencies)
- [Cache Node.js Dependencies](#cache-nodejs-dependencies)
- [Composer GitHub OAuth](#composer-github-oauth)
- [Problem Matchers](#problem-matchers)
- [Examples](#examples)
- [Versioning](#bookmark-versioning)
- [License](#scroll-license)
- [Contributions](#1-contributions)
- [Support this project](#sparkling_heart-support-this-project)
- [This action uses the following works](#bookmark-this-action-uses-the-following-works)
- [Support This Project](#sparkling_heart-support-this-project)
- [Dependencies](#package-dependencies)
- [Further Reading](#bookmark_tabs-further-reading)
## :tada: PHP Support
|PHP Version|Stability|Release Support|
|--- |--- |--- |
|5.6|`Stable`|`End of life`|
|7.0|`Stable`|`End of life`|
|7.1|`Stable`|`Security fixes only`|
|7.2|`Stable`|`Active`|
|7.3|`Stable`|`Active`|
|7.4|`RC6`|`Active`|
|PHP Version|Stability|Release Support|Runner Support|
|--- |--- |--- |--- |
|`5.3`|`Stable`|`End of life`|`GitHub-hosted`|
|`5.4`|`Stable`|`End of life`|`GitHub-hosted`|
|`5.5`|`Stable`|`End of life`|`GitHub-hosted`|
|`5.6`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|`7.0`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|`7.1`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|`7.2`|`Stable`|`Security fixes only`|`GitHub-hosted`, `self-hosted`|
|`7.3`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
|`7.4`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
|`8.0`|`Nightly`|`In development`|`GitHub-hosted`, `self-hosted`|
**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: OS/Platform Support
|Virtual environment|matrix.operating-system|
Both `GitHub-hosted` runners and `self-hosted` runners are supported on the following operating systems.
### GitHub-Hosted Runners
|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 Catalina 10.15|`macos-latest` or `macos-10.15`|`PHP 7.4`|
### Self-Hosted Runners
|Host OS/Virtual environment|YAML workflow label|
|--- |--- |
|Windows Server 2019|`windows-latest` or `windows-2019`|
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|
|Ubuntu 16.04|`ubuntu-16.04`|
|macOS X Catalina 10.15|`macOS-latest` or `macOS-10.15`|
|Ubuntu 16.04|`self-hosted` or `Linux`|
|Ubuntu 18.04|`self-hosted` or `Linux`|
|Ubuntu 20.04|`self-hosted` or `Linux`|
|Windows 7 and newer|`self-hosted` or `Windows`|
|Windows Server 2012 R2 and newer|`self-hosted` or `Windows`|
|macOS Catalina 10.15|`self-hosted` or `macOS`|
## :wrench: 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: true`.
- 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 cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
- Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
## :signal_strength: Coverage support
## :heavy_plus_sign: PHP Extension Support
- On `ubuntu` by default extensions which are available as a package can be installed. PECL extensions if not available as a package can be installed by specifying `pecl` in the tools input.
```yaml
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: pecl
extensions: swoole
```
- On `windows` PECL extensions which have the `DLL` binary can be installed.
- On `macOS` PECL extensions can be installed.
- Extensions installed along with PHP if specified are enabled.
- Specific versions of PECL extensions can be installed by suffixing the version. This is useful for installing old versions of extensions which support end of life PHP versions.
```yaml
uses: shivammathur/setup-php@v2
with:
php-version: '5.4'
tools: pecl
extensions: swoole-1.9.3
```
- Pre-release versions of PECL extensions can be setup by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
```yaml
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: pecl
extensions: xdebug-beta
```
- Shared extensions can be removed by prefixing them with a `:`.
```yaml
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: :opcache
```
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
- These extensions have custom support - `gearman` on `Ubuntu`, `blackfire`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
## :wrench: Tools Support
These tools can be setup globally using the `tools` input.
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`, `vapor-cli`
```yaml
uses: shivammathur/setup-php@v2
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. You can setup the required version by specifying `v1`, `v2`, `snapshot` or `preview` as version.
```yaml
uses: shivammathur/setup-php@v2
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@v2
with:
php-version: '7.4'
tools: php-cs-fixer:2.16.2, phpunit:8.5.1
```
**Notes**
- Both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input.
- Tools which cannot be setup 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")
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
```yaml
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '7.4'
coverage: xdebug
```
### PCOV
Specify `coverage: pcov` to use `PCOV`.
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-csv` input.
Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`.
`PCOV` supports `PHP 7.1` and newer PHP versions.
Tests with `PCOV` run much faster than with `Xdebug`.
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@master
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
ini-values-csv: pcov.directory=api #optional, see above for usage.
php-version: '7.4'
ini-values: pcov.directory=api #optional, see above for usage.
coverage: pcov
```
### Disable coverage
### Disable Coverage
Specify `coverage: none` to disable both `Xdebug` and `PCOV`.
Specify `coverage: none` to remove 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 disable `Xdebug`, which will have a positive impact on PHP performance.
- It will remove `Xdebug`, which will have a positive impact on PHP performance.
- You are using `phpdbg` for running your tests.
- You are profiling your code using `blackfire`.
```yaml
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '7.4'
coverage: none
```
## :memo: Usage
Inputs supported by this GitHub Action.
### Inputs
- php-version `required`
- extension-csv `optional`
- ini-values-csv `optional`
- coverage `optional`
- pecl `optional`
#### `php-version` (required)
See [action.yml](action.yml "Metadata for this GitHub Action") and usage below for more info.
- Specify the PHP version you want to setup.
- Accepts a `string`. For example `'7.4'`.
- See [PHP support](#tada-php-support) for supported PHP versions.
### Basic Usage
#### `extensions` (optional)
- Specify the extensions you want to add or remove.
- Accepts a `string` in csv-format. For example `mbstring, :opcache`.
- Non-default extensions prefixed with `:` are removed.
- See [PHP extension support](#heavy_plus_sign-php-extension-support) for more info.
#### `ini-values` (optional)
- Specify the values you want to add to `php.ini`.
- Accepts a `string` in csv-format. For example `post_max_size=256M, short_open_tag=On`.
#### `coverage` (optional)
- Specify the code coverage driver you want to setup.
- Accepts `xdebug`, `pcov` or `none`.
- See [coverage support](#signal_strength-coverage-support) for more info.
#### `tools` (optional)
- Specify the tools you want to setup.
- Accepts a `string` in csv-format. For example `phpunit, phpcs`
- See [tools Support](#wrench-tools-support) for tools supported.
See below for more info.
### Basic Setup
> Setup a particular PHP version.
```yaml
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
extension-csv: mbstring, intl #optional, setup extensions
ini-values-csv: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
coverage: xdebug #optional, setup coverage driver
pecl: false #optional, setup PECL
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
php-version: '7.4'
extensions: mbstring, intl
ini-values: post_max_size=256M, short_open_tag=On
coverage: xdebug
tools: php-cs-fixer, phpunit
```
### Matrix Testing
### Matrix Setup
> Setup multiple PHP versions on multiple operating systems.
```yaml
jobs:
run:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3']
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl #optional, setup extensions
ini-values-csv: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
coverage: xdebug #optional, setup coverage driver
pecl: false #optional, setup PECL
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
extensions: mbstring, intl
ini-values: post_max_size=256M, short_open_tag=On
coverage: xdebug
tools: php-cs-fixer, phpunit
```
### Cache dependencies
### Nightly Build Setup
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.
> 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.
**Note:** Please do not cache `vendor` directory using `action/cache` as that will have side-effects.
- This version is currently in development.
- `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.
```yaml
- name: Get Composer Cache Directory
id: composer-cache
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: mbstring
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1
coverage: pcov
tools: php-cs-fixer, phpunit
```
### Self Hosted Setup
> Setup PHP on a self-hosted runner.
- To setup a dockerized self-hosted runner, refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Ubuntu) to setup in an `Ubuntu` container and refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows) to setup in a `Windows` container.
- To setup the runner directly on the host OS or in a virtual machine, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
- If your workflow uses [services](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices "GitHub Actions Services"), then setup the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.
Specify the environment variable `runner` with the value `self-hosted`. Without this your workflow will fail.
```yaml
jobs:
run:
runs-on: self-hosted
strategy:
matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
env:
runner: self-hosted # Specify the runner.
```
### Local Testing Setup
> Test your `Ubuntu` workflow locally using [`nektos/act`](https://github.com/nektos/act "Project to test GitHub Actions locally").
```yaml
jobs:
run:
runs-on: ubuntu-latest
name: PHP 7.4 Test
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
```
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker image.
```bash
# For runs-on: ubuntu-latest
act -P ubuntu-latest=shivammathur/node:latest
# For runs-on: ubuntu-20.04
act -P ubuntu-20.04=shivammathur/node:focal
# For runs-on: ubuntu-18.04
act -P ubuntu-18.04=shivammathur/node:bionic
# For runs-on: ubuntu-16.04
act -P ubuntu-16.04=shivammathur/node:xenial
```
### Thread Safe Setup
> Setup both `TS` and `NTS` PHP on `Windows`.
- `NTS` versions are setup by default.
- On `Ubuntu` and `macOS` only `NTS` versions are supported.
- On `Windows` both `TS` and `NTS` versions are supported.
```yaml
jobs:
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@v2
with:
php-version: '7.4'
env:
phpts: ts # specify ts or nts
```
### Force Update
> Update to latest patch of PHP versions.
- Pre-installed PHP versions on the GitHub Actions runner are not updated to their latest patch release by default.
- You can specify the `update` environment variable to `true` to force update to the latest release.
```yaml
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
env:
update: true # specify true or false
```
### Verbose Setup
> Debug your workflow
To debug any issues, you can use the `verbose` tag instead of `v2`.
```yaml
- name: Setup PHP
uses: shivammathur/setup-php@verbose
with:
php-version: '7.4'
```
### Cache Extensions
You can cache PHP extensions using [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") and [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Actions. Extensions which take very long to setup when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
```yaml
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
env:
extensions: intl, pcov
key: cache-v1 # can be any string, change to clear the extension cache.
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
```
**Note:** If you setup both `TS` and `NTS` PHP versions on `windows`, add `${{ env.phpts }}` to `key` and `restore-keys` inputs in `actions/cache` step.
### Cache Composer Dependencies
If your project uses composer, you can persist composer's internal cache directory. 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.
```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@v1
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
- name: Install dependencies
run: composer install --prefer-dist
```
**Notes**
- Please do not cache `vendor` directory using `action/cache` as that will have side-effects.
- 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') }}
```
### Cache Node.js Dependencies
If your project has node.js dependencies, you can persist npm's or yarn's cache directory. The cached files are available across check-runs and will reduce the workflow execution time.
```yaml
- name: Get node.js cache directory
id: nodecache
run: echo "::set-output name=dir::$(npm config get cache)" # Use $(yarn cache dir) for yarn
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.nodecache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Use '**/yarn.lock' for yarn
restore-keys: ${{ runner.os }}-node-
```
**Note:** Please do not cache `node_modules` directory as that will have side-effects.
### 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
#### PHP
Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step. This will scan the logs for PHP errors and warnings, and surface them prominently in the GitHub Actions UI by creating annotations and log file decorations.
```yaml
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
```
#### PHPUnit
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@v2
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.
Examples of using `setup-php` with various PHP Frameworks and Packages.
|Framework/Package|Runs on|Workflow|
|--- |--- |--- |
|Blackfire|`macOS`, `ubuntu` and `windows`|[blackfire.yml](./examples/blackfire.yml "GitHub Action using Blackfire")|
|Blackfire Player|`macOS`, `ubuntu` and `windows`|[blackfire-player.yml](./examples/blackfire-player.yml "GitHub Action using Blackfire Player")|
|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")|
@ -219,39 +613,59 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package
|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")|
## :bookmark: Versioning
- It is highly recommended to use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with latest minor and patch releases. With `v2` you automatically get the bug fixes, new features and support for latest PHP releases. For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
- Semantic release versions can also be used. It is recommended to [use dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot "Setup Dependabot with GitHub Actions") with semantic versioning to keep the actions in your workflows up to date.
- Commit SHA can also be used, but are not recommended. They have to be updated with every release manually, without which you will not get any bug fixes or new features.
- Using the `master` branch as version is highly discouraged, it might break your workflow after major releases as they have breaking changes.
- If you are using the `v1` tag or a `1.x.y` version, it is recommended that you [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` only gets critical bug fixes. Maintenance support for `v1` will be dropped with the last `PHP 8.0` release.
## :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](https://github.com/shivammathur/setup-php/network/dependencies "Dependencies for this PHP Action") and uses [various works](#bookmark-this-action-uses-the-following-works "Tools used by this action"). Their licenses can be found in their respective repositories.
- 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").
> Contributions are welcome!
## :sparkling_heart: Support this project
- See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide") before you start.
- 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.
- Please star the project and share it, this helps reach more people.
- If you blog, write about your experience using this.
- Support on this project on <a href="https://www.patreon.com/shivammathur"><img alt="Patreon" src="https://shivammathur.com/badges/patreon.svg"></a> or using <a href="https://www.paypal.me/shivammathur"><img alt="Paypal" src="https://shivammathur.com/badges/paypal.svg"></a>.
- 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: This action uses the following works
## :package: Dependencies
- [powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
- [Homebrew](https://brew.sh/ "MacOS package manager")
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Pre-compiled ubuntu packages")
- [exolnet/homebrew-deprecated](https://github.com/eXolnet/homebrew-deprecated "Pre-compiled deprecated PHP for macOS")
- [phpbrew](https://github.com/phpbrew/phpbrew "PHP packages manager")
- [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
- [gplessis/dotdeb-php](https://github.com/gplessis/dotdeb-php "Packaging for end of life PHP versions")
- [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/cache-extensions](https://github.com/shivammathur/cache-extensions "GitHub action to help with caching PHP extensions")
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds on MacOS")
- [shivammathur/homebrew-extensions](https://github.com/shivammathur/homebrew-extensions "Tap for PHP extensions on MacOS")
- [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package")
- [shivammathur/php5-darwin](https://github.com/shivammathur/php5-darwin "Scripts to setup PHP5 versions on darwin")
- [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions on ubuntu")
## :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")
- [Other Awesome Actions](https://github.com/sdras/awesome-actions "List of Awesome GitHub Actions")

View File

@ -7,7 +7,7 @@ describe('Config tests', () => {
'win32'
);
expect(win32).toContain(
'Add-Content C:\\tools\\php\\php.ini "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
'Add-Content "$php_dir\\php.ini" "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
);
win32 = await config.addINIValues(

View File

@ -1,20 +1,10 @@
import * as config from '../src/config';
import * as coverage from '../src/coverage';
import * as extensions from '../src/coverage';
jest.mock('../src/extensions', () => ({
addExtension: jest.fn().mockImplementation(extension => {
return 'addExtension ' + 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('addExtension pcov');
expect(win32).toContain(
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php'
);
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');
@ -24,50 +14,70 @@ describe('Config tests', () => {
});
it('checking addCoverage with PCOV on linux', async () => {
let linux: string = await coverage.addCoverage('pcov', '7.4', 'linux');
expect(linux).toContain('addExtension pcov');
expect(linux).toContain('sudo sed -i "/xdebug/d" $ini_file');
expect(linux).toContain('sudo phpdismod -v 7.4 xdebug');
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 () => {
let darwin: string = await coverage.addCoverage('pcov', '7.4', 'darwin');
expect(darwin).toContain('addExtension pcov');
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 () => {
let win32: string = await coverage.addCoverage('xdebug', '7.3', 'win32');
expect(win32).toContain('addExtension xdebug');
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
expect(win32).toContain('Add-Extension xdebug');
});
it('checking addCoverage with Xdebug on linux', async () => {
let linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux');
expect(linux).toContain('addExtension xdebug');
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
expect(linux).toContain('add_extension xdebug');
});
it('checking addCoverage with Xdebug3 on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug3', '7.4', 'linux');
expect(linux).toContain('add_extension_from_source xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
});
it('checking addCoverage with Xdebug3 on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug3', '8.0', 'linux');
expect(linux).toContain('add_extension xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
});
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 () => {
let darwin: string = await coverage.addCoverage('xdebug', '7.4', 'darwin');
expect(darwin).toContain('addExtension xdebug');
const darwin: string = await coverage.addCoverage(
'xdebug',
'7.4',
'darwin'
);
expect(darwin).toContain('add_extension xdebug');
});
it('checking disableCoverage windows', async () => {
let win32 = await coverage.addCoverage('none', '7.4', 'win32');
expect(win32).toContain('Disable-PhpExtension xdebug');
expect(win32).toContain('Disable-PhpExtension pcov');
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 () => {
let linux: string = await coverage.addCoverage('none', '7.4', 'linux');
expect(linux).toContain('sudo phpdismod -v 7.4 xdebug');
expect(linux).toContain('sudo phpdismod -v 7.4 pcov');
expect(linux).toContain('sudo sed -i "/xdebug/d" $ini_file');
expect(linux).toContain('sudo sed -i "/pcov/d" $ini_file');
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 () => {
let darwin: string = await coverage.addCoverage('none', '7.4', 'darwin');
expect(darwin).toContain('sudo sed -i \'\' "/xdebug/d" $ini_file');
expect(darwin).toContain('sudo sed -i \'\' "/pcov/d" $ini_file');
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 () => {

View File

@ -1,85 +1,201 @@
import * as extensions from '../src/extensions';
describe('Extension tests', () => {
it('checking getXdebugVersion', async () => {
expect(await extensions.getXdebugVersion('5.3')).toContain('2.2.7');
expect(await extensions.getXdebugVersion('5.4')).toContain('2.4.1');
expect(await extensions.getXdebugVersion('5.5')).toContain('2.5.5');
expect(await extensions.getXdebugVersion('5.6')).toContain('2.5.5');
expect(await extensions.getXdebugVersion('7.0')).toContain('2.7.2');
expect(await extensions.getXdebugVersion('7.2')).toContain('2.9.6');
});
it('checking addExtensionOnWindows', async () => {
let win32: string = await extensions.addExtension(
'xdebug, pcov',
'7.2',
'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
'7.4',
'win32'
);
expect(win32).toContain('Install-PhpExtension xdebug');
expect(win32).toContain('Install-PhpExtension pcov');
win32 = await extensions.addExtension('xdebug, pcov', '7.4', 'win32');
const extension_url: string =
'https://xdebug.org/files/php_xdebug-2.8.0-7.4-vc15.dll';
expect(win32).toContain(
'Invoke-WebRequest -Uri ' +
extension_url +
' -OutFile C:\\tools\\php\\ext\\php_xdebug.dll'
);
expect(win32).toContain('Install-PhpExtension pcov');
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension pcov');
expect(win32).toContain('Add-Extension sqlite3');
expect(win32).toContain('Remove-Extension intl');
expect(win32).toContain('phalcon.ps1 phalcon4');
expect(win32).toContain('ioncube.ps1 7.4');
expect(win32).toContain('oci.ps1 oci8 7.4');
expect(win32).toContain('oci.ps1 pdo_oci 7.4');
expect(win32).toContain('Add-Extension ast beta');
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
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.5', 'win32');
expect(win32).toContain('Add-Extension mysql');
expect(win32).toContain('Add-Extension mysqli');
expect(win32).toContain('Add-Extension mysqlnd');
win32 = await extensions.addExtension(
'does_not_exist',
'phalcon3, does_not_exist',
'7.2',
'win32',
true
);
expect(win32).toContain(
'Add-Extension does_not_exist "Install-PhpExtension does_not_exist" extension'
);
expect(win32).toContain('phalcon.ps1 phalcon3');
expect(win32).toContain('Add-Extension does_not_exist');
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(win32).toContain('Platform fedora is not supported');
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
expect(win32).toContain('blackfire.ps1 7.3 blackfire');
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
expect(win32).toContain('blackfire.ps1 7.3 blackfire-1.31.0');
});
it('checking addExtensionOnLinux', async () => {
let linux: string = await extensions.addExtension(
'xdebug, pcov',
'7.2',
'Xdebug, xdebug3, pcov, sqlite, :intl, ast, uopz, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
'7.4',
'linux'
);
expect(linux).toContain('update_extension xdebug 2.9.6');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-xdebug'
'add_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'
);
expect(linux).toContain('pecl install xdebug');
expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-pcov');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-pcov'
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
);
expect(linux).toContain('remove_extension intl');
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-ast');
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-uopz');
expect(linux).toContain('add_unstable_extension ast beta extension');
expect(linux).toContain('add_pdo_extension mysql');
expect(linux).toContain('add_pdo_extension odbc');
expect(linux).toContain('add_pecl_extension grpc 1.2.3 extension');
expect(linux).toContain(
'add_unstable_extension xdebug alpha zend_extension'
);
expect(linux).toContain('pecl install pcov');
linux = await extensions.addExtension('phalcon3, phalcon4', '7.2', 'linux');
expect(linux).toContain('phalcon.sh master 7.2');
expect(linux).toContain('phalcon.sh 4.0.x 7.2');
linux = await extensions.addExtension('xdebug3', '8.0', 'linux');
expect(linux).toContain(
'sudo $debconf_fix apt-get install -y php8.0-xdebug'
);
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
expect(linux).toContain('phalcon.sh master 7.3');
expect(linux).toContain('phalcon.sh 4.0.x 7.3');
linux = await extensions.addExtension('gearman', '7.0', 'linux');
expect(linux).toContain('gearman.sh 7.0');
linux = await extensions.addExtension('gearman', '7.1', 'linux');
expect(linux).toContain('gearman.sh 7.1');
linux = await extensions.addExtension('gearman', '7.2', 'linux');
expect(linux).toContain('gearman.sh 7.2');
linux = await extensions.addExtension('gearman', '7.3', 'linux');
expect(linux).toContain('gearman.sh 7.3');
linux = await extensions.addExtension('gearman', '7.4', 'linux');
expect(linux).toContain('gearman.sh 7.4');
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(linux).toContain('Platform fedora is not supported');
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
expect(linux).toContain('phalcon.sh phalcon3 7.3');
expect(linux).toContain('phalcon.sh phalcon4 7.3');
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
expect(linux).toContain('ioncube.sh 7.3');
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
expect(linux).toContain('oci.sh oci8 7.3');
expect(linux).toContain('oci.sh pdo_oci 7.3');
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
expect(linux).toContain('blackfire.sh 7.3 blackfire');
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
expect(linux).toContain('blackfire.sh 7.3 blackfire-1.31.0');
});
it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension(
'xdebug, pcov',
'Xdebug, pcov, grpc, protobuf, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
'7.2',
'darwin'
);
expect(darwin).toContain('sudo pecl install xdebug');
expect(darwin).toContain('sudo pecl install pcov');
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('sudo pecl install -f sqlite3');
expect(darwin).toContain('remove_extension intl');
expect(darwin).toContain('add_unstable_extension ast beta extension');
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
darwin = await extensions.addExtension('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('ioncube', '7.3', 'darwin');
expect(darwin).toContain('ioncube.sh 7.3');
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
expect(darwin).toContain('oci.sh oci8 7.3');
expect(darwin).toContain('oci.sh pdo_oci 7.3');
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install pcov');
expect(darwin).toContain('sudo pecl install -f pcov');
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install pcov');
expect(darwin).toContain('add_brew_extension pcov');
darwin = await extensions.addExtension('xdebug', '5.3', 'darwin');
expect(darwin).toContain('sudo pecl install -f xdebug-2.2.7');
darwin = await extensions.addExtension('xdebug', '5.4', 'darwin');
expect(darwin).toContain('sudo pecl install -f xdebug-2.4.1');
darwin = await extensions.addExtension('xdebug', '5.5', 'darwin');
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
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('sudo pecl install xdebug');
expect(darwin).toContain('add_brew_extension xdebug');
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install -f redis');
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('sudo pecl install -f imagick');
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('sudo pecl install -f imagick');
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire');
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire-1.31.0');
darwin = await extensions.addExtension(
'does_not_exist',

View File

@ -10,43 +10,47 @@ jest.mock('../src/install', () => ({
version: string,
os_version: string
): Promise<string> => {
let extension_csv: string = process.env['extension-csv'] || '';
let ini_values_csv: string = process.env['ini-values-csv'] || '';
let coverage_driver: string = process.env['coverage'] || '';
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: string = 'initial script';
let script = 'initial script ' + filename + version + os_version;
if (tools_csv) {
script += 'add_tool';
}
if (extension_csv) {
script += 'install extensions';
}
if (ini_values_csv) {
script += 'edit php.ini';
}
if (coverage_driver) {
script += 'set coverage driver';
}
if (ini_values_csv) {
script += 'edit php.ini';
}
return script;
}
),
run: jest.fn().mockImplementation(
async (): Promise<string> => {
let os_version: string = process.env['RUNNER_OS'] || '';
const os_version: string = process.env['RUNNER_OS'] || '';
let version: string = process.env['php-version'] || '';
let script: string = '';
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
let script = '';
switch (os_version) {
case 'darwin':
script = await install.build(os_version + '.sh', version, os_version);
script += 'sh script.sh ' + version + ' ' + __dirname;
break;
case 'linux':
let pecl: string = process.env['pecl'] || '';
script = await install.build(os_version + '.sh', version, os_version);
script += 'sh script.sh ' + version + ' ' + pecl + ' ' + __dirname;
script += 'bash script.sh ' + version + ' ' + __dirname;
break;
case 'win32':
script = await install.build(os_version + '.sh', version, os_version);
script +=
'pwsh script.ps1 -version ' + version + ' -dir ' + __dirname;
script += 'pwsh script.ps1 ' + version + ' ' + __dirname;
break;
default:
script += os_version + ' is not supported';
@ -65,81 +69,100 @@ jest.mock('../src/install', () => ({
* @param extension_csv
* @param ini_values_csv
* @param coverage_driver
* @param tools
*/
function setEnv(
version: string,
version: string | number,
os: string,
extension_csv: string,
ini_values_csv: string,
coverage_driver: string,
pecl: any
tools: string
): void {
process.env['php-version'] = version;
process.env['php-version'] = version.toString();
process.env['RUNNER_OS'] = os;
process.env['extension-csv'] = extension_csv;
process.env['ini-values-csv'] = ini_values_csv;
process.env['extensions'] = extension_csv;
process.env['ini-values'] = ini_values_csv;
process.env['coverage'] = coverage_driver;
process.env['pecl'] = pecl;
process.env['tools'] = tools;
}
describe('Install', () => {
it('Test install on windows', async () => {
setEnv('7.3', 'win32', '', '', '', '');
// @ts-ignore
let script: string = await install.run();
setEnv('7.0', 'win32', '', '', '', '');
let script: string = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('pwsh script.ps1 -version 7.3 -dir ' + __dirname);
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', '');
// @ts-ignore
script = await install.run();
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 -version 7.3 -dir ' + __dirname);
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
});
it('Test install on linux', async () => {
setEnv('7.3', 'linux', '', '', '', '');
// @ts-ignore
let script: string = await install.run();
expect(script).toContain('initial script');
expect(script).toContain('sh script.sh 7.3 ');
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'true');
// @ts-ignore
script = await install.run();
let script: string = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash script.sh 7.3 ');
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('sh script.sh 7.3 true');
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', true);
// @ts-ignore
script = await install.run();
expect(script).toContain('initial script');
expect(script).toContain('install extensions');
expect(script).toContain('edit php.ini');
expect(script).toContain('set coverage driver');
expect(script).toContain('sh script.sh 7.3 true');
expect(script).toContain('bash script.sh 7.3');
expect(script).toContain('add_tool');
});
it('Test install on darwin', async () => {
setEnv('7.3', 'darwin', '', '', '', '');
// @ts-ignore
let script: string = await install.run();
let script: string = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
expect(script).toContain('bash script.sh 7.3 ' + __dirname);
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '');
// @ts-ignore
script = await install.run();
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('install extensions');
expect(script).toContain('edit php.ini');
expect(script).toContain('set coverage driver');
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
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);
});
});

View File

@ -0,0 +1,41 @@
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(2);
});
it('Test PHPUnit 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);
});
it('Test PHP Regex', async () => {
const regex1 = /^(.*error):\s+\s+(.+) in (.+) on line (\d+)$/;
const regex2 = /^(.*Warning|.*Deprecated|.*Notice):\s+\s+(.+) in (.+) on line (\d+)$/;
expect(
regex1.test('PHP Parse error: error_message in file.php on line 10')
).toBe(true);
expect(
regex2.test('PHP Notice: info_message in file.php on line 10')
).toBe(true);
expect(
regex2.test('PHP Warning: warning_message in file.php on line 10')
).toBe(true);
expect(
regex2.test('PHP Deprecated: deprecated_message in file.php on line 10')
).toBe(true);
});
});

651
__tests__/tools.test.ts Normal file
View File

@ -0,0 +1,651 @@
import * as httpm from '@actions/http-client';
import * as tools from '../src/tools';
httpm.HttpClient.prototype.get = jest.fn().mockImplementation(() => {
return {
message: null,
readBody: jest.fn().mockImplementation(() => {
return JSON.stringify({
stable: [{path: '/composer-stable.phar'}],
preview: [{path: '/composer-preview.phar'}],
snapshot: [{path: '/composer.phar'}],
'1': [{path: '/composer-1.phar'}],
'2': [{path: '/composer-2.phar'}]
});
})
};
});
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('fedora', 'tool')).toContain(
'Platform fedora 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 getPharUri', 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', 'fedora')).toContain(
'Platform fedora 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 getWpCliUri', async () => {
expect(await tools.getWpCliUrl('latest')).toBe(
'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'
);
expect(await tools.getWpCliUrl('2.4.0')).toBe(
'wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar'
);
});
it('checking addArchive', async () => {
let script: string = await tools.addArchive(
'tool',
'1.2.3',
'https://tool.com/tool.phar',
'linux'
);
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
script = await tools.addArchive(
'tool',
'1.2.3',
'https://tool.com/tool.phar',
'darwin'
);
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
script = await tools.addArchive(
'tool',
'1.2.3',
'https://tool.com/tool.phar',
'win32'
);
expect(script).toContain('Add-Tool https://tool.com/tool.phar tool');
script = await tools.addArchive(
'tool',
'1.2.3',
'https://tool.com/tool.phar',
'fedora'
);
expect(script).toContain('Platform fedora 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', 'fedora');
expect(script).toContain('Platform fedora 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/', 'fedora');
expect(script).toContain('Platform fedora is not supported');
});
it('checking addTools on linux', async () => {
const script: string = await tools.addTools(
'blackfire, blackfire-player, cs2pr, flex, php-cs-fixer, phplint, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony, wp-cli',
'7.4',
'linux'
);
expect(script).toContain('add_blackfire');
expect(script).toContain(
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
);
expect(script).toContain(
'add_tool 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_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
);
expect(script).toContain('add_pecl');
expect(script).toContain('add_composertool flex flex symfony/');
expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain('add_composertool phplint phplint overtrue/');
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 listOfTools = [
'blackfire',
'blackfire-player',
'composer-normalize',
'composer-prefetcher:1.2.3',
'composer-require-checker',
'composer-unused',
'cs2pr:1.2.3',
'flex',
'infection',
'phan',
'phan:2.7.2',
'phinx',
'phive:1.2.3',
'php-config',
'phpcbf',
'phpcpd',
'phpcs',
'phpize',
'phpmd',
'psalm',
'symfony',
'symfony:1.2.3',
'vapor-cli',
'wp-cli'
];
const script: string = await tools.addTools(
listOfTools.join(', '),
'7.4',
'darwin'
);
expect(script).toContain('add_blackfire');
expect(script).toContain(
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
);
expect(script).toContain(
'add_tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize'
);
expect(script).toContain(
'add_tool https://github.com/maglnet/ComposerRequireChecker/releases/latest/download/composer-require-checker.phar composer-require-checker'
);
expect(script).toContain(
'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused'
);
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/infection/infection/releases/latest/download/infection.phar infection'
);
expect(script).toContain(
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan'
);
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 vapor-cli vapor-cli laravel/');
expect(script).toContain('add_composertool flex flex symfony/');
expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain(
'add_tool https://github.com/phan/phan/releases/download/2.7.2/phan.phar phan'
);
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_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
);
expect(script).toContain('add_log "$tick" "phpize" "Added"');
expect(script).toContain('add_log "$tick" "php-config" "Added"');
});
it('checking addTools on windows', async () => {
const listOfTools = [
'blackfire',
'blackfire-player:1.8.1',
'codeception',
'cs2pr',
'deployer',
'does_not_exist',
'flex',
'phinx',
'phive:0.13.2',
'php-config',
'phpize',
'phpmd',
'prestissimo',
'symfony',
'wp-cli'
];
const script: string = await tools.addTools(
listOfTools.join(', '),
'7.4',
'win32'
);
expect(script).toContain('Add-Blackfire');
expect(script).toContain(
'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player'
);
expect(script).toContain(
'Add-Tool 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-Composertool flex flex symfony/');
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(
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
);
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 listOfTools = [
'hirak/prestissimo',
'narrowspark/automatic-composer-prefetcher',
'robmorgan/phinx'
];
const script: string = await tools.addTools(
listOfTools.join(', '),
'7.4',
'win32'
);
expect(script).toContain(
'Add-Tool 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 () => {
const listOfTools = ['composer', 'composer:v1'];
let script: string = await tools.addTools(
listOfTools.join(', '),
'7.4',
'linux'
);
expect(script).toContain(
'add_tool https://getcomposer.org/composer-1.phar composer'
);
script = await tools.addTools('composer:preview', '7.4', 'linux');
expect(script).toContain(
'add_tool 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://getcomposer.org/composer.phar composer'
);
});
});

View File

@ -27,48 +27,53 @@ describe('Utils tests', () => {
});
it('checking asyncForEach', async () => {
let array: Array<number> = [1, 2, 3, 4];
let sum: number = 0;
await utils.asyncForEach(array, function(num: number): void {
sum += num;
const array: Array<string> = ['a', 'b', 'c'];
let concat = '';
await utils.asyncForEach(array, async function (
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 () => {
let rc: string = fs.readFileSync(
path.join(__dirname, '../src/scripts/7.4.sh'),
'utf8'
);
let darwin: string = fs.readFileSync(
const darwin: string = fs.readFileSync(
path.join(__dirname, '../src/scripts/darwin.sh'),
'utf8'
);
let linux: string = fs.readFileSync(
const linux: string = fs.readFileSync(
path.join(__dirname, '../src/scripts/linux.sh'),
'utf8'
);
let win32: string = fs.readFileSync(
const win32: string = fs.readFileSync(
path.join(__dirname, '../src/scripts/win32.ps1'),
'utf8'
);
expect(await utils.readScript('darwin.sh', '7.4', 'darwin')).toBe(rc);
expect(await utils.readScript('darwin.sh', '7.3', 'darwin')).toBe(darwin);
expect(await utils.readScript('linux.sh', '7.4', 'linux')).toBe(linux);
expect(await utils.readScript('linux.sh', '7.3', 'linux')).toBe(linux);
expect(await utils.readScript('win32.ps1', '7.4', 'win32')).toBe(win32);
expect(await utils.readScript('win32.ps1', '7.3', 'win32')).toBe(win32);
expect(await utils.readScript('fedora.sh', '7.3', 'fedora')).toContain(
'Platform fedora is not supported'
);
expect(await utils.readScript('darwin.sh')).toBe(darwin);
expect(await utils.readScript('darwin.sh')).toBe(darwin);
expect(await utils.readScript('linux.sh')).toBe(linux);
expect(await utils.readScript('linux.sh')).toBe(linux);
expect(await utils.readScript('win32.ps1')).toBe(win32);
expect(await utils.readScript('win32.ps1')).toBe(win32);
});
it('checking writeScripts', async () => {
let testString: string = 'sudo apt-get install php';
let runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || '';
let script_path: string = path.join(runner_dir, 'test.sh');
const testString = 'sudo apt-get install php';
const runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || '';
const script_path: string = path.join(runner_dir, 'test.sh');
await utils.writeScript('test.sh', testString);
await fs.readFile(script_path, function(error: any, data: Buffer) {
await fs.readFile(script_path, function (
error: Error | null,
data: Buffer
) {
expect(testString).toBe(data.toString());
});
await cleanup(script_path);
@ -87,17 +92,17 @@ describe('Utils tests', () => {
});
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',
'b=2',
'c=3'
]);
expect(await utils.INIArray('')).toEqual([]);
expect(await utils.INIArray(' ')).toEqual([]);
expect(await utils.CSVArray('')).toEqual([]);
expect(await utils.CSVArray(' ')).toEqual([]);
});
it('checking log', async () => {
let message: string = 'Test message';
const message = 'Test message';
let warning_log: string = await utils.log(message, 'win32', 'warning');
expect(warning_log).toEqual('printf "\\033[33;1m' + message + ' \\033[0m"');
@ -150,6 +155,7 @@ describe('Utils tests', () => {
);
expect(await utils.getExtensionPrefix('xsl')).toEqual('extension');
expect(await utils.getExtensionPrefix('xdebug')).toEqual('zend_extension');
expect(await utils.getExtensionPrefix('xdebug3')).toEqual('zend_extension');
expect(await utils.getExtensionPrefix('opcache')).toEqual('zend_extension');
});

View File

@ -1,24 +1,26 @@
name: 'Setup PHP Action'
author: shivammathur
description: 'GitHub action to setup PHP with required extensions, php.ini configuration, code-coverage support and composer'
description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer'
branding:
color: 'purple'
icon: 'play-circle'
inputs:
php-version:
description: 'PHP version you want to install.'
description: 'Setup PHP version.'
default: '7.4'
required: true
extension-csv:
description: '(Optional) PHP extensions you want to install.'
extensions:
description: 'Setup PHP extensions.'
required: false
ini-values-csv:
description: '(Optional) Custom values you want to set in php.ini.'
ini-values:
description: 'Add values to php.ini.'
required: false
coverage:
description: '(Optional) Code coverage driver you want to install. (Accepts: xdebug, pcov and none)'
description: 'Setup code coverage driver.'
required: false
pecl:
description: '(Optional) Setup PECL on ubuntu'
tools:
description: 'Setup popular tools globally.'
required: false
runs:
using: 'node12'
main: 'lib/install.js'
main: 'dist/index.js'

4107
dist/index.js vendored Normal file

File diff suppressed because it is too large Load Diff

32
examples/bedrock.yml Normal file
View 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@v2 #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

View File

@ -0,0 +1,31 @@
# GitHub Action for Blackfire Player
name: Play a Blackfire Scenario
on: [push, pull_request]
jobs:
blackfire-player:
name: Blackfire (PHP ${{ matrix.php-versions }})
# Add your Blackfire credentials securely using GitHub Secrets
env:
BLACKFIRE_SERVER_ID: ${{ secrets.BLACKFIRE_SERVER_ID }}
BLACKFIRE_SERVER_TOKEN: ${{ secrets.BLACKFIRE_SERVER_TOKEN }}
BLACKFIRE_CLIENT_ID: ${{ secrets.BLACKFIRE_CLIENT_ID }}
BLACKFIRE_CLIENT_TOKEN: ${{ secrets.BLACKFIRE_CLIENT_TOKEN }}
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']
# blackfire-player supports PHP >= 5.5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: blackfire
tools: blackfire, blackfire-player #Setup Blackfire client, agent and player
coverage: none
- name: Play the scenario
run: blackfire-player run scenario.bkf # Refer to https://blackfire.io/docs/player/index#usage

31
examples/blackfire.yml Normal file
View File

@ -0,0 +1,31 @@
# GitHub Action for Blackfire
name: Profiling with blackfire
on: [push, pull_request]
jobs:
blackfire:
name: Blackfire (PHP ${{ matrix.php-versions }})
# Add your Blackfire credentials securely using GitHub Secrets
env:
BLACKFIRE_SERVER_ID: ${{ secrets.BLACKFIRE_SERVER_ID }}
BLACKFIRE_SERVER_TOKEN: ${{ secrets.BLACKFIRE_SERVER_TOKEN }}
BLACKFIRE_CLIENT_ID: ${{ secrets.BLACKFIRE_CLIENT_ID }}
BLACKFIRE_CLIENT_TOKEN: ${{ secrets.BLACKFIRE_CLIENT_TOKEN }}
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']
# Blackfire supports PHP >= 5.3 on ubuntu and macos and PHP >= 5.4 on windows
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: blackfire
tools: blackfire #Setup Blackfire client and agent
coverage: none
- name: Profile
run: blackfire run php my-script.php # Refer to https://blackfire.io/docs/cookbooks/profiling-cli

114
examples/cakephp-mysql.yml Normal file
View 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@v2
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@v2
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@v2
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/

View 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@v2
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@v2
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@v2
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
View 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@v2 #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@v2
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@v2
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/

View File

@ -4,21 +4,31 @@ on: [push, pull_request]
jobs:
build:
strategy:
max-parallel: 6
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.2', '7.3']
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@master
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl, curl, dom
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 --no-suggest --prefer-dist --optimize-autoloader
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Test with phpunit
run: vendor/bin/phpunit --coverage-text

View File

@ -21,7 +21,7 @@ jobs:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: laravel
ports:
- 3306
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
@ -30,20 +30,32 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, mysql
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 --no-suggest --prefer-dist --optimize-autoloader
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.example', '.env');"
@ -54,7 +66,9 @@ jobs:
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'] }}
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}

View File

@ -32,20 +32,30 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, pgsql
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 --no-suggest --prefer-dist --optimize-autoloader
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.example', '.env');"
@ -56,7 +66,9 @@ jobs:
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] }}
DB_PORT: ${{ job.services.postgres.ports[5432] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}

View File

@ -7,21 +7,31 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
max-parallel: 6
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.2', '7.3']
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo
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 --no-suggest --prefer-dist --optimize-autoloader
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.example', '.env');"

View File

@ -21,7 +21,7 @@ jobs:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: lumen
ports:
- 3306
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
@ -30,21 +30,33 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['7.2', '7.3']
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, mysql
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 --no-suggest --prefer-dist --optimize-autoloader
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');"
@ -54,7 +66,9 @@ jobs:
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'] }}
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}

View File

@ -32,21 +32,31 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['7.2', '7.3']
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, pgsql
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 --no-suggest --prefer-dist --optimize-autoloader
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');"
@ -56,7 +66,9 @@ jobs:
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'] }}

View File

@ -7,21 +7,31 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
max-parallel: 9
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.2', '7.3']
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, mysql
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 --no-suggest --prefer-dist --optimize-autoloader
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

View File

@ -24,24 +24,38 @@ jobs:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: phalcon
ports:
- 3306
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
max-parallel: 3
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@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
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 --no-suggest --prefer-dist --optimize-autoloader
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

View File

@ -29,20 +29,32 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
strategy:
fail-fast: false
max-parallel: 3
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@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
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 --no-suggest --prefer-dist --optimize-autoloader
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

57
examples/sage.yml Normal file
View 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@v2 #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

View File

@ -4,21 +4,31 @@ on: [push, pull_request]
jobs:
build:
strategy:
max-parallel: 6
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.2', '7.3']
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@master
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, simplexml, dom
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 --no-suggest --prefer-dist --optimize-autoloader
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Test with phpunit
run: vendor/bin/phpunit --coverage-text

View File

@ -13,25 +13,37 @@ jobs:
MYSQL_ROOT_PASSWORD: symfony
MYSQL_DATABASE: symfony
ports:
- 3306
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['7.3']
php-versions: ['7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, xml, ctype, iconv, mysql
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 --no-suggest --prefer-dist --optimize-autoloader
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run Migration
run: |
composer require symfony/orm-pack
@ -40,6 +52,4 @@ jobs:
env:
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
- name: Run Tests
run: |
composer require phpunit
php bin/phpunit --coverage-text
run: php bin/phpunit --coverage-text

View File

@ -17,21 +17,31 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['7.3']
php-versions: ['7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, xml, ctype, iconv, pgsql
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 --no-suggest --prefer-dist --optimize-autoloader
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run Migration
run: |
composer require symfony/orm-pack
@ -40,6 +50,4 @@ jobs:
env:
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
- name: Run Tests
run: |
composer require phpunit
php bin/phpunit --coverage-text
run: php bin/phpunit --coverage-text

View File

@ -7,24 +7,32 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
max-parallel: 3
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.3']
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, xml, ctype, iconv
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 --no-suggest --prefer-dist --optimize-autoloader
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run Tests
run: |
composer require phpunit
php bin/phpunit --coverage-text
run: php bin/phpunit --coverage-text

View File

@ -19,28 +19,40 @@ jobs:
MYSQL_ROOT_PASSWORD: yii
MYSQL_DATABASE: yii
ports:
- 3306
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Set Node.js 10.x
uses: actions/setup-node@master
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl, gd, imagick, zip, dom, mysql
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 --no-suggest --prefer-dist --optimize-autoloader
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.dist', '.env');"

View File

@ -23,24 +23,34 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Set Node.js 10.x
uses: actions/setup-node@master
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl, gd, imagick, zip, dom, pgsql
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 --no-suggest --prefer-dist --optimize-autoloader
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.dist', '.env');"

View File

@ -4,23 +4,33 @@ on: [push, pull_request]
jobs:
build:
strategy:
max-parallel: 6
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.2', '7.3']
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@master
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, bcmath, curl, intl
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 --no-suggest --prefer-dist --optimize-autoloader
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

View File

@ -9,4 +9,4 @@ module.exports = {
},
verbose: true,
collectCoverage: true
};
};

View File

@ -1,93 +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"));
/**
* Function to add custom ini values
*
* @param ini_values_csv
* @param os_version
*/
function addINIValues(ini_values_csv, os_version, no_step = false) {
return __awaiter(this, void 0, void 0, function* () {
let script = '\n';
switch (no_step) {
case true:
script +=
(yield utils.stepLog('Add php.ini values', os_version)) +
(yield utils.suppressOutput(os_version)) +
'\n';
break;
case false:
default:
script += (yield utils.stepLog('Add php.ini values', os_version)) + '\n';
break;
}
switch (os_version) {
case 'win32':
return script + (yield addINIValuesWindows(ini_values_csv));
case 'darwin':
case 'linux':
return script + (yield addINIValuesUnix(ini_values_csv));
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.addINIValues = addINIValues;
/**
* 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 ini_values = yield utils.INIArray(ini_values_csv);
let script = '\n';
yield utils.asyncForEach(ini_values, function (line) {
return __awaiter(this, void 0, void 0, function* () {
script +=
(yield utils.addLog('$tick', line, 'Added to php.ini', 'linux')) + '\n';
});
});
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + 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 ini_values = yield utils.INIArray(ini_values_csv);
let script = '\n';
yield utils.asyncForEach(ini_values, function (line) {
return __awaiter(this, void 0, void 0, function* () {
script +=
(yield utils.addLog('$tick', line, 'Added to php.ini', 'win32')) + '\n';
});
});
return ('Add-Content C:\\tools\\php\\php.ini "' +
ini_values.join('\n') +
'"' +
script);
});
}
exports.addINIValuesWindows = addINIValuesWindows;

View File

@ -1,151 +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 extensions = __importStar(require("./extensions"));
const config = __importStar(require("./config"));
/**
* Function to set coverage driver
*
* @param coverage_driver
* @param version
* @param os_version
*/
function addCoverage(coverage_driver, version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
coverage_driver.toLowerCase();
let script = '\n' + (yield utils.stepLog('Setup Coverage', os_version));
switch (coverage_driver) {
case 'pcov':
return script + (yield addCoveragePCOV(version, os_version));
case 'xdebug':
return script + (yield addCoverageXdebug(version, os_version));
case 'none':
return script + (yield disableCoverage(version, os_version));
default:
return '';
}
});
}
exports.addCoverage = addCoverage;
/**
* Function to setup Xdebug
*
* @param version
* @param os_version
*/
function addCoverageXdebug(version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
return ((yield extensions.addExtension('xdebug', version, os_version, true)) +
(yield utils.suppressOutput(os_version)) +
'\n' +
(yield utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version)));
});
}
exports.addCoverageXdebug = addCoverageXdebug;
/**
* Function to setup PCOV
*
* @param version
* @param os_version
*/
function addCoveragePCOV(version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
let script = '\n';
switch (version) {
default:
script +=
(yield extensions.addExtension('pcov', version, os_version, true)) +
(yield utils.suppressOutput(os_version)) +
'\n';
script +=
(yield config.addINIValues('pcov.enabled=1', os_version, true)) + '\n';
// add command to disable xdebug and enable pcov
switch (os_version) {
case 'linux':
script +=
'if [ -e /etc/php/' +
version +
'/mods-available/xdebug.ini ]; then sudo phpdismod -v ' +
version +
' xdebug; fi\n';
script += 'sudo sed -i "/xdebug/d" $ini_file\n';
break;
case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n';
break;
case 'win32':
script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n';
break;
}
// success
script += yield utils.addLog('$tick', 'coverage: pcov', 'PCOV enabled as coverage driver', os_version);
// version is not supported
break;
case '5.6':
case '7.0':
script += yield utils.addLog('$cross', 'pcov', 'PHP 7.1 or newer is required', os_version);
break;
}
return script;
});
}
exports.addCoveragePCOV = addCoveragePCOV;
/**
* Function to disable Xdebug and PCOV
*
* @param version
* @param os_version
*/
function disableCoverage(version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
let script = '\n';
switch (os_version) {
case 'linux':
script +=
'if [ -e /etc/php/' +
version +
'/mods-available/xdebug.ini ]; then sudo phpdismod -v ' +
version +
' xdebug; fi\n';
script +=
'if [ -e /etc/php/' +
version +
'/mods-available/pcov.ini ]; then sudo phpdismod -v ' +
version +
' pcov; fi\n';
script += 'sudo sed -i "/xdebug/d" $ini_file\n';
script += 'sudo sed -i "/pcov/d" $ini_file\n';
break;
case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n';
script += 'sudo sed -i \'\' "/pcov/d" $ini_file\n';
break;
case 'win32':
script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n';
script +=
'if(php -m | findstr -i pcov) { Disable-PhpExtension pcov C:\\tools\\php }\n';
break;
}
script += yield utils.addLog('$tick', 'none', 'Disabled Xdebug and PCOV', os_version);
return script;
});
}
exports.disableCoverage = disableCoverage;

View File

@ -1,192 +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 path = __importStar(require("path"));
const utils = __importStar(require("./utils"));
/**
* Install and enable extensions
*
* @param extension_csv
* @param version
* @param os_version
* @param log_prefix
*/
function addExtension(extension_csv, version, os_version, no_step = false) {
return __awaiter(this, void 0, void 0, function* () {
let script = '\n';
switch (no_step) {
case true:
script +=
(yield utils.stepLog('Setup Extensions', os_version)) +
(yield utils.suppressOutput(os_version));
break;
case false:
default:
script += yield utils.stepLog('Setup Extensions', os_version);
break;
}
switch (os_version) {
case 'win32':
return script + (yield addExtensionWindows(extension_csv, version));
case 'darwin':
return script + (yield addExtensionDarwin(extension_csv, version));
case 'linux':
return script + (yield addExtensionLinux(extension_csv, version));
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.addExtension = addExtension;
/**
* Install and enable extensions for darwin
*
* @param extension_csv
* @param version
*/
function addExtensionDarwin(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* () {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php
let install_command = '';
switch (version + extension) {
case '5.6xdebug':
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
break;
default:
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
break;
}
script +=
'\nadd_extension ' +
extension +
' "' +
install_command +
'" ' +
(yield utils.getExtensionPrefix(extension));
});
});
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* () {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php
let install_command = '';
switch (version + extension) {
case '7.4xdebug':
const extension_url = 'https://xdebug.org/files/php_xdebug-2.8.0-7.4-vc15.dll';
install_command =
'Invoke-WebRequest -Uri ' +
extension_url +
' -OutFile C:\\tools\\php\\ext\\php_xdebug.dll\n';
install_command += 'Enable-PhpExtension xdebug';
break;
case '7.2xdebug':
default:
install_command = 'Install-PhpExtension ' + extension;
break;
}
script +=
'\nAdd-Extension ' +
extension +
' "' +
install_command +
'" ' +
(yield utils.getExtensionPrefix(extension));
});
});
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* () {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php
let install_command = '';
switch (version + extension) {
case '7.2phalcon3':
case '7.3phalcon3':
install_command =
'sh ' +
path.join(__dirname, '../src/scripts/phalcon.sh') +
' master ' +
version +
' >/dev/null 2>&1';
break;
case '7.2phalcon4':
case '7.3phalcon4':
case '7.4phalcon4':
install_command =
'sh ' +
path.join(__dirname, '../src/scripts/phalcon.sh') +
' 4.0.x ' +
version +
' >/dev/null 2>&1';
break;
default:
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
version +
'-' +
extension.replace('pdo_', '').replace('pdo-', '') +
' >/dev/null 2>&1 || sudo pecl install ' +
extension +
' >/dev/null 2>&1';
break;
}
script +=
'\nadd_extension ' +
extension +
' "' +
install_command +
'" ' +
(yield utils.getExtensionPrefix(extension));
});
});
return script;
});
}
exports.addExtensionLinux = addExtensionLinux;

View File

@ -1,85 +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 config = __importStar(require("./config"));
const coverage = __importStar(require("./coverage"));
const extensions = __importStar(require("./extensions"));
const utils = __importStar(require("./utils"));
/**
* Build the script
*
* @param filename
* @param version
* @param os_version
*/
function build(filename, version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
// taking inputs
let extension_csv = yield utils.getInput('extension-csv', false);
let ini_values_csv = yield utils.getInput('ini-values-csv', false);
let coverage_driver = yield utils.getInput('coverage', false);
let script = yield utils.readScript(filename, version, os_version);
if (extension_csv) {
script += yield extensions.addExtension(extension_csv, version, os_version);
}
if (ini_values_csv) {
script += yield config.addINIValues(ini_values_csv, os_version);
}
if (coverage_driver) {
script += yield coverage.addCoverage(coverage_driver, version, os_version);
}
return yield utils.writeScript(filename, script);
});
}
exports.build = build;
/**
* Run the script
*/
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
let os_version = process.platform;
let version = yield utils.getInput('php-version', true);
// check the os version and run the respective script
let script_path = '';
switch (os_version) {
case 'darwin':
script_path = yield build(os_version + '.sh', version, os_version);
yield exec_1.exec('sh ' + script_path + ' ' + version + ' ' + __dirname);
break;
case 'linux':
let pecl = yield utils.getInput('pecl', false);
script_path = yield build(os_version + '.sh', version, os_version);
yield exec_1.exec('sh ' + script_path + ' ' + version + ' ' + pecl);
break;
case 'win32':
script_path = yield build('win32.ps1', version, os_version);
yield exec_1.exec('pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname);
break;
}
}
catch (error) {
core.setFailed(error.message);
}
});
}
exports.run = run;
// call the run function
run();

View File

@ -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/json.php?package=' + extension);
return response.message.statusCode === 200;
});
}
exports.checkPECLExtension = checkPECLExtension;

View File

@ -1,242 +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 to get inputs from both with and env annotations.
*
* @param name
* @param mandatory
*/
function getInput(name, mandatory) {
return __awaiter(this, void 0, void 0, function* () {
let input = process.env[name];
switch (input) {
case '':
case undefined:
return core.getInput(name, { required: mandatory });
default:
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* () {
switch (os_version) {
case 'darwin':
switch (version) {
case '7.4':
return fs.readFileSync(path.join(__dirname, '../src/scripts/7.4.sh'), 'utf8');
}
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
case 'linux':
case 'win32':
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
default:
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.readScript = readScript;
/**
* Write final script which runs
*
* @param filename
* @param version
* @param script
*/
function writeScript(filename, script) {
return __awaiter(this, void 0, void 0, function* () {
let runner_dir = yield getInput('RUNNER_TOOL_CACHE', false);
let script_path = path.join(runner_dir, filename);
fs.writeFileSync(script_path, script, { mode: 0o755 });
return script_path;
});
}
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* () {
switch (extension_csv) {
case '':
case ' ':
return [];
default:
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* () {
switch (ini_values_csv) {
case '':
case ' ':
return [];
default:
return ini_values_csv.split(',').map(function (ini_value) {
return ini_value.trim();
});
}
});
}
exports.INIArray = INIArray;
/**
* Function to log a step
*
* @param message
* @param os_version
*/
function stepLog(message, os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'win32':
return 'Step-Log "' + message + '"';
case 'linux':
case 'darwin':
return 'step_log "' + message + '"';
default:
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.stepLog = stepLog;
/**
* Function to log a result
* @param mark
* @param subject
* @param message
*/
function addLog(mark, subject, message, os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'win32':
return 'Add-Log "' + mark + '" "' + subject + '" "' + message + '"';
case 'linux':
case 'darwin':
return 'add_log "' + mark + '" "' + subject + '" "' + message + '"';
default:
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.addLog = addLog;
/**
* Log to console
*
* @param message
* @param os_version
* @param log_type
* @param prefix
*/
function log(message, os_version, log_type) {
return __awaiter(this, void 0, void 0, function* () {
const color = {
error: '31',
success: '32',
warning: '33'
};
switch (os_version) {
case 'win32':
return ('printf "\\033[' + color[log_type] + ';1m' + message + ' \\033[0m"');
case 'linux':
case 'darwin':
default:
return 'echo "\\033[' + color[log_type] + ';1m' + message + '\\033[0m"';
}
});
}
exports.log = log;
/**
* Function to get prefix required to load an extension.
*
* @param extension
*/
function getExtensionPrefix(extension) {
return __awaiter(this, void 0, void 0, function* () {
let zend = ['xdebug', 'opcache', 'ioncube', 'eaccelerator'];
switch (zend.indexOf(extension)) {
case 0:
case 1:
return 'zend_extension';
case -1:
default:
return 'extension';
}
});
}
exports.getExtensionPrefix = getExtensionPrefix;
/**
* Function to get the suffix to suppress console output
*
* @param os_version
*/
function suppressOutput(os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'win32':
return ' >$null 2>&1';
case 'linux':
case 'darwin':
return ' >/dev/null 2>&1';
default:
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.suppressOutput = suppressOutput;

140
node_modules/@actions/core/README.md generated vendored
View File

@ -1,140 +0,0 @@
# `@actions/core`
> Core functions for setting results, logging, registering secrets and exporting variables across actions
## Usage
### Import the package
```js
// javascript
const core = require('@actions/core');
// typescript
import * as core from '@actions/core';
```
#### Inputs/Outputs
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
```js
const myInput = core.getInput('inputName', { required: true });
core.setOutput('outputKey', 'outputVal');
```
#### Exporting variables
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
```js
core.exportVariable('envVar', 'Val');
```
#### Setting a secret
Setting a secret registers the secret with the runner to ensure it is masked in logs.
```js
core.setSecret('myPassword');
```
#### PATH Manipulation
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
```js
core.addPath('/path/to/mytool');
```
#### Exit codes
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
```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}`);
}
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
```
#### 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
})
```
#### Action state
You can use this library to save state and get state for sharing information between a given wrapper action:
**action.yml**
```yaml
name: 'Wrapper action sample'
inputs:
name:
default: 'GitHub'
runs:
using: 'node12'
main: 'main.js'
post: 'cleanup.js'
```
In action's `main.js`:
```js
const core = require('@actions/core');
core.saveState("pidToKill", 12345);
```
In action's `cleanup.js`:
```js
const core = require('@actions/core');
var pid = core.getState("pidToKill");
process.kill(pid);
```

View File

@ -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 {};

View File

@ -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_STRING = '::';
class Command {
constructor(command, properties, message) {
if (!command) {
command = 'missing.command';
}
this.command = command;
this.properties = properties;
this.message = message;
}
toString() {
let cmdStr = CMD_STRING + 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 += CMD_STRING;
// 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

View File

@ -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,IAAI,CAAA;AAEvB,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,UAAU,CAAA;QAEpB,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"}

View File

@ -1,112 +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;
/**
* Registers a secret which will get masked from logs
* @param secret value of the secret
*/
export declare function setSecret(secret: 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;
/**
* Writes info to log with console.log.
* @param message info message
*/
export declare function info(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>;
/**
* Saves state for current action, the state can only be retrieved by this action's post job execution.
*
* @param name name of the state to store
* @param value value to store
*/
export declare function saveState(name: string, value: string): void;
/**
* Gets the value of an state set by this action's main execution.
*
* @param name name of the state to get
* @returns string
*/
export declare function getState(name: string): string;

View File

@ -1,195 +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 os = require("os");
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;
/**
* Registers a secret which will get masked from logs
* @param secret value of the secret
*/
function setSecret(secret) {
command_1.issueCommand('add-mask', {}, secret);
}
exports.setSecret = setSecret;
/**
* 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(/ /g, '_').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;
/**
* Writes info to log with console.log.
* @param message info message
*/
function info(message) {
process.stdout.write(message + os.EOL);
}
exports.info = info;
/**
* 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;
//-----------------------------------------------------------------------
// Wrapper action state
//-----------------------------------------------------------------------
/**
* Saves state for current action, the state can only be retrieved by this action's post job execution.
*
* @param name name of the state to store
* @param value value to store
*/
function saveState(name, value) {
command_1.issueCommand('save-state', { name }, value);
}
exports.saveState = saveState;
/**
* Gets the value of an state set by this action's main execution.
*
* @param name name of the state to get
* @returns string
*/
function getState(name) {
return process.env[`STATE_${name}`] || '';
}
exports.getState = getState;
//# sourceMappingURL=core.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,yBAAwB;AACxB,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;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;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,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,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;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;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;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;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;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}

View File

@ -1,67 +0,0 @@
{
"_args": [
[
"@actions/core@1.2.0",
"E:\\python\\setup-php"
]
],
"_from": "@actions/core@1.2.0",
"_id": "@actions/core@1.2.0",
"_inBundle": false,
"_integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==",
"_location": "/@actions/core",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@actions/core@1.2.0",
"name": "@actions/core",
"escapedName": "@actions%2fcore",
"scope": "@actions",
"rawSpec": "1.2.0",
"saveSpec": null,
"fetchSpec": "1.2.0"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz",
"_spec": "1.2.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"
],
"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",
"directory": "packages/core"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"version": "1.2.0"
}

View File

@ -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
View File

@ -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']);
```

View File

@ -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>;

View File

@ -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

View File

@ -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"}

View File

@ -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;
};
}

View File

@ -1,3 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interfaces.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}

View File

@ -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[];

View File

@ -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

File diff suppressed because one or more lines are too long

View File

@ -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": [
"/"
],
"_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"
}

9
node_modules/fs/README.md generated vendored
View File

@ -1,9 +0,0 @@
# Security holding package
This package name is not currently in use, but was formerly occupied
by another package. To avoid malicious use, npm is hanging on to the
package name, but loosely, and we'll probably give it to you if you
want it.
You may adopt this package by contacting support@npmjs.com and
requesting the name.

48
node_modules/fs/package.json generated vendored
View File

@ -1,48 +0,0 @@
{
"_args": [
[
"fs@0.0.1-security",
"E:\\python\\setup-php"
]
],
"_from": "fs@0.0.1-security",
"_id": "fs@0.0.1-security",
"_inBundle": false,
"_integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=",
"_location": "/fs",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "fs@0.0.1-security",
"name": "fs",
"escapedName": "fs",
"rawSpec": "0.0.1-security",
"saveSpec": null,
"fetchSpec": "0.0.1-security"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"_spec": "0.0.1-security",
"_where": "E:\\python\\setup-php",
"author": "",
"bugs": {
"url": "https://github.com/npm/security-holder/issues"
},
"description": "This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.",
"homepage": "https://github.com/npm/security-holder#readme",
"keywords": [],
"license": "ISC",
"main": "index.js",
"name": "fs",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/security-holder.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.0.1-security"
}

6277
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,15 @@
{
"name": "setup-php",
"version": "1.5.3",
"version": "2.4.0",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "lib/setup-php.js",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"format": "prettier --write **/*.ts",
"lint": "eslint **/*.ts --cache",
"format": "prettier --write **/*.ts && git add .",
"format-check": "prettier --check **/*.ts",
"release": "ncc build src/install.ts -o dist && git add -f dist/",
"test": "jest"
},
"repository": {
@ -22,24 +24,34 @@
"author": "shivammathur",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/exec": "^1.0.1",
"@actions/core": "^1.2.4",
"@actions/exec": "^1.0.4",
"@actions/http-client": "^1.0.8",
"@actions/io": "^1.0.2",
"fs": "0.0.1-security"
},
"devDependencies": {
"@types/jest": "^24.0.21",
"@types/node": "^12.12.0",
"husky": "^3.0.9",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"prettier": "^1.17.1",
"ts-jest": "^24.1.0",
"typescript": "^3.6.4"
"@types/jest": "^26.0.5",
"@types/node": "^14.0.23",
"@typescript-eslint/eslint-plugin": "^3.6.1",
"@typescript-eslint/parser": "^3.6.1",
"@zeit/ncc": "^0.22.3",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.18.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.2.5",
"jest": "^26.1.0",
"jest-circus": "^26.1.0",
"prettier": "^2.0.5",
"ts-jest": "^26.1.3",
"typescript": "^3.9.7"
},
"husky": {
"skipCI": true,
"hooks": {
"pre-commit": "npm run build && npm run format"
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
}
}
}

View File

@ -1,17 +1,54 @@
import * as utils from './utils';
/**
* Add script to set custom ini values for unix
*
* @param ini_values_csv
*/
export async function addINIValuesUnix(
ini_values_csv: string
): Promise<string> {
const ini_values: Array<string> = await utils.CSVArray(ini_values_csv);
let script = '';
await utils.asyncForEach(ini_values, async function (line: string) {
script +=
'\n' + (await utils.addLog('$tick', line, 'Added to php.ini', 'linux'));
});
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + script;
}
/**
* Add script to set custom ini values for windows
*
* @param ini_values_csv
*/
export async function addINIValuesWindows(
ini_values_csv: string
): Promise<string> {
const ini_values: Array<string> = await utils.CSVArray(ini_values_csv);
let script = '\n';
await utils.asyncForEach(ini_values, async function (line: string) {
script +=
(await utils.addLog('$tick', line, 'Added to php.ini', 'win32')) + '\n';
});
return (
'Add-Content "$php_dir\\php.ini" "' + ini_values.join('\n') + '"' + script
);
}
/**
* Function to add custom ini values
*
* @param ini_values_csv
* @param os_version
* @param no_step
*/
export async function addINIValues(
ini_values_csv: string,
os_version: string,
no_step = false
): Promise<string> {
let script: string = '\n';
let script = '\n';
switch (no_step) {
case true:
script +=
@ -38,42 +75,3 @@ export async function addINIValues(
);
}
}
/**
* Add script to set custom ini values for unix
*
* @param ini_values_csv
*/
export async function addINIValuesUnix(
ini_values_csv: string
): Promise<string> {
let ini_values: Array<string> = await utils.INIArray(ini_values_csv);
let script: string = '\n';
await utils.asyncForEach(ini_values, async function(line: string) {
script +=
(await utils.addLog('$tick', line, 'Added to php.ini', 'linux')) + '\n';
});
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + script;
}
/**
* Add script to set custom ini values for windows
*
* @param ini_values_csv
*/
export async function addINIValuesWindows(
ini_values_csv: string
): Promise<string> {
let ini_values: Array<string> = await utils.INIArray(ini_values_csv);
let script: string = '\n';
await utils.asyncForEach(ini_values, async function(line: string) {
script +=
(await utils.addLog('$tick', line, 'Added to php.ini', 'win32')) + '\n';
});
return (
'Add-Content C:\\tools\\php\\php.ini "' +
ini_values.join('\n') +
'"' +
script
);
}

View File

@ -1,58 +0,0 @@
variants:
dev:
bcmath:
calendar:
cli:
ctype:
dom:
fileinfo:
filter:
ipc:
iconv:
json:
mbregex:
mbstring:
mhash:
mcrypt:
pcntl:
pcre:
pdo:
phar:
posix:
sockets:
tokenizer:
xml:
curl:
openssl:
zip:
gd:
- --with-freetype
- --with-pdo-mysql=mysqlnd
- --with-mysqli=mysqlnd
- --with-pgsql
- --with-pdo-pgsql
- --with-gmp=/usr/local/opt/gmp
- --with-openssl
- --with-pear
- --with-zip
- --with-libxml
- --with-kerberos
- --with-gd
- --with-ffi
- --with-curl
- --with-mhash
- --with-readline=/usr/local/opt/readline
- --with-iconv=/usr/local/opt/libiconv
- --with-icu-dir=/usr/local/opt/icu4c
- --with-config-file-path=/etc
- --enable-intl
- --enable-xml
- --enable-sysvsem
- --enable-sysvshm
- --enable-sysvmsg
- --enable-phpdbg
- --enable-exif
- --enable-gd
- --enable-soap
- --enable-xmlreader
- --enable-zend-test=shared

29
src/configs/php.json Normal file
View File

@ -0,0 +1,29 @@
{
"problemMatcher": [
{
"owner": "php_native_error",
"severity": "error",
"pattern": [
{
"regexp": "^(.*error):\\s+\\s+(.+) in (.+) on line (\\d+)$",
"code": 1,
"message": 2,
"file": 3,
"line": 4
}
]
}, {
"owner": "php_native_warning",
"severity": "warning",
"pattern": [
{
"regexp": "^(.*Warning|.*Deprecated|.*Notice):\\s+\\s+(.+) in (.+) on line (\\d+)$",
"code": 1,
"message": 2,
"file": 3,
"line": 4
}
]
}
]
}

24
src/configs/phpunit.json Normal file
View File

@ -0,0 +1,24 @@
{
"problemMatcher": [
{
"owner": "phpunit",
"pattern": [
{
"regexp": "^\\d+\\)\\s.*$"
},
{
"regexp": "^(.*Failed\\sasserting\\sthat.*)$",
"message": 1
},
{
"regexp": "^\\s*$"
},
{
"regexp": "^(.*):(\\d+)$",
"file": 1,
"line": 2
}
]
}
]
}

View File

@ -2,51 +2,42 @@ import * as utils from './utils';
import * as extensions from './extensions';
import * as config from './config';
/**
* Function to set coverage driver
*
* @param coverage_driver
* @param version
* @param os_version
*/
export async function addCoverage(
coverage_driver: string,
version: string,
os_version: string
): Promise<string> {
coverage_driver.toLowerCase();
let script: string =
'\n' + (await utils.stepLog('Setup Coverage', os_version));
switch (coverage_driver) {
case 'pcov':
return script + (await addCoveragePCOV(version, os_version));
case 'xdebug':
return script + (await addCoverageXdebug(version, os_version));
case 'none':
return script + (await disableCoverage(version, os_version));
default:
return '';
}
}
/**
* Function to setup Xdebug
*
* @param extension
* @param version
* @param os_version
* @param pipe
*/
export async function addCoverageXdebug(version: string, os_version: string) {
return (
(await extensions.addExtension('xdebug', version, os_version, true)) +
(await utils.suppressOutput(os_version)) +
'\n' +
(await utils.addLog(
'$tick',
'xdebug',
'Xdebug enabled as coverage driver',
os_version
))
export async function addCoverageXdebug(
extension: string,
version: string,
os_version: string,
pipe: string
): Promise<string> {
const xdebug =
(await extensions.addExtension(extension, version, os_version, true)) +
pipe;
const ini = await config.addINIValues(
'xdebug.mode=coverage',
os_version,
true
);
const log = await utils.addLog(
'$tick',
extension,
'Xdebug enabled as coverage driver',
os_version
);
switch (true) {
case /^xdebug3$/.test(extension):
case /^8\.0$/.test(version):
return '\n' + xdebug + '\n' + ini + '\n' + log;
case /^xdebug$/.test(extension):
default:
return xdebug + '\n' + log;
}
}
/**
@ -54,14 +45,19 @@ export async function addCoverageXdebug(version: string, os_version: string) {
*
* @param version
* @param os_version
* @param pipe
*/
export async function addCoveragePCOV(version: string, os_version: string) {
let script: string = '\n';
switch (version) {
export async function addCoveragePCOV(
version: string,
os_version: string,
pipe: string
): Promise<string> {
let script = '\n';
switch (true) {
default:
script +=
(await extensions.addExtension('pcov', version, os_version, true)) +
(await utils.suppressOutput(os_version)) +
pipe +
'\n';
script +=
(await config.addINIValues('pcov.enabled=1', os_version, true)) + '\n';
@ -69,20 +65,11 @@ export async function addCoveragePCOV(version: string, os_version: string) {
// add command to disable xdebug and enable pcov
switch (os_version) {
case 'linux':
script +=
'if [ -e /etc/php/' +
version +
'/mods-available/xdebug.ini ]; then sudo phpdismod -v ' +
version +
' xdebug; fi\n';
script += 'sudo sed -i "/xdebug/d" $ini_file\n';
break;
case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n';
script += 'remove_extension xdebug' + pipe + '\n';
break;
case 'win32':
script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n';
script += 'Remove-Extension xdebug' + pipe + '\n';
break;
}
@ -95,8 +82,8 @@ export async function addCoveragePCOV(version: string, os_version: string) {
);
// version is not supported
break;
case '5.6':
case '7.0':
case /5\.[3-6]|7\.0/.test(version):
script += await utils.addLog(
'$cross',
'pcov',
@ -114,35 +101,23 @@ export async function addCoveragePCOV(version: string, os_version: string) {
*
* @param version
* @param os_version
* @param pipe
*/
export async function disableCoverage(version: string, os_version: string) {
let script: string = '\n';
export async function disableCoverage(
version: string,
os_version: string,
pipe: string
): Promise<string> {
let script = '\n';
switch (os_version) {
case 'linux':
script +=
'if [ -e /etc/php/' +
version +
'/mods-available/xdebug.ini ]; then sudo phpdismod -v ' +
version +
' xdebug; fi\n';
script +=
'if [ -e /etc/php/' +
version +
'/mods-available/pcov.ini ]; then sudo phpdismod -v ' +
version +
' pcov; fi\n';
script += 'sudo sed -i "/xdebug/d" $ini_file\n';
script += 'sudo sed -i "/pcov/d" $ini_file\n';
break;
case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n';
script += 'sudo sed -i \'\' "/pcov/d" $ini_file\n';
script += 'remove_extension xdebug' + pipe + '\n';
script += 'remove_extension pcov' + pipe + '\n';
break;
case 'win32':
script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n';
script +=
'if(php -m | findstr -i pcov) { Disable-PhpExtension pcov C:\\tools\\php }\n';
script += 'Remove-Extension xdebug' + pipe + '\n';
script += 'Remove-Extension pcov' + pipe + '\n';
break;
}
script += await utils.addLog(
@ -154,3 +129,35 @@ export async function disableCoverage(version: string, os_version: string) {
return script;
}
/**
* Function to set coverage driver
*
* @param coverage_driver
* @param version
* @param os_version
*/
export async function addCoverage(
coverage_driver: string,
version: string,
os_version: string
): Promise<string> {
coverage_driver = coverage_driver.toLowerCase();
const script: string =
'\n' + (await utils.stepLog('Setup Coverage', os_version));
const pipe: string = await utils.suppressOutput(os_version);
switch (coverage_driver) {
case 'pcov':
return script + (await addCoveragePCOV(version, os_version, pipe));
case 'xdebug':
case 'xdebug3':
return (
script +
(await addCoverageXdebug(coverage_driver, version, os_version, pipe))
);
case 'none':
return script + (await disableCoverage(version, os_version, pipe));
default:
return '';
}
}

Binary file not shown.

View File

@ -2,45 +2,23 @@ import * as path from 'path';
import * as utils from './utils';
/**
* Install and enable extensions
* Function to get Xdebug version compatible with php versions
*
* @param extension_csv
* @param version
* @param os_version
* @param log_prefix
*/
export async function addExtension(
extension_csv: string,
version: string,
os_version: string,
no_step = false
): Promise<string> {
let script: string = '\n';
switch (no_step) {
case true:
script +=
(await utils.stepLog('Setup Extensions', os_version)) +
(await utils.suppressOutput(os_version));
break;
case false:
export async function getXdebugVersion(version: string): Promise<string> {
switch (version) {
case '5.3':
return '2.2.7';
case '5.4':
return '2.4.1';
case '5.5':
case '5.6':
return '2.5.5';
case '7.0':
return '2.7.2';
default:
script += await utils.stepLog('Setup Extensions', os_version);
break;
}
switch (os_version) {
case 'win32':
return script + (await addExtensionWindows(extension_csv, version));
case 'darwin':
return script + (await addExtensionDarwin(extension_csv, version));
case 'linux':
return script + (await addExtensionLinux(extension_csv, version));
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
return '2.9.6';
}
}
@ -49,34 +27,128 @@ export async function addExtension(
*
* @param extension_csv
* @param version
* @param pipe
*/
export async function addExtensionDarwin(
extension_csv: string,
version: string
version: string,
pipe: string
): Promise<string> {
let extensions: Array<string> = await utils.extensionArray(extension_csv);
let script: string = '\n';
await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php
let install_command: string = '';
switch (version + extension) {
case '5.6xdebug':
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
const extensions: Array<string> = await utils.extensionArray(extension_csv);
let add_script = '\n';
let remove_script = '';
await utils.asyncForEach(extensions, async function (extension: string) {
const version_extension: string = version + extension;
const [ext_name, ext_version]: string[] = extension.split('-');
const ext_prefix = await utils.getExtensionPrefix(ext_name);
const command_prefix = 'sudo pecl install -f ';
let command = '';
switch (true) {
// match :extension
case /^:/.test(ext_name):
remove_script += '\nremove_extension ' + ext_name.slice(1);
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
command =
'bash ' +
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
' ' +
version +
' ' +
extension;
break;
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
add_script +=
'\nadd_unstable_extension ' +
ext_name +
' ' +
ext_version +
' ' +
ext_prefix;
return;
// match semver
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
add_script +=
'\nadd_pecl_extension ' +
ext_name +
' ' +
ext_version +
' ' +
ext_prefix;
return;
// match 5.3xdebug...5.5xdebug
case /5\.[3-5]xdebug/.test(version_extension):
command =
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
break;
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
// match 7.1pcov to 8.0pcov
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|swoole)/.test(version_extension):
case /(5\.6|7\.[0-4])(grpc|protobuf)/.test(version_extension):
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
command = 'add_brew_extension ' + ext_name;
break;
// match 5.6redis
case /5\.6redis/.test(version_extension):
command = command_prefix + 'redis-2.2.8';
break;
// match imagick
case /^imagick$/.test(extension):
command =
'brew install pkg-config imagemagick' +
pipe +
' && ' +
command_prefix +
'imagick' +
pipe;
break;
// match sqlite
case /^sqlite$/.test(extension):
extension = 'sqlite3';
command = command_prefix + extension;
break;
// match pdo_oci and oci8
case /^pdo_oci$|^oci8$/.test(extension):
add_script +=
'\nbash ' +
path.join(__dirname, '../src/scripts/ext/oci.sh') +
' ' +
extension +
' ' +
version;
return;
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
add_script +=
'\nbash ' +
path.join(__dirname, '../src/scripts/ext/ioncube.sh') +
' ' +
version;
return;
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script +=
'\nbash ' +
path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh') +
' ' +
extension +
' ' +
version;
return;
default:
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
command = command_prefix + extension;
break;
}
script +=
'\nadd_extension ' +
extension +
' "' +
install_command +
'" ' +
(await utils.getExtensionPrefix(extension));
add_script +=
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
});
return script;
return add_script + remove_script;
}
/**
@ -89,37 +161,104 @@ export async function addExtensionWindows(
extension_csv: string,
version: string
): Promise<string> {
let extensions: Array<string> = await utils.extensionArray(extension_csv);
let script: string = '\n';
await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php
let install_command: string = '';
switch (version + extension) {
case '7.4xdebug':
const extension_url: string =
'https://xdebug.org/files/php_xdebug-2.8.0-7.4-vc15.dll';
install_command =
'Invoke-WebRequest -Uri ' +
extension_url +
' -OutFile C:\\tools\\php\\ext\\php_xdebug.dll\n';
install_command += 'Enable-PhpExtension xdebug';
const extensions: Array<string> = await utils.extensionArray(extension_csv);
let add_script = '\n';
let remove_script = '';
await utils.asyncForEach(extensions, async function (extension: string) {
const [ext_name, ext_version]: string[] = extension.split('-');
const version_extension: string = version + extension;
let matches: RegExpExecArray;
switch (true) {
// Match :extension
case /^:/.test(ext_name):
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
return;
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.4blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
add_script +=
'\n& ' +
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
' ' +
version +
' ' +
extension;
return;
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
add_script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
break;
// match semver without state
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
add_script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
return;
// match semver with state
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
version_extension
):
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(
version_extension
) as RegExpExecArray;
add_script +=
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
return;
// match 5.3mysql..5.6mysql
// match 5.3mysqli..5.6mysqli
// match 5.3mysqlnd..5.6mysqlnd
case /^5\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
add_script +=
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
break;
// match 7.0mysql..8.0mysql
// match 7.0mysqli..8.0mysqli
// match 7.0mysqlnd..8.0mysqlnd
case /[7-8]\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
break;
// match sqlite
case /^sqlite$/.test(extension):
extension = 'sqlite3';
add_script += '\nAdd-Extension ' + extension;
break;
// match pdo_oci and oci8
case /^pdo_oci$|^oci8$/.test(extension):
add_script +=
'\n& ' +
path.join(__dirname, '../src/scripts/ext/oci.ps1') +
' ' +
extension +
' ' +
version +
'\n';
break;
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
add_script +=
'\n& ' +
path.join(__dirname, '../src/scripts/ext/ioncube.ps1') +
' ' +
version +
'\n';
break;
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script +=
'\n& ' +
path.join(__dirname, '../src/scripts/ext/phalcon.ps1') +
' ' +
extension +
' ' +
version +
'\n';
break;
case '7.2xdebug':
default:
install_command = 'Install-PhpExtension ' + extension;
add_script += '\nAdd-Extension ' + extension;
break;
}
script +=
'\nAdd-Extension ' +
extension +
' "' +
install_command +
'" ' +
(await utils.getExtensionPrefix(extension));
});
return script;
return add_script + remove_script;
}
/**
@ -127,56 +266,180 @@ export async function addExtensionWindows(
*
* @param extension_csv
* @param version
* @param pipe
*/
export async function addExtensionLinux(
extension_csv: string,
version: string
version: string,
pipe: string
): Promise<string> {
let extensions: Array<string> = await utils.extensionArray(extension_csv);
let script: string = '\n';
await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php
let install_command: string = '';
switch (version + extension) {
case '7.2phalcon3':
case '7.3phalcon3':
install_command =
'sh ' +
path.join(__dirname, '../src/scripts/phalcon.sh') +
' master ' +
const extensions: Array<string> = await utils.extensionArray(extension_csv);
let add_script = '\n';
let remove_script = '';
await utils.asyncForEach(extensions, async function (extension: string) {
const version_extension: string = version + extension;
const [ext_name, ext_version]: string[] = extension.split('-');
const ext_prefix = await utils.getExtensionPrefix(ext_name);
const command_prefix = 'sudo $debconf_fix apt-get install -y php';
let command = '';
switch (true) {
// Match :extension
case /^:/.test(ext_name):
remove_script += '\nremove_extension ' + ext_name.slice(1);
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver}
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
command =
'bash ' +
path.join(__dirname, '../src/scripts/ext/blackfire.sh') +
' ' +
version +
' >/dev/null 2>&1';
' ' +
extension;
break;
case '7.2phalcon4':
case '7.3phalcon4':
case '7.4phalcon4':
install_command =
'sh ' +
path.join(__dirname, '../src/scripts/phalcon.sh') +
' 4.0.x ' +
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
add_script +=
'\nadd_unstable_extension ' +
ext_name +
' ' +
ext_version +
' ' +
ext_prefix;
return;
// match semver versions
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
add_script +=
'\nadd_pecl_extension ' +
ext_name +
' ' +
ext_version +
' ' +
ext_prefix;
return;
// match 5.6gearman..7.4gearman
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
command =
'\nbash ' +
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
' ' +
version +
' >/dev/null 2>&1';
pipe;
break;
// match pdo_oci and oci8
case /^pdo_oci$|^oci8$/.test(extension):
add_script +=
'\nbash ' +
path.join(__dirname, '../src/scripts/ext/oci.sh') +
' ' +
extension +
' ' +
version;
return;
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
add_script +=
'\nbash ' +
path.join(__dirname, '../src/scripts/ext/ioncube.sh') +
' ' +
version;
return;
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script +=
'\nbash ' +
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
' ' +
extension +
' ' +
version;
return;
// match 7.2xdebug3..7.4xdebug3
case /^7\.[2-4]xdebug3$/.test(version_extension):
add_script +=
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
return;
// match 8.0xdebug3
case /^8\.[0-9]xdebug3$/.test(version_extension):
extension = 'xdebug';
command = command_prefix + version + '-' + extension + pipe;
break;
// match 7.1xdebug..7.4xdebug
case /^7\.[1-4]xdebug$/.test(version_extension):
add_script +=
'\nupdate_extension xdebug 2.9.6' +
pipe +
'\n' +
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
return;
// match pdo extensions
case /.*pdo[_-].*/.test(version_extension):
extension = extension
.replace('pdo_', '')
.replace('pdo-', '')
.replace('sqlite3', 'sqlite');
add_script += '\nadd_pdo_extension ' + extension;
return;
// match ast and uopz
case /^(ast|uopz)$/.test(extension):
command = command_prefix + '-' + extension + pipe;
break;
// match sqlite
case /^sqlite$/.test(extension):
extension = 'sqlite3';
command = command_prefix + version + '-' + extension + pipe;
break;
default:
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
version +
'-' +
extension.replace('pdo_', '').replace('pdo-', '') +
' >/dev/null 2>&1 || sudo pecl install ' +
extension +
' >/dev/null 2>&1';
command = command_prefix + version + '-' + extension + pipe;
break;
}
script +=
'\nadd_extension ' +
extension +
' "' +
install_command +
'" ' +
(await utils.getExtensionPrefix(extension));
add_script +=
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
});
return script;
return add_script + remove_script;
}
/**
* Install and enable extensions
*
* @param extension_csv
* @param version
* @param os_version
* @param no_step
*/
export async function addExtension(
extension_csv: string,
version: string,
os_version: string,
no_step = false
): Promise<string> {
const pipe: string = await utils.suppressOutput(os_version);
let script = '\n';
switch (no_step) {
case true:
script += (await utils.stepLog('Setup Extensions', os_version)) + pipe;
break;
case false:
default:
script += await utils.stepLog('Setup Extensions', os_version);
break;
}
switch (os_version) {
case 'win32':
return script + (await addExtensionWindows(extension_csv, version));
case 'darwin':
return script + (await addExtensionDarwin(extension_csv, version, pipe));
case 'linux':
return script + (await addExtensionLinux(extension_csv, version, pipe));
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
}
}

View File

@ -3,7 +3,9 @@ import * as core from '@actions/core';
import * as config from './config';
import * as coverage from './coverage';
import * as extensions from './extensions';
import * as tools from './tools';
import * as utils from './utils';
import * as matchers from './matchers';
/**
* Build the script
@ -18,20 +20,33 @@ export async function build(
os_version: string
): Promise<string> {
// taking inputs
let extension_csv: string = await utils.getInput('extension-csv', false);
let ini_values_csv: string = await utils.getInput('ini-values-csv', false);
let coverage_driver: string = await utils.getInput('coverage', false);
const extension_csv: string =
(await utils.getInput('extensions', false)) ||
(await utils.getInput('extension', false));
const ini_values_csv: string = await utils.getInput('ini-values', false);
const coverage_driver: string = await utils.getInput('coverage', false);
const pecl: string = await utils.getInput('pecl', false);
let tools_csv: string = await utils.getInput('tools', false);
if (
pecl == 'true' ||
/.*-(beta|alpha|devel|snapshot).*/.test(extension_csv) ||
/.*-(\d+\.\d+\.\d+).*/.test(extension_csv)
) {
tools_csv = 'pecl, ' + tools_csv;
}
let script: string = await utils.readScript(filename);
script += await tools.addTools(tools_csv, version, os_version);
let script: string = await utils.readScript(filename, version, os_version);
if (extension_csv) {
script += await extensions.addExtension(extension_csv, version, os_version);
}
if (ini_values_csv) {
script += await config.addINIValues(ini_values_csv, os_version);
}
if (coverage_driver) {
script += await coverage.addCoverage(coverage_driver, version, os_version);
}
if (ini_values_csv) {
script += await config.addINIValues(ini_values_csv, os_version);
}
return await utils.writeScript(filename, script);
}
@ -39,29 +54,26 @@ export async function build(
/**
* Run the script
*/
export async function run() {
export async function run(): Promise<void> {
try {
let os_version: string = process.platform;
let version: string = await utils.getInput('php-version', true);
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
const os_version: string = process.platform;
// check the os version and run the respective script
let script_path: string = '';
let script_path = '';
switch (os_version) {
case 'darwin':
script_path = await build(os_version + '.sh', version, os_version);
await exec('sh ' + script_path + ' ' + version + ' ' + __dirname);
break;
case 'linux':
let pecl: string = await utils.getInput('pecl', false);
script_path = await build(os_version + '.sh', version, os_version);
await exec('sh ' + script_path + ' ' + version + ' ' + pecl);
await exec('bash ' + script_path + ' ' + version + ' ' + __dirname);
break;
case 'win32':
script_path = await build('win32.ps1', version, os_version);
await exec(
'pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname
);
await exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
break;
}
await matchers.addMatchers();
} catch (error) {
core.setFailed(error.message);
}

13
src/matchers.ts Normal file
View File

@ -0,0 +1,13 @@
import * as path from 'path';
import * as utils from './utils';
import * as io from '@actions/io';
/**
* Cache json files for problem matchers
*/
export async function addMatchers(): Promise<void> {
const config_path = path.join(__dirname, '..', 'src', 'configs');
const runner_dir: string = await utils.getInput('RUNNER_TOOL_CACHE', false);
await io.cp(path.join(config_path, 'phpunit.json'), runner_dir);
await io.cp(path.join(config_path, 'php.json'), runner_dir);
}

View File

@ -1,115 +0,0 @@
tick="✓"
cross="✗"
step_log() {
message=$1
printf "\n\033[90;1m==> \033[0m\033[37;1m%s\033[0m\n" "$message"
}
add_log() {
mark=$1
subject=$2
message=$3
if [ "$mark" = "$tick" ]; then
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
else
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
fi
}
version='7.4.0RC6'
step_log "Setup dependencies"
for package in pkg-config autoconf bison re2c openssl@1.1 krb5 enchant libffi freetype intltool icu4c libiconv t1lib gd libzip gmp tidyp libxml2 libxslt postgresql curl;
do
brew install "$package" >/dev/null 2>&1
add_log "$tick" "$package" "Installed"
done
brew link icu4c gettext --force >/dev/null 2>&1
for package in gettext gmp krb5 icu4c bison openssl@1.1 libxml2 libffi libxslt libiconv pkgconfig enchant krb5 readline libedit freetype;
do
caps_package=$(echo "$package" | tr '[:lower:]' '[:upper:]')
{
echo 'export PATH="/usr/local/opt/'"$package"'/bin:$PATH"'
echo 'export PKG_CONFIG_PATH="/usr/local/opt/'$package'/lib/pkgconfig:$PKG_CONFIG_PATH"'
echo 'export '"$caps_package"'_LIBS="-L/usr/local/opt/'$package'/lib"'
echo 'export '"$caps_package"'_CFLAGS="-I/usr/local/opt/'$package'/include"'
} >> ~/.bash_profile;
done
{
echo 'export ICONV_LIBS="-L/usr/local/opt/libiconv/lib"'
echo 'export ICONV_CFLAGS="-I/usr/local/opt/libiconv/include"'
echo 'export LIBXML_LIBS="-L/usr/local/opt/libxml2/lib"'
echo 'export LIBXML_CFLAGS="-I/usr/local/opt/libxml2/include"'
echo 'export ICU_LIBS="-L/usr/local/opt/icu4c/lib"'
echo 'export ICU_CFLAGS="-I/usr/local/opt/icu4c/include"'
echo 'export OPENSSL_LIBS="-L/usr/local/opt/openssl@1.1/lib -lcrypto"'
echo 'export OPENSSL_CFLAGS="-I/usr/local/opt/openssl@1.1/include"'
echo 'export OPENSSL_ROOT_DIR="/usr/local/opt/openssl@1.1/"'
echo 'export OPENSSL_LIB_DIR="/usr/local/opt/openssl@1.1/lib"'
echo 'export OPENSSL_INCLUDE_DIR="/usr/local/opt/openssl@1.1/include"'
echo 'export PKG_CONFIG="/usr/local/opt/pkgconfig/bin/pkg-config"'
echo 'export EXTRA_LIBS="/usr/local/opt/readline/lib/libhistory.dylib
/usr/local/opt/readline/lib/libreadline.dylib
/usr/local/opt/openssl@1.1/lib/libssl.dylib
/usr/local/opt/openssl@1.1/lib/libcrypto.dylib
/usr/local/opt/icu4c/lib/libicudata.dylib
/usr/local/opt/icu4c/lib/libicui18n.dylib
/usr/local/opt/icu4c/lib/libicuio.dylib
/usr/local/opt/icu4c/lib/libicutu.dylib
/usr/local/opt/icu4c/lib/libicuuc.dylib"'
} >> ~/.bash_profile
config_file=$2/../src/configs/config.yaml
step_log "Setup PHPBrew"
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew >/dev/null 2>&1
chmod +x ./phpbrew
sudo mv phpbrew /usr/local/bin/phpbrew
sudo mkdir -p /opt/phpbrew
sudo mkdir -p /usr/local/lib
sudo mkdir -p /usr/local/bin
sudo phpbrew init --root=/opt/phpbrew --config="$config_file" >/dev/null 2>&1
sudo chmod -R 777 /opt/phpbrew
export PHPBREW_ROOT=/opt/phpbrew
export PHPBREW_HOME=/opt/phpbrew
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc
add_log "$tick" "PHPBrew" "Installed"
source ~/.bash_profile >/dev/null 2>&1
source ~/.bashrc >/dev/null 2>&1
step_log "Setup PHP and Composer"
phpbrew install -j 6 $version +dev >/dev/null 2>&1
phpbrew switch $version
sudo ln -sf /opt/phpbrew/php/php-$version/bin/* /usr/local/bin/
sudo ln -sf /opt/phpbrew/php/php-$version/etc/php.ini /etc/php.ini
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(php -i | grep "extension_dir => /opt" | sed -e "s|.*=> s*||")
pecl config-set php_ini "$ini_file" >/dev/null 2>&1
sudo chmod 777 "$ini_file"
brew install composer >/dev/null 2>&1
add_log "$tick" "PHP" "Installed PHP$version"
add_log "$tick" "Composer" "Installed"
add_extension() {
extension=$1
install_command=$2
prefix=$3
if ! php -m | grep -i -q "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$extension" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif php -m | grep -i -q "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q "$extension"; then
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
if [ "$exists" = "200" ]; then
(
eval "$install_command" && \
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on PHP$version"
else
if ! php -m | grep -i -q "$extension"; then
add_log "$cross" "$extension" "Could not find $extension for PHP$version on PECL"
fi
fi
fi
}

View File

@ -1,11 +1,10 @@
tick="✓"
cross="✗"
# Function to log start of a operation.
step_log() {
message=$1
printf "\n\033[90;1m==> \033[0m\033[37;1m%s\033[0m\n" "$message"
}
# Function to log result of a operation.
add_log() {
mark=$1
subject=$2
@ -17,42 +16,265 @@ add_log() {
fi
}
version=$1
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
if [ "$1" = "5.6" ] || [ "$1" = "7.0" ]; then
brew tap exolnet/homebrew-deprecated >/dev/null 2>&1
fi
step_log "Setup PHP and Composer"
brew install php@"$1" composer >/dev/null 2>&1
brew link --force --overwrite php@"$1" >/dev/null 2>&1
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
echo "date.timezone=UTC" >> "$ini_file"
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
sudo chmod 777 "$ini_file"
mkdir -p "$(pecl config-get ext_dir)"
composer global require hirak/prestissimo >/dev/null 2>&1
add_log "$tick" "PHP" "Installed PHP$version"
add_log "$tick" "Composer" "Installed"
# Function to read env inputs.
read_env() {
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
[ "$update" = false ] && [[ -n ${UPDATE} ]] && update="${UPDATE}"
[[ -z "${runner}" ]] && runner='github' && RUNNER='github' || runner="${runner}"
[ "$runner" = false ] && [[ -n ${RUNNER} ]] && runner="${RUNNER}"
}
# Function to setup environment for self-hosted runners.
self_hosted_setup() {
if [[ $(command -v brew) == "" ]]; then
step_log "Setup Brew"
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash -s >/dev/null 2>&1
add_log "$tick" "Brew" "Installed Homebrew"
fi
}
# Function to remove extensions.
remove_extension() {
extension=$1
if check_extension "$extension"; then
sudo sed -i '' "/$extension/d" "$ini_file"
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
(! check_extension "$extension" && add_log "$tick" ":$extension" "Removed") ||
add_log "$cross" ":$extension" "Could not remove $extension on PHP $semver"
else
add_log "$tick" ":$extension" "Could not find $extension on PHP $semver"
fi
}
# Function to test if extension is loaded.
check_extension() {
extension=$1
if [ "$extension" != "mysql" ]; then
php -m | grep -i -q -w "$extension"
else
php -m | grep -i -q "$extension"
fi
}
# Fuction to get the PECL version.
get_pecl_version() {
extension=$1
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
pecl_rest='https://pecl.php.net/rest/r/'
response=$(curl -q -sSL "$pecl_rest$extension"/allreleases.xml)
pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)")
if [ ! "$pecl_version" ]; then
pecl_version=$(echo "$response" | grep -m 1 -Eo "(\d*\.\d*\.\d*)")
fi
echo "$pecl_version"
}
# Function to install a specific version of PECL extension.
add_pecl_extension() {
extension=$1
pecl_version=$2
prefix=$3
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
fi
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"
fi
ext_version=$(php -r "echo phpversion('$extension');")
if [ "$ext_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
remove_extension "$extension" >/dev/null 2>&1
(
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
fi
}
# Function to install a php extension from shivammathur/extensions tap.
add_brew_extension() {
extension=$1
if ! brew tap | grep shivammathur/extensions; then
brew tap --shallow shivammathur/extensions
fi
brew install "$extension@$version"
sudo cp "$(brew --prefix)/opt/$extension@$version/$extension.so" "$ext_dir"
}
# Function to setup extensions
add_extension() {
extension=$1
install_command=$2
prefix=$3
if ! php -m | grep -i -q "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$extension" >>"$ini_file" && add_log $tick "$extension" "Enabled"
elif php -m | grep -i -q "$extension"; then
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif check_extension "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q "$extension"; then
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
if [ "$exists" = "200" ]; then
(
eval "$install_command" && \
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on PHP$version"
else
if ! php -m | grep -i -q "$extension"; then
add_log "$cross" "$extension" "Could not find $extension for PHP$version on PECL"
fi
fi
elif ! check_extension "$extension"; then
eval "$install_command" >/dev/null 2>&1 &&
if [[ "$version" =~ $old_versions ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
}
}
# Function to setup pre-release extensions using PECL.
add_unstable_extension() {
extension=$1
stability=$2
prefix=$3
pecl_version=$(get_pecl_version "$extension" "$stability")
add_pecl_extension "$extension" "$pecl_version" "$prefix"
}
# Function to configure composer
configure_composer() {
tool_path=$1
sudo ln -sf "$tool_path" "$tool_path.phar"
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
if [ $? -eq 1 ]; then
add_log "$cross" "composer" "Could not download composer"
exit 1;
fi
composer -q global config process-timeout 0
echo "::add-path::/Users/$USER/.composer/vendor/bin"
if [ -n "$COMPOSER_TOKEN" ]; then
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
fi
# TODO: Remove after composer 2.0 update, fixes peer fingerprint error
if [[ "$version" =~ $old_versions ]]; then
composer -q global config repos.packagist composer https://repo-ca-bhs-1.packagist.org
fi
}
# Function to setup a remote tool.
add_tool() {
url=$1
tool=$2
tool_path="$tool_path_dir/$tool"
if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path"
fi
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" -L "$url")
if [ "$status_code" = "200" ]; then
sudo chmod a+x "$tool_path"
if [ "$tool" = "composer" ]; then
configure_composer "$tool_path"
elif [ "$tool" = "phan" ]; then
add_extension fileinfo "sudo pecl install -f fileinfo" extension >/dev/null 2>&1
add_extension ast "sudo pecl install -f ast" extension >/dev/null 2>&1
elif [ "$tool" = "phive" ]; then
add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1
add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1
add_extension xml "sudo pecl install -f xml" extension >/dev/null 2>&1
elif [ "$tool" = "cs2pr" ]; then
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
tr -d '\r' <"$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
sudo chmod a+x "$tool_path"
elif [ "$tool" = "wp-cli" ]; then
sudo cp -p "$tool_path" "$tool_path_dir"/wp
fi
add_log "$tick" "$tool" "Added"
else
add_log "$cross" "$tool" "Could not setup $tool"
fi
}
# Function to add a tool using composer.
add_composertool() {
tool=$1
release=$2
prefix=$3
(
composer global require "$prefix$release" >/dev/null 2>&1 &&
add_log "$tick" "$tool" "Added"
) || add_log "$cross" "$tool" "Could not setup $tool"
}
add_blackfire() {
sudo mkdir -p usr/local/var/run
brew tap --shallow blackfireio/homebrew-blackfire >/dev/null 2>&1
brew install blackfire-agent >/dev/null 2>&1
if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then
blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" >/dev/null 2>&1
brew services start blackfire-agent >/dev/null 2>&1
fi
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1
fi
add_log "$tick" "blackfire" "Added"
add_log "$tick" "blackfire-agent" "Added"
}
# Function to configure PECL
configure_pecl() {
for tool in pear pecl; do
sudo "$tool" config-set php_ini "$ini_file"
sudo "$tool" channel-update "$tool".php.net
done
}
# Function to handle request to add PECL.
add_pecl() {
add_log "$tick" "PECL" "Added"
}
# Function to setup PHP 5.6 and newer.
setup_php() {
action=$1
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
brew tap --shallow shivammathur/homebrew-php
if brew list php@"$version" 2>/dev/null | grep -q "Error" && [ "$action" != "upgrade" ]; then
brew unlink php@"$version"
else
brew "$action" shivammathur/php/php@"$version"
fi
brew link --force --overwrite php@"$version"
}
# Variables
tick="✓"
cross="✗"
version=$1
nodot_version=${1/./}
old_versions="5.[3-5]"
tool_path_dir="/usr/local/bin"
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
read_env
if [ "$runner" = "self-hosted" ]; then
if [[ "$version" =~ $old_versions ]]; then
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
exit 1
else
self_hosted_setup >/dev/null 2>&1
fi
fi
# Setup PHP
step_log "Setup PHP"
if [[ "$version" =~ $old_versions ]]; then
curl -sSL https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh | bash -s "$nodot_version" >/dev/null 2>&1 &&
status="Installed"
elif [ "$existing_version" != "$version" ]; then
setup_php "install" >/dev/null 2>&1
status="Installed"
elif [ "$existing_version" = "$version" ] && [ "$update" = "true" ]; then
setup_php "upgrade" >/dev/null 2>&1
status="Updated to"
else
status="Found"
fi
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
sudo chmod 777 "$ini_file" "$tool_path_dir"
echo -e "date.timezone=UTC\nmemory_limit=-1" >>"$ini_file"
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
sudo mkdir -p "$ext_dir"
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
if [[ ! "$version" =~ $old_versions ]]; then configure_pecl >/dev/null 2>&1; fi
add_log "$tick" "PHP" "$status PHP $semver"

View File

@ -0,0 +1,35 @@
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$version,
[Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()]
[string]
$extension
)
$tick = ([char]8730)
$php_dir = 'C:\tools\php'
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
$ext_dir = "$php_dir\ext"
$arch='x64'
if ($version -lt '7.0') { $arch='x86' }
$version = $version.replace('.', '')
$extension_version = $extension.split('-')[1]
if ($extension_version -notmatch "\S") {
$ext_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '<td class="version">' | Select-Object -Index 2 }
$extension_version = [regex]::Matches($ext_data, '<td.*?>(.+)</td>') | ForEach-Object { $_.Captures[0].Groups[1].value }
}
if (Test-Path $ext_dir\blackfire.dll) {
Enable-PhpExtension -Extension blackfire -Path $php_dir
$status="Enabled"
} else {
$installed = Get-Php -Path $php_dir
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
Invoke-WebRequest -UseBasicParsing -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
Enable-PhpExtension -Extension blackfire -Path $php_dir
$status="Installed and enabled"
}
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick "blackfire" "$status"

View File

@ -0,0 +1,11 @@
version=${1/./}
extension=${2}
extension_version=$(echo "$extension" | cut -d '-' -f 2)
if [ "$extension_version" = "blackfire" ]; then
extension_version=$(curl -sSL https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e 's/<[^>]*>\| //g' | sed -n '3,3p')
fi
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ini_file="$scan_dir/50-blackfire.ini"
sudo curl -o $ext_dir/blackfire.so -SL https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-linux_amd64-php-$version.so
echo "extension=blackfire.so" | sudo tee -a "$ini_file"

View File

@ -0,0 +1,11 @@
version=${1/./}
extension=${2}
extension_version=$(echo "$extension" | cut -d '-' -f 2)
if [ "$extension_version" = "blackfire" ]; then
extension_version=$(curl -sSL https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e "s/ //g" | sed -n '3,3p' | cut -d '>' -f 2 | cut -d '<' -f 1)
fi
ext_dir=$(php -i | grep -Ei "extension_dir => /usr" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ini_file="$scan_dir/50-blackfire.ini"
sudo curl -o $ext_dir/blackfire.so -SL https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-darwin_amd64-php-$version.so
echo "extension=blackfire.so" | sudo tee -a "$ini_file"

View File

@ -0,0 +1,9 @@
release_version=$(lsb_release -s -r)
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/pkg-gearman -y
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
if [ "$release_version" = "18.04" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev php"$1"-gearman
elif [ "$release_version" = "16.04" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-gearman
fi

View File

@ -0,0 +1,48 @@
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$version
)
# Function to log result of a operation.
Function Add-Log($mark, $subject, $message) {
if ($mark -eq $tick) {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $mark $subject $message
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
Get-Content $ext_dir\ioncube\LICENSE.txt
Write-Output "::endgroup::"
} else {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "31" $mark $subject $message
}
}
$tick = ([char]8730)
$cross = ([char]10007)
$status = 'Enabled'
$php_dir = 'C:\tools\php'
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
$ext_dir = "$php_dir\ext"
$installed = Get-Php $php_dir
try {
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
$status = 'Installed and enabled'
$arch = 'x86-64'
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
$arch = 'x86'
}
$vc = $installed.VCVersion
$ts = ""
if (-not($installed.ThreadSafe)) {
$ts = "_nonts"
}
Invoke-WebRequest -UseBasicParsing -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts`_vc$vc`_$arch.zip" -OutFile $ext_dir\ioncube.zip
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
}
"zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
Add-Log $tick "ioncube" $status
} catch {
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
}

View File

@ -0,0 +1,41 @@
# Function to log result of a operation.
add_log() {
mark=$1
subject=$2
message=$3
if [ "$mark" = "$tick" ]; then
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
cat /tmp/ioncube/LICENSE.txt
echo "::endgroup::"
else
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
fi
}
# Function to test if extension is loaded.
check_extension() {
extension=$1
php -m | grep -i -q -w "$extension"
}
# Function to install ioncube.
install_ioncube() {
if [ ! -e "$ext_dir/ioncube.so" ]; then
os_name='lin'
status='Installed and enabled'
[ "$(uname -s)" = "Darwin" ] && os_name='mac'
curl -sSL https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"$version".so "$ext_dir/ioncube.so"
fi
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "$scan_dir/00-ioncube.ini"
}
version=$1
tick='✓'
cross='✗'
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
status='Enabled'
install_ioncube >/dev/null 2>&1
(check_extension "ioncube" && add_log "$tick" "ioncube" "$status") || add_log "$cross" "ioncube" "Could not install ioncube"

68
src/scripts/ext/oci.ps1 Normal file
View File

@ -0,0 +1,68 @@
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[ValidateSet('oci8', 'pdo_oci')]
[string]
$extension,
[Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$version
)
# Function to log result of a operation.
Function Add-Log($mark, $subject, $message) {
if ($mark -eq $tick) {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $mark $subject $message
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
printf "Oracle Instant Client package is required for %s extension.\n" $extension
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
Write-Output "::endgroup::"
} else {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "31" $mark $subject $message
}
}
$tick = ([char]8730)
$cross = ([char]10007)
$php_dir = 'C:\tools\php'
$status = 'Enabled'
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
$ext_dir = "$php_dir\ext"
$installed = Get-Php -Path $php_dir
try
{
if (-not(Test-Path $php_dir\oci.dll)) {
$suffix = 'windows'
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0')
{
$suffix = 'nt'
}
Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
Copy-Item $php_dir\instantclient*\* $php_dir
}
if ($extension -eq "pdo_oci") {
Enable-PhpExtension pdo_oci -Path $php_dir
} else {
$status = 'Installed and enabled'
$ociVersion = '2.2.0'
if ($version -eq '7.0')
{
$ociVersion = '2.1.8'
}
elseif ($version -lt '7.0')
{
$ociVersion = '2.0.12'
}
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
Invoke-WebRequest -UseBasicParsing -Uri $ociUrl -OutFile $php_dir\oci8.zip
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
}
Add-Log $tick $extension $status
} catch {
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
}

140
src/scripts/ext/oci.sh Normal file
View File

@ -0,0 +1,140 @@
# Function to log result of a operation.
add_log() {
mark=$1
subject=$2
message=$3
if [ "$mark" = "$tick" ]; then
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
echo "::endgroup::"
else
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
fi
}
# Function to test if extension is loaded.
check_extension() {
extension=$1
php -m | grep -i -q -w "$extension"
}
# Function to get the tag for a php version.
get_tag() {
master_version='8.0'
tag='master'
if [ ! "$version" = "$master_version" ]; then
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
fi
echo "$tag"
}
# Function to install instantclient and SDK.
install_client() {
sudo mkdir -p -m 777 "$oracle_home"
if [ ! -e "$oracle_client" ]; then
for package in basiclite sdk; do
if [ "$os" = 'Linux' ]; then
libs='/usr/lib/'
os_name='linux'
arch='linuxx64'
lib_ext='so'
elif [ "$os" = 'Darwin' ]; then
libs='/usr/local/lib/'
os_name='mac'
arch='macos'
lib_ext='dylib'
fi
curl -o "/opt/oracle/$package.zip" -sSL "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
unzip "/opt/oracle/$package.zip" -d "$oracle_home"
done
sudo ln -sf /opt/oracle/instantclient*/*.$lib_ext* $libs
sudo ln -sf /opt/oracle/instantclient* "$oracle_client"
fi
}
# Function to get PHP source.
get_php() {
[ ! -d "/opt/oracle/php-src-$tag" ] && curl -sSL "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "$oracle_home/"
}
# Function to get phpize location on darwin.
get_phpize() {
if [[ "$version" =~ 5.[3-5] ]]; then
echo '/opt/local/bin/phpize'
else
echo "/usr/local/bin/$(readlink /usr/local/bin/phpize)"
fi
}
# Function to patch phpize to link to php headers on darwin.
patch_phpize() {
if [ "$os" = "Darwin" ]; then
sudo cp "$phpize_orig" "$phpize_orig.bck"
sudo sed -i '' 's~includedir=.*~includedir="$(xcrun --show-sdk-path)/usr/include/php"~g' "$phpize_orig"
fi
}
# Function to restore phpize.
restore_phpize() {
if [ "$os" = "Darwin" ]; then
sudo mv "$phpize_orig.bck" "$phpize_orig" || true
fi
}
# Function to patch pdo_oci.
patch_pdo_oci_config() {
curl -sSLO https://raw.githubusercontent.com/php/php-src/master/ext/pdo_oci/config.m4
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
}
# Function to install the dependencies.
install_dependencies() {
if [ "$os" = 'Linux' ]; then
if [ "$runner" = "self-hosted" ] || [ "$RUNNER" = "self-hosted" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y autoconf automake libaio-dev gcc g++ php"$version"-dev
else
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$version"-dev
fi
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
fi
}
# Function to install the extension.
install_extension() {
if ! [ -e "$ext_dir/$ext.so" ]; then
(
status='Installed and enabled'
phpize_orig=$(get_phpize)
tag=$(get_tag)
get_php
patch_phpize
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
sudo make -j"$(nproc)"
sudo cp ./modules/* "$ext_dir/"
restore_phpize
)
fi
echo "extension=$ext.so" | sudo tee "$scan_dir/99-$ext.ini"
}
ext=$1
version=$2
tick='✓'
cross='✗'
status='Enabled'
oracle_home='/opt/oracle'
oracle_client=$oracle_home/instantclient
runner="${runner:-github}" && RUNNER="${RUNNER:-github}"
os=$(uname -s)
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
install_client >/dev/null 2>&1
install_dependencies >/dev/null 2>&1
install_extension >/dev/null 2>&1
(check_extension "$ext" && add_log "$tick" "$ext" "$status") || add_log "$cross" "$ext" "Could not install $ext"

View File

@ -0,0 +1,57 @@
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[ValidateSet('phalcon3', 'phalcon4')]
[string]
$extension,
[Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$version
)
# Function to install phalcon
Function Install-Phalcon() {
if ($extension_version -eq '4') {
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
} else {
$installed = Get-Php -Path $php_dir
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
$zip_file = $match.Matches[0].Groups[1].Value
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
Enable-PhpExtension -Extension phalcon -Path $php_dir
}
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
}
$tick = ([char]8730)
$domain = 'https://github.com'
$php_dir = 'C:\tools\php'
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
$ext_dir = "$php_dir\ext"
$extension_version = $extension.substring($extension.Length - 1)
if($extension_version -eq '4') {
if (Test-Path $ext_dir\php_psr.dll) {
Enable-PhpExtension -Extension psr -Path $php_dir
} else {
Install-Phpextension psr -MinimumStability stable -Path $php_dir
}
}
if(Test-Path $ext_dir\php_phalcon.dll) {
$phalcon = Get-PhpExtension $ext_dir\php_phalcon.dll
if($phalcon.Version[0] -eq $extension_version) {
Enable-PhpExtension -Extension phalcon -Path $php_dir
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Enabled"
} else {
Remove-Item $ext_dir\php_phalcon.dll
Install-Phalcon
}
} else {
Install-Phalcon
}

Some files were not shown because too many files have changed in this diff Show More